forked from LD4P/sinopia_editor
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.eslintrc.js
More file actions
236 lines (235 loc) · 6.85 KB
/
.eslintrc.js
File metadata and controls
236 lines (235 loc) · 6.85 KB
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
// Copyright 2018 Stanford University see Apache2.txt for license
module.exports = {
plugins: [
"import",
"jest",
"jsx-a11y",
"react",
"react-hooks",
"security",
"cypress"
],
extends: [
"eslint:recommended",
"plugin:node/recommended",
"plugin:react/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:jsx-a11y/recommended",
"plugin:security/recommended",
"airbnb-base",
"plugin:cypress/recommended"
],
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 2019,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
settings: {
"node": {
"resolvePaths": ['src', '__tests__/test_utilities'],
"tryExtensions": ['.js','.jsx','.json','.node']
},
"import/resolver": {
"node": {
"paths": ['src', '__tests__/test_utilities'],
"extensions": ['.js','.jsx']
}
},
"react": {
"version": "16.6"
},
},
env: {
"browser": true,
"jest": true,
"node": true,
"es6": true
},
rules: {
"array-callback-return": "off",
"brace-style": "off",
'capitalized-comments': "off",
"class-methods-use-this": "off",
"consistent-return": "off",
"eqeqeq": ["error", "smart"],
"func-style": ["error", "declaration", { "allowArrowFunctions": true }],
"global-require": "off",
"guard-for-in": "off",
"id-length": "off",
"import/exports-last": "off",
"import/group-exports": "off",
"import/max-dependencies": "off",
"import/no-commonjs": "off",
"import/no-cycle": "off",
"import/no-default-export": "off",
"import/no-dynamic-require": "off",
"import/no-extraneous-dependencies": "off",
"import/no-internal-modules": "off",
"import/no-mutable-exports": "off",
"import/no-named-as-default": "off",
"import/no-namespace": "off",
"import/no-nodejs-modules": "off",
"import/no-relative-parent-imports": "off",
"import/no-unassigned-import": "off",
"import/order": "off",
"import/unambiguous": "off",
"indent": ["error", 2, {
"SwitchCase": 1,
"ignoredNodes": [
// Let react/jsx-indent-props govern JSX prop indentation
"JSXAttribute"
]
}],
"init-declarations": "off",
"jsx-a11y/anchor-is-valid": "warn", // see #172
"jsx-a11y/label-has-for": "off", // see #173
"jsx-a11y/no-onchange": "warn", // The DropZone select form needs an onChange prop to set the state with the new group
'jsx-a11y/no-noninteractive-tabindex': ['off', { roles: ['tooltip'] }],
'lines-around-comment': ['error', { 'allowBlockStart': true }],
"max-classes-per-file": "off",
"max-len": ["error", { "code": 164, "ignoreComments": true }],
"max-lines-per-function": "off",
"max-statements": "off",
"max-statements-per-line": "off",
'multiline-comment-style': "off",
"new-cap": "off",
'newline-after-var': 'off', // deprecated rule, enabled by airbnb-base/whitespace
"newline-before-return": "off",
"node/no-extraneous-import": "off", // turning off because objects to our imports
"no-alert": "off",
"no-await-in-loop": "off",
"no-console": ["warn", { allow: ["error", "info"] }], // we want to see errors in the console
"no-extra-semi": "error",
"no-inline-comments": "off",
"no-invalid-this": "off",
"no-magic-numbers": "off",
"no-negated-condition": "off",
"no-nested-ternary": "off",
"no-param-reassign": "off",
"no-plusplus": "off",
"no-process-env": "off",
"no-restricted-syntax": "off",
"no-return-assign": "off",
"no-return-await": "off",
"no-sequences": "off",
"no-shadow": "off",
"no-sync": "off",
"no-ternary": "off",
"no-throw-literal": "off",
"no-undefined": "off",
"no-underscore-dangle": "off",
"no-unused-expressions": "off",
"no-use-before-define": "off",
"no-useless-constructor": "warn",
"no-var": "error",
"no-warning-comments": "off",
"node/no-unsupported-features/es-syntax": "off",
"prefer-const": "error",
"prefer-destructuring": "off",
"prefer-reflect": "off",
"quotes": ["error", "single"],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/jsx-indent": ["error", 2],
"react/jsx-indent-props": ["error", "first"],
"require-await": "off",
"require-jsdoc": "off",
"require-unicode-regexp": "off",
"security/detect-object-injection": "off",
"semi": ["error", "never"],
"sort-imports": "off",
"sort-keys": "off",
"valid-jsdoc": "off"
},
overrides: [
{
// Allow tests to include block statements (idiomatic Jest style)
"files": ["__tests__/**"],
"rules": {
"arrow-body-style": "off",
"max-lines": "off",
"max-len": "off"
}
},
{
// Allow integration tests to use `page` global variable defined by puppeteer
"files": ["__tests__/integration/**"],
"rules": {
"no-undef": "off"
}
},
{
// There is a known issue with exporting async default functions
// Link: https://github.com/babel/babel/issues/6262
"files": ["__tests__/integration/previewRDFHelper.js"],
"rules": {
"import/prefer-default-export": "off"
}
},
{
// Allow ImportFileZone test to require `isomorphic-fetch`
"files": ["__tests__/components/editor/ImportFileZone.test.js"],
"rules": {
"node/no-extraneous-require": "warn"
}
},
{
// Allow unicode whitespace in OutlineHeader test (bc apparently actually used in OutlineHeader component)
"files": ["__tests__/components/editor/OutlineHeader.test.js"],
"rules": {
"no-irregular-whitespace": "off"
}
},
{
// Allow react-router-dom mock to do things counter to React's linter preferences
"files": ["__mocks__/react-router-dom.js"],
"rules": {
"react/display-name": "warn",
"react/prop-types": "warn"
}
},
{
// Allow a continue guard clause here as an if will increase the depth
"files": ["src/GraphBuilder.js"],
"rules": {
"no-continue": "off"
}
},
{
"files": ["src/components/editor/property/ResourceProperty.jsx"],
"rules": {
"max-len": "off"
}
},
{
// Bootstrap styles require that navbar's use <a> instead of <btn>, so ignoring.
// Might be able to fix this with BS4.
"files": [
"src/components/Header.jsx",
"src/components/home/Header.jsx"
],
"rules": {
"jsx-a11y/anchor-is-valid": "off"
}
},
{
"files": [
"react-testing-library.setup.js",
"setupEnzyme.js"
],
"rules": {
"node/no-unpublished-import": "off"
}
},
{
"files": ["cypress/plugins/index.js"],
"rules": {
"no-unused-vars": "off"
}
},
]
}