Skip to content

Commit 7410e38

Browse files
authored
JS linters (#1057)
* JS linters * Iterate * Lint * Update ci * Fix file name * Missing dependencies
1 parent 50dc472 commit 7410e38

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1123
-1008
lines changed

.github/workflows/main.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,14 @@ jobs:
2828
- name: Setup conda
2929
uses: conda-incubator/setup-miniconda@v2
3030
with:
31+
environment-file: environment-dev.yml
32+
activate-environment: ipyleaflet-dev
3133
mamba-version: "*"
34+
python-version: ${{ matrix.python-version }}
3235
channels: conda-forge
3336

34-
- name: Mamba install dependencies
35-
run: mamba install python=${{ matrix.python-version }} pip nodejs flake8
36-
37-
- name: Mamba install dependencies
38-
run: mamba install jupyterlab ipywidgets openssl=1.1.1l jupyter-packaging~=0.7.9
39-
4037
- name: Install ipyleaflet
41-
run: pip install .
38+
run: pip install . --no-deps
4239

4340
- name: Check installation files
4441
run: |
@@ -48,8 +45,14 @@ jobs:
4845
test -d $CONDA_PREFIX/share/jupyter/labextensions/jupyter-leaflet
4946
test -f $CONDA_PREFIX/share/jupyter/labextensions/jupyter-leaflet/package.json
5047
51-
- name: Flake8 check
48+
- name: Python Linters
5249
run: flake8 ipyleaflet --ignore=E501,E731
5350

51+
- name: JS Linters
52+
run: |
53+
yarn install
54+
yarn run lint:check
55+
working-directory: js
56+
5457
- name: Import check
5558
run: python -c 'import ipyleaflet'

.github/workflows/ui-tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ jobs:
2222
- name: Setup conda
2323
uses: conda-incubator/setup-miniconda@v2
2424
with:
25+
environment-file: environment-dev.yml
26+
activate-environment: ipyleaflet-dev
2527
mamba-version: "*"
28+
python-version: ${{ matrix.python-version }}
2629
channels: conda-forge
2730

28-
- name: Mamba install dependencies
29-
run: mamba install python=${{ matrix.python-version }} pip nodejs=16 flake8 jupyterlab ipywidgets>=8.0.1 jupyter-packaging~=0.7.9 pandas
30-
3131
- name: Install ipyleaflet
32-
run: pip install .
32+
run: pip install . --no-deps
3333

3434
- name: Install browser
3535
run: |

.github/workflows/update_galata_references.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ jobs:
3535
- name: Setup conda
3636
uses: conda-incubator/setup-miniconda@v2
3737
with:
38+
environment-file: environment-dev.yml
39+
activate-environment: ipyleaflet-dev
3840
mamba-version: "*"
41+
python-version: ${{ matrix.python-version }}
3942
channels: conda-forge
4043

41-
- name: Mamba install dependencies
42-
run: mamba install python=${{ matrix.python-version }} pip nodejs flake8 jupyterlab ipywidgets pandas jupyter-packaging~=0.7.9
43-
4444
- name: Install ipyleaflet
45-
run: pip install .
45+
run: pip install . --no-deps
4646

4747
- name: Install JS deps
4848
run: |

environment-dev.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: ipyleaflet-dev
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- pip
6+
- wheel
7+
- flake8
8+
- jupyterlab
9+
- ipywidgets
10+
- xyzservices
11+
- branca
12+
- traittypes
13+
- jupyter-packaging~=0.7.9
14+
- pandas

js/.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

js/.eslintrc.json

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
{
2-
"env": {
3-
"browser": true,
4-
"es6": true,
5-
"node": true
6-
},
7-
"extends": "eslint:recommended",
8-
"globals": {
9-
"Atomics": "readonly",
10-
"SharedArrayBuffer": "readonly"
11-
},
12-
"parserOptions": {
13-
"ecmaVersion": 11,
14-
"sourceType": "module"
15-
},
16-
"rules": {
17-
"object-curly-spacing": ["error", "always"]
18-
}
2+
"env": {
3+
"browser": true,
4+
"es6": true,
5+
"node": true
6+
},
7+
"extends": "eslint:recommended",
8+
"globals": {
9+
"Atomics": "readonly",
10+
"SharedArrayBuffer": "readonly",
11+
"L": true
12+
},
13+
"parserOptions": {
14+
"ecmaVersion": 11,
15+
"sourceType": "module"
16+
},
17+
"rules": {
18+
"object-curly-spacing": ["error", "always"]
19+
}
1920
}

js/.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

js/.prettierrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}

js/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
Jupyter Leaflet Widget
2-
======================
1+
# Jupyter Leaflet Widget
32

43
Interactive leaflet widget for the Jupyter notebook
54

65
The reference Python backend, `ipyleaflet` is available
76
[here](https://github.com/jupyter-widgets/ipyleaflet), with examples.
87

9-
Package Install
10-
---------------
8+
## Package Install
119

1210
**Prerequisites**
11+
1312
- [node](https://nodejs.org/)
1413

1514
```bash

js/amd-public-path.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// See https://github.com/requirejs/requirejs/wiki/Differences-between-the-simplified-CommonJS-wrapper-and-standard-AMD-define#module
33
// Since 'module' is a requirejs magic module, we must include 'module' in the webpack externals configuration.
44
var module = require('module');
5-
var url = new URL(module.uri, document.location)
5+
var url = new URL(module.uri, document.location);
66
// Using lastIndexOf('/')+1 gives us the empty string if there is no '/', so pathname becomes '/'
7-
url.pathname = url.pathname.slice(0,url.pathname.lastIndexOf('/')+1);
8-
__webpack_public_path__ = `${url.origin}${url.pathname}`;
7+
url.pathname = url.pathname.slice(0, url.pathname.lastIndexOf('/') + 1);
8+
__webpack_public_path__ = `${url.origin}${url.pathname}`; // eslint-disable-line no-undef

0 commit comments

Comments
 (0)