-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
79 lines (78 loc) · 2.5 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
import { fixupPluginRules } from '@eslint/compat';
import eslint from '@eslint/js';
import queryPlugin from '@tanstack/eslint-plugin-query';
import prettierPlugin from 'eslint-config-prettier';
import cypressPlugin from 'eslint-plugin-cypress/flat';
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
import noOnlyTestsPlugin from 'eslint-plugin-no-only-tests';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import reactTestingLibraryPlugin from 'eslint-plugin-testing-library';
import globals from 'globals';
import tseslint from 'typescript-eslint';
export default tseslint.config(
{
files: ['**/*.{js,ts,jsx,tsx}'],
languageOptions: {
sourceType: 'module',
ecmaVersion: 2015,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
globals: {
...globals.browser,
},
},
settings: {
react: {
version: 'detect',
},
},
plugins: {
react: reactPlugin,
// eslint-plugin-react-hooks doesn't support flat config properly yet
// https://github.com/facebook/react/issues/28313
'react-hooks': fixupPluginRules(reactHooksPlugin),
'@tanstack/query': queryPlugin,
'no-only-tests': noOnlyTestsPlugin,
'jsx-a11y': jsxA11yPlugin,
},
extends: [
eslint.configs.recommended,
...tseslint.configs.recommended,
cypressPlugin.configs.recommended,
// See https://github.com/prettier/eslint-config-prettier put last
prettierPlugin,
],
rules: {
// Emulate typescript style for unused variables, see
// https://typescript-eslint.io/rules/no-unused-vars/
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
...reactPlugin.configs.recommended.rules,
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
...reactHooksPlugin.configs.recommended.rules,
...queryPlugin.configs.recommended.rules,
'no-only-tests/no-only-tests': 'error',
...jsxA11yPlugin.configs.recommended.rules,
},
},
{
files: ['**/?*test.{js,ts,jsx,tsx}'],
plugins: reactTestingLibraryPlugin.configs['flat/react'].plugins,
rules: reactTestingLibraryPlugin.configs['flat/react'].rules,
}
);