From f6c1bb370fc57596dd33e634701c81731f0c0510 Mon Sep 17 00:00:00 2001 From: Frederic Collonval Date: Wed, 4 Mar 2020 05:01:22 -0500 Subject: [PATCH] Switch to eslint --- .github/workflows/main.yml | 10 +- advanced/kernel-messaging/.eslintignore | 4 + advanced/kernel-messaging/.eslintrc.js | 156 ++++++++++++++++++++++++ advanced/kernel-messaging/package.json | 15 ++- advanced/kernel-messaging/tslint.json | 117 ------------------ advanced/kernel-output/.eslintignore | 4 + advanced/kernel-output/.eslintrc.js | 156 ++++++++++++++++++++++++ advanced/kernel-output/package.json | 15 ++- advanced/kernel-output/tslint.json | 117 ------------------ advanced/server-extension/.eslintignore | 4 + advanced/server-extension/.eslintrc.js | 156 ++++++++++++++++++++++++ advanced/server-extension/package.json | 17 +-- advanced/server-extension/tslint.json | 117 ------------------ basics/datagrid/.eslintignore | 4 + basics/datagrid/.eslintrc.js | 156 ++++++++++++++++++++++++ basics/datagrid/package.json | 15 ++- basics/datagrid/tslint.json | 117 ------------------ basics/hello-world/.eslintignore | 4 + basics/hello-world/.eslintrc.js | 156 ++++++++++++++++++++++++ basics/hello-world/package.json | 15 ++- basics/hello-world/tslint.json | 117 ------------------ basics/signals/.eslintignore | 4 + basics/signals/.eslintrc.js | 156 ++++++++++++++++++++++++ basics/signals/package.json | 15 ++- basics/signals/tslint.json | 117 ------------------ command-palette/.eslintignore | 4 + command-palette/.eslintrc.js | 156 ++++++++++++++++++++++++ command-palette/package.json | 17 +-- command-palette/tslint.json | 117 ------------------ commands/.eslintignore | 4 + commands/.eslintrc.js | 156 ++++++++++++++++++++++++ commands/package.json | 17 +-- commands/tslint.json | 117 ------------------ launcher/.eslintignore | 4 + launcher/.eslintrc.js | 156 ++++++++++++++++++++++++ launcher/package.json | 17 +-- launcher/tslint.json | 117 ------------------ main-menu/.eslintignore | 4 + main-menu/.eslintrc.js | 156 ++++++++++++++++++++++++ main-menu/package.json | 17 +-- main-menu/tslint.json | 117 ------------------ react/react-widget/.eslintignore | 4 + react/react-widget/.eslintrc.js | 156 ++++++++++++++++++++++++ react/react-widget/package.json | 17 +-- react/react-widget/tslint.json | 117 ------------------ settings/.eslintignore | 4 + settings/.eslintrc.js | 156 ++++++++++++++++++++++++ settings/package.json | 17 +-- settings/tslint.json | 117 ------------------ state/.eslintignore | 4 + state/.eslintrc.js | 156 ++++++++++++++++++++++++ state/package.json | 17 +-- state/tslint.json | 117 ------------------ widget-tracker/widgets/.eslintignore | 4 + widget-tracker/widgets/.eslintrc.js | 156 ++++++++++++++++++++++++ widget-tracker/widgets/package.json | 15 ++- widget-tracker/widgets/tslint.json | 117 ------------------ 57 files changed, 2380 insertions(+), 1734 deletions(-) create mode 100644 advanced/kernel-messaging/.eslintignore create mode 100644 advanced/kernel-messaging/.eslintrc.js delete mode 100644 advanced/kernel-messaging/tslint.json create mode 100644 advanced/kernel-output/.eslintignore create mode 100644 advanced/kernel-output/.eslintrc.js delete mode 100644 advanced/kernel-output/tslint.json create mode 100644 advanced/server-extension/.eslintignore create mode 100644 advanced/server-extension/.eslintrc.js delete mode 100644 advanced/server-extension/tslint.json create mode 100644 basics/datagrid/.eslintignore create mode 100644 basics/datagrid/.eslintrc.js delete mode 100644 basics/datagrid/tslint.json create mode 100644 basics/hello-world/.eslintignore create mode 100644 basics/hello-world/.eslintrc.js delete mode 100644 basics/hello-world/tslint.json create mode 100644 basics/signals/.eslintignore create mode 100644 basics/signals/.eslintrc.js delete mode 100644 basics/signals/tslint.json create mode 100644 command-palette/.eslintignore create mode 100644 command-palette/.eslintrc.js delete mode 100644 command-palette/tslint.json create mode 100644 commands/.eslintignore create mode 100644 commands/.eslintrc.js delete mode 100644 commands/tslint.json create mode 100644 launcher/.eslintignore create mode 100644 launcher/.eslintrc.js delete mode 100644 launcher/tslint.json create mode 100644 main-menu/.eslintignore create mode 100644 main-menu/.eslintrc.js delete mode 100644 main-menu/tslint.json create mode 100644 react/react-widget/.eslintignore create mode 100644 react/react-widget/.eslintrc.js delete mode 100644 react/react-widget/tslint.json create mode 100644 settings/.eslintignore create mode 100644 settings/.eslintrc.js delete mode 100644 settings/tslint.json create mode 100644 state/.eslintignore create mode 100644 state/.eslintrc.js delete mode 100644 state/tslint.json create mode 100644 widget-tracker/widgets/.eslintignore create mode 100644 widget-tracker/widgets/.eslintrc.js delete mode 100644 widget-tracker/widgets/tslint.json diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f9d789b4..25700d42 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 }} @@ -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 @@ -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: @@ -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 diff --git a/advanced/kernel-messaging/.eslintignore b/advanced/kernel-messaging/.eslintignore new file mode 100644 index 00000000..8d5c8605 --- /dev/null +++ b/advanced/kernel-messaging/.eslintignore @@ -0,0 +1,4 @@ +node_modules +dist +coverage +**/*.d.ts diff --git a/advanced/kernel-messaging/.eslintrc.js b/advanced/kernel-messaging/.eslintrc.js new file mode 100644 index 00000000..0bf0ce88 --- /dev/null +++ b/advanced/kernel-messaging/.eslintrc.js @@ -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' + } + } +}; diff --git a/advanced/kernel-messaging/package.json b/advanced/kernel-messaging/package.json index a7da3d4d..89b32c63 100644 --- a/advanced/kernel-messaging/package.json +++ b/advanced/kernel-messaging/package.json @@ -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": { @@ -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": [ diff --git a/advanced/kernel-messaging/tslint.json b/advanced/kernel-messaging/tslint.json deleted file mode 100644 index 201ebcd5..00000000 --- a/advanced/kernel-messaging/tslint.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "rulesDirectory": ["tslint-plugin-prettier"], - "rules": { - "prettier": [true, { "singleQuote": true }], - "align": [true, "parameters", "statements"], - "await-promise": true, - "ban": [ - true, - ["_", "forEach"], - ["_", "each"], - ["$", "each"], - ["angular", "forEach"] - ], - "class-name": true, - "comment-format": [true, "check-space"], - "curly": true, - "eofline": true, - "forin": false, - "indent": [true, "spaces", 2], - "interface-name": [true, "always-prefix"], - "jsdoc-format": true, - "label-position": true, - "max-line-length": [false], - "member-access": false, - "member-ordering": [false], - "new-parens": true, - "no-angle-bracket-type-assertion": true, - "no-any": false, - "no-arg": true, - "no-bitwise": true, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": false, - "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], - "no-construct": true, - "no-debugger": true, - "no-default-export": false, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-floating-promises": true, - "no-inferrable-types": false, - "no-internal-module": true, - "no-invalid-this": [true, "check-function-in-method"], - "no-null-keyword": false, - "no-reference": true, - "no-require-imports": false, - "no-shadowed-variable": false, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-use-before-declare": false, - "no-var-keyword": true, - "no-var-requires": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-finally", - "check-whitespace" - ], - "one-variable-per-declaration": [true, "ignore-for-loop"], - "quotemark": { - "options": [true, "single", "avoid-escape"], - "severity": "off" - }, - "radix": true, - "semicolon": [true, "always", "ignore-bound-class-methods"], - "switch-default": true, - "trailing-comma": [ - false, - { - "multiline": "never", - "singleline": "never" - } - ], - "triple-equals": [true, "allow-null-check", "allow-undefined-check"], - "typedef": [false], - "typedef-whitespace": [ - false, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }, - { - "call-signature": "space", - "index-signature": "space", - "parameter": "space", - "property-declaration": "space", - "variable-declaration": "space" - } - ], - "use-isnan": true, - "use-strict": [false], - "variable-name": [ - true, - "check-format", - "allow-leading-underscore", - "ban-keywords", - "allow-pascal-case" - ], - "whitespace": [ - true, - "check-branch", - "check-operator", - "check-separator", - "check-type" - ] - }, - "linterOptions": { - "exclude": ["node_modules/**/*.ts", "node_modules/**/*.tsx", "**/*.d.ts"] - } -} diff --git a/advanced/kernel-output/.eslintignore b/advanced/kernel-output/.eslintignore new file mode 100644 index 00000000..8d5c8605 --- /dev/null +++ b/advanced/kernel-output/.eslintignore @@ -0,0 +1,4 @@ +node_modules +dist +coverage +**/*.d.ts diff --git a/advanced/kernel-output/.eslintrc.js b/advanced/kernel-output/.eslintrc.js new file mode 100644 index 00000000..0bf0ce88 --- /dev/null +++ b/advanced/kernel-output/.eslintrc.js @@ -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' + } + } +}; diff --git a/advanced/kernel-output/package.json b/advanced/kernel-output/package.json index 2495079f..d2408087 100644 --- a/advanced/kernel-output/package.json +++ b/advanced/kernel-output/package.json @@ -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": { @@ -44,11 +44,14 @@ "@lumino/disposable": "^1.1.2" }, "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": [ diff --git a/advanced/kernel-output/tslint.json b/advanced/kernel-output/tslint.json deleted file mode 100644 index 201ebcd5..00000000 --- a/advanced/kernel-output/tslint.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "rulesDirectory": ["tslint-plugin-prettier"], - "rules": { - "prettier": [true, { "singleQuote": true }], - "align": [true, "parameters", "statements"], - "await-promise": true, - "ban": [ - true, - ["_", "forEach"], - ["_", "each"], - ["$", "each"], - ["angular", "forEach"] - ], - "class-name": true, - "comment-format": [true, "check-space"], - "curly": true, - "eofline": true, - "forin": false, - "indent": [true, "spaces", 2], - "interface-name": [true, "always-prefix"], - "jsdoc-format": true, - "label-position": true, - "max-line-length": [false], - "member-access": false, - "member-ordering": [false], - "new-parens": true, - "no-angle-bracket-type-assertion": true, - "no-any": false, - "no-arg": true, - "no-bitwise": true, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": false, - "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], - "no-construct": true, - "no-debugger": true, - "no-default-export": false, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-floating-promises": true, - "no-inferrable-types": false, - "no-internal-module": true, - "no-invalid-this": [true, "check-function-in-method"], - "no-null-keyword": false, - "no-reference": true, - "no-require-imports": false, - "no-shadowed-variable": false, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-use-before-declare": false, - "no-var-keyword": true, - "no-var-requires": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-finally", - "check-whitespace" - ], - "one-variable-per-declaration": [true, "ignore-for-loop"], - "quotemark": { - "options": [true, "single", "avoid-escape"], - "severity": "off" - }, - "radix": true, - "semicolon": [true, "always", "ignore-bound-class-methods"], - "switch-default": true, - "trailing-comma": [ - false, - { - "multiline": "never", - "singleline": "never" - } - ], - "triple-equals": [true, "allow-null-check", "allow-undefined-check"], - "typedef": [false], - "typedef-whitespace": [ - false, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }, - { - "call-signature": "space", - "index-signature": "space", - "parameter": "space", - "property-declaration": "space", - "variable-declaration": "space" - } - ], - "use-isnan": true, - "use-strict": [false], - "variable-name": [ - true, - "check-format", - "allow-leading-underscore", - "ban-keywords", - "allow-pascal-case" - ], - "whitespace": [ - true, - "check-branch", - "check-operator", - "check-separator", - "check-type" - ] - }, - "linterOptions": { - "exclude": ["node_modules/**/*.ts", "node_modules/**/*.tsx", "**/*.d.ts"] - } -} diff --git a/advanced/server-extension/.eslintignore b/advanced/server-extension/.eslintignore new file mode 100644 index 00000000..8d5c8605 --- /dev/null +++ b/advanced/server-extension/.eslintignore @@ -0,0 +1,4 @@ +node_modules +dist +coverage +**/*.d.ts diff --git a/advanced/server-extension/.eslintrc.js b/advanced/server-extension/.eslintrc.js new file mode 100644 index 00000000..0bf0ce88 --- /dev/null +++ b/advanced/server-extension/.eslintrc.js @@ -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' + } + } +}; diff --git a/advanced/server-extension/package.json b/advanced/server-extension/package.json index dd67bd16..0450065e 100644 --- a/advanced/server-extension/package.json +++ b/advanced/server-extension/package.json @@ -35,8 +35,8 @@ "clean:all": "jlpm run clean:lib && jlpm run clean:labextension", "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": { @@ -46,11 +46,14 @@ }, "devDependencies": { "mkdirp": "^0.5.1", - "rimraf": "^2.6.1", - "tslint": "^5.20.1", - "tslint-config-prettier": "^1.18.0", - "tslint-plugin-prettier": "^2.0.1", - "tslint-react": "^4.1.0", + "@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", "typescript": "~3.7.5" }, "sideEffects": [ diff --git a/advanced/server-extension/tslint.json b/advanced/server-extension/tslint.json deleted file mode 100644 index 201ebcd5..00000000 --- a/advanced/server-extension/tslint.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "rulesDirectory": ["tslint-plugin-prettier"], - "rules": { - "prettier": [true, { "singleQuote": true }], - "align": [true, "parameters", "statements"], - "await-promise": true, - "ban": [ - true, - ["_", "forEach"], - ["_", "each"], - ["$", "each"], - ["angular", "forEach"] - ], - "class-name": true, - "comment-format": [true, "check-space"], - "curly": true, - "eofline": true, - "forin": false, - "indent": [true, "spaces", 2], - "interface-name": [true, "always-prefix"], - "jsdoc-format": true, - "label-position": true, - "max-line-length": [false], - "member-access": false, - "member-ordering": [false], - "new-parens": true, - "no-angle-bracket-type-assertion": true, - "no-any": false, - "no-arg": true, - "no-bitwise": true, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": false, - "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], - "no-construct": true, - "no-debugger": true, - "no-default-export": false, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-floating-promises": true, - "no-inferrable-types": false, - "no-internal-module": true, - "no-invalid-this": [true, "check-function-in-method"], - "no-null-keyword": false, - "no-reference": true, - "no-require-imports": false, - "no-shadowed-variable": false, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-use-before-declare": false, - "no-var-keyword": true, - "no-var-requires": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-finally", - "check-whitespace" - ], - "one-variable-per-declaration": [true, "ignore-for-loop"], - "quotemark": { - "options": [true, "single", "avoid-escape"], - "severity": "off" - }, - "radix": true, - "semicolon": [true, "always", "ignore-bound-class-methods"], - "switch-default": true, - "trailing-comma": [ - false, - { - "multiline": "never", - "singleline": "never" - } - ], - "triple-equals": [true, "allow-null-check", "allow-undefined-check"], - "typedef": [false], - "typedef-whitespace": [ - false, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }, - { - "call-signature": "space", - "index-signature": "space", - "parameter": "space", - "property-declaration": "space", - "variable-declaration": "space" - } - ], - "use-isnan": true, - "use-strict": [false], - "variable-name": [ - true, - "check-format", - "allow-leading-underscore", - "ban-keywords", - "allow-pascal-case" - ], - "whitespace": [ - true, - "check-branch", - "check-operator", - "check-separator", - "check-type" - ] - }, - "linterOptions": { - "exclude": ["node_modules/**/*.ts", "node_modules/**/*.tsx", "**/*.d.ts"] - } -} diff --git a/basics/datagrid/.eslintignore b/basics/datagrid/.eslintignore new file mode 100644 index 00000000..8d5c8605 --- /dev/null +++ b/basics/datagrid/.eslintignore @@ -0,0 +1,4 @@ +node_modules +dist +coverage +**/*.d.ts diff --git a/basics/datagrid/.eslintrc.js b/basics/datagrid/.eslintrc.js new file mode 100644 index 00000000..0bf0ce88 --- /dev/null +++ b/basics/datagrid/.eslintrc.js @@ -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' + } + } +}; diff --git a/basics/datagrid/package.json b/basics/datagrid/package.json index 10771ed3..fc32a9ea 100644 --- a/basics/datagrid/package.json +++ b/basics/datagrid/package.json @@ -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": { @@ -42,11 +42,14 @@ "@lumino/disposable": "^1.3.1" }, "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": [ diff --git a/basics/datagrid/tslint.json b/basics/datagrid/tslint.json deleted file mode 100644 index 201ebcd5..00000000 --- a/basics/datagrid/tslint.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "rulesDirectory": ["tslint-plugin-prettier"], - "rules": { - "prettier": [true, { "singleQuote": true }], - "align": [true, "parameters", "statements"], - "await-promise": true, - "ban": [ - true, - ["_", "forEach"], - ["_", "each"], - ["$", "each"], - ["angular", "forEach"] - ], - "class-name": true, - "comment-format": [true, "check-space"], - "curly": true, - "eofline": true, - "forin": false, - "indent": [true, "spaces", 2], - "interface-name": [true, "always-prefix"], - "jsdoc-format": true, - "label-position": true, - "max-line-length": [false], - "member-access": false, - "member-ordering": [false], - "new-parens": true, - "no-angle-bracket-type-assertion": true, - "no-any": false, - "no-arg": true, - "no-bitwise": true, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": false, - "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], - "no-construct": true, - "no-debugger": true, - "no-default-export": false, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-floating-promises": true, - "no-inferrable-types": false, - "no-internal-module": true, - "no-invalid-this": [true, "check-function-in-method"], - "no-null-keyword": false, - "no-reference": true, - "no-require-imports": false, - "no-shadowed-variable": false, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-use-before-declare": false, - "no-var-keyword": true, - "no-var-requires": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-finally", - "check-whitespace" - ], - "one-variable-per-declaration": [true, "ignore-for-loop"], - "quotemark": { - "options": [true, "single", "avoid-escape"], - "severity": "off" - }, - "radix": true, - "semicolon": [true, "always", "ignore-bound-class-methods"], - "switch-default": true, - "trailing-comma": [ - false, - { - "multiline": "never", - "singleline": "never" - } - ], - "triple-equals": [true, "allow-null-check", "allow-undefined-check"], - "typedef": [false], - "typedef-whitespace": [ - false, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }, - { - "call-signature": "space", - "index-signature": "space", - "parameter": "space", - "property-declaration": "space", - "variable-declaration": "space" - } - ], - "use-isnan": true, - "use-strict": [false], - "variable-name": [ - true, - "check-format", - "allow-leading-underscore", - "ban-keywords", - "allow-pascal-case" - ], - "whitespace": [ - true, - "check-branch", - "check-operator", - "check-separator", - "check-type" - ] - }, - "linterOptions": { - "exclude": ["node_modules/**/*.ts", "node_modules/**/*.tsx", "**/*.d.ts"] - } -} diff --git a/basics/hello-world/.eslintignore b/basics/hello-world/.eslintignore new file mode 100644 index 00000000..8d5c8605 --- /dev/null +++ b/basics/hello-world/.eslintignore @@ -0,0 +1,4 @@ +node_modules +dist +coverage +**/*.d.ts diff --git a/basics/hello-world/.eslintrc.js b/basics/hello-world/.eslintrc.js new file mode 100644 index 00000000..0bf0ce88 --- /dev/null +++ b/basics/hello-world/.eslintrc.js @@ -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' + } + } +}; diff --git a/basics/hello-world/package.json b/basics/hello-world/package.json index f624d66b..7da2434b 100644 --- a/basics/hello-world/package.json +++ b/basics/hello-world/package.json @@ -29,19 +29,22 @@ "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": { "@jupyterlab/application": "^2.0.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": [ diff --git a/basics/hello-world/tslint.json b/basics/hello-world/tslint.json deleted file mode 100644 index 201ebcd5..00000000 --- a/basics/hello-world/tslint.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "rulesDirectory": ["tslint-plugin-prettier"], - "rules": { - "prettier": [true, { "singleQuote": true }], - "align": [true, "parameters", "statements"], - "await-promise": true, - "ban": [ - true, - ["_", "forEach"], - ["_", "each"], - ["$", "each"], - ["angular", "forEach"] - ], - "class-name": true, - "comment-format": [true, "check-space"], - "curly": true, - "eofline": true, - "forin": false, - "indent": [true, "spaces", 2], - "interface-name": [true, "always-prefix"], - "jsdoc-format": true, - "label-position": true, - "max-line-length": [false], - "member-access": false, - "member-ordering": [false], - "new-parens": true, - "no-angle-bracket-type-assertion": true, - "no-any": false, - "no-arg": true, - "no-bitwise": true, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": false, - "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], - "no-construct": true, - "no-debugger": true, - "no-default-export": false, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-floating-promises": true, - "no-inferrable-types": false, - "no-internal-module": true, - "no-invalid-this": [true, "check-function-in-method"], - "no-null-keyword": false, - "no-reference": true, - "no-require-imports": false, - "no-shadowed-variable": false, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-use-before-declare": false, - "no-var-keyword": true, - "no-var-requires": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-finally", - "check-whitespace" - ], - "one-variable-per-declaration": [true, "ignore-for-loop"], - "quotemark": { - "options": [true, "single", "avoid-escape"], - "severity": "off" - }, - "radix": true, - "semicolon": [true, "always", "ignore-bound-class-methods"], - "switch-default": true, - "trailing-comma": [ - false, - { - "multiline": "never", - "singleline": "never" - } - ], - "triple-equals": [true, "allow-null-check", "allow-undefined-check"], - "typedef": [false], - "typedef-whitespace": [ - false, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }, - { - "call-signature": "space", - "index-signature": "space", - "parameter": "space", - "property-declaration": "space", - "variable-declaration": "space" - } - ], - "use-isnan": true, - "use-strict": [false], - "variable-name": [ - true, - "check-format", - "allow-leading-underscore", - "ban-keywords", - "allow-pascal-case" - ], - "whitespace": [ - true, - "check-branch", - "check-operator", - "check-separator", - "check-type" - ] - }, - "linterOptions": { - "exclude": ["node_modules/**/*.ts", "node_modules/**/*.tsx", "**/*.d.ts"] - } -} diff --git a/basics/signals/.eslintignore b/basics/signals/.eslintignore new file mode 100644 index 00000000..8d5c8605 --- /dev/null +++ b/basics/signals/.eslintignore @@ -0,0 +1,4 @@ +node_modules +dist +coverage +**/*.d.ts diff --git a/basics/signals/.eslintrc.js b/basics/signals/.eslintrc.js new file mode 100644 index 00000000..0bf0ce88 --- /dev/null +++ b/basics/signals/.eslintrc.js @@ -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' + } + } +}; diff --git a/basics/signals/package.json b/basics/signals/package.json index 2b90f509..1cb81619 100644 --- a/basics/signals/package.json +++ b/basics/signals/package.json @@ -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": { @@ -43,11 +43,14 @@ "@lumino/disposable": "^1.3.1" }, "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": [ diff --git a/basics/signals/tslint.json b/basics/signals/tslint.json deleted file mode 100644 index 201ebcd5..00000000 --- a/basics/signals/tslint.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "rulesDirectory": ["tslint-plugin-prettier"], - "rules": { - "prettier": [true, { "singleQuote": true }], - "align": [true, "parameters", "statements"], - "await-promise": true, - "ban": [ - true, - ["_", "forEach"], - ["_", "each"], - ["$", "each"], - ["angular", "forEach"] - ], - "class-name": true, - "comment-format": [true, "check-space"], - "curly": true, - "eofline": true, - "forin": false, - "indent": [true, "spaces", 2], - "interface-name": [true, "always-prefix"], - "jsdoc-format": true, - "label-position": true, - "max-line-length": [false], - "member-access": false, - "member-ordering": [false], - "new-parens": true, - "no-angle-bracket-type-assertion": true, - "no-any": false, - "no-arg": true, - "no-bitwise": true, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": false, - "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], - "no-construct": true, - "no-debugger": true, - "no-default-export": false, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-floating-promises": true, - "no-inferrable-types": false, - "no-internal-module": true, - "no-invalid-this": [true, "check-function-in-method"], - "no-null-keyword": false, - "no-reference": true, - "no-require-imports": false, - "no-shadowed-variable": false, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-use-before-declare": false, - "no-var-keyword": true, - "no-var-requires": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-finally", - "check-whitespace" - ], - "one-variable-per-declaration": [true, "ignore-for-loop"], - "quotemark": { - "options": [true, "single", "avoid-escape"], - "severity": "off" - }, - "radix": true, - "semicolon": [true, "always", "ignore-bound-class-methods"], - "switch-default": true, - "trailing-comma": [ - false, - { - "multiline": "never", - "singleline": "never" - } - ], - "triple-equals": [true, "allow-null-check", "allow-undefined-check"], - "typedef": [false], - "typedef-whitespace": [ - false, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }, - { - "call-signature": "space", - "index-signature": "space", - "parameter": "space", - "property-declaration": "space", - "variable-declaration": "space" - } - ], - "use-isnan": true, - "use-strict": [false], - "variable-name": [ - true, - "check-format", - "allow-leading-underscore", - "ban-keywords", - "allow-pascal-case" - ], - "whitespace": [ - true, - "check-branch", - "check-operator", - "check-separator", - "check-type" - ] - }, - "linterOptions": { - "exclude": ["node_modules/**/*.ts", "node_modules/**/*.tsx", "**/*.d.ts"] - } -} diff --git a/command-palette/.eslintignore b/command-palette/.eslintignore new file mode 100644 index 00000000..8d5c8605 --- /dev/null +++ b/command-palette/.eslintignore @@ -0,0 +1,4 @@ +node_modules +dist +coverage +**/*.d.ts diff --git a/command-palette/.eslintrc.js b/command-palette/.eslintrc.js new file mode 100644 index 00000000..0bf0ce88 --- /dev/null +++ b/command-palette/.eslintrc.js @@ -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' + } + } +}; diff --git a/command-palette/package.json b/command-palette/package.json index ee77c164..96ef839b 100644 --- a/command-palette/package.json +++ b/command-palette/package.json @@ -29,19 +29,22 @@ "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": { "@jupyterlab/application": "^2.0.0" }, "devDependencies": { - "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-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", "typescript": "~3.7.5" }, "sideEffects": [ diff --git a/command-palette/tslint.json b/command-palette/tslint.json deleted file mode 100644 index 201ebcd5..00000000 --- a/command-palette/tslint.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "rulesDirectory": ["tslint-plugin-prettier"], - "rules": { - "prettier": [true, { "singleQuote": true }], - "align": [true, "parameters", "statements"], - "await-promise": true, - "ban": [ - true, - ["_", "forEach"], - ["_", "each"], - ["$", "each"], - ["angular", "forEach"] - ], - "class-name": true, - "comment-format": [true, "check-space"], - "curly": true, - "eofline": true, - "forin": false, - "indent": [true, "spaces", 2], - "interface-name": [true, "always-prefix"], - "jsdoc-format": true, - "label-position": true, - "max-line-length": [false], - "member-access": false, - "member-ordering": [false], - "new-parens": true, - "no-angle-bracket-type-assertion": true, - "no-any": false, - "no-arg": true, - "no-bitwise": true, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": false, - "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], - "no-construct": true, - "no-debugger": true, - "no-default-export": false, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-floating-promises": true, - "no-inferrable-types": false, - "no-internal-module": true, - "no-invalid-this": [true, "check-function-in-method"], - "no-null-keyword": false, - "no-reference": true, - "no-require-imports": false, - "no-shadowed-variable": false, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-use-before-declare": false, - "no-var-keyword": true, - "no-var-requires": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-finally", - "check-whitespace" - ], - "one-variable-per-declaration": [true, "ignore-for-loop"], - "quotemark": { - "options": [true, "single", "avoid-escape"], - "severity": "off" - }, - "radix": true, - "semicolon": [true, "always", "ignore-bound-class-methods"], - "switch-default": true, - "trailing-comma": [ - false, - { - "multiline": "never", - "singleline": "never" - } - ], - "triple-equals": [true, "allow-null-check", "allow-undefined-check"], - "typedef": [false], - "typedef-whitespace": [ - false, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }, - { - "call-signature": "space", - "index-signature": "space", - "parameter": "space", - "property-declaration": "space", - "variable-declaration": "space" - } - ], - "use-isnan": true, - "use-strict": [false], - "variable-name": [ - true, - "check-format", - "allow-leading-underscore", - "ban-keywords", - "allow-pascal-case" - ], - "whitespace": [ - true, - "check-branch", - "check-operator", - "check-separator", - "check-type" - ] - }, - "linterOptions": { - "exclude": ["node_modules/**/*.ts", "node_modules/**/*.tsx", "**/*.d.ts"] - } -} diff --git a/commands/.eslintignore b/commands/.eslintignore new file mode 100644 index 00000000..8d5c8605 --- /dev/null +++ b/commands/.eslintignore @@ -0,0 +1,4 @@ +node_modules +dist +coverage +**/*.d.ts diff --git a/commands/.eslintrc.js b/commands/.eslintrc.js new file mode 100644 index 00000000..0bf0ce88 --- /dev/null +++ b/commands/.eslintrc.js @@ -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' + } + } +}; diff --git a/commands/package.json b/commands/package.json index fde0c7da..129728c3 100644 --- a/commands/package.json +++ b/commands/package.json @@ -29,19 +29,22 @@ "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": { "@jupyterlab/application": "^2.0.0" }, "devDependencies": { - "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-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", "typescript": "~3.7.5" }, "sideEffects": [ diff --git a/commands/tslint.json b/commands/tslint.json deleted file mode 100644 index 201ebcd5..00000000 --- a/commands/tslint.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "rulesDirectory": ["tslint-plugin-prettier"], - "rules": { - "prettier": [true, { "singleQuote": true }], - "align": [true, "parameters", "statements"], - "await-promise": true, - "ban": [ - true, - ["_", "forEach"], - ["_", "each"], - ["$", "each"], - ["angular", "forEach"] - ], - "class-name": true, - "comment-format": [true, "check-space"], - "curly": true, - "eofline": true, - "forin": false, - "indent": [true, "spaces", 2], - "interface-name": [true, "always-prefix"], - "jsdoc-format": true, - "label-position": true, - "max-line-length": [false], - "member-access": false, - "member-ordering": [false], - "new-parens": true, - "no-angle-bracket-type-assertion": true, - "no-any": false, - "no-arg": true, - "no-bitwise": true, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": false, - "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], - "no-construct": true, - "no-debugger": true, - "no-default-export": false, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-floating-promises": true, - "no-inferrable-types": false, - "no-internal-module": true, - "no-invalid-this": [true, "check-function-in-method"], - "no-null-keyword": false, - "no-reference": true, - "no-require-imports": false, - "no-shadowed-variable": false, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-use-before-declare": false, - "no-var-keyword": true, - "no-var-requires": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-finally", - "check-whitespace" - ], - "one-variable-per-declaration": [true, "ignore-for-loop"], - "quotemark": { - "options": [true, "single", "avoid-escape"], - "severity": "off" - }, - "radix": true, - "semicolon": [true, "always", "ignore-bound-class-methods"], - "switch-default": true, - "trailing-comma": [ - false, - { - "multiline": "never", - "singleline": "never" - } - ], - "triple-equals": [true, "allow-null-check", "allow-undefined-check"], - "typedef": [false], - "typedef-whitespace": [ - false, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }, - { - "call-signature": "space", - "index-signature": "space", - "parameter": "space", - "property-declaration": "space", - "variable-declaration": "space" - } - ], - "use-isnan": true, - "use-strict": [false], - "variable-name": [ - true, - "check-format", - "allow-leading-underscore", - "ban-keywords", - "allow-pascal-case" - ], - "whitespace": [ - true, - "check-branch", - "check-operator", - "check-separator", - "check-type" - ] - }, - "linterOptions": { - "exclude": ["node_modules/**/*.ts", "node_modules/**/*.tsx", "**/*.d.ts"] - } -} diff --git a/launcher/.eslintignore b/launcher/.eslintignore new file mode 100644 index 00000000..8d5c8605 --- /dev/null +++ b/launcher/.eslintignore @@ -0,0 +1,4 @@ +node_modules +dist +coverage +**/*.d.ts diff --git a/launcher/.eslintrc.js b/launcher/.eslintrc.js new file mode 100644 index 00000000..0bf0ce88 --- /dev/null +++ b/launcher/.eslintrc.js @@ -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' + } + } +}; diff --git a/launcher/package.json b/launcher/package.json index 9ef3af78..69f283f6 100644 --- a/launcher/package.json +++ b/launcher/package.json @@ -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": { @@ -40,11 +40,14 @@ "@jupyterlab/mainmenu": "^2.0.0" }, "devDependencies": { - "rimraf": "^2.6.1", - "tslint": "^5.20.1", - "tslint-config-prettier": "^1.18.0", - "tslint-plugin-prettier": "^2.0.1", - "tslint-react": "^4.1.0", + "@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", "typescript": "~3.7.5" }, "sideEffects": [ diff --git a/launcher/tslint.json b/launcher/tslint.json deleted file mode 100644 index 201ebcd5..00000000 --- a/launcher/tslint.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "rulesDirectory": ["tslint-plugin-prettier"], - "rules": { - "prettier": [true, { "singleQuote": true }], - "align": [true, "parameters", "statements"], - "await-promise": true, - "ban": [ - true, - ["_", "forEach"], - ["_", "each"], - ["$", "each"], - ["angular", "forEach"] - ], - "class-name": true, - "comment-format": [true, "check-space"], - "curly": true, - "eofline": true, - "forin": false, - "indent": [true, "spaces", 2], - "interface-name": [true, "always-prefix"], - "jsdoc-format": true, - "label-position": true, - "max-line-length": [false], - "member-access": false, - "member-ordering": [false], - "new-parens": true, - "no-angle-bracket-type-assertion": true, - "no-any": false, - "no-arg": true, - "no-bitwise": true, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": false, - "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], - "no-construct": true, - "no-debugger": true, - "no-default-export": false, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-floating-promises": true, - "no-inferrable-types": false, - "no-internal-module": true, - "no-invalid-this": [true, "check-function-in-method"], - "no-null-keyword": false, - "no-reference": true, - "no-require-imports": false, - "no-shadowed-variable": false, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-use-before-declare": false, - "no-var-keyword": true, - "no-var-requires": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-finally", - "check-whitespace" - ], - "one-variable-per-declaration": [true, "ignore-for-loop"], - "quotemark": { - "options": [true, "single", "avoid-escape"], - "severity": "off" - }, - "radix": true, - "semicolon": [true, "always", "ignore-bound-class-methods"], - "switch-default": true, - "trailing-comma": [ - false, - { - "multiline": "never", - "singleline": "never" - } - ], - "triple-equals": [true, "allow-null-check", "allow-undefined-check"], - "typedef": [false], - "typedef-whitespace": [ - false, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }, - { - "call-signature": "space", - "index-signature": "space", - "parameter": "space", - "property-declaration": "space", - "variable-declaration": "space" - } - ], - "use-isnan": true, - "use-strict": [false], - "variable-name": [ - true, - "check-format", - "allow-leading-underscore", - "ban-keywords", - "allow-pascal-case" - ], - "whitespace": [ - true, - "check-branch", - "check-operator", - "check-separator", - "check-type" - ] - }, - "linterOptions": { - "exclude": ["node_modules/**/*.ts", "node_modules/**/*.tsx", "**/*.d.ts"] - } -} diff --git a/main-menu/.eslintignore b/main-menu/.eslintignore new file mode 100644 index 00000000..8d5c8605 --- /dev/null +++ b/main-menu/.eslintignore @@ -0,0 +1,4 @@ +node_modules +dist +coverage +**/*.d.ts diff --git a/main-menu/.eslintrc.js b/main-menu/.eslintrc.js new file mode 100644 index 00000000..0bf0ce88 --- /dev/null +++ b/main-menu/.eslintrc.js @@ -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' + } + } +}; diff --git a/main-menu/package.json b/main-menu/package.json index 59616a7c..efc24e38 100644 --- a/main-menu/package.json +++ b/main-menu/package.json @@ -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": { @@ -39,11 +39,14 @@ "@lumino/widgets": "^1.9.3" }, "devDependencies": { - "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-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", "typescript": "~3.7.5" }, "sideEffects": [ diff --git a/main-menu/tslint.json b/main-menu/tslint.json deleted file mode 100644 index 201ebcd5..00000000 --- a/main-menu/tslint.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "rulesDirectory": ["tslint-plugin-prettier"], - "rules": { - "prettier": [true, { "singleQuote": true }], - "align": [true, "parameters", "statements"], - "await-promise": true, - "ban": [ - true, - ["_", "forEach"], - ["_", "each"], - ["$", "each"], - ["angular", "forEach"] - ], - "class-name": true, - "comment-format": [true, "check-space"], - "curly": true, - "eofline": true, - "forin": false, - "indent": [true, "spaces", 2], - "interface-name": [true, "always-prefix"], - "jsdoc-format": true, - "label-position": true, - "max-line-length": [false], - "member-access": false, - "member-ordering": [false], - "new-parens": true, - "no-angle-bracket-type-assertion": true, - "no-any": false, - "no-arg": true, - "no-bitwise": true, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": false, - "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], - "no-construct": true, - "no-debugger": true, - "no-default-export": false, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-floating-promises": true, - "no-inferrable-types": false, - "no-internal-module": true, - "no-invalid-this": [true, "check-function-in-method"], - "no-null-keyword": false, - "no-reference": true, - "no-require-imports": false, - "no-shadowed-variable": false, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-use-before-declare": false, - "no-var-keyword": true, - "no-var-requires": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-finally", - "check-whitespace" - ], - "one-variable-per-declaration": [true, "ignore-for-loop"], - "quotemark": { - "options": [true, "single", "avoid-escape"], - "severity": "off" - }, - "radix": true, - "semicolon": [true, "always", "ignore-bound-class-methods"], - "switch-default": true, - "trailing-comma": [ - false, - { - "multiline": "never", - "singleline": "never" - } - ], - "triple-equals": [true, "allow-null-check", "allow-undefined-check"], - "typedef": [false], - "typedef-whitespace": [ - false, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }, - { - "call-signature": "space", - "index-signature": "space", - "parameter": "space", - "property-declaration": "space", - "variable-declaration": "space" - } - ], - "use-isnan": true, - "use-strict": [false], - "variable-name": [ - true, - "check-format", - "allow-leading-underscore", - "ban-keywords", - "allow-pascal-case" - ], - "whitespace": [ - true, - "check-branch", - "check-operator", - "check-separator", - "check-type" - ] - }, - "linterOptions": { - "exclude": ["node_modules/**/*.ts", "node_modules/**/*.tsx", "**/*.d.ts"] - } -} diff --git a/react/react-widget/.eslintignore b/react/react-widget/.eslintignore new file mode 100644 index 00000000..8d5c8605 --- /dev/null +++ b/react/react-widget/.eslintignore @@ -0,0 +1,4 @@ +node_modules +dist +coverage +**/*.d.ts diff --git a/react/react-widget/.eslintrc.js b/react/react-widget/.eslintrc.js new file mode 100644 index 00000000..0bf0ce88 --- /dev/null +++ b/react/react-widget/.eslintrc.js @@ -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' + } + } +}; diff --git a/react/react-widget/package.json b/react/react-widget/package.json index 87fdda2d..85376c53 100644 --- a/react/react-widget/package.json +++ b/react/react-widget/package.json @@ -28,8 +28,8 @@ "build": "tsc", "clean": "rimraf lib && rimraf tsconfig.tsbuildinfo", "link": "jupyter labextension link . --no-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": { @@ -38,11 +38,14 @@ "@jupyterlab/ui-components": "^2.0.0" }, "devDependencies": { - "rimraf": "^2.6.1", - "tslint": "^5.20.1", - "tslint-config-prettier": "^1.18.0", - "tslint-plugin-prettier": "^2.0.1", - "tslint-react": "^4.1.0", + "@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", "typescript": "~3.7.5" }, "sideEffects": [ diff --git a/react/react-widget/tslint.json b/react/react-widget/tslint.json deleted file mode 100644 index 201ebcd5..00000000 --- a/react/react-widget/tslint.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "rulesDirectory": ["tslint-plugin-prettier"], - "rules": { - "prettier": [true, { "singleQuote": true }], - "align": [true, "parameters", "statements"], - "await-promise": true, - "ban": [ - true, - ["_", "forEach"], - ["_", "each"], - ["$", "each"], - ["angular", "forEach"] - ], - "class-name": true, - "comment-format": [true, "check-space"], - "curly": true, - "eofline": true, - "forin": false, - "indent": [true, "spaces", 2], - "interface-name": [true, "always-prefix"], - "jsdoc-format": true, - "label-position": true, - "max-line-length": [false], - "member-access": false, - "member-ordering": [false], - "new-parens": true, - "no-angle-bracket-type-assertion": true, - "no-any": false, - "no-arg": true, - "no-bitwise": true, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": false, - "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], - "no-construct": true, - "no-debugger": true, - "no-default-export": false, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-floating-promises": true, - "no-inferrable-types": false, - "no-internal-module": true, - "no-invalid-this": [true, "check-function-in-method"], - "no-null-keyword": false, - "no-reference": true, - "no-require-imports": false, - "no-shadowed-variable": false, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-use-before-declare": false, - "no-var-keyword": true, - "no-var-requires": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-finally", - "check-whitespace" - ], - "one-variable-per-declaration": [true, "ignore-for-loop"], - "quotemark": { - "options": [true, "single", "avoid-escape"], - "severity": "off" - }, - "radix": true, - "semicolon": [true, "always", "ignore-bound-class-methods"], - "switch-default": true, - "trailing-comma": [ - false, - { - "multiline": "never", - "singleline": "never" - } - ], - "triple-equals": [true, "allow-null-check", "allow-undefined-check"], - "typedef": [false], - "typedef-whitespace": [ - false, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }, - { - "call-signature": "space", - "index-signature": "space", - "parameter": "space", - "property-declaration": "space", - "variable-declaration": "space" - } - ], - "use-isnan": true, - "use-strict": [false], - "variable-name": [ - true, - "check-format", - "allow-leading-underscore", - "ban-keywords", - "allow-pascal-case" - ], - "whitespace": [ - true, - "check-branch", - "check-operator", - "check-separator", - "check-type" - ] - }, - "linterOptions": { - "exclude": ["node_modules/**/*.ts", "node_modules/**/*.tsx", "**/*.d.ts"] - } -} diff --git a/settings/.eslintignore b/settings/.eslintignore new file mode 100644 index 00000000..8d5c8605 --- /dev/null +++ b/settings/.eslintignore @@ -0,0 +1,4 @@ +node_modules +dist +coverage +**/*.d.ts diff --git a/settings/.eslintrc.js b/settings/.eslintrc.js new file mode 100644 index 00000000..0bf0ce88 --- /dev/null +++ b/settings/.eslintrc.js @@ -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' + } + } +}; diff --git a/settings/package.json b/settings/package.json index c065d169..11288241 100644 --- a/settings/package.json +++ b/settings/package.json @@ -30,8 +30,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": { @@ -41,11 +41,14 @@ "@lumino/widgets": "^1.9.3" }, "devDependencies": { - "rimraf": "^2.6.1", - "tslint": "^5.20.1", - "tslint-config-prettier": "^1.18.0", - "tslint-plugin-prettier": "^2.0.1", - "tslint-react": "^4.1.0", + "@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", "typescript": "~3.7.5" }, "sideEffects": [ diff --git a/settings/tslint.json b/settings/tslint.json deleted file mode 100644 index 201ebcd5..00000000 --- a/settings/tslint.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "rulesDirectory": ["tslint-plugin-prettier"], - "rules": { - "prettier": [true, { "singleQuote": true }], - "align": [true, "parameters", "statements"], - "await-promise": true, - "ban": [ - true, - ["_", "forEach"], - ["_", "each"], - ["$", "each"], - ["angular", "forEach"] - ], - "class-name": true, - "comment-format": [true, "check-space"], - "curly": true, - "eofline": true, - "forin": false, - "indent": [true, "spaces", 2], - "interface-name": [true, "always-prefix"], - "jsdoc-format": true, - "label-position": true, - "max-line-length": [false], - "member-access": false, - "member-ordering": [false], - "new-parens": true, - "no-angle-bracket-type-assertion": true, - "no-any": false, - "no-arg": true, - "no-bitwise": true, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": false, - "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], - "no-construct": true, - "no-debugger": true, - "no-default-export": false, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-floating-promises": true, - "no-inferrable-types": false, - "no-internal-module": true, - "no-invalid-this": [true, "check-function-in-method"], - "no-null-keyword": false, - "no-reference": true, - "no-require-imports": false, - "no-shadowed-variable": false, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-use-before-declare": false, - "no-var-keyword": true, - "no-var-requires": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-finally", - "check-whitespace" - ], - "one-variable-per-declaration": [true, "ignore-for-loop"], - "quotemark": { - "options": [true, "single", "avoid-escape"], - "severity": "off" - }, - "radix": true, - "semicolon": [true, "always", "ignore-bound-class-methods"], - "switch-default": true, - "trailing-comma": [ - false, - { - "multiline": "never", - "singleline": "never" - } - ], - "triple-equals": [true, "allow-null-check", "allow-undefined-check"], - "typedef": [false], - "typedef-whitespace": [ - false, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }, - { - "call-signature": "space", - "index-signature": "space", - "parameter": "space", - "property-declaration": "space", - "variable-declaration": "space" - } - ], - "use-isnan": true, - "use-strict": [false], - "variable-name": [ - true, - "check-format", - "allow-leading-underscore", - "ban-keywords", - "allow-pascal-case" - ], - "whitespace": [ - true, - "check-branch", - "check-operator", - "check-separator", - "check-type" - ] - }, - "linterOptions": { - "exclude": ["node_modules/**/*.ts", "node_modules/**/*.tsx", "**/*.d.ts"] - } -} diff --git a/state/.eslintignore b/state/.eslintignore new file mode 100644 index 00000000..8d5c8605 --- /dev/null +++ b/state/.eslintignore @@ -0,0 +1,4 @@ +node_modules +dist +coverage +**/*.d.ts diff --git a/state/.eslintrc.js b/state/.eslintrc.js new file mode 100644 index 00000000..0bf0ce88 --- /dev/null +++ b/state/.eslintrc.js @@ -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' + } + } +}; diff --git a/state/package.json b/state/package.json index c8e13092..9a759f0b 100644 --- a/state/package.json +++ b/state/package.json @@ -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": { @@ -40,11 +40,14 @@ "@lumino/coreutils": "^1.4.2" }, "devDependencies": { - "rimraf": "^2.6.1", - "tslint": "^5.20.1", - "tslint-config-prettier": "^1.18.0", - "tslint-plugin-prettier": "^2.0.1", - "tslint-react": "^4.1.0", + "@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", "typescript": "~3.7.5" }, "sideEffects": [ diff --git a/state/tslint.json b/state/tslint.json deleted file mode 100644 index 201ebcd5..00000000 --- a/state/tslint.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "rulesDirectory": ["tslint-plugin-prettier"], - "rules": { - "prettier": [true, { "singleQuote": true }], - "align": [true, "parameters", "statements"], - "await-promise": true, - "ban": [ - true, - ["_", "forEach"], - ["_", "each"], - ["$", "each"], - ["angular", "forEach"] - ], - "class-name": true, - "comment-format": [true, "check-space"], - "curly": true, - "eofline": true, - "forin": false, - "indent": [true, "spaces", 2], - "interface-name": [true, "always-prefix"], - "jsdoc-format": true, - "label-position": true, - "max-line-length": [false], - "member-access": false, - "member-ordering": [false], - "new-parens": true, - "no-angle-bracket-type-assertion": true, - "no-any": false, - "no-arg": true, - "no-bitwise": true, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": false, - "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], - "no-construct": true, - "no-debugger": true, - "no-default-export": false, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-floating-promises": true, - "no-inferrable-types": false, - "no-internal-module": true, - "no-invalid-this": [true, "check-function-in-method"], - "no-null-keyword": false, - "no-reference": true, - "no-require-imports": false, - "no-shadowed-variable": false, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-use-before-declare": false, - "no-var-keyword": true, - "no-var-requires": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-finally", - "check-whitespace" - ], - "one-variable-per-declaration": [true, "ignore-for-loop"], - "quotemark": { - "options": [true, "single", "avoid-escape"], - "severity": "off" - }, - "radix": true, - "semicolon": [true, "always", "ignore-bound-class-methods"], - "switch-default": true, - "trailing-comma": [ - false, - { - "multiline": "never", - "singleline": "never" - } - ], - "triple-equals": [true, "allow-null-check", "allow-undefined-check"], - "typedef": [false], - "typedef-whitespace": [ - false, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }, - { - "call-signature": "space", - "index-signature": "space", - "parameter": "space", - "property-declaration": "space", - "variable-declaration": "space" - } - ], - "use-isnan": true, - "use-strict": [false], - "variable-name": [ - true, - "check-format", - "allow-leading-underscore", - "ban-keywords", - "allow-pascal-case" - ], - "whitespace": [ - true, - "check-branch", - "check-operator", - "check-separator", - "check-type" - ] - }, - "linterOptions": { - "exclude": ["node_modules/**/*.ts", "node_modules/**/*.tsx", "**/*.d.ts"] - } -} diff --git a/widget-tracker/widgets/.eslintignore b/widget-tracker/widgets/.eslintignore new file mode 100644 index 00000000..8d5c8605 --- /dev/null +++ b/widget-tracker/widgets/.eslintignore @@ -0,0 +1,4 @@ +node_modules +dist +coverage +**/*.d.ts diff --git a/widget-tracker/widgets/.eslintrc.js b/widget-tracker/widgets/.eslintrc.js new file mode 100644 index 00000000..0bf0ce88 --- /dev/null +++ b/widget-tracker/widgets/.eslintrc.js @@ -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' + } + } +}; diff --git a/widget-tracker/widgets/package.json b/widget-tracker/widgets/package.json index 36e39450..5f891ce4 100644 --- a/widget-tracker/widgets/package.json +++ b/widget-tracker/widgets/package.json @@ -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": { @@ -41,11 +41,14 @@ "@lumino/disposable": "^1.3.1" }, "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": [ diff --git a/widget-tracker/widgets/tslint.json b/widget-tracker/widgets/tslint.json deleted file mode 100644 index 201ebcd5..00000000 --- a/widget-tracker/widgets/tslint.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "rulesDirectory": ["tslint-plugin-prettier"], - "rules": { - "prettier": [true, { "singleQuote": true }], - "align": [true, "parameters", "statements"], - "await-promise": true, - "ban": [ - true, - ["_", "forEach"], - ["_", "each"], - ["$", "each"], - ["angular", "forEach"] - ], - "class-name": true, - "comment-format": [true, "check-space"], - "curly": true, - "eofline": true, - "forin": false, - "indent": [true, "spaces", 2], - "interface-name": [true, "always-prefix"], - "jsdoc-format": true, - "label-position": true, - "max-line-length": [false], - "member-access": false, - "member-ordering": [false], - "new-parens": true, - "no-angle-bracket-type-assertion": true, - "no-any": false, - "no-arg": true, - "no-bitwise": true, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": false, - "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], - "no-construct": true, - "no-debugger": true, - "no-default-export": false, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-floating-promises": true, - "no-inferrable-types": false, - "no-internal-module": true, - "no-invalid-this": [true, "check-function-in-method"], - "no-null-keyword": false, - "no-reference": true, - "no-require-imports": false, - "no-shadowed-variable": false, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-use-before-declare": false, - "no-var-keyword": true, - "no-var-requires": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-finally", - "check-whitespace" - ], - "one-variable-per-declaration": [true, "ignore-for-loop"], - "quotemark": { - "options": [true, "single", "avoid-escape"], - "severity": "off" - }, - "radix": true, - "semicolon": [true, "always", "ignore-bound-class-methods"], - "switch-default": true, - "trailing-comma": [ - false, - { - "multiline": "never", - "singleline": "never" - } - ], - "triple-equals": [true, "allow-null-check", "allow-undefined-check"], - "typedef": [false], - "typedef-whitespace": [ - false, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }, - { - "call-signature": "space", - "index-signature": "space", - "parameter": "space", - "property-declaration": "space", - "variable-declaration": "space" - } - ], - "use-isnan": true, - "use-strict": [false], - "variable-name": [ - true, - "check-format", - "allow-leading-underscore", - "ban-keywords", - "allow-pascal-case" - ], - "whitespace": [ - true, - "check-branch", - "check-operator", - "check-separator", - "check-type" - ] - }, - "linterOptions": { - "exclude": ["node_modules/**/*.ts", "node_modules/**/*.tsx", "**/*.d.ts"] - } -}