Skip to content

Commit

Permalink
Switch to eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Collonval committed Mar 6, 2020
1 parent fbef6e8 commit f6c1bb3
Show file tree
Hide file tree
Showing 57 changed files with 2,380 additions and 1,734 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ jobs:
- name: Check config files
run: |
diff basics/hello-world/tsconfig.json ${EXAMPLE_FOLDER}/tsconfig.json
diff basics/hello-world/tslint.json ${EXAMPLE_FOLDER}/tslint.json
diff basics/hello-world/.eslintignore ${EXAMPLE_FOLDER}/.eslintignore
diff basics/hello-world/.eslintrc.js ${EXAMPLE_FOLDER}/.eslintrc.js
diff basics/hello-world/.gitignore ${EXAMPLE_FOLDER}/.gitignore
env:
EXAMPLE_FOLDER: ${{ matrix.example }}
Expand All @@ -57,7 +58,7 @@ jobs:
- name: Lint the files
run: |
cd ${EXAMPLE_FOLDER}
jlpm run tslint:check
jlpm run eslint:check
env:
EXAMPLE_FOLDER: ${{ matrix.example }}
- name: Build and check by extension
Expand All @@ -81,7 +82,8 @@ jobs:
- name: Check config files
run: |
diff basics/hello-world/tsconfig.json advanced/server-extension/tsconfig.json
diff basics/hello-world/tslint.json advanced/server-extension/tslint.json
diff basics/hello-world/.eslintignore ${EXAMPLE_FOLDER}/.eslintignore
diff basics/hello-world/.eslintrc.js ${EXAMPLE_FOLDER}/.eslintrc.js
- name: Install Python
uses: actions/setup-python@v1
with:
Expand All @@ -96,7 +98,7 @@ jobs:
- name: Lint the files
run: |
cd advanced/server-extension
jlpm run tslint:check
jlpm run eslint:check
- name: Build and check extension as user
run: |
cd advanced/server-extension
Expand Down
4 changes: 4 additions & 0 deletions advanced/kernel-messaging/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
coverage
**/*.d.ts
156 changes: 156 additions & 0 deletions advanced/kernel-messaging/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jsdoc/recommended',
'plugin:prettier/recommended',
'plugin:react/recommended'
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module'
},
plugins: ['@typescript-eslint', 'jsdoc'],
rules: {
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/class-name-casing': 'error',
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/explicit-member-accessibility': [
'off',
{
accessibility: 'explicit'
}
],
'@typescript-eslint/indent': [
'error',
2,
{
FunctionDeclaration: {
parameters: 'first'
},
FunctionExpression: {
parameters: 'first'
}
}
],
'@typescript-eslint/interface-name-prefix': 'error',
'@typescript-eslint/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'semi',
requireLast: true
},
singleline: {
delimiter: 'semi',
requireLast: false
}
}
],
'@typescript-eslint/member-ordering': 'off',
'@typescript-eslint/no-empty-function': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/quotes': [
'off',
'single',
{
avoidEscape: true
}
],
'@typescript-eslint/semi': ['error', 'always'],
'@typescript-eslint/triple-slash-reference': 'error',
'@typescript-eslint/type-annotation-spacing': 'off',
camelcase: 'error',
'comma-dangle': 'off',
curly: 'error',
'default-case': 'error',
'dot-notation': 'off',
'eol-last': 'error',
eqeqeq: ['error', 'smart'],
'guard-for-in': 'off',
'id-blacklist': [
'error',
'any',
'Number',
'number',
'String',
'string',
'Boolean',
'boolean',
'Undefined',
'undefined'
],
'id-match': 'error',
'import/no-default-export': 'off',
'max-len': 'off',
'new-parens': 'error',
'no-bitwise': 'error',
'no-caller': 'error',
'no-cond-assign': 'error',
'no-console': [
'error',
{
allow: [
'log',
'dirxml',
'warn',
'error',
'dir',
'timeLog',
'assert',
'clear',
'count',
'countReset',
'group',
'groupCollapsed',
'groupEnd',
'table',
'Console',
'markTimeline',
'profile',
'profileEnd',
'timeline',
'timelineEnd',
'timeStamp',
'context'
]
}
],
'no-debugger': 'error',
'no-empty': 'error',
'no-eval': 'error',
'no-fallthrough': 'error',
'no-invalid-this': 'error',
'no-multiple-empty-lines': 'off',
'no-new-wrappers': 'error',
'no-null/no-null': 'off',
'no-redeclare': 'error',
'no-shadow': [
'off',
{
hoist: 'all'
}
],
'no-trailing-spaces': 'error',
'no-underscore-dangle': 'error',
'no-unused-labels': 'error',
'no-var': 'error',
'one-var': ['error', 'never'],
radix: 'error',
'spaced-comment': 'error',
'use-isnan': 'error'
},
settings: {
react: {
version: 'detect'
}
}
};
15 changes: 9 additions & 6 deletions advanced/kernel-messaging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"clean": "rimraf lib tsconfig.tsbuildinfo",
"link": "jupyter labextension link . --no-build",
"prepare": "jlpm run clean && jlpm run build",
"tslint": "tslint --fix -c tslint.json --project tsconfig.json \"**/*{.ts,.tsx}\"",
"tslint:check": "tslint -c tslint.json --project tsconfig.json \"**/*{.ts,.tsx}\"",
"eslint": "eslint . --ext .ts,.tsx --fix",
"eslint:check": "eslint . --ext .ts,.tsx",
"watch": "tsc -w"
},
"dependencies": {
Expand All @@ -45,11 +45,14 @@
"@lumino/widgets": "^1.11.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^2.21.0",
"@typescript-eslint/parser": "^2.21.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-jsdoc": "^22.0.0",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.18.3",
"rimraf": "^3.0.0",
"tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.0.1",
"tslint-react": "^4.1.0",
"typescript": "~3.7.5"
},
"sideEffects": [
Expand Down
117 changes: 0 additions & 117 deletions advanced/kernel-messaging/tslint.json

This file was deleted.

4 changes: 4 additions & 0 deletions advanced/kernel-output/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
coverage
**/*.d.ts
Loading

0 comments on commit f6c1bb3

Please sign in to comment.