-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
103 lines (103 loc) · 3.16 KB
/
.eslintrc.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
/** @type {import('eslint').Linter.Config} */
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
parser: '@babel/eslint-parser',
parserOptions: {
requireConfigFile: false,
ecmaFeatures: {
jsx: true,
},
project: ['./tsconfig.json'],
},
settings: {
'react': { version: 'detect' },
'import/parsers': {
[require.resolve('@typescript-eslint/parser')]: ['.ts', '.mts', '.cts', '.tsx', '.d.ts'],
},
'import/resolver': {
[require.resolve('eslint-import-resolver-node')]: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
[require.resolve('eslint-import-resolver-typescript')]: {
alwaysTryTypes: true,
},
},
},
reportUnusedDisableDirectives: true,
plugins: ['react', 'simple-import-sort', 'unused-imports', '@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:react/recommended',
'airbnb',
'airbnb/hooks',
'plugin:react/jsx-runtime',
'prettier',
],
rules: {
'react/jsx-filename-extension': ['error', { extensions: ['.tsx'] }],
'import/prefer-default-export': 'off',
'react/function-component-definition': [
'error',
{ namedComponents: 'function-declaration', unnamedComponents: 'arrow-function' },
],
'import/extensions': [
'error',
'always',
{ js: 'never', jsx: 'never', ts: 'never', tsx: 'never' },
],
'react/require-default-props': 'off',
'no-use-before-define': ['error', { functions: false }],
'no-useless-return': 'off',
'react/no-danger': 'error',
'func-names': ['error', 'always'],
'no-param-reassign': 'error',
'react/destructuring-assignment': 'off',
'dot-notation': 'error',
'react/jsx-props-no-spreading': 'off',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'off',
'import/order': 'off', // Conflict with 'simple-import-sort/imports
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
'unused-imports/no-unused-imports': 'error',
'no-console': 'error',
'react/no-unused-prop-types': 'off',
'jsx-a11y/label-has-associated-control': ['error', { assert: 'either' }],
'no-restricted-syntax': 'off',
'prefer-destructuring': ['error', { enforceForRenamedProperties: false }],
},
overrides: [
{
files: ['**/*.ts?(x)'],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaFeatures: { jsx: true },
},
plugins: ['@typescript-eslint'],
extends: ['plugin:@typescript-eslint/recommended'],
rules: {
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-use-before-define': ['error', { functions: false }],
'@typescript-eslint/consistent-type-imports': [
'error',
{ fixStyle: 'inline-type-imports' },
],
'@typescript-eslint/dot-notation': 'error',
'no-use-before-define': 'off',
'dot-notation': 'off',
},
},
{
files: ['.*rc.{js,ts}', '*.config.{js,ts}', '**/*.d.ts'],
rules: {
'import/no-extraneous-dependencies': 'off',
},
},
],
};