-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
101 lines (97 loc) · 3.01 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
module.exports = {
env: {
browser: true,
es6: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: { jsx: true },
ecmaVersion: 2020,
project: ['./tsconfig.json'],
sourceType: 'module',
},
plugins: [
'@typescript-eslint',
'jsx-a11y',
'react-hooks',
'react',
'prettier',
],
rules: {
// TypeScript specific rules
'@typescript-eslint/consistent-type-assertions': 'warn',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-array-constructor': 'warn',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-redeclare': 'warn',
'@typescript-eslint/no-use-before-define': [
'warn',
{ functions: false, classes: false, variables: false, typedefs: false },
],
'@typescript-eslint/no-unused-expressions': [
'error',
{
allowShortCircuit: true,
allowTernary: true,
allowTaggedTemplates: true,
},
],
'@typescript-eslint/no-unused-vars': [
'warn',
{ args: 'none', ignoreRestSiblings: true },
],
'@typescript-eslint/no-useless-constructor': 'warn',
'@typescript-eslint/no-var-requires': 'off',
// Base rules
'max-len': ['warn', { code: 80, ignorePattern: '//', ignoreStrings: true }],
'new-cap': ['warn', { properties: false }],
'no-array-constructor': 'off',
'no-redeclare': 'off',
'no-use-before-define': 'off',
'no-unused-expressions': 'off',
'no-unused-vars': 'off',
'no-useless-constructor': 'off',
// A11y rules
'jsx-a11y/alt-text': 'warn',
'jsx-a11y/anchor-has-content': 'warn',
'jsx-a11y/anchor-is-valid': [
'warn',
{ aspects: ['noHref', 'invalidHref'] },
],
'jsx-a11y/aria-activedescendant-has-tabindex': 'warn',
'jsx-a11y/aria-props': 'warn',
'jsx-a11y/aria-proptypes': 'warn',
'jsx-a11y/aria-role': ['warn', { ignoreNonDOM: true }],
'jsx-a11y/aria-unsupported-elements': 'warn',
'jsx-a11y/heading-has-content': 'warn',
'jsx-a11y/iframe-has-title': 'warn',
'jsx-a11y/img-redundant-alt': 'warn',
'jsx-a11y/no-access-key': 'warn',
'jsx-a11y/no-distracting-elements': 'warn',
'jsx-a11y/no-redundant-roles': 'warn',
'jsx-a11y/role-has-required-aria-props': 'warn',
'jsx-a11y/role-supports-aria-props': 'warn',
'jsx-a11y/scope': 'warn',
// React rules
'react/jsx-filename-extension': [
'warn',
{ extensions: ['.jsx', '.mdx', '.tsx'] },
],
'react/no-unescaped-entities': 'off',
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
// React Hooks rules
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
},
settings: { react: { version: 'detect' } },
};