-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
122 lines (110 loc) · 2.74 KB
/
eslint.config.mjs
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import comments from '@eslint-community/eslint-plugin-eslint-comments/configs';
import eslintConfigPrettier from 'eslint-config-prettier';
import globals from 'globals';
import jest from 'eslint-plugin-jest';
import jestDom from 'eslint-plugin-jest-dom';
import js from '@eslint/js';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import reactPlugin from 'eslint-plugin-react';
import testingLibrary from 'eslint-plugin-testing-library';
import tseslint from 'typescript-eslint';
export default tseslint.config(
{
files: [
'**/*.js',
'**/*.jsx',
'**/*.ts',
'**/*.tsx',
'**/*.mjs',
'**/*.cjs',
],
},
{
ignores: ['node_modules', 'dist'],
},
js.configs.recommended,
...tseslint.configs.recommended,
reactPlugin.configs.flat.recommended,
reactPlugin.configs.flat['jsx-runtime'],
jsxA11y.flatConfigs.recommended,
{
plugins: {
'react-hooks': reactHooksPlugin,
},
rules: reactHooksPlugin.configs.recommended.rules,
},
comments.recommended,
eslintConfigPrettier,
{
languageOptions: {
globals: {
...globals.browser,
process: false,
},
ecmaVersion: 'latest',
sourceType: 'module',
},
settings: {
react: {
version: 'detect',
},
},
rules: {
'@eslint-community/eslint-comments/no-unused-disable': 'error',
'@eslint-community/eslint-comments/disable-enable-pair': [
'error',
{
allowWholeFile: true,
},
],
'@typescript-eslint/no-explicit-any': 'off',
'react/jsx-uses-react': 'error',
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
},
},
{
files: [
'**/*.test.{js,jsx}',
'src/spec_helpers/*.js',
'src/__*__.{js,jsx}',
],
plugins: {
jest,
'jest-dom': jestDom,
'testing-library': testingLibrary,
},
languageOptions: {
globals: {
...globals.jest,
require: false,
},
},
rules: {
...jest.configs['flat/recommended'].rules,
...jestDom.configs['flat/recommended'].rules,
...testingLibrary.configs['flat/react'].rules,
'import/no-extraneous-dependencies': 'off',
'react/display-name': 'off',
'react/jsx-no-bind': 'off',
'react/prop-types': 'off',
'jest/expect-expect': 'off',
'jest/no-standalone-expect': 'off',
'testing-library/no-node-access': 'off',
},
},
{
files: ['examples/**/*'],
rules: {
'import/no-extraneous-dependencies': 'off',
'react/prop-types': 'off',
},
},
{
files: ['eslint.config.mjs', 'jest.config.mjs'],
rules: {
'import/no-default-export': 'off',
},
},
);