-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
98 lines (90 loc) · 2.64 KB
/
eslint.config.js
File metadata and controls
98 lines (90 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import { fixupConfigRules } from '@eslint/compat';
import { FlatCompat } from '@eslint/eslintrc';
import js from '@eslint/js';
import reactDom from 'eslint-plugin-react-dom';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import reactX from 'eslint-plugin-react-x';
import globals from 'globals';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import tseslint from 'typescript-eslint';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default tseslint.config(
{
ignores: ['**/node_modules', '**/dist'],
},
...fixupConfigRules(compat.extends(
'airbnb-base',
// 'eslint:recommended',
'plugin:import/typescript',
// 'plugin:react/recommended',
// 'plugin:react/jsx-runtime',
// 'plugin:react-hooks/recommended',
)),
{
extends: [
js.configs.recommended,
...tseslint.configs.recommended,
// ...tseslint.configs.recommendedTypeChecked,
// ...tseslint.configs.stylisticTypeChecked,
],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2023,
globals: globals.browser,
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
settings: {
react: {
version: 'detect',
},
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: true,
node: true,
},
},
plugins: {
'react-x': reactX,
'react-dom': reactDom,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactX.configs['recommended-typescript'].rules,
...reactDom.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
indent: ['error', 2],
'no-continue': ['warn'],
'no-console': ['error'],
'class-methods-use-this': ['warn'],
'import/no-cycle': ['warn'],
'import/prefer-default-export': ['warn'],
'import/extensions': ['error', 'ignorePackages'],
'react-refresh/only-export-components': ['warn', {
allowConstantExport: true,
}],
'no-plusplus': 'off',
'no-await-in-loop': 'off',
'no-use-before-define': 'off',
'react/prop-types': 'off',
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
);