Skip to content
This repository was archived by the owner on Jul 28, 2023. It is now read-only.

Commit 158a7dd

Browse files
authored
Merge pull request #19 from jtpio/eslint
Add Eslint
2 parents d646171 + f241f8d commit 158a7dd

18 files changed

+182
-116
lines changed

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
dist
3+
coverage
4+
**/*.d.ts

.eslintrc.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
module.exports = {
2+
extends: [
3+
'eslint:recommended',
4+
'plugin:@typescript-eslint/eslint-recommended',
5+
'plugin:@typescript-eslint/recommended',
6+
'plugin:jsdoc/recommended',
7+
'plugin:prettier/recommended',
8+
'plugin:react/recommended',
9+
],
10+
parser: '@typescript-eslint/parser',
11+
parserOptions: {
12+
sourceType: 'module',
13+
ecmaVersion: 2017,
14+
},
15+
plugins: ['@typescript-eslint', 'jsdoc'],
16+
rules: {
17+
'@typescript-eslint/interface-name-prefix': [
18+
'error',
19+
{ prefixWithI: 'always' },
20+
],
21+
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
22+
'@typescript-eslint/no-explicit-any': 'off',
23+
'@typescript-eslint/camelcase': 'off',
24+
'@typescript-eslint/no-namespace': 'off',
25+
'@typescript-eslint/no-use-before-define': 'off',
26+
'@typescript-eslint/quotes': [
27+
'error',
28+
'single',
29+
{ avoidEscape: true, allowTemplateLiterals: false },
30+
],
31+
curly: ['error', 'all'],
32+
'jsdoc/require-param-type': 'off',
33+
'jsdoc/require-property-type': 'off',
34+
'jsdoc/require-returns-type': 'off',
35+
'jsdoc/require-returns': 'off',
36+
'jsdoc/no-types': 'warn',
37+
'prefer-arrow-callback': 'error',
38+
},
39+
settings: {
40+
jsdoc: {
41+
mode: 'typescript',
42+
},
43+
react: {
44+
version: 'detect',
45+
},
46+
},
47+
};

.github/workflows/build.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,33 @@ on: [push]
44

55
jobs:
66
build:
7-
87
runs-on: ubuntu-latest
9-
108
steps:
9+
1110
- name: Checkout
12-
uses: actions/checkout@v1
11+
uses: actions/checkout@v2
12+
1313
- name: Install node
1414
uses: actions/setup-node@v1
1515
with:
1616
node-version: '10.x'
17+
1718
- name: Install Python
1819
uses: actions/setup-python@v1
1920
with:
2021
python-version: '3.8'
22+
2123
- name: Install JupyterLab
2224
run: python -m pip install jupyterlab nbresuse
25+
2326
- name: Build and install the extension
2427
run: |
2528
jlpm
2629
jlpm run build
27-
jlpm run install
30+
jlpm run link
31+
2832
- name: Browser check
2933
run: python -m jupyterlab.browser_check
34+
35+
- name: Lint
36+
run: jlpm run lint:check

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ node_modules/
44
*.egg-info/
55
.ipynb_checkpoints
66
*.tsbuildinfo
7+
.vscode

.lintstagedrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}": [
3+
"prettier --write"
4+
]
5+
}

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
**/node_modules
3+
**/lib
4+
**/build
5+
**/static

.prettierrc

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

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ For more info, check the [memory limit](https://github.com/yuvipanda/nbresuse#me
4646

4747
Edit `~/.jupyter/jupyter_notebook_config.py`:
4848

49-
``` python
49+
```python
5050
c = get_config()
5151

5252
c.NotebookApp.ResourceUseDisplay.mem_limit = Size_of_GB *1024*1024*1024
@@ -78,6 +78,6 @@ jlpm
7878
# Build Typescript source
7979
jlpm run build
8080

81-
# Link and install the extensions
82-
jlpm run install
81+
# Link the local extensions
82+
jlpm run link
8383
```

lerna.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{
2-
"packages": [
3-
"packages/*"
4-
],
2+
"packages": ["packages/*"],
53
"npmClient": "jlpm",
64
"useWorkspaces": true,
75
"version": "independent"

package.json

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,37 @@
44
"bootstrap": "lerna bootstrap",
55
"build": "lerna run build",
66
"clean": "lerna run clean",
7-
"link": "lerna run link",
8-
"install": "lerna run link && jupyter labextension install jupyterlab-topbar-extension"
7+
"link": "lerna run link && jupyter labextension install jupyterlab-topbar-extension",
8+
"lint": "jlpm run eslint && jlpm run prettier",
9+
"lint:check": "jlpm run eslint:check && jlpm run prettier:check",
10+
"eslint": "eslint . --ext .ts,.tsx --fix",
11+
"eslint:check": "eslint . --ext .ts,.tsx",
12+
"prettier": "prettier --write \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
13+
"prettier:check": "prettier --list-different \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\""
914
},
1015
"workspaces": {
1116
"packages": [
1217
"packages/*"
1318
]
1419
},
20+
"husky": {
21+
"hooks": {
22+
"pre-commit": "lint-staged"
23+
}
24+
},
1525
"devDependencies": {
16-
"lerna": "^3.20.2"
26+
"@typescript-eslint/eslint-plugin": "^2.21.0",
27+
"@typescript-eslint/parser": "^2.21.0",
28+
"eslint": "^6.8.0",
29+
"eslint-config-prettier": "^6.10.0",
30+
"eslint-plugin-jsdoc": "^22.0.0",
31+
"eslint-plugin-prettier": "^3.1.2",
32+
"eslint-plugin-react": "^7.18.3",
33+
"husky": "^3.0.0",
34+
"lerna": "^3.20.2",
35+
"lint-staged": "^10.0.8",
36+
"prettier": "^2.0.2",
37+
"rimraf": "^3.0.2",
38+
"typescript": "~3.8.1"
1739
}
1840
}

packages/system-monitor-base/package.json

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"scripts": {
2828
"build": "tsc",
2929
"link": "jupyter labextension link . --no-build",
30-
"prettier": "prettier --write '**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}'",
3130
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
3231
"prepare": "npm run clean && npm run build",
3332
"watch": "tsc -w"
@@ -43,23 +42,7 @@
4342
"@types/react": "~16.9.0",
4443
"@types/react-dom": "~16.9.0",
4544
"@types/react-sparklines": "^1.7.0",
46-
"husky": "^3.0.0",
47-
"lint-staged": "^8.1.5",
48-
"prettier": "^1.17.0",
4945
"rimraf": "^2.6.1",
50-
"tslint-config-prettier": "^1.18.0",
51-
"tslint-plugin-prettier": "^2.0.1",
5246
"typescript": "~3.8.1"
53-
},
54-
"lint-staged": {
55-
"**/*{.ts,.tsx,.css,.json,.md}": [
56-
"prettier --write",
57-
"git add"
58-
]
59-
},
60-
"husky": {
61-
"hooks": {
62-
"pre-commit": "lint-staged"
63-
}
6447
}
6548
}

0 commit comments

Comments
 (0)