-
Notifications
You must be signed in to change notification settings - Fork 18
/
.eslintrc.js
106 lines (100 loc) · 3.03 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
module.exports = {
extends: [
'airbnb-typescript',
'plugin:jest-dom/recommended',
'plugin:testing-library/recommended',
"plugin:@typescript-eslint/eslint-recommended",
// "plugin:@typescript-eslint/recommended",
// "plugin:@typescript-eslint/recommended-requiring-type-checking",
'plugin:prettier/recommended',
'prettier',
'prettier/@typescript-eslint',
'prettier/react',
],
parser: '@typescript-eslint/parser',
plugins: ['jest', 'emotion', 'react-hooks'],
env: {
browser: true,
node: true,
'jest/globals': true,
},
settings: {
'import/resolver': {
webpack: {
config: 'webpack.config.js',
},
},
},
globals: {
fetchMock: true,
__DEV__: true,
__VERSION__: true,
},
parserOptions: {
warnOnUnsupportedTypeScriptVersion: false,
project: './tsconfig.eslint.json',
},
rules: {
// typescript
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'no-public' }],
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-expressions': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: true,
argsIgnorePattern: '^_',
},
],
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/unified-signatures': 'warn',
// emotion
'emotion/import-from-emotion': 'error',
'emotion/no-vanilla': 'error',
'emotion/styled-import': 'error',
// import
'import/extensions': ['error', 'ignorePackages', {
ts: 'never',
tsx: 'never',
js: 'never',
jsx: 'never',
}],
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
'import/no-named-as-default': 'off',
'import/prefer-default-export': 'off',
'import/no-cycle': 'off',
// core
'no-constant-condition': 'off',
'no-underscore-dangle': 'off',
'no-unused-expressions': 'off',
// React
'react/destructuring-assignment': ['error', 'always', { ignoreClassFields: true }],
'react/forbid-prop-types': 'off',
'react/jsx-filename-extension': ['error', { extensions: ['.tsx', '.jsx'] }],
'react/jsx-no-bind': 'off',
'react/jsx-props-no-spreading': 'off',
'react/no-array-index-key': 'off',
'react/prop-types': 'off',
'react/state-in-constructor': ['error', 'never'],
'react/static-property-placement': 'off',
// hooks
'react-hooks/exhaustive-deps': 'warn',
'react-hooks/rules-of-hooks': 'error',
// a11y
'jsx-a11y/anchor-is-valid': [
'error',
{
components: ['Link'],
specialLink: ['to', 'hrefLeft', 'hrefRight'],
aspects: ['noHref', 'invalidHref', 'preferButton'],
},
],
},
};