Skip to content

Commit eff7153

Browse files
ianhimartinRenou
authored andcommitted
Convert frontend to typescript
In the process also update some the tooling (eslint, prettier, setup.py) to more closely the widget-ts-cookiecutter. Also fix miscellanous errors discovered by using typescript. Finally, add a labextension watch command. lint the correct directory Update MANIFEST.in for TS correctly install labextension in the test Return to using yarn in setup.pt
1 parent fb2605c commit eff7153

30 files changed

+7703
-3428
lines changed

.eslintignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
dist
3+
coverage
4+
**/*.d.ts
5+
tests

.eslintrc.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
parserOptions: {
4+
project: './tsconfig.json',
5+
sourceType: 'module',
6+
},
7+
extends: [
8+
'eslint:recommended',
9+
'plugin:@typescript-eslint/eslint-recommended',
10+
'plugin:@typescript-eslint/recommended',
11+
'plugin:prettier/recommended'
12+
],
13+
plugins: ['@typescript-eslint'],
14+
rules: {
15+
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
16+
'@typescript-eslint/no-explicit-any': 'off',
17+
'@typescript-eslint/no-namespace': 'off',
18+
'@typescript-eslint/no-use-before-define': 'off',
19+
'@typescript-eslint/explicit-module-boundary-types': 'off',
20+
'@typescript-eslint/quotes': [
21+
'error',
22+
'single',
23+
{ avoidEscape: true, allowTemplateLiterals: false }
24+
],
25+
curly: ['error', 'all'],
26+
eqeqeq: 'error',
27+
'prefer-arrow-callback': 'error'
28+
},
29+
ignorePatterns: ['.eslintrc.js']
30+
};

.github/workflows/main.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ jobs:
5858
- name: Test flake8
5959
run: flake8 ipympl --ignore=E501,W504,W503
6060

61-
- name: Test JS linters
62-
working-directory: js
61+
- name: Test TS linters
6362
run: |
6463
npm run eslint:check
6564
npm run prettier:check
@@ -138,7 +137,7 @@ jobs:
138137
139138
- name: Manually install labextension for lab2
140139
if: ${{ matrix.jlab_version }} == 2
141-
run: jupyter labextension install js
140+
run: jupyter labextension install .
142141

143142
- name: Test installation files
144143
run: |

.prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
**/node_modules
3+
**/lib
4+
**/package.json

.prettierrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": true,
3+
"tabWidth": 4
4+
}

MANIFEST.in

+30-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,35 @@
11
recursive-include ipympl/nbextension *.*
22
recursive-include ipympl/labextension *.*
33

4-
graft js/src
5-
include js/package.json
6-
include js/webpack.config.js
7-
include LICENSE
8-
include jupyter-matplotlib.json
9-
104
include setup.py
115
include pyproject.toml
6+
7+
include tsconfig.json
8+
include package.json
9+
include webpack.config.js
10+
include ipympl/labextension/*.tgz
11+
12+
# Documentation
13+
graft docs
14+
exclude docs/\#*
15+
prune docs/build
16+
prune docs/gh-pages
17+
prune docs/dist
18+
19+
# Examples
20+
graft examples
21+
22+
# Javascript files
23+
graft ipympl/nbextension
24+
graft src
25+
graft css
26+
prune **/node_modules
27+
prune coverage
28+
prune lib
29+
30+
# Patterns to exclude from any directory
31+
global-exclude *~
32+
global-exclude *.pyc
33+
global-exclude *.pyo
34+
global-exclude .git
35+
global-exclude .ipynb_checkpoints

babel.config.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
sourceMap: 'inline',
3+
presets: [
4+
[
5+
'@babel/preset-env',
6+
{
7+
targets: {
8+
node: 'current',
9+
},
10+
},
11+
],
12+
],
13+
};
14+
File renamed without changes.

js/.eslintrc.js

-21
This file was deleted.

js/.prettierrc

-11
This file was deleted.

js/README.md

-11
This file was deleted.

js/package.json

-57
This file was deleted.

js/webpack.config.js

-82
This file was deleted.

0 commit comments

Comments
 (0)