@origin-1/eslint-config 0.1.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -1
- package/lib/create-config.js +11 -3
- package/lib/rules.js +18 -4
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './lib/create-config';
|
|
1
|
+
export * from './lib/create-config.js';
|
package/lib/create-config.js
CHANGED
|
@@ -14,7 +14,15 @@ function createBaseConfig(configData) {
|
|
|
14
14
|
const { env, parser, parserOptions, plugins: overridePlugins, rules: overrideRules } = createBaseOverride(configData);
|
|
15
15
|
plugins.push(...overridePlugins);
|
|
16
16
|
Object.assign(rules, overrideRules);
|
|
17
|
-
const baseConfig = {
|
|
17
|
+
const baseConfig = {
|
|
18
|
+
env,
|
|
19
|
+
globals: configData.globals,
|
|
20
|
+
parser,
|
|
21
|
+
parserOptions,
|
|
22
|
+
plugins,
|
|
23
|
+
reportUnusedDisableDirectives: true,
|
|
24
|
+
rules,
|
|
25
|
+
};
|
|
18
26
|
return baseConfig;
|
|
19
27
|
}
|
|
20
28
|
exports.createBaseConfig = createBaseConfig;
|
|
@@ -137,8 +145,8 @@ function createConfig(...configDataList) {
|
|
|
137
145
|
exports.createConfig = createConfig;
|
|
138
146
|
function createOverride(configData) {
|
|
139
147
|
const baseOverride = createBaseOverride(configData);
|
|
140
|
-
const { excludedFiles, files } = configData;
|
|
141
|
-
const override = { ...baseOverride, excludedFiles, files };
|
|
148
|
+
const { excludedFiles, files, globals } = configData;
|
|
149
|
+
const override = { ...baseOverride, excludedFiles, files, globals };
|
|
142
150
|
return override;
|
|
143
151
|
}
|
|
144
152
|
function findRuleEntry(versionedList, jsVersion, tsVersion) {
|
package/lib/rules.js
CHANGED
|
@@ -25,6 +25,7 @@ function jsts(jsEntry, tsEntry) {
|
|
|
25
25
|
}
|
|
26
26
|
exports.RULES = {
|
|
27
27
|
[exports.UNIQUE]: {
|
|
28
|
+
////////////////////////////////////////////
|
|
28
29
|
// Problem
|
|
29
30
|
'array-callback-return': 'off',
|
|
30
31
|
'constructor-super': 'error',
|
|
@@ -80,6 +81,7 @@ exports.RULES = {
|
|
|
80
81
|
'require-atomic-updates': 'off',
|
|
81
82
|
'use-isnan': ['error', { enforceForSwitchCase: true }],
|
|
82
83
|
'valid-typeof': 'error',
|
|
84
|
+
////////////////////////////////////////////
|
|
83
85
|
// Suggestion
|
|
84
86
|
'accessor-pairs': ['error', { enforceForClassMembers: true }],
|
|
85
87
|
'arrow-body-style': 'error',
|
|
@@ -206,11 +208,12 @@ exports.RULES = {
|
|
|
206
208
|
'sort-imports': ['error', { ignoreDeclarationSort: true }],
|
|
207
209
|
'sort-keys': 'off',
|
|
208
210
|
'sort-vars': 'off',
|
|
209
|
-
'spaced-comment': 'error',
|
|
211
|
+
'spaced-comment': ['error', 'always', { exceptions: ['/'] }],
|
|
210
212
|
'strict': jsts(['error', 'global'], 'off'),
|
|
211
213
|
'symbol-description': 'off',
|
|
212
214
|
'vars-on-top': 'off',
|
|
213
215
|
'yoda': 'error',
|
|
216
|
+
////////////////////////////////////////////
|
|
214
217
|
// Layout
|
|
215
218
|
'array-bracket-newline': ['error', 'consistent'],
|
|
216
219
|
'array-bracket-spacing': 'error',
|
|
@@ -262,11 +265,13 @@ exports.RULES = {
|
|
|
262
265
|
'yield-star-spacing': ['error', 'both'],
|
|
263
266
|
},
|
|
264
267
|
[exports.HYBRID]: {
|
|
268
|
+
////////////////////////////////////////////
|
|
265
269
|
// Problem
|
|
266
270
|
'no-dupe-class-members': 'error',
|
|
267
271
|
'no-loss-of-precision': 'error',
|
|
268
272
|
'no-unused-vars': jsts(beforeOrElse(2019, ['error', { ignoreRestSiblings: true, vars: 'local' }], ['error', { caughtErrors: 'all', ignoreRestSiblings: true, vars: 'local' }]), ['error', { caughtErrors: 'all', ignoreRestSiblings: true, vars: 'local' }]),
|
|
269
273
|
'no-use-before-define': 'off',
|
|
274
|
+
////////////////////////////////////////////
|
|
270
275
|
// Suggestion
|
|
271
276
|
'default-param-last': 'off',
|
|
272
277
|
'dot-notation': 'error',
|
|
@@ -286,6 +291,7 @@ exports.RULES = {
|
|
|
286
291
|
'no-unused-expressions': 'error',
|
|
287
292
|
'no-useless-constructor': 'error',
|
|
288
293
|
'require-await': 'error',
|
|
294
|
+
////////////////////////////////////////////
|
|
289
295
|
// Layout
|
|
290
296
|
'brace-style': ['error', 'allman'],
|
|
291
297
|
'comma-dangle': ['error', 'always-multiline'],
|
|
@@ -337,6 +343,7 @@ exports.RULES = {
|
|
|
337
343
|
},
|
|
338
344
|
'@typescript-eslint/eslint-plugin': {
|
|
339
345
|
[exports.FOR_LANG]: 'ts',
|
|
346
|
+
////////////////////////////////////////////
|
|
340
347
|
// Problem
|
|
341
348
|
'await-thenable': 'error',
|
|
342
349
|
'ban-ts-comment': 'off',
|
|
@@ -371,6 +378,7 @@ exports.RULES = {
|
|
|
371
378
|
'restrict-template-expressions': 'off',
|
|
372
379
|
'return-await': 'error',
|
|
373
380
|
'unbound-method': 'off',
|
|
381
|
+
////////////////////////////////////////////
|
|
374
382
|
// Suggestion
|
|
375
383
|
'adjacent-overload-signatures': 'error',
|
|
376
384
|
'array-type': 'error',
|
|
@@ -427,31 +435,37 @@ exports.RULES = {
|
|
|
427
435
|
'triple-slash-reference': ['error', { lib: 'never' }],
|
|
428
436
|
'typedef': 'error',
|
|
429
437
|
'unified-signatures': 'error',
|
|
438
|
+
////////////////////////////////////////////
|
|
430
439
|
// Layout
|
|
431
440
|
'type-annotation-spacing': 'error',
|
|
432
441
|
},
|
|
433
442
|
'@fasttime/eslint-plugin': {
|
|
443
|
+
////////////////////////////////////////////
|
|
434
444
|
// Layout
|
|
435
445
|
'nice-space-before-function-paren': 'error',
|
|
436
446
|
'no-spaces-in-call-expression': 'error',
|
|
437
447
|
},
|
|
438
448
|
'eslint-plugin-n': {
|
|
449
|
+
////////////////////////////////////////////
|
|
439
450
|
// Problem
|
|
440
451
|
'no-callback-literal': 'off',
|
|
441
452
|
'no-deprecated-api': 'error',
|
|
442
453
|
'no-exports-assign': 'error',
|
|
454
|
+
// Does not handle type declaration imports.
|
|
443
455
|
'no-extraneous-import': jsts('error', 'off'),
|
|
444
456
|
'no-extraneous-require': 'error',
|
|
445
|
-
|
|
446
|
-
'no-missing-
|
|
457
|
+
// Does not handle type declaration imports.
|
|
458
|
+
'no-missing-import': jsts('error', 'off'),
|
|
459
|
+
'no-missing-require': 'error',
|
|
447
460
|
'no-unpublished-bin': 'error',
|
|
448
461
|
'no-unpublished-import': 'error',
|
|
449
|
-
'no-unpublished-require': '
|
|
462
|
+
'no-unpublished-require': 'error',
|
|
450
463
|
'no-unsupported-features/es-builtins': 'off',
|
|
451
464
|
'no-unsupported-features/es-syntax': 'off',
|
|
452
465
|
'no-unsupported-features/node-builtins': 'off',
|
|
453
466
|
'process-exit-as-throw': 'error',
|
|
454
467
|
'shebang': 'off',
|
|
468
|
+
////////////////////////////////////////////
|
|
455
469
|
// Suggestion
|
|
456
470
|
'callback-return': 'off',
|
|
457
471
|
'exports-style': 'off',
|
package/package.json
CHANGED