Merge pull request #1568 from umap-project/eslint
lint: use eslint with a browserslist configuration
This commit is contained in:
commit
c3a849258d
7 changed files with 1759 additions and 68 deletions
11
.eslintrc.json
Normal file
11
.eslintrc.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"plugins": ["compat"],
|
||||
"extends": ["plugin:compat/recommended"],
|
||||
"env": {
|
||||
"es6": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2020,
|
||||
"sourceType": "module"
|
||||
}
|
||||
}
|
89
.github/workflows/test-docs.yml
vendored
89
.github/workflows/test-docs.yml
vendored
|
@ -2,9 +2,9 @@ name: Test & Docs
|
|||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
|
@ -24,57 +24,58 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.8", "3.12"]
|
||||
python-version: ['3.8', '3.12']
|
||||
database: [postgresql]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache: 'pip'
|
||||
cache-dependency-path: '**/pyproject.toml'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install libgdal-dev
|
||||
python -m pip install --upgrade pip
|
||||
make develop installjs vendors
|
||||
- name: run tests
|
||||
run: make test
|
||||
env:
|
||||
DJANGO_SETTINGS_MODULE: 'umap.tests.settings'
|
||||
UMAP_SETTINGS: 'umap/tests/settings.py'
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache: 'pip'
|
||||
cache-dependency-path: '**/pyproject.toml'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install libgdal-dev
|
||||
python -m pip install --upgrade pip
|
||||
make develop installjs vendors
|
||||
- name: run tests
|
||||
run: make test
|
||||
env:
|
||||
DJANGO_SETTINGS_MODULE: 'umap.tests.settings'
|
||||
UMAP_SETTINGS: 'umap/tests/settings.py'
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.11"
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python3 -m pip install -e .[test,dev]
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python3 -m pip install -e .[test,dev]
|
||||
make installjs
|
||||
|
||||
- name: Run Lint
|
||||
run: make lint
|
||||
|
||||
- name: Run Docs
|
||||
run: make docs
|
||||
- name: Run Lint
|
||||
run: make lint
|
||||
|
||||
- name: Run Docs
|
||||
run: make docs
|
||||
|
||||
docs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.11"
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python3 -m pip install -r docs/requirements.txt
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python3 -m pip install -r docs/requirements.txt
|
||||
|
||||
- name: Run Docs
|
||||
run: mkdocs build
|
||||
- name: Run Docs
|
||||
run: mkdocs build
|
||||
|
|
3
Makefile
3
Makefile
|
@ -20,9 +20,10 @@ 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/ &&\
|
||||
ruff format --check --target-version=py38 umap/ &&\
|
||||
vermin --no-tips --violations -t=3.8- umap/
|
||||
|
||||
docs: ## Compile the docs
|
||||
|
|
1715
package-lock.json
generated
1715
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -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"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -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
|
||||
)
|
||||
},
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
"after": true,
|
||||
"it": true,
|
||||
"sinon": true,
|
||||
"qs": true,
|
||||
"enableEdit": true,
|
||||
"disableEdit": true,
|
||||
"changeInputValue": true,
|
||||
|
|
Loading…
Reference in a new issue