Skip to content

Commit 22f13d6

Browse files
migrate to ESLint 9 with flat config and add unicorn plugin
- Upgrade from ESLint 8 to ESLint 9 with new flat config format - Remove @tstt/eslint-config dependency - Add eslint-plugin-unicorn for additional code quality rules - Upgrade Prettier to v3 and convert config to JSON format - Add .prettierignore to exclude build directories - Remove deprecated .eslintignore (now using ignores in flat config) - Configure proper TypeScript support with @typescript-eslint v8 - Update lint script to work with ESLint 9
1 parent 3addbf2 commit 22f13d6

7 files changed

Lines changed: 1640 additions & 702 deletions

File tree

.eslintignore

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

.prettierignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules/
2+
extension/
3+
devapp-3.4/
4+
.yarn/
5+
webpack/
6+
*.lock
7+
yarn.lock
8+
package-lock.json

.prettierrc.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

.prettierrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"plugins": ["prettier-plugin-tailwindcss"],
3+
"semi": false,
4+
"trailingComma": "all",
5+
"singleQuote": true,
6+
"printWidth": 80,
7+
"tabWidth": 2,
8+
"bracketSpacing": true,
9+
"jsxSingleQuote": true,
10+
"arrowParens": "avoid"
11+
}

eslint.config.mjs

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
import js from '@eslint/js'
2+
import typescript from '@typescript-eslint/eslint-plugin'
3+
import typescriptParser from '@typescript-eslint/parser'
4+
import react from 'eslint-plugin-react'
5+
import reactHooks from 'eslint-plugin-react-hooks'
6+
import prettier from 'eslint-plugin-prettier'
7+
import unicorn from 'eslint-plugin-unicorn'
8+
import globals from 'globals'
9+
10+
export default [
11+
{
12+
ignores: [
13+
'node_modules/**',
14+
'extension/**',
15+
'devapp-*/**',
16+
'.yarn/**',
17+
'webpack/**',
18+
],
19+
},
20+
// Base config for all files
21+
{
22+
files: ['**/*.{js,jsx,mjs,cjs}'],
23+
plugins: {
24+
react,
25+
'react-hooks': reactHooks,
26+
prettier,
27+
unicorn,
28+
},
29+
languageOptions: {
30+
ecmaVersion: 2020,
31+
sourceType: 'module',
32+
parser: typescriptParser,
33+
parserOptions: {
34+
ecmaFeatures: {
35+
jsx: true,
36+
},
37+
},
38+
globals: {
39+
...globals.browser,
40+
...globals.node,
41+
...globals.mocha,
42+
Meteor: 'readonly',
43+
Helene: 'readonly',
44+
},
45+
},
46+
settings: {
47+
react: {
48+
version: 'detect',
49+
},
50+
},
51+
rules: {
52+
...js.configs.recommended.rules,
53+
...react.configs.recommended.rules,
54+
...unicorn.configs.recommended.rules,
55+
'no-console': 0,
56+
'react/prop-types': 0,
57+
'react/jsx-curly-spacing': 0,
58+
'react/display-name': 0,
59+
'react-hooks/rules-of-hooks': 'error',
60+
'react-hooks/exhaustive-deps': 0,
61+
'no-inner-declarations': 0,
62+
'react/no-unescaped-entities': 0,
63+
'react/react-in-jsx-scope': 0,
64+
// Unicorn adjustments for this project
65+
'unicorn/prevent-abbreviations': 0,
66+
'unicorn/filename-case': 0,
67+
'unicorn/no-null': 0,
68+
'unicorn/prefer-module': 0,
69+
'unicorn/prefer-node-protocol': 0,
70+
'prettier/prettier': 'error',
71+
},
72+
},
73+
// TypeScript specific config
74+
{
75+
files: ['**/*.{ts,tsx}'],
76+
plugins: {
77+
'@typescript-eslint': typescript,
78+
react,
79+
'react-hooks': reactHooks,
80+
prettier,
81+
unicorn,
82+
},
83+
languageOptions: {
84+
ecmaVersion: 2020,
85+
sourceType: 'module',
86+
parser: typescriptParser,
87+
parserOptions: {
88+
ecmaFeatures: {
89+
jsx: true,
90+
},
91+
},
92+
globals: {
93+
...globals.browser,
94+
...globals.node,
95+
...globals.mocha,
96+
Meteor: 'readonly',
97+
Helene: 'readonly',
98+
},
99+
},
100+
settings: {
101+
react: {
102+
version: 'detect',
103+
},
104+
},
105+
rules: {
106+
...js.configs.recommended.rules,
107+
...typescript.configs.recommended.rules,
108+
...react.configs.recommended.rules,
109+
...unicorn.configs.recommended.rules,
110+
'no-console': 0,
111+
'react/prop-types': 0,
112+
'react/jsx-curly-spacing': 0,
113+
'react/display-name': 0,
114+
'react-hooks/rules-of-hooks': 'error',
115+
'react-hooks/exhaustive-deps': 0,
116+
'no-inner-declarations': 0,
117+
'react/no-unescaped-entities': 0,
118+
'react/react-in-jsx-scope': 0,
119+
'@typescript-eslint/no-non-null-assertion': 0,
120+
'@typescript-eslint/no-explicit-any': 0,
121+
'@typescript-eslint/no-empty-interface': 0,
122+
'@typescript-eslint/explicit-module-boundary-types': 0,
123+
'@typescript-eslint/no-unused-vars': 0,
124+
'@typescript-eslint/no-this-alias': 0,
125+
'@typescript-eslint/ban-ts-comment': 0,
126+
'@typescript-eslint/no-namespace': 0,
127+
'no-undef': 0, // TypeScript handles this
128+
// Unicorn adjustments for this project
129+
'unicorn/prevent-abbreviations': 0,
130+
'unicorn/filename-case': 0,
131+
'unicorn/no-null': 0,
132+
'unicorn/prefer-module': 0,
133+
'unicorn/prefer-node-protocol': 0,
134+
'prettier/prettier': 'error',
135+
},
136+
},
137+
]

package.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"open:firefox": "yarn wait:firefox && web-ext run --start-url \"http://localhost:2100\" --source-dir ./extension/firefox/ --browser-console",
2323
"open:chrome": "yarn wait:chrome && web-ext run -t chromium --start-url \"http://localhost:2100\" --source-dir ./extension/chrome/ --browser-console",
2424
"clean": "rimraf extension/firefox extension/chrome",
25-
"lint": "eslint ./src --ext .js,.jsx,.ts,.tsx --cache .",
25+
"lint": "eslint .",
2626
"audit": "yarn audit --all --recursive --severity high"
2727
},
2828
"author": "Leonardo Venturini",
@@ -35,7 +35,6 @@
3535
"@blueprintjs/icons": "4.12.1",
3636
"@blueprintjs/popover2": "^1.11.1",
3737
"@heroicons/react": "^2.0.13",
38-
"@tstt/eslint-config": "^0.1.4",
3938
"@types/chrome": "0.0.178",
4039
"@types/classnames": "^2.2.10",
4140
"@types/luxon": "^2.0.5",
@@ -110,11 +109,21 @@
110109
"ws": "^8.17.1"
111110
},
112111
"devDependencies": {
112+
"@eslint/js": "^9.0.0",
113113
"@types/webextension-polyfill": "^0.9.0",
114+
"@typescript-eslint/eslint-plugin": "^8.0.0",
115+
"@typescript-eslint/parser": "^8.0.0",
114116
"concurrently": "^7.2.2",
115117
"copy-webpack-plugin": "^11.0.0",
116-
"eslint": "8.31.0",
118+
"eslint": "^9.0.0",
119+
"eslint-plugin-prettier": "^5.0.0",
120+
"eslint-plugin-react": "^7.37.0",
121+
"eslint-plugin-react-hooks": "^5.0.0",
122+
"eslint-plugin-unicorn": "^56.0.0",
123+
"globals": "^15.0.0",
117124
"npm-run-all": "^4.1.5",
125+
"prettier": "^3.0.0",
126+
"prettier-plugin-tailwindcss": "^0.6.0",
118127
"wait-on": "^6.0.1",
119128
"web-ext": "^7.1.0",
120129
"webextension-polyfill": "^0.9.0"

0 commit comments

Comments
 (0)