-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy patheslint.config.js
72 lines (71 loc) · 2.37 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
import eslint from '@eslint/js';
import prettier from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import';
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
import reactPlugin from 'eslint-plugin-react';
import hooksPlugin from 'eslint-plugin-react-hooks';
import ymlPlugin from 'eslint-plugin-yml';
import globals from 'globals';
import ts from 'typescript-eslint';
export default ts.config(
{ ignores: ['coverage', 'lib', 'react-children-utilities.*', '_site'] },
eslint.configs.all,
reactPlugin.configs.flat.recommended,
reactPlugin.configs.flat['jsx-runtime'],
importPlugin.flatConfigs.recommended,
importPlugin.configs.typescript,
...ymlPlugin.configs['flat/recommended'],
...ymlPlugin.configs['flat/prettier'],
{
files: ['**/*.{js,jsx,ts,tsx}'],
languageOptions: {
ecmaVersion: 'latest',
globals: { ...globals.browser },
parserOptions: { ecmaFeatures: { jsx: true }, project: 'tsconfig.json' },
sourceType: 'module',
},
plugins: {
'jsx-a11y': jsxA11yPlugin,
'react-hooks': hooksPlugin,
},
rules: {
...hooksPlugin.configs.recommended.rules,
'import/no-unresolved': 'off',
'max-lines': ['error', { max: 130, skipBlankLines: true, skipComments: true }],
'max-lines-per-function': ['error', { max: 24, skipBlankLines: true, skipComments: true }],
'no-ternary': 'off',
'no-useless-assignment': 'off',
'one-var': 'off',
'sort-imports': 'off',
},
settings: {
'import/resolver': { typescript: {} },
react: { version: 'detect' },
},
},
{
// eslint-disable-next-line import/no-named-as-default-member
extends: [...ts.configs.all],
files: ['**/*.ts', '**/*.tsx'],
rules: {
// eslint-disable-next-line no-magic-numbers
'@typescript-eslint/no-magic-numbers': ['error', { ignore: [0, 1] }],
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
},
},
{
files: ['**/*.test.*'],
rules: {
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-deprecated': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-magic-numbers': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'max-lines': 'off',
'max-lines-per-function': 'off',
'max-statements': 'off',
'no-undefined': 'off',
},
},
prettier,
);