Skip to content

Commit 909abad

Browse files
committed
[Draft] Upgrade eslint from v.8.* to v.9.*
Signed-off-by: Victor Rubezhny <[email protected]>
1 parent 627c60c commit 909abad

File tree

4 files changed

+156
-155
lines changed

4 files changed

+156
-155
lines changed

.eslintignore

-12
This file was deleted.

.eslintrc

-140
This file was deleted.

eslint.config.js

+153
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
// eslint.config.js (without defineConfig)
2+
module.exports = [
3+
{
4+
files: ['*.ts', '*.tsx'],
5+
root: true,
6+
env: {
7+
browser: true,
8+
node: true,
9+
es6: true,
10+
jasmine: true
11+
},
12+
extends: [
13+
'eslint:recommended',
14+
'plugin:@typescript-eslint/eslint-recommended',
15+
'plugin:@typescript-eslint/recommended',
16+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
17+
'prettier',
18+
],
19+
parserOptions: {
20+
ecmaVersion: 2020,
21+
comment: true,
22+
project: [
23+
'./tsconfig.json',
24+
'./src/webview/tsconfig.json'
25+
],
26+
sourceType: 'module'
27+
},
28+
parser: '@typescript-eslint/parser',
29+
plugins: [
30+
'@typescript-eslint',
31+
'prettier',
32+
'header',
33+
'import',
34+
'jsdoc'
35+
],
36+
settings: {
37+
'import/core-modules': [ 'vscode' ],
38+
'import/parsers': {
39+
'@typescript-eslint/parser': ['.ts', '.tsx']
40+
},
41+
'import/resolver': {
42+
'typescript': {},
43+
'node': {
44+
'extensions': [
45+
'.js',
46+
'.jsx',
47+
'.tsx',
48+
'.ts'
49+
]
50+
}
51+
},
52+
'import/extensions': [
53+
'.js',
54+
'.jsx',
55+
'.tsx',
56+
'.ts'
57+
]
58+
},
59+
rules: {
60+
'header/header': [2, './header.js'],
61+
'camelcase': 2,
62+
'consistent-return': 0,
63+
'consistent-this': [1, 'that'],
64+
'curly': ['error', 'multi-line'],
65+
'default-case': [2],
66+
'dot-notation': [2],
67+
'no-multiple-empty-lines': [1, { 'max': 1, 'maxEOF': 0 }],
68+
'eqeqeq': [2, 'allow-null'],
69+
'guard-for-in': 2,
70+
'import/no-unresolved': ['error'],
71+
'import/no-duplicates': ['error'],
72+
'import/prefer-default-export': 0,
73+
'import/extensions': [
74+
'error',
75+
'ignorePackages',
76+
{
77+
'js': 'never',
78+
'jsx': 'never',
79+
'ts': 'never',
80+
'tsx': 'never'
81+
}
82+
],
83+
'max-nested-callbacks': [1, 4],
84+
'max-classes-per-file': [0],
85+
'no-alert': 2,
86+
'no-caller': 2,
87+
'no-console': 2,
88+
'no-constant-condition': 2,
89+
'no-debugger': 2,
90+
'no-else-return': ['error'],
91+
'no-global-strict': 0,
92+
'no-irregular-whitespace': ['error'],
93+
'no-param-reassign': ['error', { 'props': false }],
94+
'no-shadow': 1,
95+
'no-underscore-dangle': 0,
96+
'no-useless-constructor': 'off',
97+
'@typescript-eslint/await-thenable': 'error',
98+
'@typescript-eslint/unbound-method': ['error', { 'ignoreStatic': true }],
99+
'@typescript-eslint/restrict-template-expressions': 1,
100+
'@typescript-eslint/no-floating-promises': 2,
101+
'@typescript-eslint/no-unsafe-return': 1,
102+
'@typescript-eslint/no-unsafe-member-access': 1,
103+
'@typescript-eslint/no-unsafe-call': 1,
104+
'@typescript-eslint/no-unsafe-assignment': 1,
105+
'@typescript-eslint/no-var-requires': 1,
106+
'@typescript-eslint/no-unsafe-argument': 1,
107+
'@typescript-eslint/no-unused-expressions': 0,
108+
'no-var': 2,
109+
'object-shorthand': ['error', 'properties'],
110+
'prefer-const': ['error', { 'destructuring': 'all' }],
111+
'prefer-template': 2,
112+
'radix': 2,
113+
'no-trailing-spaces': 'error',
114+
'@typescript-eslint/prefer-regexp-exec': 0,
115+
'quotes': [ 'error', 'single'],
116+
'@typescript-eslint/no-unused-vars': [ 'error', { 'vars': 'local', 'args': 'none' }],
117+
'@typescript-eslint/no-explicit-any': 1,
118+
'jsdoc/check-tag-names': 'error',
119+
'jsdoc/check-param-names': ['error', { 'checkDestructured': false }],
120+
'jsdoc/check-alignment': 'error',
121+
'jsdoc/no-multi-asterisks': 'error',
122+
'jsdoc/no-types': 'error',
123+
'jsdoc/require-param-name': 'error',
124+
'jsdoc/require-returns-check': 'error',
125+
'jsdoc/require-returns-description': 'error'
126+
}
127+
},
128+
{
129+
files: ['*.test.ts'],
130+
rules: {
131+
'no-unused-expressions': 'off',
132+
'@typescript-eslint/unbound-method': 'off',
133+
'max-nested-callbacks': 'off',
134+
'@typescript-eslint/no-unsafe-assignment': 'warn',
135+
},
136+
},
137+
{
138+
ignores: [
139+
'node_modules',
140+
'out',
141+
'.yarn',
142+
'__coverage__',
143+
'public/dist',
144+
'*.min.js',
145+
'public/lib',
146+
'Godeps',
147+
'test-resources',
148+
'test/sandbox-registration',
149+
// vendored from https://github.com/IonicaBizau/git-url-parse, see https://github.com/IonicaBizau/git-url-parse/pull/159
150+
'src/util/gitParse.ts'
151+
] // Files or directories to ignore
152+
}
153+
];

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@
5757
"compile:build-production": "node ./build/esbuild.mjs --production",
5858
"watch": "node ./build/esbuild-watch.mjs",
5959
"clean": "shx rm -rf out/build out/src out/webview out/test out/tools out/test-resources out/**.tsbuildinfo",
60-
"lint": "eslint . --ext .ts --ext .tsx --quiet",
61-
"lint-fix": "eslint . --ext .ts --ext .tsx --fix",
62-
"lint-nic": "eslint . --ext .ts --ext .tsx --no-inline-config",
60+
"lint": "eslint . --quiet",
61+
"lint-fix": "eslint . --fix",
62+
"lint-nic": "eslint . --no-inline-config",
6363
"check-cycles": "dpdm --no-tree --no-warning --exit-code circular:1 ./src/extension.ts",
6464
"bundle-tools": "ts-node ./build/bundle-tools.ts --platform",
6565
"todo": "leasot **/*.ts --ignore node_modules -x",

0 commit comments

Comments
 (0)