Skip to content

Commit

Permalink
Convert frontend to typescript
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ianhi authored and martinRenou committed Sep 21, 2021
1 parent fb2605c commit eff7153
Show file tree
Hide file tree
Showing 30 changed files with 7,703 additions and 3,428 deletions.
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
dist
coverage
**/*.d.ts
tests
30 changes: 30 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
sourceType: 'module',
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended'
],
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/quotes': [
'error',
'single',
{ avoidEscape: true, allowTemplateLiterals: false }
],
curly: ['error', 'all'],
eqeqeq: 'error',
'prefer-arrow-callback': 'error'
},
ignorePatterns: ['.eslintrc.js']
};
5 changes: 2 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ jobs:
- name: Test flake8
run: flake8 ipympl --ignore=E501,W504,W503

- name: Test JS linters
working-directory: js
- name: Test TS linters
run: |
npm run eslint:check
npm run prettier:check
Expand Down Expand Up @@ -138,7 +137,7 @@ jobs:
- name: Manually install labextension for lab2
if: ${{ matrix.jlab_version }} == 2
run: jupyter labextension install js
run: jupyter labextension install .

- name: Test installation files
run: |
Expand Down
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
**/node_modules
**/lib
**/package.json
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"tabWidth": 4
}
36 changes: 30 additions & 6 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
recursive-include ipympl/nbextension *.*
recursive-include ipympl/labextension *.*

graft js/src
include js/package.json
include js/webpack.config.js
include LICENSE
include jupyter-matplotlib.json

include setup.py
include pyproject.toml

include tsconfig.json
include package.json
include webpack.config.js
include ipympl/labextension/*.tgz

# Documentation
graft docs
exclude docs/\#*
prune docs/build
prune docs/gh-pages
prune docs/dist

# Examples
graft examples

# Javascript files
graft ipympl/nbextension
graft src
graft css
prune **/node_modules
prune coverage
prune lib

# Patterns to exclude from any directory
global-exclude *~
global-exclude *.pyc
global-exclude *.pyo
global-exclude .git
global-exclude .ipynb_checkpoints
14 changes: 14 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
sourceMap: 'inline',
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
],
};

File renamed without changes.
21 changes: 0 additions & 21 deletions js/.eslintrc.js

This file was deleted.

11 changes: 0 additions & 11 deletions js/.prettierrc

This file was deleted.

11 changes: 0 additions & 11 deletions js/README.md

This file was deleted.

57 changes: 0 additions & 57 deletions js/package.json

This file was deleted.

82 changes: 0 additions & 82 deletions js/webpack.config.js

This file was deleted.

Loading

0 comments on commit eff7153

Please sign in to comment.