lint: use eslint with a browserslist configuration

This commit is contained in:
David Larlet 2024-01-29 14:13:03 -05:00
parent 20998f05be
commit 65f1cdd6b4
No known key found for this signature in database
GPG key ID: 3E2953A359E7E7BD
7 changed files with 1759 additions and 68 deletions

11
.eslintrc.json Normal file
View file

@ -0,0 +1,11 @@
{
"plugins": ["compat"],
"extends": ["plugin:compat/recommended"],
"env": {
"es6": true
},
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
}
}

View file

@ -24,7 +24,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.12"]
python-version: ['3.8', '3.12']
database: [postgresql]
steps:
@ -53,10 +53,11 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
python-version: '3.11'
- name: Install dependencies
run: |
python3 -m pip install -e .[test,dev]
make installjs
- name: Run Lint
run: make lint
@ -71,7 +72,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
python-version: '3.11'
- name: Install dependencies
run: |
python3 -m pip install -r docs/requirements.txt

View file

@ -20,6 +20,7 @@ format: ## Format the code and templates files
.PHONY: lint
lint: ## Lint the code and template files
npx eslint umap/static/umap/ &&\
djlint umap/templates --lint &&\
isort --check --profile black umap/ &&\
ruff format --check --target-version=py38 umap/ &&\

1715
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -7,6 +7,8 @@
},
"devDependencies": {
"chai": "^3.3.0",
"eslint": "^8.56.0",
"eslint-plugin-compat": "^4.2.0",
"happen": "~0.1.3",
"lebab": "^3.2.1",
"mocha": "^10.2.0",
@ -60,5 +62,8 @@
"simple-statistics": "^7.8.3",
"togpx": "^0.5.4",
"tokml": "0.4.0"
}
},
"browserslist": [
"> 0.5%, last 2 versions, Firefox ESR, not dead, not op_mini all"
]
}

View file

@ -548,6 +548,7 @@ L.U.Help = L.Class.extend({
label.title = label.textContent = L._('Close')
this.content = L.DomUtil.create('div', 'umap-help-content', this.box)
this.isMacOS = /mac/i.test(
// eslint-disable-next-line compat/compat -- Fallback available.
navigator.userAgentData ? navigator.userAgentData.platform : navigator.platform
)
},

View file

@ -7,7 +7,6 @@
"after": true,
"it": true,
"sinon": true,
"qs": true,
"enableEdit": true,
"disableEdit": true,
"changeInputValue": true,