Skip to content

Commit 3328fb5

Browse files
committed
adapt to eslint 9
1 parent 3827635 commit 3328fb5

File tree

10 files changed

+1050
-774
lines changed

10 files changed

+1050
-774
lines changed

.eslintignore

Lines changed: 0 additions & 23 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 57 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

buildutils/src/develop.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ commander
4545
try {
4646
fs.removeSync(destDir);
4747
console.log('Removed previous destination:', destDir);
48-
} catch (e) {
48+
} catch {
4949
console.info('Skip unlink', destDir);
5050
}
5151
}

eslint.config.mjs

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import js from '@eslint/js';
2+
import { defineConfig } from 'eslint/config';
3+
import tseslint from 'typescript-eslint';
4+
import prettierConfig from 'eslint-config-prettier';
5+
import prettierPlugin from 'eslint-plugin-prettier';
6+
import jestPlugin from 'eslint-plugin-jest';
7+
import reactPlugin from 'eslint-plugin-react';
8+
import globals from 'globals';
9+
10+
export default defineConfig([
11+
// Global ignores (replaces .eslintignore)
12+
{
13+
ignores: [
14+
'node_modules/**',
15+
'**/build/**',
16+
'**/lib/**',
17+
'**/node_modules/**',
18+
'**/mock_packages/**',
19+
'**/static/**',
20+
'**/typings/**',
21+
'**/schemas/**',
22+
'**/themes/**',
23+
'coverage/**',
24+
'**/*.map.js',
25+
'**/*.bundle.js',
26+
'app/index.template.js',
27+
'.idea/**',
28+
'.history/**',
29+
'.vscode/**',
30+
'.pixi/**',
31+
'.venv/**',
32+
'docs/**',
33+
'**/*.js',
34+
],
35+
},
36+
// Base recommended configs
37+
js.configs.recommended,
38+
tseslint.configs.recommended,
39+
// Main config for TypeScript files
40+
{
41+
files: ['**/*.{ts,tsx}'],
42+
plugins: {
43+
prettier: prettierPlugin,
44+
jest: jestPlugin,
45+
react: reactPlugin,
46+
},
47+
languageOptions: {
48+
globals: {
49+
...globals.browser,
50+
...globals.es2015,
51+
...globals.commonjs,
52+
...globals.node,
53+
...globals.jest,
54+
},
55+
parserOptions: {
56+
project: 'tsconfig.eslint.json',
57+
},
58+
},
59+
settings: {
60+
react: {
61+
version: 'detect',
62+
},
63+
},
64+
rules: {
65+
'@typescript-eslint/naming-convention': [
66+
'error',
67+
{
68+
selector: 'interface',
69+
format: ['PascalCase'],
70+
custom: {
71+
regex: '^I[A-Z]',
72+
match: true,
73+
},
74+
},
75+
],
76+
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
77+
'@typescript-eslint/no-explicit-any': 'off',
78+
'@typescript-eslint/no-namespace': 'off',
79+
'@typescript-eslint/no-require-imports': 'off',
80+
'@typescript-eslint/no-use-before-define': 'off',
81+
'@typescript-eslint/no-empty-object-type': 'off',
82+
'jest/no-done-callback': 'off',
83+
curly: ['error', 'all'],
84+
eqeqeq: 'error',
85+
'prefer-arrow-callback': 'error',
86+
},
87+
},
88+
// Prettier must be last
89+
prettierConfig,
90+
]);

package.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"clean": "lerna run clean",
2929
"deduplicate": "jlpm dlx yarn-berry-deduplicate -s fewerHighest && jlpm install",
3030
"develop": "jupyter labextension develop . --overwrite && node ./buildutils/lib/develop.js --overwrite",
31-
"eslint": "eslint . --ext .ts,.tsx --fix",
32-
"eslint:check": "eslint . --ext .ts,.tsx",
31+
"eslint": "eslint . --fix",
32+
"eslint:check": "eslint .",
3333
"eslint:files": "eslint --fix",
3434
"get:lab:version": "node ./buildutils/lib/get-latest-lab-version.js",
3535
"integrity": "node buildutils/lib/ensure-repo.js",
@@ -51,20 +51,21 @@
5151
"yjs": "^13.5.40"
5252
},
5353
"devDependencies": {
54+
"@eslint/js": "^9.26.0",
5455
"@jupyterlab/buildutils": "~4.6.0-alpha.2",
55-
"@typescript-eslint/eslint-plugin": "^5.55.0",
56-
"@typescript-eslint/parser": "^5.55.0",
5756
"eslint": "^9.26.0",
58-
"eslint-config-prettier": "^8.7.0",
59-
"eslint-plugin-jest": "^27.2.1",
60-
"eslint-plugin-prettier": "^4.2.1",
61-
"eslint-plugin-react": "^7.32.2",
57+
"eslint-config-prettier": "^10.0.0",
58+
"eslint-plugin-jest": "^28.0.0",
59+
"eslint-plugin-prettier": "^5.0.0",
60+
"eslint-plugin-react": "^7.37.0",
61+
"globals": "^16.0.0",
6262
"html-webpack-plugin": "^5.6.3",
6363
"lerna": "^7.1.4",
6464
"npm-run-all": "^4.1.5",
6565
"prettier": "^2.8.5",
6666
"rimraf": "^3.0.2",
67-
"typescript": "~5.5.4"
67+
"typescript": "~5.5.4",
68+
"typescript-eslint": "^8.0.0"
6869
},
6970
"nx": {}
7071
}

packages/lab-extension/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@ const interfaceSwitcher: JupyterFrontEndPlugin<void> = {
155155

156156
commands.addCommand(command, {
157157
label: (args) => {
158-
args.noLabel ? '' : commandLabel;
158+
if (args.noLabel) {
159+
return '';
160+
}
159161
if (args.isMenu || args.isPalette) {
160162
return commandDescription;
161163
}

tsconfig.eslint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"buildutils/**/*",
77
"ui-tests/**/*",
88
"docs/**/*",
9-
".eslintrc.js"
9+
"eslint.config.mjs"
1010
],
1111
"compilerOptions": {
1212
"types": ["jest"]

ui-tests/test/smoke.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test.describe('Smoke', () => {
3636
try {
3737
// we may have to select the kernel first
3838
await notebook.click('text="Select"', { timeout: 5000 });
39-
} catch (e) {
39+
} catch {
4040
// The kernel is already selected
4141
}
4242

0 commit comments

Comments
 (0)