-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
139 lines (133 loc) · 3.73 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
module.exports = {
env: {
browser: true,
es6: true,
jest: true,
},
extends: [
'airbnb',
'plugin:react-hooks/recommended',
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
// webpack DefinePlugin variables
__DEV__: 'readonly',
JOB_TYPE: 'readonly',
ANALYZER_SERVER: 'readonly',
PARAVIEW_SERVER: 'readonly',
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
tsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: [
'@typescript-eslint',
],
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
rules: {
/**
* General Rules
*/
'comma-dangle': ['error', 'always-multiline'],
'function-paren-newline': ['error', 'multiline-arguments'],
'import/extensions': ['error', 'never'],
'lines-between-class-members': ['error', 'always', {
exceptAfterSingleLine: true,
}],
'max-classes-per-file': ['error', 20],
'max-len': ['warn', 128, 2, {
// Ignore long import lines
ignorePattern: '^import\\s.+\\sfrom\\s.+;$',
ignoreUrls: true,
}],
'no-unused-expressions': ['error', {
allowShortCircuit: true,
allowTernary: true,
}],
'object-curly-newline': ['error', {
consistent: true,
multiline: true,
}],
'object-curly-spacing': ['error', 'always'],
'operator-linebreak': ['error', 'after'],
quotes: ['error', 'single'],
semi: ['error', 'always'],
'react/jsx-closing-bracket-location': ['error', {
nonEmpty: 'after-props',
selfClosing: 'tag-aligned',
}],
'react/jsx-filename-extension': [1, {
extensions: ['.tsx', '.jsx'],
}],
'react/jsx-sort-props': ['error', {
ignoreCase: true,
callbacksLast: false,
shorthandFirst: false,
shorthandLast: false,
noSortAlphabetically: false,
reservedFirst: false,
}],
'react/jsx-wrap-multilines': ['error', {
arrow: 'parens-new-line',
assignment: 'ignore',
condition: 'ignore',
declaration: 'ignore',
logical: 'ignore',
prop: 'ignore',
return: 'parens-new-line',
}],
'react/state-in-constructor': ['error', 'never'],
'react/static-property-placement': ['error', 'static public field'],
'react/function-component-definition': [2, {"namedComponents": "arrow-function"}],
/**
* Disabled Rules
*/
'no-await-in-loop': 'off',
'no-param-reassign': 'off',
// The following two rules cause false positives in a TS constructor where
// all its parameters are used to define the data membbers.
'no-empty-function': 'off',
'no-useless-constructor': 'off',
// The following two rules are to make debugging easier.
// they should be removed in a future.
'no-alert': 'off',
'no-console': 'off',
// Use the typescript-specific version below instead.
'no-unused-vars': 'off',
'one-var': 'off',
'one-var-declaration-per-line': 'off',
'react/jsx-fragments': 'off',
'react/jsx-one-expression-per-line': 'off',
'react/jsx-props-no-spreading': 'off',
'react/destructuring-assignment': 'off',
// prop-types check reports many false positives.
// We use typescript for prop typechecking, so disable it.
'react/prop-types': 'off',
'no-use-before-define': 'off',
"@typescript-eslint/no-use-before-define": ["error"]
},
// https://github.com/typescript-eslint/typescript-eslint/issues/46
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'@typescript-eslint/no-unused-vars': ['error', {
args: 'none',
ignoreRestSiblings: true,
}],
},
},
],
};