@w5s/eslint-config 3.31.0 → 3.33.0
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/README.md +30 -0
- package/dist/index.d.ts +111 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +101 -31
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/config/es.ts +104 -6
- package/src/config/imports.ts +3 -1
- package/src/config/stylistic.ts +1 -0
- package/src/defineConfig.ts +39 -60
- package/src/index.ts +2 -1
- package/src/restrictedGlobals.ts +15 -0
- package/src/restrictedImportPaths.ts +19 -0
- package/src/rules/airbnb-base/overrides.ts +1 -1
- package/src/type/RestrictedGlobals.ts +12 -0
- package/src/type/RestrictedImportPaths.ts +15 -0
- package/src/type.ts +2 -0
package/dist/index.js
CHANGED
|
@@ -93,6 +93,62 @@ async function e18e(options = {}) {
|
|
|
93
93
|
}];
|
|
94
94
|
}
|
|
95
95
|
//#endregion
|
|
96
|
+
//#region src/restrictedGlobals.ts
|
|
97
|
+
const restrictedGlobals = Object.freeze([{
|
|
98
|
+
message: "Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite",
|
|
99
|
+
name: "isFinite"
|
|
100
|
+
}, {
|
|
101
|
+
message: "Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan",
|
|
102
|
+
name: "isNaN"
|
|
103
|
+
}]);
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/restrictedImportPaths.ts
|
|
106
|
+
/**
|
|
107
|
+
* This file contains the list of restricted import paths used in the ESLint configuration.
|
|
108
|
+
*/
|
|
109
|
+
const restrictedImportPaths = Object.freeze([
|
|
110
|
+
{
|
|
111
|
+
name: "moment",
|
|
112
|
+
message: "Use Temporal, date-fns, or luxon."
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "jquery",
|
|
116
|
+
message: "Use native DOM APIs."
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "underscore",
|
|
120
|
+
message: "Use native APIs or es-toolkit."
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: "bluebird",
|
|
124
|
+
message: "Use native Promise."
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: "request",
|
|
128
|
+
message: "Use fetch or undici."
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "request-promise",
|
|
132
|
+
message: "Use fetch or undici."
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "node-fetch",
|
|
136
|
+
message: "Use global fetch (Node 18+)."
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "isomorphic-fetch",
|
|
140
|
+
message: "Use global fetch."
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: "whatwg-fetch",
|
|
144
|
+
message: "Use global fetch."
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "rxjs/Rx",
|
|
148
|
+
message: "Import from \"rxjs\" or \"rxjs/operators\"."
|
|
149
|
+
}
|
|
150
|
+
]);
|
|
151
|
+
//#endregion
|
|
96
152
|
//#region src/internal/lazy.ts
|
|
97
153
|
function lazy(fn) {
|
|
98
154
|
let isSet = false;
|
|
@@ -444,38 +500,51 @@ const esRules = lazy(() => ({
|
|
|
444
500
|
//#region src/config/es.ts
|
|
445
501
|
const defaultFiles$10 = [esSourceGlob];
|
|
446
502
|
async function es(options) {
|
|
447
|
-
const { recommended = true, rules = {} } = options;
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
...globals[`es${Project.ecmaVersion()}`],
|
|
454
|
-
...globals.node,
|
|
455
|
-
__DEV__: "readonly",
|
|
456
|
-
__PROD__: "readonly",
|
|
457
|
-
__TEST__: "readonly",
|
|
458
|
-
document: "readonly",
|
|
459
|
-
navigator: "readonly",
|
|
460
|
-
window: "readonly"
|
|
461
|
-
},
|
|
462
|
-
parserOptions: {
|
|
463
|
-
ecmaFeatures: { jsx: true },
|
|
503
|
+
const { defaultRestrictedGlobals = restrictedGlobals, defaultRestrictedImportPaths = restrictedImportPaths, recommended = true, restrictedImportPaths: paths, rules = {} } = options;
|
|
504
|
+
const resolvedGlobals = typeof options.restrictedGlobals === "function" ? options.restrictedGlobals(defaultRestrictedGlobals) : options.restrictedGlobals ?? defaultRestrictedGlobals;
|
|
505
|
+
const resolvedPaths = typeof paths === "function" ? paths(defaultRestrictedImportPaths) : paths ?? defaultRestrictedImportPaths;
|
|
506
|
+
return [
|
|
507
|
+
{
|
|
508
|
+
languageOptions: {
|
|
464
509
|
ecmaVersion: Project.ecmaVersion(),
|
|
510
|
+
globals: {
|
|
511
|
+
...globals.browser,
|
|
512
|
+
...globals[`es${Project.ecmaVersion()}`],
|
|
513
|
+
...globals.node,
|
|
514
|
+
__DEV__: "readonly",
|
|
515
|
+
__PROD__: "readonly",
|
|
516
|
+
__TEST__: "readonly",
|
|
517
|
+
document: "readonly",
|
|
518
|
+
navigator: "readonly",
|
|
519
|
+
window: "readonly"
|
|
520
|
+
},
|
|
521
|
+
parserOptions: {
|
|
522
|
+
ecmaFeatures: { jsx: true },
|
|
523
|
+
ecmaVersion: Project.ecmaVersion(),
|
|
524
|
+
sourceType: "module"
|
|
525
|
+
},
|
|
465
526
|
sourceType: "module"
|
|
466
527
|
},
|
|
467
|
-
|
|
528
|
+
linterOptions: { reportUnusedDisableDirectives: true },
|
|
529
|
+
name: "w5s/es/setup"
|
|
468
530
|
},
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
531
|
+
{
|
|
532
|
+
files: [sourceGlob],
|
|
533
|
+
name: "w5s/source/restricted-rules",
|
|
534
|
+
rules: {
|
|
535
|
+
"no-restricted-globals": ["error", ...resolvedGlobals],
|
|
536
|
+
"no-restricted-imports": ["error", { paths: resolvedPaths }]
|
|
537
|
+
}
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
files: defaultFiles$10,
|
|
541
|
+
name: "w5s/es/rules",
|
|
542
|
+
rules: {
|
|
543
|
+
...recommended ? es["recommended"] : {},
|
|
544
|
+
...rules
|
|
545
|
+
}
|
|
477
546
|
}
|
|
478
|
-
|
|
547
|
+
];
|
|
479
548
|
}
|
|
480
549
|
/**
|
|
481
550
|
* Recommended rules
|
|
@@ -1044,6 +1113,7 @@ async function stylistic(options = {}) {
|
|
|
1044
1113
|
...config.rules,
|
|
1045
1114
|
"style/arrow-parens": ["error", "always"],
|
|
1046
1115
|
"style/brace-style": ["error", "1tbs"],
|
|
1116
|
+
"style/jsx-one-expression-per-line": ["error", { allow: "single-line" }],
|
|
1047
1117
|
"style/operator-linebreak": [
|
|
1048
1118
|
"error",
|
|
1049
1119
|
"after",
|
|
@@ -1327,16 +1397,16 @@ async function defineConfig(options = {}) {
|
|
|
1327
1397
|
...optionsOrBoolean
|
|
1328
1398
|
});
|
|
1329
1399
|
const includeEnabled = (factory, input) => input.enabled ? [factory(input)] : [];
|
|
1330
|
-
return ESLintConfig.concat(...includeEnabled(
|
|
1400
|
+
return ESLintConfig.concat(...includeEnabled(ignores, toOption(options)), ...includeEnabled(es, toOption(plugins.es)), ...includeEnabled(ts, toOption(plugins.ts)), ...includeEnabled(e18e, toOption(plugins.e18e)), ...includeEnabled(jsx, toOption(plugins.jsx)), ...includeEnabled(unusedImports, toOption(plugins["unused-imports"])), ...includeEnabled(imports, toOption(plugins.import)), ...includeEnabled(perfectionist, toOption(plugins.perfectionist)), ...includeEnabled(node, toOption(plugins.node)), ...includeEnabled(next, toOption(plugins.next, false)), ...includeEnabled(react, toOption(plugins.react)), ...includeEnabled(unicorn, toOption(plugins.unicorn)), ...includeEnabled(test, toOption(plugins.test)), ...rules ? [{ rules }] : []);
|
|
1331
1401
|
}
|
|
1332
1402
|
//#endregion
|
|
1333
1403
|
//#region src/meta.ts
|
|
1334
1404
|
const meta = Object.freeze({
|
|
1335
|
-
buildNumber:
|
|
1405
|
+
buildNumber: 1788193978,
|
|
1336
1406
|
name: "@w5s/eslint-config",
|
|
1337
|
-
version: "3.
|
|
1407
|
+
version: "3.33.0"
|
|
1338
1408
|
});
|
|
1339
1409
|
//#endregion
|
|
1340
|
-
export { StylisticConfig, defineConfig
|
|
1410
|
+
export { StylisticConfig, defineConfig, e18e, es, ignores, imports, jsdoc, jsonc, jsx, markdown, meta, next, node, perfectionist, react, restrictedGlobals, restrictedImportPaths, stylistic, test, ts, unicorn, unusedImports, yml };
|
|
1341
1411
|
|
|
1342
1412
|
//# sourceMappingURL=index.js.map
|