-
Notifications
You must be signed in to change notification settings - Fork 122
/
.eslintrc.js
120 lines (119 loc) · 3.39 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
const OFF = 'off'
const WARNING = 'warn'
const ERROR = 'error'
module.exports = {
extends: ['airbnb', 'prettier', 'prettier/react'],
plugins: ['react-hooks', 'import', '@typescript-eslint'],
env: {
browser: true,
commonjs: true,
jest: true,
node: true,
jquery: true,
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
parser: '@typescript-eslint/parser',
parserOptions: {
allowImportExportEverywhere: true,
},
rules: {
curly: [WARNING, 'all'],
semi: [ERROR, 'never'],
quotes: [ERROR, 'single'],
'class-methods-use-this': OFF, // It's a way of allowing private variables.
'func-names': OFF,
'no-unused-expressions': OFF,
'no-nested-ternary': OFF,
'global-require': OFF,
'no-underscore-dangle': OFF,
'no-template-curly-in-string': OFF,
'no-param-reassign': OFF,
'arrow-parens': [ERROR, 'always'],
'no-use-before-define': OFF,
'no-console': ERROR,
'no-unused-vars': OFF,
'@typescript-eslint/no-unused-vars': [ERROR, { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-use-before-define': [
ERROR,
{
functions: false,
enums: false,
variables: false,
typedefs: false,
},
],
'jsx-a11y/click-events-have-key-events': OFF,
'jsx-a11y/no-noninteractive-element-interactions': OFF,
'jsx-a11y/no-static-element-interactions': OFF,
'react/require-default-props': OFF,
'react/jsx-closing-bracket-location': OFF, // Conflicts with Prettier.
'react/jsx-filename-extension': [ERROR, { extensions: ['.jsx', '.tsx'] }],
'react/jsx-no-target-blank': OFF,
'react/jsx-one-expression-per-line': OFF,
'react/no-array-index-key': OFF, // Sometimes its ok, e.g. non-changing data.
'react/sort-comp': OFF,
'react/prop-types': OFF,
'react/destructuring-assignment': OFF, // Too many lines.
'react/prefer-stateless-function': WARNING,
'react/jsx-props-no-spreading': OFF,
'import/no-dynamic-require': OFF,
'import/extensions': OFF,
'import/prefer-default-export': OFF,
'react-hooks/rules-of-hooks': ERROR,
'import/no-unresolved': [ERROR, { ignore: ['^@/*', '^~/*', '_', '__'] }], // Ignore certain webpack alias because it can't be resolved
'import/no-extraneous-dependencies': OFF,
'import/order': [
// sort import groups
ERROR,
{
groups: [['builtin', 'external'], 'internal', ['sibling', 'parent'], 'index'],
pathGroupsExcludedImportTypes: ['builtin'],
'newlines-between': 'always-and-inside-groups',
alphabetize: {
order: 'asc',
caseInsensitive: false,
},
pathGroups: [
{
pattern: '@[a-z]*/**',
group: 'internal',
position: 'before',
},
{
pattern: '@/**',
group: 'sibling',
position: 'before',
},
{
pattern: '~/**',
group: 'sibling',
position: 'before',
},
],
},
],
},
overrides: [
{
files: ['*.d.ts'],
rules: {
'spaced-comment': OFF,
},
},
{
files: ['*.ts', '*.tsx'],
rules: {
'no-undef': OFF,
'no-redeclare': OFF,
'import/no-unresolved': OFF,
'import/no-extraneous-dependencies': OFF,
},
},
],
}