Skip to content

Commit ab6f2cd

Browse files
committed
refactor(deps): upgraded to the latest eslint and migrated config
1 parent cf659c7 commit ab6f2cd

File tree

6 files changed

+189
-94
lines changed

6 files changed

+189
-94
lines changed

.eslintrc.cjs

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

eslint.config.js

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import eslint from '@eslint/js';
2+
import tseslint from 'typescript-eslint';
3+
import stylistic from '@stylistic/eslint-plugin';
4+
import importPlugin from 'eslint-plugin-import';
5+
import simpleImportSort from 'eslint-plugin-simple-import-sort';
6+
import unusedImports from 'eslint-plugin-unused-imports';
7+
import unicorn from 'eslint-plugin-unicorn';
8+
9+
export default tseslint.config(
10+
// Ignore patterns
11+
{
12+
ignores: ['**/lib/**', 'node_modules/**', 'dist/**', 'target/**', 'test-results/**', 'playwright/.cache', 'playwright-report/**']
13+
},
14+
15+
// Base ESLint recommended config
16+
eslint.configs.recommended,
17+
18+
// TypeScript ESLint recommended configs
19+
...tseslint.configs.recommended,
20+
21+
// Unicorn recommended config
22+
unicorn.configs['flat/recommended'],
23+
24+
// Main configuration
25+
{
26+
files: ['**/*.ts', '**/*.tsx'],
27+
languageOptions: {
28+
parser: tseslint.parser,
29+
parserOptions: {
30+
ecmaVersion: 6,
31+
sourceType: 'module',
32+
project: [
33+
'./tsconfig.eslint.json',
34+
],
35+
},
36+
},
37+
plugins: {
38+
'@typescript-eslint': tseslint.plugin,
39+
'@stylistic': stylistic,
40+
'import': importPlugin,
41+
'simple-import-sort': simpleImportSort,
42+
'unused-imports': unusedImports,
43+
},
44+
rules: {
45+
'simple-import-sort/imports': 'error',
46+
'simple-import-sort/exports': 'error',
47+
'sort-imports': 'off',
48+
'import/order': 'off',
49+
'unused-imports/no-unused-imports': 'error',
50+
51+
'no-multiple-empty-lines': ['warn', {
52+
'max': 1,
53+
}],
54+
55+
'@typescript-eslint/explicit-module-boundary-types': 'off',
56+
57+
// Formatting rules using @stylistic plugin
58+
'@stylistic/indent': ['error', 4, {
59+
'MemberExpression': 'off',
60+
'SwitchCase': 1,
61+
}],
62+
63+
'@stylistic/quotes': ['error', 'single', {
64+
'allowTemplateLiterals': 'always',
65+
'avoidEscape': true,
66+
}],
67+
68+
'@typescript-eslint/no-explicit-any': 'off', // todo: review
69+
70+
'@typescript-eslint/no-unused-vars': ['warn', {
71+
'args': 'none',
72+
'vars': 'all',
73+
'varsIgnorePattern': '^.*_$',
74+
}],
75+
76+
'unicorn/empty-brace-spaces': 'off',
77+
78+
'unicorn/filename-case': [ 'error', {
79+
'cases': {
80+
'kebabCase': true, // packages
81+
'pascalCase': true, // classes
82+
'camelCase': true, // functions
83+
}
84+
}],
85+
86+
'unicorn/no-array-for-each': 'off',
87+
'unicorn/no-array-reduce': 'off',
88+
'unicorn/no-array-callback-reference': 'off',
89+
'unicorn/no-static-only-class': 'off',
90+
91+
'unicorn/numeric-separators-style': 'off',
92+
93+
'unicorn/prefer-module': 'off', // fixme disable when we can provide support for ESM
94+
'unicorn/prefer-node-protocol': 'off', // fixme requires Node 14.13 or newer, disable until we no longer have to support Node 12
95+
'unicorn/prefer-spread': 'off',
96+
97+
'unicorn/prevent-abbreviations': [ 'error', {
98+
'allowList': {
99+
'conf': true,
100+
'wdio': true,
101+
}
102+
}]
103+
}
104+
}
105+
);
106+

package-lock.json

Lines changed: 75 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"test:execute": "playwright test -c playwright-ct.config.ts",
3434
"test:report": "serenity-bdd run --features ./src",
3535
"start": "mkdirp target/site/serenity && npx http-server -p 8080 target/site/serenity -s -o",
36-
"lint": "eslint --ext ts --config .eslintrc.cjs .",
36+
"lint": "eslint .",
3737
"lint:fix": "npm run lint -- --fix"
3838
},
3939
"repository": {
@@ -70,6 +70,7 @@
7070
}
7171
},
7272
"devDependencies": {
73+
"@eslint/js": "^9.39.1",
7374
"@playwright/experimental-ct-react": "1.57.0",
7475
"@serenity-js/assertions": "^3.37.0",
7576
"@serenity-js/console-reporter": "^3.37.0",
@@ -79,9 +80,8 @@
7980
"@serenity-js/rest": "^3.37.0",
8081
"@serenity-js/serenity-bdd": "^3.37.0",
8182
"@serenity-js/web": "^3.37.0",
83+
"@stylistic/eslint-plugin": "^5.6.1",
8284
"@types/node": "^24.10.2",
83-
"@typescript-eslint/eslint-plugin": "^8.49.0",
84-
"@typescript-eslint/parser": "^8.49.0",
8585
"cpy-cli": "^6.0.0",
8686
"eslint": "^9.39.1",
8787
"eslint-plugin-import": "^2.32.0",
@@ -95,7 +95,8 @@
9595
"react-dom": "^19.2.1",
9696
"rimraf": "^6.1.2",
9797
"ts-node": "^10.9.2",
98-
"typescript": "^5.9.3"
98+
"typescript": "^5.9.3",
99+
"typescript-eslint": "^8.49.0"
99100
},
100101
"dependencies": {
101102
"clsx": "^2.1.1"

src/components/Dropdown/Dropdown.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ export function Dropdown({ placeholder, options, allowMultiple, onChange }: Drop
4646
}
4747
}
4848

49-
window.addEventListener('click', handler);
49+
globalThis.addEventListener('click', handler);
5050

5151
return () => {
52-
window.removeEventListener('click', handler);
52+
globalThis.removeEventListener('click', handler);
5353
};
5454
});
5555

tsconfig.eslint.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"include": [
44
"src/**/*.ts",
55
"src/**/*.tsx",
6+
"playwright/index.tsx",
67
"playwright-ct.config.ts"
78
],
89
"exclude": [

0 commit comments

Comments
 (0)