-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.eslintrc.js
248 lines (223 loc) · 7.44 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
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
237
238
239
240
241
242
243
244
245
246
247
248
module.exports = {
env: {
/*browser - browser global variables.
node - Node.js global variables and Node.js scoping.
commonjs - CommonJS global variables and CommonJS scoping (use this for browser-only code that uses Browserify/WebPack).
shared-node-browser - Globals common to both Node.js and Browser.
es6 - enable all ECMAScript 6 features except for modules (this automatically sets the ecmaVersion parser option to 6).
es2017 - adds all ECMAScript 2017 globals and automatically sets the ecmaVersion parser option to 8.*/
es2020: true/*, // - adds all ECMAScript 2020 globals and automatically sets the ecmaVersion parser option to 11.
worker - web workers global variables.
amd - defines require() and define() as global variables as per the amd spec.
mocha - adds all of the Mocha testing global variables.
jasmine - adds all of the Jasmine testing global variables for version 1.3 and 2.0.
jest - Jest global variables.
phantomjs - PhantomJS global variables.
protractor - Protractor global variables.
qunit - QUnit global variables.
jquery - jQuery global variables.
prototypejs - Prototype.js global variables.
shelljs - ShellJS global variables.
meteor - Meteor global variables.
mongo - MongoDB global variables.
applescript - AppleScript global variables.
nashorn - Java 8 Nashorn global variables.
serviceworker - Service Worker global variables.
atomtest - Atom test helper globals.
embertest - Ember test helper globals.
webextensions - WebExtensions globals.
greasemonkey - GreaseMonkey globals.*/
},
// https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
extends: [
//'eslint:recommended',
//'airbnb-base',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:jsx-a11y/recommended',
'plugin:react-hooks/recommended'
],
globals: {
// Node
__dirname: false,
process: false,
require: false,
// CommonJS (CJS) format
exports: false,
module: false,
// Nashorn
Java: false,
// Enonic XP
app: false,
log: false,
resolve: false,
__: false,
// Mocha
//describe: false,
//it: false,
// Client-side js
console: false,
document: false,
fetch: false,
//global: false,
//navigator: false,
setTimeout: false,
window: false,
//XMLHttpRequest: false,
// Jquery
$: false,
jQuery: false,
// React
React: false
}, //globals
ignorePatterns: [
"build/**/*.*"
],
//parser: 'espree', // default
//parser: 'esprima',
//parser: 'babel-eslint',
/*parserOptions: {
allowImportExportEverywhere: false,
codeFrame: true,
ecmaFeatures: {
jsx: true
},
// set to 3, 5 (default), 6, 7, 8, 9, 10 or 11 to specify the version of ECMAScript syntax you want to use.
// You can also set to 2015 (same as 6), 2016 (same as 7), 2017 (same as 8), 2018 (same as 9), 2019 (same as 10) or 2020 (same as 11) to use the year-based naming.
//ecmaVersion: 2020, // 11
ecmaVersion: 6, // 2015
impliedStrict: true,
// set to "script" (default) or "module" if your code is in ECMAScript modules.
sourceType: 'module' // allow import statements
},*/
overrides: [{
files: [
//'**/*.es', // Currently no such files
//'**/*.es6', // Currently no such files
//'**/*.js', // Currently no such files
//'**/*.jsx', // Currently no such files
//'**/*.mjs', // Currently no such files
'**/*.ts',
'**/*.tsx'
]
}],
plugins: [
///'import',
//'react',
'jsx-a11y',
'@typescript-eslint'
],
root: true,
rules: { // https://eslint.org/docs/rules
'@typescript-eslint/ban-ts-comment': ['error', {
'ts-expect-error': false, // 'allow-with-comment'
'ts-ignore': false, // 'allow-with-comment'
'ts-nocheck': true,
'ts-check': true,
}],
'comma-dangle': ['error', {
// never (default) disallows trailing commas
// always requires trailing commas
// always-multiline requires trailing commas when the last element
// or property is in a different line than the closing ] or } and
// disallows trailing commas when the last element or property is
// on the same line as the closing ] or }
// only-multiline allows (but does not require) trailing commas when
// the last element or property is in a different line than the
// closing ] or } and disallows trailing commas when the last
// element or property is on the same line as the closing ] or }
// ignore who cares? no body
arrays: 'ignore',
objects: 'only-multiline',
imports: 'only-multiline',
exports: 'only-multiline',
functions: 'ignore'
}],
'import/extensions': ['off'],
'import/prefer-default-export': ['off'],
'import/no-absolute-path': ['off'],
'import/no-extraneous-dependencies': ['off'],
'import/no-unresolved': ['off'],
indent: ['warn', 'tab'],
'jsx-a11y/label-has-associated-control': ['off'],
'max-len': ['error', 160, 2, {
ignoreUrls: true,
ignoreComments: true,
ignoreRegExpLiterals: true,
ignoreStrings: true,
ignoreTemplateLiterals: true
}],
'no-cond-assign': ['error', 'except-parens'],
'no-console': 'off',
'no-multi-spaces': ['off'],
'no-tabs': ['off'],
'no-underscore-dangle': ['error', {
allow: [
'__', // Enonic XP Java Bridge
'__connection', // My own stupidity
'_branchId', // fake node property
'_collection', // fake node property
'_createdTime', // fake node property
'_documentType', // fake node property
'_id', // content-type property
'_indexConfig', // node property
'_inheritsPermissions', // node property
'_json', // fake node property
'_modifiedTime', // fake node property
'_name', // node property
'_nodeType', // node property
'_parentPath', // node property
'_path', // content-type property
'_permissions', // node property
'_repoId', // fake node property
'_score', // fake node property
'_selected', // option-set property
'_ts', // node property
'_versionKey' // node property
],
allowAfterThis: true,
allowAfterSuper: false,
enforceInMethodNames: false
}],
'no-unexpected-multiline': 'off',
'no-unused-vars': ["warn", { "argsIgnorePattern": "^_" }],
'@typescript-eslint/no-unused-vars': ["warn", { "argsIgnorePattern": "^_" }],
'object-curly-spacing': ['off'],
'react/jsx-no-undef': [
'error',
{
allowGlobals: true
}
],
//'react/jsx-uses-react': 'error',
//'react/jsx-uses-vars': 'error',
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off', // Since React is a global
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
semi: [
'off',
// "always" (default) requires semicolons at the end of statements
// "never" disallows semicolons as the end of statements (except to
// disambiguate statements beginning with [, (, /, +, or -)
'always',
{
// when "always"
omitLastInOneLineBlock: true
// when "never"
// "any" (default) ignores semicolons (or lacking semicolon) at
// the end of statements if the next line starts with
// [, (, /, +, or -.
// "always" requires semicolons at the end of statements if the
// next line starts with [, (, /, +, or -.
// "never" disallows semicolons as the end of statements if it
// doesn't make ASI hazard even if the next line starts
// with [, (, /, +, or -.
//beforeStatementContinuationChars: 'never'
}
],
'spaced-comment': ['off'],
strict: 1
} // rules
}; // module.exports