-
Notifications
You must be signed in to change notification settings - Fork 394
/
.eslintrc.js
147 lines (145 loc) · 4.23 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
const path = require('path');
const commonRules = {
'no-mixed-operators': [
'error',
{
allowSamePrecedence: true,
},
],
'no-shadow': 1,
'jsx-a11y/anchor-is-valid': [
'warn',
{
components: ['Link'],
specialLink: ['to'],
},
],
'react/no-array-index-key': 1,
'react/require-default-props': 0,
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: ['.storybook/**', 'src/stories/**'],
},
],
'react/sort-comp': [2],
'react/jsx-indent': 'off',
'react/jsx-fragments': 'off',
'react/jsx-curly-newline': 'off',
'react/forbid-prop-types': 'off',
'react/static-property-placement': 'off',
'react/jsx-props-no-spreading': 'off',
'react/destructuring-assignment': 'off',
'react/prop-types': 'off',
'react/no-access-state-in-setstate': 'off',
'react/button-has-type': 'off',
'react/function-component-definition': 'off',
'react/default-props-match-prop-types': 'off',
'max-classes-per-file': 'off',
'import/no-cycle': 'off',
camelcase: 'off',
'default-param-last': 'off',
'no-restricted-exports': 'off',
'default-case-last': 'off',
'react/no-unused-class-component-methods': 'warn',
'react/no-unstable-nested-components': 'warn',
'react/no-unused-prop-types': 'warn',
radix: 'warn',
'no-use-before-define': 'warn',
'no-unused-vars': 'warn',
'no-unused-expressions': 'warn',
'no-param-reassign': 'warn',
'prefer-template': 'warn',
};
module.exports = {
parser: '@babel/eslint-parser',
env: {
browser: true,
jest: true,
},
settings: {
'import/resolver': {
node: {
paths: [path.resolve(__dirname, './src')],
},
},
},
extends: ['airbnb', 'prettier'],
rules: {
...commonRules,
'import/named': ['error'],
'react/state-in-constructor': 'off',
'react/destructuring-assignment': 'off',
'react/prop-types': 'off',
'react/no-access-state-in-setstate': 'off',
'react/button-has-type': 'off',
'max-classes-per-file': 'off',
'import/no-cycle': 'off',
'arrow-parens': 'off',
'operator-linebreak': 'off',
'react/jsx-wrap-multilines': 'off',
'react/jsx-one-expression-per-line': 'off',
'object-curly-newline': 'off',
'no-else-return': 'off',
'implicit-arrow-linebreak': 'off',
'prefer-object-spread': 'off',
'lines-between-class-members': 'off',
'react/jsx-tag-spacing': 'off',
'import/no-useless-path-segments': 'off',
'no-dupe-class-members': 'off',
},
overrides: [
{
files: ['./src/**/*.ts', './src/**/*.tsx'],
env: { browser: true, jest: true },
extends: [
'airbnb',
'plugin:import/typescript',
'plugin:@typescript-eslint/recommended',
'prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: { jsx: true },
sourceType: 'module',
project: './tsconfig.json',
},
plugins: ['react', '@typescript-eslint'],
rules: {
...commonRules,
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/no-inferrable-types': [
'error',
{ ignoreProperties: true, ignoreParameters: false },
],
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'interface',
format: ['PascalCase'],
custom: {
regex: '^I[A-Z]',
match: true,
},
},
],
'@typescript-eslint/explicit-function-return-type': 'off',
'no-useless-constructor': 'off',
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'react/jsx-filename-extension': [1, { extensions: ['.ts', '.tsx'] }],
'import/prefer-default-export': 'off',
'react/state-in-constructor': 'off',
'import/extensions': 'off',
'import/no-unresolved': 'off',
semi: 'off',
'arrow-body-style': 'off',
'@typescript-eslint/member-delimiter-style': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'import/order': 'off',
'linebreak-style': 'off',
},
},
],
};