-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheslint.config.js
108 lines (103 loc) · 3.06 KB
/
eslint.config.js
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
99
100
101
102
103
104
105
106
107
108
import eslint from '@eslint/js';
import globals from 'globals';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import tseslint from 'typescript-eslint';
import eslintPluginReact from 'eslint-plugin-react';
import importPlugin from 'eslint-plugin-import';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import unusedImports from 'eslint-plugin-unused-imports';
export default tseslint.config(
{ ignores: ['dist', 'node_modules', 'stories'] },
{
extends: [
eslint.configs.recommended,
eslintPluginPrettierRecommended,
...tseslint.configs.recommended,
importPlugin.flatConfigs.recommended,
eslintPluginReact.configs.flat.recommended,
jsxA11y.flatConfigs.recommended,
],
files: ['**/*.{ts,tsx}'],
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
globals: {
...globals.browser,
},
},
plugins: {
react: eslintPluginReact,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
'unused-imports': unusedImports,
},
rules: {
indent: ['error', 2],
'no-console': ['warn', { allow: ['warn', 'error'] }],
camelcase: ['error', { properties: 'always' }],
'space-infix-ops': ['warn'],
'func-style': ['error', 'expression'],
'react/require-default-props': 'off',
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'react/jsx-pascal-case': 'warn',
'react/no-unknown-property': ['error', { ignore: ['css'] }],
'react/function-component-definition': [
'error',
{
namedComponents: 'arrow-function',
},
],
'react-hooks/rules-of-hooks': 'error',
'react-refresh/only-export-components': [
'warn',
{
allowConstantExport: true,
},
],
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'import/no-unresolved': 'off',
'import/order': [
'error',
{
groups: ['builtin', 'external', ['parent', 'sibling'], 'index'],
pathGroups: [
{
pattern: 'react*',
group: 'builtin',
position: 'before',
},
{
pattern: '@/*',
group: 'internal',
position: 'after',
},
],
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
'newlines-between': 'always',
},
],
'unused-imports/no-unused-imports': 'error',
'import/prefer-default-export': 'error',
...eslintPluginReact.configs.flat.recommended.rules,
...reactHooks.configs.recommended.rules,
'react/jsx-uses-vars': 'error',
'react/react-in-jsx-scope': 'off',
'react/no-unescaped-entities': 'off',
},
settings: {
react: {
version: 'detect',
},
},
},
);