Skip to content

Commit f16c8f8

Browse files
committed
chore: migrate to ESLint flat config and update tooling
Replace legacy .eslintrc.js and .eslintignore with eslint.config.mjs flat config. Update husky, prettier, stylelint, postcss configs and dependencies.
1 parent 6a116f6 commit f16c8f8

11 files changed

Lines changed: 2099 additions & 2310 deletions

.eslintignore

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

.eslintrc.js

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

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx --no -- commitlint --edit $1

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

.npmignore

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,20 @@ design
66
test
77
docs
88
jest.config.js
9-
webpack.config.js
9+
tsdown.config.ts
1010
site
1111
.idea
12-
.travis.yml
13-
.babelrc
1412
.prettierignore
1513
.prettierrc
1614
.commitlintrc.js
1715
.cz-config.js
18-
.eslintrc.js
16+
.eslintignore
17+
eslint.config.mjs
1918
.versionrc.js
2019
postcss.config.js
2120
tsconfig.json
21+
tsconfig.test.json
22+
test-setup.js
2223
.DS_Store
2324
*.iml
25+
.husky

.prettierrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
"semi": true,
66
"singleQuote": true,
77
"bracketSpacing": true,
8-
"jsxBracketSameLine": true,
9-
"alwaysParens": "always"
8+
"bracketSameLine": true,
9+
"arrowParens": "always"
1010
}

.stylelintrc

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
{
2-
"extends": "stylelint-config-standard",
2+
"extends": "stylelint-config-standard-scss",
33
"rules": {
4-
"at-rule-no-unknown": [
5-
true,
6-
{
7-
"ignoreAtRules": [
8-
"function",
9-
"if",
10-
"each",
11-
"include",
12-
"mixin",
13-
"for",
14-
"extend"
15-
]
16-
}
17-
]
4+
"scss/at-rule-no-unknown": true
185
}
196
}

eslint.config.mjs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import eslint from '@eslint/js';
2+
import tseslint from 'typescript-eslint';
3+
import reactPlugin from 'eslint-plugin-react';
4+
import reactHooksPlugin from 'eslint-plugin-react-hooks';
5+
import jestPlugin from 'eslint-plugin-jest';
6+
import jestDomPlugin from 'eslint-plugin-jest-dom';
7+
8+
export default tseslint.config(
9+
{
10+
ignores: ['dist/', 'es/', 'lib/', 'node_modules/', 'site/build/'],
11+
},
12+
eslint.configs.recommended,
13+
...tseslint.configs.recommended,
14+
{
15+
files: ['components/**/*.{ts,tsx}'],
16+
plugins: {
17+
react: reactPlugin,
18+
'react-hooks': reactHooksPlugin,
19+
},
20+
settings: {
21+
react: { version: 'detect' },
22+
},
23+
rules: {
24+
semi: ['error', 'always'],
25+
'react-hooks/rules-of-hooks': 'error',
26+
'react-hooks/exhaustive-deps': 'warn',
27+
'@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePattern: '^React$' }],
28+
'@typescript-eslint/no-explicit-any': 'off',
29+
'@typescript-eslint/no-unused-expressions': 'off',
30+
'@typescript-eslint/no-empty-function': 'off',
31+
'react/prop-types': 'off',
32+
'react/react-in-jsx-scope': 'off',
33+
},
34+
},
35+
{
36+
files: ['components/**/*.test.{ts,tsx}'],
37+
plugins: {
38+
jest: jestPlugin,
39+
'jest-dom': jestDomPlugin,
40+
},
41+
rules: {
42+
...jestPlugin.configs.recommended.rules,
43+
...jestDomPlugin.configs.recommended.rules,
44+
'jest/no-conditional-expect': 'off',
45+
},
46+
},
47+
{
48+
files: ['**/*.js'],
49+
rules: {
50+
'@typescript-eslint/no-require-imports': 'off',
51+
},
52+
},
53+
);

0 commit comments

Comments
 (0)