@useinsider/eslint-config 3.0.1 → 3.0.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/dist/configs/strict/index.d.ts +1 -0
- package/dist/main.cjs +195 -175
- package/dist/main.cjs.map +1 -1
- package/dist/main.js +195 -175
- package/dist/main.js.map +1 -1
- package/dist/{strict-B2mCkeX_.js → strict-BHw_cKrv.js} +2 -1
- package/dist/strict-BHw_cKrv.js.map +1 -0
- package/dist/{strict-tmp-wKop.cjs → strict-DnJFBY_B.cjs} +2 -1
- package/dist/strict-DnJFBY_B.cjs.map +1 -0
- package/dist/utils/ensureConfigStructure.d.ts +10 -0
- package/package.json +1 -1
- package/dist/strict-B2mCkeX_.js.map +0 -1
- package/dist/strict-tmp-wKop.cjs.map +0 -1
package/dist/main.js
CHANGED
|
@@ -63,177 +63,6 @@ function buildJqueryBlocks(entries) {
|
|
|
63
63
|
}));
|
|
64
64
|
}
|
|
65
65
|
//#endregion
|
|
66
|
-
//#region src/builders/typescript.ts
|
|
67
|
-
function applyTypescriptOverrides(block, input) {
|
|
68
|
-
const languageOptions = block.languageOptions ?? {};
|
|
69
|
-
const parserOptions = languageOptions.parserOptions ?? {};
|
|
70
|
-
parserOptions.project = input.tsconfigPaths;
|
|
71
|
-
parserOptions.tsconfigRootDir = process.cwd();
|
|
72
|
-
languageOptions.parserOptions = parserOptions;
|
|
73
|
-
block.languageOptions = languageOptions;
|
|
74
|
-
return block;
|
|
75
|
-
}
|
|
76
|
-
//#endregion
|
|
77
|
-
//#region src/builders/vue.ts
|
|
78
|
-
function escapeRegex(input) {
|
|
79
|
-
return input.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&");
|
|
80
|
-
}
|
|
81
|
-
function anchoredEscapeRegex(input) {
|
|
82
|
-
return `^${escapeRegex(input)}$`;
|
|
83
|
-
}
|
|
84
|
-
function applyVueOverrides(block, input) {
|
|
85
|
-
if (!input.globalComponents || input.globalComponents.length === 0) return block;
|
|
86
|
-
const rules = block.rules ?? {};
|
|
87
|
-
rules["vue/no-undef-components"] = ["error", { ignorePatterns: input.globalComponents.map(anchoredEscapeRegex) }];
|
|
88
|
-
block.rules = rules;
|
|
89
|
-
return block;
|
|
90
|
-
}
|
|
91
|
-
//#endregion
|
|
92
|
-
//#region src/builders/scopeBlocks.ts
|
|
93
|
-
var scopeMap = {
|
|
94
|
-
async javascript() {
|
|
95
|
-
return import("./javascript-9ynvToz3.js");
|
|
96
|
-
},
|
|
97
|
-
async javascriptDom() {
|
|
98
|
-
return import("./javascript-dom-B1wtLzJC.js");
|
|
99
|
-
},
|
|
100
|
-
async javascriptNode() {
|
|
101
|
-
return import("./javascript-node-JaASOojH.js");
|
|
102
|
-
},
|
|
103
|
-
async typescript() {
|
|
104
|
-
return import("./typescript-C7Xg57WE.js");
|
|
105
|
-
},
|
|
106
|
-
async typescriptDom() {
|
|
107
|
-
return import("./typescript-dom-ClE8ufzf.js");
|
|
108
|
-
},
|
|
109
|
-
async typescriptNode() {
|
|
110
|
-
return import("./typescript-node-CbViUIa8.js");
|
|
111
|
-
},
|
|
112
|
-
async vue2() {
|
|
113
|
-
return import("./vue2-CYgPhPVM.js");
|
|
114
|
-
},
|
|
115
|
-
async vue3() {
|
|
116
|
-
return import("./vue3-haIiBEhv.js");
|
|
117
|
-
},
|
|
118
|
-
async vue2Typescript() {
|
|
119
|
-
return import("./vue2-typescript-BbhsVbsV.js");
|
|
120
|
-
},
|
|
121
|
-
async vue3Typescript() {
|
|
122
|
-
return import("./vue3-typescript-BRN2iL98.js");
|
|
123
|
-
},
|
|
124
|
-
async vue2OptionsApi() {
|
|
125
|
-
return import("./vue2-options-api-Dvem0WyV.js");
|
|
126
|
-
},
|
|
127
|
-
async vue3OptionsApi() {
|
|
128
|
-
return import("./vue3-options-api-DkF4JagY.js");
|
|
129
|
-
},
|
|
130
|
-
async vue2TypescriptOptionsApi() {
|
|
131
|
-
return import("./vue2-typescript-options-api-A5jU6hdD.js");
|
|
132
|
-
},
|
|
133
|
-
async vue3TypescriptOptionsApi() {
|
|
134
|
-
return import("./vue3-typescript-options-api-BZ-QVwuD.js");
|
|
135
|
-
},
|
|
136
|
-
async jest() {
|
|
137
|
-
return import("./jest-zpwEzF4X.js");
|
|
138
|
-
},
|
|
139
|
-
async vitest() {
|
|
140
|
-
return import("./vitest-Cdq7Gq88.js");
|
|
141
|
-
},
|
|
142
|
-
async jsdocBasedTs() {
|
|
143
|
-
return import("./jsdoc-based-ts-D7tlky3K.js");
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
var tsScopes = /* @__PURE__ */ new Set([
|
|
147
|
-
"typescript",
|
|
148
|
-
"typescriptDom",
|
|
149
|
-
"typescriptNode",
|
|
150
|
-
"vue2Typescript",
|
|
151
|
-
"vue3Typescript",
|
|
152
|
-
"vue2TypescriptOptionsApi",
|
|
153
|
-
"vue3TypescriptOptionsApi",
|
|
154
|
-
"jsdocBasedTs"
|
|
155
|
-
]);
|
|
156
|
-
var vueScopes = /* @__PURE__ */ new Set([
|
|
157
|
-
"vue2",
|
|
158
|
-
"vue3",
|
|
159
|
-
"vue2Typescript",
|
|
160
|
-
"vue3Typescript",
|
|
161
|
-
"vue2OptionsApi",
|
|
162
|
-
"vue3OptionsApi",
|
|
163
|
-
"vue2TypescriptOptionsApi",
|
|
164
|
-
"vue3TypescriptOptionsApi"
|
|
165
|
-
]);
|
|
166
|
-
function cloneLanguageOptions(languageOptions) {
|
|
167
|
-
const clone = { ...languageOptions };
|
|
168
|
-
if (languageOptions.parserOptions) clone.parserOptions = { ...languageOptions.parserOptions };
|
|
169
|
-
if (languageOptions.globals) clone.globals = { ...languageOptions.globals };
|
|
170
|
-
return clone;
|
|
171
|
-
}
|
|
172
|
-
function clonePreset(preset) {
|
|
173
|
-
const { languageOptions, rules, settings, ...rest } = preset;
|
|
174
|
-
const clone = { ...rest };
|
|
175
|
-
if (languageOptions) clone.languageOptions = cloneLanguageOptions(languageOptions);
|
|
176
|
-
if (rules) clone.rules = { ...rules };
|
|
177
|
-
if (settings) clone.settings = { ...settings };
|
|
178
|
-
return clone;
|
|
179
|
-
}
|
|
180
|
-
function isScopeName(key) {
|
|
181
|
-
return Object.keys(scopeMap).includes(key);
|
|
182
|
-
}
|
|
183
|
-
function applyCommonEntryFields(block, entry) {
|
|
184
|
-
if (entry.ignores && entry.ignores.length > 0) block.ignores = [...entry.ignores];
|
|
185
|
-
if (entry.globals) {
|
|
186
|
-
const languageOptions = block.languageOptions ?? {};
|
|
187
|
-
languageOptions.globals = {
|
|
188
|
-
...languageOptions.globals ?? {},
|
|
189
|
-
...entry.globals
|
|
190
|
-
};
|
|
191
|
-
block.languageOptions = languageOptions;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
async function buildScopeBlocks(scope, entries) {
|
|
195
|
-
const preset = (await scopeMap[scope]()).default;
|
|
196
|
-
return entries.map((entry) => {
|
|
197
|
-
const block = clonePreset(preset);
|
|
198
|
-
block.files = entry.files;
|
|
199
|
-
if (tsScopes.has(scope)) {
|
|
200
|
-
const { tsconfigPaths } = entry;
|
|
201
|
-
if (tsconfigPaths) applyTypescriptOverrides(block, { tsconfigPaths });
|
|
202
|
-
}
|
|
203
|
-
if (vueScopes.has(scope)) {
|
|
204
|
-
const { globalComponents } = entry;
|
|
205
|
-
applyVueOverrides(block, { globalComponents });
|
|
206
|
-
}
|
|
207
|
-
applyCommonEntryFields(block, entry);
|
|
208
|
-
return block;
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
//#endregion
|
|
212
|
-
//#region src/builders/spellChecker.ts
|
|
213
|
-
function buildSpellCheckerBlocks(input) {
|
|
214
|
-
if (!input) return [];
|
|
215
|
-
const blocks = [];
|
|
216
|
-
if (input.customWordListFile) blocks.push({ rules: { "@cspell/spellchecker": ["error", { customWordListFile: input.customWordListFile }] } });
|
|
217
|
-
if (input.ignoredPaths && input.ignoredPaths.length > 0) blocks.push({
|
|
218
|
-
files: input.ignoredPaths,
|
|
219
|
-
rules: { "@cspell/spellchecker": "off" }
|
|
220
|
-
});
|
|
221
|
-
return blocks;
|
|
222
|
-
}
|
|
223
|
-
//#endregion
|
|
224
|
-
//#region src/builders/strict.ts
|
|
225
|
-
async function buildStrictBlocks(value) {
|
|
226
|
-
if (!value) return [];
|
|
227
|
-
const isFileScoped = Array.isArray(value);
|
|
228
|
-
if (isFileScoped && value.length === 0) return [];
|
|
229
|
-
const { default: strictConfig } = await import("./strict-B2mCkeX_.js");
|
|
230
|
-
const clone = { ...strictConfig };
|
|
231
|
-
if (clone.rules) clone.rules = { ...clone.rules };
|
|
232
|
-
if (isFileScoped) clone.files = value;
|
|
233
|
-
else delete clone.files;
|
|
234
|
-
return [clone];
|
|
235
|
-
}
|
|
236
|
-
//#endregion
|
|
237
66
|
//#region src/utils/ensureConfigStructure.ts
|
|
238
67
|
var CONFIG_FILE_REGEX = /eslint\.config\.[mc]?[jt]s(?:$|\?)/;
|
|
239
68
|
var OPT_OUT_ENV = "INSIDER_SKIP_CONFIG_VALIDATION";
|
|
@@ -417,6 +246,21 @@ function getConsumerConfigPath(frames = readStackFrames(), argv = process.argv)
|
|
|
417
246
|
if (fromArgv) return fromArgv;
|
|
418
247
|
return null;
|
|
419
248
|
}
|
|
249
|
+
var consumerConfigDir = null;
|
|
250
|
+
function captureConsumerConfigDir(configPath) {
|
|
251
|
+
consumerConfigDir = configPath === null ? null : dirname(resolve(configPath));
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Directory holding the consumer's `eslint.config.*`, captured by {@link ensureConfigStructure}.
|
|
255
|
+
* This is the anchor `tsconfigPaths` entries are written against; it falls back to `process.cwd()`
|
|
256
|
+
* when the config file could not be located.
|
|
257
|
+
* @example
|
|
258
|
+
* // consumer config at /repo/eslint.config.mjs, `eslint` launched from /repo/app
|
|
259
|
+
* getConsumerConfigDir(); // '/repo'
|
|
260
|
+
*/
|
|
261
|
+
function getConsumerConfigDir() {
|
|
262
|
+
return consumerConfigDir ?? process.cwd();
|
|
263
|
+
}
|
|
420
264
|
function formatReport(configPath, violations) {
|
|
421
265
|
const header = ["@useinsider/eslint-config: protected configuration structure violated in:", ` ${configPath}`].join("\n");
|
|
422
266
|
const lines = violations.map((violation) => ` - [${violation.line}:${violation.column}] ${violation.reason}`);
|
|
@@ -468,26 +312,198 @@ function parseConsumerSource(configPath, source) {
|
|
|
468
312
|
return fail(`@useinsider/eslint-config: failed to parse consumer config at ${configPath}: ${message}`);
|
|
469
313
|
}
|
|
470
314
|
}
|
|
471
|
-
function runValidation(
|
|
472
|
-
const configPath = overridePath === void 0 ? getConsumerConfigPath() : overridePath;
|
|
315
|
+
function runValidation(configPath) {
|
|
473
316
|
if (!configPath) fail(["@useinsider/eslint-config: unable to locate consumer `eslint.config.*` file for structure validation.", "If this is an unexpected environment, set INSIDER_SKIP_CONFIG_VALIDATION=true (do not commit)."].join("\n"));
|
|
474
317
|
const violations = validateProgramStructure(parseConsumerSource(configPath, readConsumerSource(configPath)), configPath);
|
|
475
318
|
if (violations.length === 0) return;
|
|
476
319
|
fail(formatReport(configPath, violations));
|
|
477
320
|
}
|
|
478
321
|
function ensureConfigStructure(overridePath) {
|
|
322
|
+
const configPath = overridePath === void 0 ? getConsumerConfigPath() : overridePath;
|
|
323
|
+
captureConsumerConfigDir(configPath);
|
|
479
324
|
if (process.env[OPT_OUT_ENV] === "true") {
|
|
480
325
|
emitBypassWarning();
|
|
481
326
|
return;
|
|
482
327
|
}
|
|
483
328
|
try {
|
|
484
|
-
runValidation(
|
|
329
|
+
runValidation(configPath);
|
|
485
330
|
} catch (error) {
|
|
486
331
|
if (error instanceof ConfigStructureExit) return;
|
|
487
332
|
throw error;
|
|
488
333
|
}
|
|
489
334
|
}
|
|
490
335
|
//#endregion
|
|
336
|
+
//#region src/builders/typescript.ts
|
|
337
|
+
function applyTypescriptOverrides(block, input) {
|
|
338
|
+
const languageOptions = block.languageOptions ?? {};
|
|
339
|
+
const parserOptions = languageOptions.parserOptions ?? {};
|
|
340
|
+
parserOptions.project = input.tsconfigPaths;
|
|
341
|
+
parserOptions.tsconfigRootDir = getConsumerConfigDir();
|
|
342
|
+
languageOptions.parserOptions = parserOptions;
|
|
343
|
+
block.languageOptions = languageOptions;
|
|
344
|
+
return block;
|
|
345
|
+
}
|
|
346
|
+
//#endregion
|
|
347
|
+
//#region src/builders/vue.ts
|
|
348
|
+
function escapeRegex(input) {
|
|
349
|
+
return input.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&");
|
|
350
|
+
}
|
|
351
|
+
function anchoredEscapeRegex(input) {
|
|
352
|
+
return `^${escapeRegex(input)}$`;
|
|
353
|
+
}
|
|
354
|
+
function applyVueOverrides(block, input) {
|
|
355
|
+
if (!input.globalComponents || input.globalComponents.length === 0) return block;
|
|
356
|
+
const rules = block.rules ?? {};
|
|
357
|
+
rules["vue/no-undef-components"] = ["error", { ignorePatterns: input.globalComponents.map(anchoredEscapeRegex) }];
|
|
358
|
+
block.rules = rules;
|
|
359
|
+
return block;
|
|
360
|
+
}
|
|
361
|
+
//#endregion
|
|
362
|
+
//#region src/builders/scopeBlocks.ts
|
|
363
|
+
var scopeMap = {
|
|
364
|
+
async javascript() {
|
|
365
|
+
return import("./javascript-9ynvToz3.js");
|
|
366
|
+
},
|
|
367
|
+
async javascriptDom() {
|
|
368
|
+
return import("./javascript-dom-B1wtLzJC.js");
|
|
369
|
+
},
|
|
370
|
+
async javascriptNode() {
|
|
371
|
+
return import("./javascript-node-JaASOojH.js");
|
|
372
|
+
},
|
|
373
|
+
async typescript() {
|
|
374
|
+
return import("./typescript-C7Xg57WE.js");
|
|
375
|
+
},
|
|
376
|
+
async typescriptDom() {
|
|
377
|
+
return import("./typescript-dom-ClE8ufzf.js");
|
|
378
|
+
},
|
|
379
|
+
async typescriptNode() {
|
|
380
|
+
return import("./typescript-node-CbViUIa8.js");
|
|
381
|
+
},
|
|
382
|
+
async vue2() {
|
|
383
|
+
return import("./vue2-CYgPhPVM.js");
|
|
384
|
+
},
|
|
385
|
+
async vue3() {
|
|
386
|
+
return import("./vue3-haIiBEhv.js");
|
|
387
|
+
},
|
|
388
|
+
async vue2Typescript() {
|
|
389
|
+
return import("./vue2-typescript-BbhsVbsV.js");
|
|
390
|
+
},
|
|
391
|
+
async vue3Typescript() {
|
|
392
|
+
return import("./vue3-typescript-BRN2iL98.js");
|
|
393
|
+
},
|
|
394
|
+
async vue2OptionsApi() {
|
|
395
|
+
return import("./vue2-options-api-Dvem0WyV.js");
|
|
396
|
+
},
|
|
397
|
+
async vue3OptionsApi() {
|
|
398
|
+
return import("./vue3-options-api-DkF4JagY.js");
|
|
399
|
+
},
|
|
400
|
+
async vue2TypescriptOptionsApi() {
|
|
401
|
+
return import("./vue2-typescript-options-api-A5jU6hdD.js");
|
|
402
|
+
},
|
|
403
|
+
async vue3TypescriptOptionsApi() {
|
|
404
|
+
return import("./vue3-typescript-options-api-BZ-QVwuD.js");
|
|
405
|
+
},
|
|
406
|
+
async jest() {
|
|
407
|
+
return import("./jest-zpwEzF4X.js");
|
|
408
|
+
},
|
|
409
|
+
async vitest() {
|
|
410
|
+
return import("./vitest-Cdq7Gq88.js");
|
|
411
|
+
},
|
|
412
|
+
async jsdocBasedTs() {
|
|
413
|
+
return import("./jsdoc-based-ts-D7tlky3K.js");
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
var tsScopes = /* @__PURE__ */ new Set([
|
|
417
|
+
"typescript",
|
|
418
|
+
"typescriptDom",
|
|
419
|
+
"typescriptNode",
|
|
420
|
+
"vue2Typescript",
|
|
421
|
+
"vue3Typescript",
|
|
422
|
+
"vue2TypescriptOptionsApi",
|
|
423
|
+
"vue3TypescriptOptionsApi",
|
|
424
|
+
"jsdocBasedTs"
|
|
425
|
+
]);
|
|
426
|
+
var vueScopes = /* @__PURE__ */ new Set([
|
|
427
|
+
"vue2",
|
|
428
|
+
"vue3",
|
|
429
|
+
"vue2Typescript",
|
|
430
|
+
"vue3Typescript",
|
|
431
|
+
"vue2OptionsApi",
|
|
432
|
+
"vue3OptionsApi",
|
|
433
|
+
"vue2TypescriptOptionsApi",
|
|
434
|
+
"vue3TypescriptOptionsApi"
|
|
435
|
+
]);
|
|
436
|
+
function cloneLanguageOptions(languageOptions) {
|
|
437
|
+
const clone = { ...languageOptions };
|
|
438
|
+
if (languageOptions.parserOptions) clone.parserOptions = { ...languageOptions.parserOptions };
|
|
439
|
+
if (languageOptions.globals) clone.globals = { ...languageOptions.globals };
|
|
440
|
+
return clone;
|
|
441
|
+
}
|
|
442
|
+
function clonePreset(preset) {
|
|
443
|
+
const { languageOptions, rules, settings, ...rest } = preset;
|
|
444
|
+
const clone = { ...rest };
|
|
445
|
+
if (languageOptions) clone.languageOptions = cloneLanguageOptions(languageOptions);
|
|
446
|
+
if (rules) clone.rules = { ...rules };
|
|
447
|
+
if (settings) clone.settings = { ...settings };
|
|
448
|
+
return clone;
|
|
449
|
+
}
|
|
450
|
+
function isScopeName(key) {
|
|
451
|
+
return Object.keys(scopeMap).includes(key);
|
|
452
|
+
}
|
|
453
|
+
function applyCommonEntryFields(block, entry) {
|
|
454
|
+
if (entry.ignores && entry.ignores.length > 0) block.ignores = [...entry.ignores];
|
|
455
|
+
if (entry.globals) {
|
|
456
|
+
const languageOptions = block.languageOptions ?? {};
|
|
457
|
+
languageOptions.globals = {
|
|
458
|
+
...languageOptions.globals ?? {},
|
|
459
|
+
...entry.globals
|
|
460
|
+
};
|
|
461
|
+
block.languageOptions = languageOptions;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
async function buildScopeBlocks(scope, entries) {
|
|
465
|
+
const preset = (await scopeMap[scope]()).default;
|
|
466
|
+
return entries.map((entry) => {
|
|
467
|
+
const block = clonePreset(preset);
|
|
468
|
+
block.files = entry.files;
|
|
469
|
+
if (tsScopes.has(scope)) {
|
|
470
|
+
const { tsconfigPaths } = entry;
|
|
471
|
+
if (tsconfigPaths) applyTypescriptOverrides(block, { tsconfigPaths });
|
|
472
|
+
}
|
|
473
|
+
if (vueScopes.has(scope)) {
|
|
474
|
+
const { globalComponents } = entry;
|
|
475
|
+
applyVueOverrides(block, { globalComponents });
|
|
476
|
+
}
|
|
477
|
+
applyCommonEntryFields(block, entry);
|
|
478
|
+
return block;
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
//#endregion
|
|
482
|
+
//#region src/builders/spellChecker.ts
|
|
483
|
+
function buildSpellCheckerBlocks(input) {
|
|
484
|
+
if (!input) return [];
|
|
485
|
+
const blocks = [];
|
|
486
|
+
if (input.customWordListFile) blocks.push({ rules: { "@cspell/spellchecker": ["error", { customWordListFile: input.customWordListFile }] } });
|
|
487
|
+
if (input.ignoredPaths && input.ignoredPaths.length > 0) blocks.push({
|
|
488
|
+
files: input.ignoredPaths,
|
|
489
|
+
rules: { "@cspell/spellchecker": "off" }
|
|
490
|
+
});
|
|
491
|
+
return blocks;
|
|
492
|
+
}
|
|
493
|
+
//#endregion
|
|
494
|
+
//#region src/builders/strict.ts
|
|
495
|
+
async function buildStrictBlocks(value) {
|
|
496
|
+
if (!value) return [];
|
|
497
|
+
const isFileScoped = Array.isArray(value);
|
|
498
|
+
if (isFileScoped && value.length === 0) return [];
|
|
499
|
+
const { default: strictConfig } = await import("./strict-BHw_cKrv.js");
|
|
500
|
+
const clone = { ...strictConfig };
|
|
501
|
+
if (clone.rules) clone.rules = { ...clone.rules };
|
|
502
|
+
if (isFileScoped) clone.files = value;
|
|
503
|
+
else delete clone.files;
|
|
504
|
+
return [clone];
|
|
505
|
+
}
|
|
506
|
+
//#endregion
|
|
491
507
|
//#region src/utils/ensureDependencies.ts
|
|
492
508
|
var turnOff = false;
|
|
493
509
|
var scanned = false;
|
|
@@ -559,6 +575,10 @@ function silenceRules(rules) {
|
|
|
559
575
|
globallySilencedRules.add(rule);
|
|
560
576
|
});
|
|
561
577
|
}
|
|
578
|
+
function isDisabled(config) {
|
|
579
|
+
const [severity] = Array.isArray(config) ? config : [config];
|
|
580
|
+
return severity === "off" || severity === 0;
|
|
581
|
+
}
|
|
562
582
|
function silenceRule(config) {
|
|
563
583
|
const [, ...restConfig] = Array.isArray(config) ? config : [];
|
|
564
584
|
return ["warn", ...restConfig];
|
|
@@ -572,7 +592,7 @@ function filterSilencedRules(rules, silencedRules) {
|
|
|
572
592
|
warn(`Unknown rule "${rule}". Please remove it from the silenced rules list.`);
|
|
573
593
|
});
|
|
574
594
|
return Object.entries(rules).reduce((newRules, [key, value]) => {
|
|
575
|
-
if (value) newRules[key] = targetSilencedRules.has(key) ? silenceRule(value) : value;
|
|
595
|
+
if (value) newRules[key] = targetSilencedRules.has(key) && !isDisabled(value) ? silenceRule(value) : value;
|
|
576
596
|
return newRules;
|
|
577
597
|
}, {});
|
|
578
598
|
}
|