pickier 0.1.16 → 0.1.18
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/bin/cli.js +421 -273
- package/dist/plugins/utils.d.ts +2 -0
- package/dist/src/index.js +425 -277
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -6136,7 +6136,7 @@ var init_config = __esm(async () => {
|
|
|
6136
6136
|
"markdown/proper-names": "off",
|
|
6137
6137
|
"markdown/no-alt-text": "warn",
|
|
6138
6138
|
"markdown/table-pipe-style": "warn",
|
|
6139
|
-
"markdown/table-column-count": "
|
|
6139
|
+
"markdown/table-column-count": "warn",
|
|
6140
6140
|
"markdown/table-column-style": "warn",
|
|
6141
6141
|
"lockfile/validate-host": ["warn", { allowedHosts: ["npm", "yarn"] }],
|
|
6142
6142
|
"lockfile/validate-https": "error",
|
|
@@ -6213,13 +6213,9 @@ async function loadConfigFromPath(pathLike) {
|
|
|
6213
6213
|
return _cachedDefaultConfig;
|
|
6214
6214
|
}
|
|
6215
6215
|
try {
|
|
6216
|
-
const {
|
|
6217
|
-
const
|
|
6218
|
-
|
|
6219
|
-
if (existsSync6(configPath)) {
|
|
6220
|
-
const { config: config4 } = await init_config().then(() => exports_config);
|
|
6221
|
-
return mergeConfig(config4, {});
|
|
6222
|
-
}
|
|
6216
|
+
const { getConfig: getConfig2 } = await init_config().then(() => exports_config);
|
|
6217
|
+
const cfg = await getConfig2();
|
|
6218
|
+
return mergeConfig(defaultConfig3, cfg);
|
|
6223
6219
|
} catch {}
|
|
6224
6220
|
return mergeConfig(defaultConfig3, {});
|
|
6225
6221
|
}
|
|
@@ -15093,6 +15089,27 @@ var init_require_await = __esm(() => {
|
|
|
15093
15089
|
};
|
|
15094
15090
|
});
|
|
15095
15091
|
|
|
15092
|
+
// src/plugins/utils.ts
|
|
15093
|
+
function codeOnly(rule) {
|
|
15094
|
+
return {
|
|
15095
|
+
meta: rule.meta,
|
|
15096
|
+
check: (content, context) => {
|
|
15097
|
+
if (!CODE_EXTS2.test(context.filePath))
|
|
15098
|
+
return [];
|
|
15099
|
+
return rule.check(content, context);
|
|
15100
|
+
},
|
|
15101
|
+
fix: rule.fix ? (content, context) => {
|
|
15102
|
+
if (!CODE_EXTS2.test(context.filePath))
|
|
15103
|
+
return content;
|
|
15104
|
+
return rule.fix(content, context);
|
|
15105
|
+
} : undefined
|
|
15106
|
+
};
|
|
15107
|
+
}
|
|
15108
|
+
var CODE_EXTS2;
|
|
15109
|
+
var init_utils2 = __esm(() => {
|
|
15110
|
+
CODE_EXTS2 = /\.(?:ts|js|tsx|jsx|mts|mjs|cts|cjs)$/;
|
|
15111
|
+
});
|
|
15112
|
+
|
|
15096
15113
|
// src/plugins/eslint.ts
|
|
15097
15114
|
var eslintPlugin;
|
|
15098
15115
|
var init_eslint = __esm(() => {
|
|
@@ -15161,74 +15178,75 @@ var init_eslint = __esm(() => {
|
|
|
15161
15178
|
init_no_with();
|
|
15162
15179
|
init_prefer_arrow_callback();
|
|
15163
15180
|
init_require_await();
|
|
15181
|
+
init_utils2();
|
|
15164
15182
|
eslintPlugin = {
|
|
15165
15183
|
name: "eslint",
|
|
15166
15184
|
rules: {
|
|
15167
|
-
"array-callback-return": arrayCallbackReturnRule,
|
|
15168
|
-
"constructor-super": constructorSuperRule,
|
|
15169
|
-
"for-direction": forDirectionRule,
|
|
15170
|
-
"getter-return": getterReturnRule,
|
|
15171
|
-
"no-async-promise-executor": noAsyncPromiseExecutorRule,
|
|
15172
|
-
"no-compare-neg-zero": noCompareNegZeroRule,
|
|
15173
|
-
"no-cond-assign": noCondAssignRule,
|
|
15174
|
-
"no-constant-condition": noConstantConditionRule,
|
|
15175
|
-
"no-const-assign": noConstAssignRule,
|
|
15176
|
-
"no-dupe-class-members": noDupeClassMembersRule,
|
|
15177
|
-
"no-dupe-keys": noDupeKeysRule,
|
|
15178
|
-
"no-duplicate-case": noDuplicateCaseRule,
|
|
15179
|
-
"no-empty-pattern": noEmptyPatternRule,
|
|
15180
|
-
"no-fallthrough": noFallthroughRule,
|
|
15181
|
-
"no-loss-of-precision": noLossOfPrecisionRule,
|
|
15182
|
-
"no-promise-executor-return": noPromiseExecutorReturnRule,
|
|
15183
|
-
"no-redeclare": noRedeclareRule,
|
|
15184
|
-
"no-self-assign": noSelfAssignRule,
|
|
15185
|
-
"no-self-compare": noSelfCompareRule,
|
|
15186
|
-
"no-sparse-arrays": noSparseArraysRule,
|
|
15187
|
-
"no-undef": noUndefRule,
|
|
15188
|
-
"no-unsafe-negation": noUnsafeNegationRule,
|
|
15189
|
-
"no-unreachable": noUnreachableRule,
|
|
15190
|
-
"no-useless-catch": noUselessCatchRule,
|
|
15191
|
-
"use-isnan": useIsNaNRule,
|
|
15192
|
-
"valid-typeof": validTypeofRule,
|
|
15193
|
-
"default-case": defaultCaseRule,
|
|
15194
|
-
eqeqeq: eqeqeqRule,
|
|
15195
|
-
"no-alert": noAlertRule,
|
|
15196
|
-
"no-await-in-loop": noAwaitInLoopRule,
|
|
15197
|
-
"no-caller": noCallerRule,
|
|
15198
|
-
"no-case-declarations": noCaseDeclarationsRule,
|
|
15199
|
-
"no-else-return": noElseReturnRule,
|
|
15200
|
-
"no-empty": noEmptyRule,
|
|
15201
|
-
"no-empty-function": noEmptyFunctionRule,
|
|
15202
|
-
"no-eval": noEvalRule,
|
|
15203
|
-
"no-extend-native": noExtendNativeRule,
|
|
15204
|
-
"no-global-assign": noGlobalAssignRule,
|
|
15205
|
-
"no-implied-eval": noImpliedEvalRule,
|
|
15206
|
-
"no-iterator": noIteratorRule,
|
|
15207
|
-
"no-new": noNewRule,
|
|
15208
|
-
"no-new-func": noNewFuncRule,
|
|
15209
|
-
"no-new-wrappers": noNewWrappersRule,
|
|
15210
|
-
"no-octal": noOctalRule,
|
|
15211
|
-
"no-param-reassign": noParamReassignRule,
|
|
15212
|
-
"no-proto": noProtoRule,
|
|
15213
|
-
"no-return-assign": noReturnAssignRule,
|
|
15214
|
-
"no-shadow": noShadowRule,
|
|
15215
|
-
"no-throw-literal": noThrowLiteralRule,
|
|
15216
|
-
"no-use-before-define": noUseBeforeDefineRule,
|
|
15217
|
-
"no-useless-call": noUselessCallRule,
|
|
15218
|
-
"no-with": noWithRule,
|
|
15219
|
-
"require-await": requireAwaitRule,
|
|
15220
|
-
complexity: complexityRule,
|
|
15221
|
-
"max-depth": maxDepthRule,
|
|
15222
|
-
"max-lines-per-function": maxLinesPerFunctionRule,
|
|
15223
|
-
"no-extra-boolean-cast": noExtraBooleanCastRule,
|
|
15224
|
-
"no-lonely-if": noLonelyIfRule,
|
|
15225
|
-
"no-sequences": noSequencesRule,
|
|
15226
|
-
"no-useless-concat": noUselessConcatRule,
|
|
15227
|
-
"no-useless-escape": noUselessEscapeRule,
|
|
15228
|
-
"no-useless-rename": noUselessRenameRule,
|
|
15229
|
-
"no-useless-return": noUselessReturnRule,
|
|
15230
|
-
"no-var": noVarRule,
|
|
15231
|
-
"prefer-arrow-callback": preferArrowCallbackRule
|
|
15185
|
+
"array-callback-return": codeOnly(arrayCallbackReturnRule),
|
|
15186
|
+
"constructor-super": codeOnly(constructorSuperRule),
|
|
15187
|
+
"for-direction": codeOnly(forDirectionRule),
|
|
15188
|
+
"getter-return": codeOnly(getterReturnRule),
|
|
15189
|
+
"no-async-promise-executor": codeOnly(noAsyncPromiseExecutorRule),
|
|
15190
|
+
"no-compare-neg-zero": codeOnly(noCompareNegZeroRule),
|
|
15191
|
+
"no-cond-assign": codeOnly(noCondAssignRule),
|
|
15192
|
+
"no-constant-condition": codeOnly(noConstantConditionRule),
|
|
15193
|
+
"no-const-assign": codeOnly(noConstAssignRule),
|
|
15194
|
+
"no-dupe-class-members": codeOnly(noDupeClassMembersRule),
|
|
15195
|
+
"no-dupe-keys": codeOnly(noDupeKeysRule),
|
|
15196
|
+
"no-duplicate-case": codeOnly(noDuplicateCaseRule),
|
|
15197
|
+
"no-empty-pattern": codeOnly(noEmptyPatternRule),
|
|
15198
|
+
"no-fallthrough": codeOnly(noFallthroughRule),
|
|
15199
|
+
"no-loss-of-precision": codeOnly(noLossOfPrecisionRule),
|
|
15200
|
+
"no-promise-executor-return": codeOnly(noPromiseExecutorReturnRule),
|
|
15201
|
+
"no-redeclare": codeOnly(noRedeclareRule),
|
|
15202
|
+
"no-self-assign": codeOnly(noSelfAssignRule),
|
|
15203
|
+
"no-self-compare": codeOnly(noSelfCompareRule),
|
|
15204
|
+
"no-sparse-arrays": codeOnly(noSparseArraysRule),
|
|
15205
|
+
"no-undef": codeOnly(noUndefRule),
|
|
15206
|
+
"no-unsafe-negation": codeOnly(noUnsafeNegationRule),
|
|
15207
|
+
"no-unreachable": codeOnly(noUnreachableRule),
|
|
15208
|
+
"no-useless-catch": codeOnly(noUselessCatchRule),
|
|
15209
|
+
"use-isnan": codeOnly(useIsNaNRule),
|
|
15210
|
+
"valid-typeof": codeOnly(validTypeofRule),
|
|
15211
|
+
"default-case": codeOnly(defaultCaseRule),
|
|
15212
|
+
eqeqeq: codeOnly(eqeqeqRule),
|
|
15213
|
+
"no-alert": codeOnly(noAlertRule),
|
|
15214
|
+
"no-await-in-loop": codeOnly(noAwaitInLoopRule),
|
|
15215
|
+
"no-caller": codeOnly(noCallerRule),
|
|
15216
|
+
"no-case-declarations": codeOnly(noCaseDeclarationsRule),
|
|
15217
|
+
"no-else-return": codeOnly(noElseReturnRule),
|
|
15218
|
+
"no-empty": codeOnly(noEmptyRule),
|
|
15219
|
+
"no-empty-function": codeOnly(noEmptyFunctionRule),
|
|
15220
|
+
"no-eval": codeOnly(noEvalRule),
|
|
15221
|
+
"no-extend-native": codeOnly(noExtendNativeRule),
|
|
15222
|
+
"no-global-assign": codeOnly(noGlobalAssignRule),
|
|
15223
|
+
"no-implied-eval": codeOnly(noImpliedEvalRule),
|
|
15224
|
+
"no-iterator": codeOnly(noIteratorRule),
|
|
15225
|
+
"no-new": codeOnly(noNewRule),
|
|
15226
|
+
"no-new-func": codeOnly(noNewFuncRule),
|
|
15227
|
+
"no-new-wrappers": codeOnly(noNewWrappersRule),
|
|
15228
|
+
"no-octal": codeOnly(noOctalRule),
|
|
15229
|
+
"no-param-reassign": codeOnly(noParamReassignRule),
|
|
15230
|
+
"no-proto": codeOnly(noProtoRule),
|
|
15231
|
+
"no-return-assign": codeOnly(noReturnAssignRule),
|
|
15232
|
+
"no-shadow": codeOnly(noShadowRule),
|
|
15233
|
+
"no-throw-literal": codeOnly(noThrowLiteralRule),
|
|
15234
|
+
"no-use-before-define": codeOnly(noUseBeforeDefineRule),
|
|
15235
|
+
"no-useless-call": codeOnly(noUselessCallRule),
|
|
15236
|
+
"no-with": codeOnly(noWithRule),
|
|
15237
|
+
"require-await": codeOnly(requireAwaitRule),
|
|
15238
|
+
complexity: codeOnly(complexityRule),
|
|
15239
|
+
"max-depth": codeOnly(maxDepthRule),
|
|
15240
|
+
"max-lines-per-function": codeOnly(maxLinesPerFunctionRule),
|
|
15241
|
+
"no-extra-boolean-cast": codeOnly(noExtraBooleanCastRule),
|
|
15242
|
+
"no-lonely-if": codeOnly(noLonelyIfRule),
|
|
15243
|
+
"no-sequences": codeOnly(noSequencesRule),
|
|
15244
|
+
"no-useless-concat": codeOnly(noUselessConcatRule),
|
|
15245
|
+
"no-useless-escape": codeOnly(noUselessEscapeRule),
|
|
15246
|
+
"no-useless-rename": codeOnly(noUselessRenameRule),
|
|
15247
|
+
"no-useless-return": codeOnly(noUselessReturnRule),
|
|
15248
|
+
"no-var": codeOnly(noVarRule),
|
|
15249
|
+
"prefer-arrow-callback": codeOnly(preferArrowCallbackRule)
|
|
15232
15250
|
}
|
|
15233
15251
|
};
|
|
15234
15252
|
});
|
|
@@ -15246,8 +15264,8 @@ var init_no_constructor_return = __esm(() => {
|
|
|
15246
15264
|
for (let i = 0;i < lines.length; i++) {
|
|
15247
15265
|
const line = lines[i];
|
|
15248
15266
|
const commentIdx = line.indexOf("//");
|
|
15249
|
-
const
|
|
15250
|
-
const constructorMatch =
|
|
15267
|
+
const codeOnly2 = commentIdx >= 0 ? line.slice(0, commentIdx) : line;
|
|
15268
|
+
const constructorMatch = codeOnly2.match(/\bconstructor\s*\(/);
|
|
15251
15269
|
if (!constructorMatch)
|
|
15252
15270
|
continue;
|
|
15253
15271
|
let braceDepth = 0;
|
|
@@ -15491,6 +15509,8 @@ var init_no_regex_spaces = __esm(() => {
|
|
|
15491
15509
|
const lines = content.split(/\r?\n/);
|
|
15492
15510
|
for (let i = 0;i < lines.length; i++) {
|
|
15493
15511
|
const line = lines[i];
|
|
15512
|
+
if (/^\s*\/\//.test(line))
|
|
15513
|
+
continue;
|
|
15494
15514
|
const regexLiteralPattern = /\/(?![*/])((?:\\.|[^/\\])+)\/[gimsuvy]*/g;
|
|
15495
15515
|
let match;
|
|
15496
15516
|
while ((match = regexLiteralPattern.exec(line)) !== null) {
|
|
@@ -15939,7 +15959,7 @@ var init_no_unused_vars = __esm(() => {
|
|
|
15939
15959
|
const line = lines[i];
|
|
15940
15960
|
if (/^\s*\/\//.test(line))
|
|
15941
15961
|
continue;
|
|
15942
|
-
let
|
|
15962
|
+
let codeOnly2 = line;
|
|
15943
15963
|
let inStr = null;
|
|
15944
15964
|
let inRegex = false;
|
|
15945
15965
|
let escaped = false;
|
|
@@ -15967,7 +15987,7 @@ var init_no_unused_vars = __esm(() => {
|
|
|
15967
15987
|
if (/[=([{,:;!?]/.test(prevChar) || prev2Chars === "&&" || prev2Chars === "||" || /^\s*$/.test(line.slice(0, idx))) {
|
|
15968
15988
|
inRegex = true;
|
|
15969
15989
|
} else if (next === "/") {
|
|
15970
|
-
|
|
15990
|
+
codeOnly2 = line.slice(0, idx);
|
|
15971
15991
|
break;
|
|
15972
15992
|
}
|
|
15973
15993
|
}
|
|
@@ -16009,7 +16029,7 @@ var init_no_unused_vars = __esm(() => {
|
|
|
16009
16029
|
}
|
|
16010
16030
|
return result;
|
|
16011
16031
|
};
|
|
16012
|
-
const codeNoRegex = stripRegex(
|
|
16032
|
+
const codeNoRegex = stripRegex(codeOnly2);
|
|
16013
16033
|
const m = codeNoRegex.match(/\bfunction\b/);
|
|
16014
16034
|
if (m) {
|
|
16015
16035
|
if (line.includes("function scanContent") || line.includes("function findMatching")) {
|
|
@@ -16360,11 +16380,11 @@ var init_prefer_object_spread = __esm(() => {
|
|
|
16360
16380
|
if (/^\s*\/\//.test(line))
|
|
16361
16381
|
continue;
|
|
16362
16382
|
const commentIdx = line.indexOf("//");
|
|
16363
|
-
const
|
|
16364
|
-
const assignMatches =
|
|
16383
|
+
const codeOnly2 = commentIdx >= 0 ? line.slice(0, commentIdx) : line;
|
|
16384
|
+
const assignMatches = codeOnly2.matchAll(/\bObject\.assign\s*\(/g);
|
|
16365
16385
|
for (const match of assignMatches) {
|
|
16366
16386
|
const startIdx = match.index;
|
|
16367
|
-
const beforeAssign =
|
|
16387
|
+
const beforeAssign = codeOnly2.slice(0, startIdx);
|
|
16368
16388
|
const singleQuotes = (beforeAssign.match(/'/g) || []).length;
|
|
16369
16389
|
const doubleQuotes = (beforeAssign.match(/"/g) || []).length;
|
|
16370
16390
|
const backticks = (beforeAssign.match(/`/g) || []).length;
|
|
@@ -16372,7 +16392,7 @@ var init_prefer_object_spread = __esm(() => {
|
|
|
16372
16392
|
continue;
|
|
16373
16393
|
}
|
|
16374
16394
|
const openParenIdx = startIdx + "Object.assign".length;
|
|
16375
|
-
const restOfLine =
|
|
16395
|
+
const restOfLine = codeOnly2.slice(openParenIdx);
|
|
16376
16396
|
let firstArgEnd = -1;
|
|
16377
16397
|
let parenDepth = 1;
|
|
16378
16398
|
let braceDepth = 0;
|
|
@@ -16544,43 +16564,44 @@ var init_general = __esm(() => {
|
|
|
16544
16564
|
init_prefer_template();
|
|
16545
16565
|
init_use_isnan();
|
|
16546
16566
|
init_valid_typeof();
|
|
16567
|
+
init_utils2();
|
|
16547
16568
|
generalPlugin = {
|
|
16548
16569
|
name: "general",
|
|
16549
16570
|
rules: {
|
|
16550
|
-
"array-callback-return": arrayCallbackReturnRule,
|
|
16551
|
-
"constructor-super": constructorSuperRule,
|
|
16552
|
-
"for-direction": forDirectionRule,
|
|
16553
|
-
"getter-return": getterReturnRule,
|
|
16554
|
-
"no-async-promise-executor": noAsyncPromiseExecutorRule,
|
|
16555
|
-
"no-compare-neg-zero": noCompareNegZeroRule,
|
|
16556
|
-
"no-cond-assign": noCondAssignRule,
|
|
16557
|
-
"no-const-assign": noConstAssignRule,
|
|
16558
|
-
"no-constant-condition": noConstantConditionRule,
|
|
16559
|
-
"no-constructor-return": noConstructorReturnRule,
|
|
16560
|
-
"no-dupe-class-members": noDupeClassMembersRule,
|
|
16561
|
-
"no-dupe-keys": noDupeKeysRule,
|
|
16562
|
-
"no-duplicate-case": noDuplicateCaseRule,
|
|
16563
|
-
"no-empty-pattern": noEmptyPatternRule,
|
|
16564
|
-
"no-fallthrough": noFallthroughRule,
|
|
16565
|
-
"no-irregular-whitespace": noIrregularWhitespaceRule,
|
|
16566
|
-
"no-loss-of-precision": noLossOfPrecisionRule,
|
|
16567
|
-
"no-new": noNew,
|
|
16568
|
-
"no-regex-spaces": noRegexSpaces,
|
|
16569
|
-
"no-promise-executor-return": noPromiseExecutorReturnRule,
|
|
16570
|
-
"no-redeclare": noRedeclareRule,
|
|
16571
|
-
"no-self-assign": noSelfAssignRule,
|
|
16572
|
-
"no-self-compare": noSelfCompareRule,
|
|
16573
|
-
"no-sparse-arrays": noSparseArraysRule,
|
|
16574
|
-
"no-undef": noUndefRule,
|
|
16575
|
-
"no-unsafe-negation": noUnsafeNegationRule,
|
|
16576
|
-
"no-unreachable": noUnreachableRule,
|
|
16577
|
-
"no-unused-vars": noUnusedVarsRule,
|
|
16578
|
-
"no-useless-catch": noUselessCatchRule,
|
|
16579
|
-
"prefer-const": preferConstRule,
|
|
16580
|
-
"prefer-object-spread": preferObjectSpreadRule,
|
|
16581
|
-
"prefer-template": preferTemplate,
|
|
16582
|
-
"use-isnan": useIsNaNRule,
|
|
16583
|
-
"valid-typeof": validTypeofRule
|
|
16571
|
+
"array-callback-return": codeOnly(arrayCallbackReturnRule),
|
|
16572
|
+
"constructor-super": codeOnly(constructorSuperRule),
|
|
16573
|
+
"for-direction": codeOnly(forDirectionRule),
|
|
16574
|
+
"getter-return": codeOnly(getterReturnRule),
|
|
16575
|
+
"no-async-promise-executor": codeOnly(noAsyncPromiseExecutorRule),
|
|
16576
|
+
"no-compare-neg-zero": codeOnly(noCompareNegZeroRule),
|
|
16577
|
+
"no-cond-assign": codeOnly(noCondAssignRule),
|
|
16578
|
+
"no-const-assign": codeOnly(noConstAssignRule),
|
|
16579
|
+
"no-constant-condition": codeOnly(noConstantConditionRule),
|
|
16580
|
+
"no-constructor-return": codeOnly(noConstructorReturnRule),
|
|
16581
|
+
"no-dupe-class-members": codeOnly(noDupeClassMembersRule),
|
|
16582
|
+
"no-dupe-keys": codeOnly(noDupeKeysRule),
|
|
16583
|
+
"no-duplicate-case": codeOnly(noDuplicateCaseRule),
|
|
16584
|
+
"no-empty-pattern": codeOnly(noEmptyPatternRule),
|
|
16585
|
+
"no-fallthrough": codeOnly(noFallthroughRule),
|
|
16586
|
+
"no-irregular-whitespace": codeOnly(noIrregularWhitespaceRule),
|
|
16587
|
+
"no-loss-of-precision": codeOnly(noLossOfPrecisionRule),
|
|
16588
|
+
"no-new": codeOnly(noNew),
|
|
16589
|
+
"no-regex-spaces": codeOnly(noRegexSpaces),
|
|
16590
|
+
"no-promise-executor-return": codeOnly(noPromiseExecutorReturnRule),
|
|
16591
|
+
"no-redeclare": codeOnly(noRedeclareRule),
|
|
16592
|
+
"no-self-assign": codeOnly(noSelfAssignRule),
|
|
16593
|
+
"no-self-compare": codeOnly(noSelfCompareRule),
|
|
16594
|
+
"no-sparse-arrays": codeOnly(noSparseArraysRule),
|
|
16595
|
+
"no-undef": codeOnly(noUndefRule),
|
|
16596
|
+
"no-unsafe-negation": codeOnly(noUnsafeNegationRule),
|
|
16597
|
+
"no-unreachable": codeOnly(noUnreachableRule),
|
|
16598
|
+
"no-unused-vars": codeOnly(noUnusedVarsRule),
|
|
16599
|
+
"no-useless-catch": codeOnly(noUselessCatchRule),
|
|
16600
|
+
"prefer-const": codeOnly(preferConstRule),
|
|
16601
|
+
"prefer-object-spread": codeOnly(preferObjectSpreadRule),
|
|
16602
|
+
"prefer-template": codeOnly(preferTemplate),
|
|
16603
|
+
"use-isnan": codeOnly(useIsNaNRule),
|
|
16604
|
+
"valid-typeof": codeOnly(validTypeofRule)
|
|
16584
16605
|
}
|
|
16585
16606
|
};
|
|
16586
16607
|
});
|
|
@@ -18729,9 +18750,17 @@ var init_no_empty_links = __esm(() => {
|
|
|
18729
18750
|
check: (text, ctx) => {
|
|
18730
18751
|
const issues = [];
|
|
18731
18752
|
const lines = text.split(/\r?\n/);
|
|
18753
|
+
let inFence = false;
|
|
18732
18754
|
for (let i = 0;i < lines.length; i++) {
|
|
18733
18755
|
const line = lines[i];
|
|
18734
|
-
|
|
18756
|
+
if (/^(`{3,}|~{3,})/.test(line.trim())) {
|
|
18757
|
+
inFence = !inFence;
|
|
18758
|
+
continue;
|
|
18759
|
+
}
|
|
18760
|
+
if (inFence)
|
|
18761
|
+
continue;
|
|
18762
|
+
const stripped = line.replace(/`[^`]+`/g, (m) => "x".repeat(m.length));
|
|
18763
|
+
const emptyUrlMatches = stripped.matchAll(/\[[^\]]+\]\(\s*\)/g);
|
|
18735
18764
|
for (const match of emptyUrlMatches) {
|
|
18736
18765
|
const column = match.index + 1;
|
|
18737
18766
|
issues.push({
|
|
@@ -18743,7 +18772,7 @@ var init_no_empty_links = __esm(() => {
|
|
|
18743
18772
|
severity: "error"
|
|
18744
18773
|
});
|
|
18745
18774
|
}
|
|
18746
|
-
const emptyTextMatches =
|
|
18775
|
+
const emptyTextMatches = stripped.matchAll(/\[\s*\]\([^)]+\)/g);
|
|
18747
18776
|
for (const match of emptyTextMatches) {
|
|
18748
18777
|
const column = match.index + 1;
|
|
18749
18778
|
issues.push({
|
|
@@ -18771,8 +18800,15 @@ var init_no_hard_tabs = __esm(() => {
|
|
|
18771
18800
|
check: (text, ctx) => {
|
|
18772
18801
|
const issues = [];
|
|
18773
18802
|
const lines = text.split(/\r?\n/);
|
|
18803
|
+
let inFence = false;
|
|
18774
18804
|
for (let i = 0;i < lines.length; i++) {
|
|
18775
18805
|
const line = lines[i];
|
|
18806
|
+
if (/^(`{3,}|~{3,})/.test(line.trim())) {
|
|
18807
|
+
inFence = !inFence;
|
|
18808
|
+
continue;
|
|
18809
|
+
}
|
|
18810
|
+
if (inFence)
|
|
18811
|
+
continue;
|
|
18776
18812
|
const tabIndex = line.indexOf("\t");
|
|
18777
18813
|
if (tabIndex !== -1) {
|
|
18778
18814
|
issues.push({
|
|
@@ -20381,11 +20417,12 @@ var nodePlugin;
|
|
|
20381
20417
|
var init_node = __esm(() => {
|
|
20382
20418
|
init_prefer_global_buffer();
|
|
20383
20419
|
init_prefer_global_process();
|
|
20420
|
+
init_utils2();
|
|
20384
20421
|
nodePlugin = {
|
|
20385
20422
|
name: "node",
|
|
20386
20423
|
rules: {
|
|
20387
|
-
"prefer-global/buffer": preferGlobalBuffer,
|
|
20388
|
-
"prefer-global/process": preferGlobalProcess
|
|
20424
|
+
"prefer-global/buffer": codeOnly(preferGlobalBuffer),
|
|
20425
|
+
"prefer-global/process": codeOnly(preferGlobalProcess)
|
|
20389
20426
|
}
|
|
20390
20427
|
};
|
|
20391
20428
|
});
|
|
@@ -20429,10 +20466,11 @@ ${rest}`;
|
|
|
20429
20466
|
var perfectionistPlugin;
|
|
20430
20467
|
var init_perfectionist = __esm(() => {
|
|
20431
20468
|
init_imports();
|
|
20469
|
+
init_utils2();
|
|
20432
20470
|
perfectionistPlugin = {
|
|
20433
20471
|
name: "perfectionist",
|
|
20434
20472
|
rules: {
|
|
20435
|
-
"sort-imports": sortImportsRule
|
|
20473
|
+
"sort-imports": codeOnly(sortImportsRule)
|
|
20436
20474
|
}
|
|
20437
20475
|
};
|
|
20438
20476
|
});
|
|
@@ -21284,24 +21322,25 @@ var init_pickier = __esm(() => {
|
|
|
21284
21322
|
init_named_imports();
|
|
21285
21323
|
init_objects();
|
|
21286
21324
|
init_top_level_function();
|
|
21325
|
+
init_utils2();
|
|
21287
21326
|
pickierPlugin = {
|
|
21288
21327
|
name: "pickier",
|
|
21289
21328
|
rules: {
|
|
21290
|
-
"sort-exports": sortExportsRule,
|
|
21291
|
-
"sort-objects": sortObjectsRule,
|
|
21292
|
-
"sort-imports": sortImportsRule,
|
|
21293
|
-
"sort-named-imports": sortNamedImportsRule,
|
|
21294
|
-
"sort-heritage-clauses": sortHeritageClausesRule,
|
|
21295
|
-
"sort-keys": sortKeysRule,
|
|
21296
|
-
"import-dedupe": importDedupeRule,
|
|
21297
|
-
"import-first": firstRule,
|
|
21298
|
-
"import-named": namedRule,
|
|
21299
|
-
"import-no-cycle": noCycleRule,
|
|
21300
|
-
"import-no-unresolved": noUnresolvedRule,
|
|
21301
|
-
"no-import-dist": noImportDistRule,
|
|
21302
|
-
"no-import-node-modules-by-path": noImportNodeModulesByPathRule,
|
|
21303
|
-
"no-duplicate-imports": noDuplicateImportsRule,
|
|
21304
|
-
"top-level-function": topLevelFunctionRule
|
|
21329
|
+
"sort-exports": codeOnly(sortExportsRule),
|
|
21330
|
+
"sort-objects": codeOnly(sortObjectsRule),
|
|
21331
|
+
"sort-imports": codeOnly(sortImportsRule),
|
|
21332
|
+
"sort-named-imports": codeOnly(sortNamedImportsRule),
|
|
21333
|
+
"sort-heritage-clauses": codeOnly(sortHeritageClausesRule),
|
|
21334
|
+
"sort-keys": codeOnly(sortKeysRule),
|
|
21335
|
+
"import-dedupe": codeOnly(importDedupeRule),
|
|
21336
|
+
"import-first": codeOnly(firstRule),
|
|
21337
|
+
"import-named": codeOnly(namedRule),
|
|
21338
|
+
"import-no-cycle": codeOnly(noCycleRule),
|
|
21339
|
+
"import-no-unresolved": codeOnly(noUnresolvedRule),
|
|
21340
|
+
"no-import-dist": codeOnly(noImportDistRule),
|
|
21341
|
+
"no-import-node-modules-by-path": codeOnly(noImportNodeModulesByPathRule),
|
|
21342
|
+
"no-duplicate-imports": codeOnly(noDuplicateImportsRule),
|
|
21343
|
+
"top-level-function": codeOnly(topLevelFunctionRule)
|
|
21305
21344
|
}
|
|
21306
21345
|
};
|
|
21307
21346
|
});
|
|
@@ -21348,48 +21387,49 @@ var init_quality = __esm(() => {
|
|
|
21348
21387
|
init_no_with();
|
|
21349
21388
|
init_prefer_arrow_callback();
|
|
21350
21389
|
init_require_await();
|
|
21390
|
+
init_utils2();
|
|
21351
21391
|
qualityPlugin = {
|
|
21352
21392
|
name: "quality",
|
|
21353
21393
|
rules: {
|
|
21354
|
-
"default-case": defaultCaseRule,
|
|
21355
|
-
eqeqeq: eqeqeqRule,
|
|
21356
|
-
"no-alert": noAlertRule,
|
|
21357
|
-
"no-await-in-loop": noAwaitInLoopRule,
|
|
21358
|
-
"no-caller": noCallerRule,
|
|
21359
|
-
"no-case-declarations": noCaseDeclarationsRule,
|
|
21360
|
-
"no-else-return": noElseReturnRule,
|
|
21361
|
-
"no-empty": noEmptyRule,
|
|
21362
|
-
"no-empty-function": noEmptyFunctionRule,
|
|
21363
|
-
"no-eval": noEvalRule,
|
|
21364
|
-
"no-extend-native": noExtendNativeRule,
|
|
21365
|
-
"no-global-assign": noGlobalAssignRule,
|
|
21366
|
-
"no-implied-eval": noImpliedEvalRule,
|
|
21367
|
-
"no-iterator": noIteratorRule,
|
|
21368
|
-
"no-new": noNewRule,
|
|
21369
|
-
"no-new-func": noNewFuncRule,
|
|
21370
|
-
"no-new-wrappers": noNewWrappersRule,
|
|
21371
|
-
"no-octal": noOctalRule,
|
|
21372
|
-
"no-param-reassign": noParamReassignRule,
|
|
21373
|
-
"no-proto": noProtoRule,
|
|
21374
|
-
"no-return-assign": noReturnAssignRule,
|
|
21375
|
-
"no-shadow": noShadowRule,
|
|
21376
|
-
"no-throw-literal": noThrowLiteralRule,
|
|
21377
|
-
"no-use-before-define": noUseBeforeDefineRule,
|
|
21378
|
-
"no-useless-call": noUselessCallRule,
|
|
21379
|
-
"no-with": noWithRule,
|
|
21380
|
-
"require-await": requireAwaitRule,
|
|
21381
|
-
complexity: complexityRule,
|
|
21382
|
-
"max-depth": maxDepthRule,
|
|
21383
|
-
"max-lines-per-function": maxLinesPerFunctionRule,
|
|
21384
|
-
"no-extra-boolean-cast": noExtraBooleanCastRule,
|
|
21385
|
-
"no-lonely-if": noLonelyIfRule,
|
|
21386
|
-
"no-sequences": noSequencesRule,
|
|
21387
|
-
"no-useless-concat": noUselessConcatRule,
|
|
21388
|
-
"no-useless-escape": noUselessEscapeRule,
|
|
21389
|
-
"no-useless-rename": noUselessRenameRule,
|
|
21390
|
-
"no-useless-return": noUselessReturnRule,
|
|
21391
|
-
"no-var": noVarRule,
|
|
21392
|
-
"prefer-arrow-callback": preferArrowCallbackRule
|
|
21394
|
+
"default-case": codeOnly(defaultCaseRule),
|
|
21395
|
+
eqeqeq: codeOnly(eqeqeqRule),
|
|
21396
|
+
"no-alert": codeOnly(noAlertRule),
|
|
21397
|
+
"no-await-in-loop": codeOnly(noAwaitInLoopRule),
|
|
21398
|
+
"no-caller": codeOnly(noCallerRule),
|
|
21399
|
+
"no-case-declarations": codeOnly(noCaseDeclarationsRule),
|
|
21400
|
+
"no-else-return": codeOnly(noElseReturnRule),
|
|
21401
|
+
"no-empty": codeOnly(noEmptyRule),
|
|
21402
|
+
"no-empty-function": codeOnly(noEmptyFunctionRule),
|
|
21403
|
+
"no-eval": codeOnly(noEvalRule),
|
|
21404
|
+
"no-extend-native": codeOnly(noExtendNativeRule),
|
|
21405
|
+
"no-global-assign": codeOnly(noGlobalAssignRule),
|
|
21406
|
+
"no-implied-eval": codeOnly(noImpliedEvalRule),
|
|
21407
|
+
"no-iterator": codeOnly(noIteratorRule),
|
|
21408
|
+
"no-new": codeOnly(noNewRule),
|
|
21409
|
+
"no-new-func": codeOnly(noNewFuncRule),
|
|
21410
|
+
"no-new-wrappers": codeOnly(noNewWrappersRule),
|
|
21411
|
+
"no-octal": codeOnly(noOctalRule),
|
|
21412
|
+
"no-param-reassign": codeOnly(noParamReassignRule),
|
|
21413
|
+
"no-proto": codeOnly(noProtoRule),
|
|
21414
|
+
"no-return-assign": codeOnly(noReturnAssignRule),
|
|
21415
|
+
"no-shadow": codeOnly(noShadowRule),
|
|
21416
|
+
"no-throw-literal": codeOnly(noThrowLiteralRule),
|
|
21417
|
+
"no-use-before-define": codeOnly(noUseBeforeDefineRule),
|
|
21418
|
+
"no-useless-call": codeOnly(noUselessCallRule),
|
|
21419
|
+
"no-with": codeOnly(noWithRule),
|
|
21420
|
+
"require-await": codeOnly(requireAwaitRule),
|
|
21421
|
+
complexity: codeOnly(complexityRule),
|
|
21422
|
+
"max-depth": codeOnly(maxDepthRule),
|
|
21423
|
+
"max-lines-per-function": codeOnly(maxLinesPerFunctionRule),
|
|
21424
|
+
"no-extra-boolean-cast": codeOnly(noExtraBooleanCastRule),
|
|
21425
|
+
"no-lonely-if": codeOnly(noLonelyIfRule),
|
|
21426
|
+
"no-sequences": codeOnly(noSequencesRule),
|
|
21427
|
+
"no-useless-concat": codeOnly(noUselessConcatRule),
|
|
21428
|
+
"no-useless-escape": codeOnly(noUselessEscapeRule),
|
|
21429
|
+
"no-useless-rename": codeOnly(noUselessRenameRule),
|
|
21430
|
+
"no-useless-return": codeOnly(noUselessReturnRule),
|
|
21431
|
+
"no-var": codeOnly(noVarRule),
|
|
21432
|
+
"prefer-arrow-callback": codeOnly(preferArrowCallbackRule)
|
|
21393
21433
|
}
|
|
21394
21434
|
};
|
|
21395
21435
|
});
|
|
@@ -21436,74 +21476,194 @@ var init_no_super_linear_backtracking = __esm(() => {
|
|
|
21436
21476
|
});
|
|
21437
21477
|
|
|
21438
21478
|
// src/rules/regexp/no-unused-capturing-group.ts
|
|
21479
|
+
function parseRegexLiteral(content, idx) {
|
|
21480
|
+
let prevIdx = idx - 1;
|
|
21481
|
+
while (prevIdx >= 0 && (content[prevIdx] === " " || content[prevIdx] === "\t"))
|
|
21482
|
+
prevIdx--;
|
|
21483
|
+
const prevChar = prevIdx >= 0 ? content[prevIdx] : "";
|
|
21484
|
+
const regexPrecedes = "=(<>!&|?:;,{[+(~^%*/";
|
|
21485
|
+
const isRegex = prevIdx < 0 || regexPrecedes.includes(prevChar) || /\b(?:return|typeof|void|delete|throw|new|in|of|case)\s*$/.test(content.slice(Math.max(0, prevIdx - 5), prevIdx + 1));
|
|
21486
|
+
if (!isRegex)
|
|
21487
|
+
return null;
|
|
21488
|
+
let i = idx + 1;
|
|
21489
|
+
let inClass = false;
|
|
21490
|
+
let escaped = false;
|
|
21491
|
+
let closedAt = -1;
|
|
21492
|
+
while (i < content.length) {
|
|
21493
|
+
const c = content[i];
|
|
21494
|
+
if (escaped) {
|
|
21495
|
+
escaped = false;
|
|
21496
|
+
} else if (c === "\\") {
|
|
21497
|
+
escaped = true;
|
|
21498
|
+
} else if (c === "[") {
|
|
21499
|
+
if (!inClass)
|
|
21500
|
+
inClass = true;
|
|
21501
|
+
} else if (c === "]") {
|
|
21502
|
+
if (inClass)
|
|
21503
|
+
inClass = false;
|
|
21504
|
+
} else if (c === "/" && !inClass) {
|
|
21505
|
+
closedAt = i;
|
|
21506
|
+
break;
|
|
21507
|
+
} else if (c === `
|
|
21508
|
+
`) {
|
|
21509
|
+
break;
|
|
21510
|
+
}
|
|
21511
|
+
i++;
|
|
21512
|
+
}
|
|
21513
|
+
if (closedAt <= idx)
|
|
21514
|
+
return null;
|
|
21515
|
+
const pattern = content.slice(idx + 1, closedAt);
|
|
21516
|
+
let flagEnd = closedAt + 1;
|
|
21517
|
+
while (flagEnd < content.length && /[gimsuy]/.test(content[flagEnd]))
|
|
21518
|
+
flagEnd++;
|
|
21519
|
+
if (/\\[1-9]/.test(pattern))
|
|
21520
|
+
return null;
|
|
21521
|
+
let capCount = 0;
|
|
21522
|
+
let firstCapOffset = -1;
|
|
21523
|
+
let inCharClass = false;
|
|
21524
|
+
for (let j = 0;j < pattern.length; j++) {
|
|
21525
|
+
if (pattern[j] === "\\") {
|
|
21526
|
+
j++;
|
|
21527
|
+
continue;
|
|
21528
|
+
}
|
|
21529
|
+
if (pattern[j] === "[" && !inCharClass) {
|
|
21530
|
+
inCharClass = true;
|
|
21531
|
+
continue;
|
|
21532
|
+
}
|
|
21533
|
+
if (pattern[j] === "]" && inCharClass) {
|
|
21534
|
+
inCharClass = false;
|
|
21535
|
+
continue;
|
|
21536
|
+
}
|
|
21537
|
+
if (inCharClass)
|
|
21538
|
+
continue;
|
|
21539
|
+
if (pattern[j] === "(" && pattern.slice(j + 1, j + 3) !== "?:" && pattern.slice(j + 1, j + 3) !== "?=" && pattern.slice(j + 1, j + 3) !== "?!" && pattern.slice(j + 1, j + 4) !== "?<=" && pattern.slice(j + 1, j + 4) !== "?<!") {
|
|
21540
|
+
if (firstCapOffset < 0)
|
|
21541
|
+
firstCapOffset = j;
|
|
21542
|
+
capCount++;
|
|
21543
|
+
}
|
|
21544
|
+
}
|
|
21545
|
+
if (capCount === 0)
|
|
21546
|
+
return null;
|
|
21547
|
+
return { patternStart: idx, patternEnd: flagEnd, pattern, capCount, firstCapOffset };
|
|
21548
|
+
}
|
|
21549
|
+
function areCapturesUsed(content, regexStart, regexEnd) {
|
|
21550
|
+
let afterIdx = regexEnd;
|
|
21551
|
+
while (afterIdx < content.length && (content[afterIdx] === " " || content[afterIdx] === "\t"))
|
|
21552
|
+
afterIdx++;
|
|
21553
|
+
if (content[afterIdx] === ".") {
|
|
21554
|
+
const rest = content.slice(afterIdx + 1, afterIdx + 20);
|
|
21555
|
+
if (/^test\s*\(/.test(rest))
|
|
21556
|
+
return false;
|
|
21557
|
+
if (/^exec\s*\(/.test(rest))
|
|
21558
|
+
return true;
|
|
21559
|
+
}
|
|
21560
|
+
let beforeIdx = regexStart - 1;
|
|
21561
|
+
while (beforeIdx >= 0 && (content[beforeIdx] === " " || content[beforeIdx] === "\t"))
|
|
21562
|
+
beforeIdx--;
|
|
21563
|
+
if (content[beforeIdx] === "(") {
|
|
21564
|
+
let methodEnd = beforeIdx;
|
|
21565
|
+
let methodStart = methodEnd - 1;
|
|
21566
|
+
while (methodStart >= 0 && (content[methodStart] === " " || content[methodStart] === "\t"))
|
|
21567
|
+
methodStart--;
|
|
21568
|
+
const slice = content.slice(Math.max(0, methodStart - 20), methodStart + 1);
|
|
21569
|
+
if (/\.match\s*$/.test(slice))
|
|
21570
|
+
return true;
|
|
21571
|
+
if (/\.matchAll\s*$/.test(slice))
|
|
21572
|
+
return true;
|
|
21573
|
+
if (/\.exec\s*$/.test(slice))
|
|
21574
|
+
return true;
|
|
21575
|
+
if (/\.replace\s*$/.test(slice))
|
|
21576
|
+
return true;
|
|
21577
|
+
if (/\.replaceAll\s*$/.test(slice))
|
|
21578
|
+
return true;
|
|
21579
|
+
if (/\.split\s*$/.test(slice))
|
|
21580
|
+
return true;
|
|
21581
|
+
if (/\.search\s*$/.test(slice))
|
|
21582
|
+
return false;
|
|
21583
|
+
if (/\.test\s*$/.test(slice))
|
|
21584
|
+
return false;
|
|
21585
|
+
}
|
|
21586
|
+
const lineStart = content.lastIndexOf(`
|
|
21587
|
+
`, regexStart) + 1;
|
|
21588
|
+
const beforeRegex = content.slice(lineStart, regexStart).trim();
|
|
21589
|
+
const assignMatch = beforeRegex.match(/(?:const|let|var)\s+(\w+)\s*=\s*$/);
|
|
21590
|
+
if (assignMatch) {
|
|
21591
|
+
const varName = assignMatch[1];
|
|
21592
|
+
const afterContent = content.slice(regexEnd);
|
|
21593
|
+
const execPattern = new RegExp(`\\b${varName}\\.exec\\s*\\(`);
|
|
21594
|
+
const testPattern = new RegExp(`\\b${varName}\\.test\\s*\\(`);
|
|
21595
|
+
const matchPattern = new RegExp(`\\.match(?:All)?\\s*\\(\\s*${varName}\\s*\\)`);
|
|
21596
|
+
const replacePattern = new RegExp(`\\.replace(?:All)?\\s*\\(\\s*${varName}`);
|
|
21597
|
+
const hasExec = execPattern.test(afterContent);
|
|
21598
|
+
const hasMatch = matchPattern.test(afterContent);
|
|
21599
|
+
const hasReplace = replacePattern.test(afterContent);
|
|
21600
|
+
const hasTest = testPattern.test(afterContent);
|
|
21601
|
+
if (hasExec || hasMatch || hasReplace)
|
|
21602
|
+
return true;
|
|
21603
|
+
if (hasTest)
|
|
21604
|
+
return false;
|
|
21605
|
+
return true;
|
|
21606
|
+
}
|
|
21607
|
+
return true;
|
|
21608
|
+
}
|
|
21439
21609
|
function findIssues(content, ctx) {
|
|
21440
21610
|
const issues = [];
|
|
21441
21611
|
const filePath = ctx.filePath;
|
|
21442
|
-
const _re = /(^|[^\\\w])/g;
|
|
21443
21612
|
let idx = 0;
|
|
21444
21613
|
while (idx < content.length) {
|
|
21445
21614
|
const ch = content[idx];
|
|
21446
|
-
if (ch === "/") {
|
|
21447
|
-
|
|
21448
|
-
|
|
21449
|
-
|
|
21450
|
-
|
|
21451
|
-
|
|
21452
|
-
|
|
21453
|
-
|
|
21454
|
-
|
|
21455
|
-
|
|
21456
|
-
|
|
21457
|
-
|
|
21458
|
-
|
|
21459
|
-
|
|
21460
|
-
|
|
21461
|
-
|
|
21462
|
-
|
|
21463
|
-
|
|
21464
|
-
|
|
21615
|
+
if (ch === "/" && content[idx + 1] === "/") {
|
|
21616
|
+
while (idx < content.length && content[idx] !== `
|
|
21617
|
+
`)
|
|
21618
|
+
idx++;
|
|
21619
|
+
continue;
|
|
21620
|
+
}
|
|
21621
|
+
if (ch === "/" && content[idx + 1] === "*") {
|
|
21622
|
+
idx += 2;
|
|
21623
|
+
while (idx < content.length - 1 && !(content[idx] === "*" && content[idx + 1] === "/"))
|
|
21624
|
+
idx++;
|
|
21625
|
+
idx += 2;
|
|
21626
|
+
continue;
|
|
21627
|
+
}
|
|
21628
|
+
if (ch === "'" || ch === '"' || ch === "`") {
|
|
21629
|
+
const quote = ch;
|
|
21630
|
+
idx++;
|
|
21631
|
+
while (idx < content.length) {
|
|
21632
|
+
if (content[idx] === "\\") {
|
|
21633
|
+
idx += 2;
|
|
21634
|
+
continue;
|
|
21635
|
+
}
|
|
21636
|
+
if (content[idx] === quote) {
|
|
21637
|
+
idx++;
|
|
21465
21638
|
break;
|
|
21466
21639
|
}
|
|
21467
|
-
|
|
21640
|
+
idx++;
|
|
21468
21641
|
}
|
|
21469
|
-
|
|
21470
|
-
|
|
21471
|
-
|
|
21472
|
-
|
|
21473
|
-
|
|
21474
|
-
|
|
21475
|
-
let capCount = 0;
|
|
21476
|
-
for (let j = 0;j < pattern.length; j++) {
|
|
21477
|
-
const c = pattern[j];
|
|
21478
|
-
if (c === "(") {
|
|
21479
|
-
const prev = pattern[j - 1];
|
|
21480
|
-
const isEscaped = prev === "\\";
|
|
21481
|
-
if (!isEscaped) {
|
|
21482
|
-
const next2 = pattern.slice(j + 1, j + 3);
|
|
21483
|
-
if (next2 !== "?:")
|
|
21484
|
-
capCount++;
|
|
21485
|
-
}
|
|
21486
|
-
}
|
|
21487
|
-
}
|
|
21488
|
-
if (capCount > 0) {
|
|
21489
|
-
const rel = pattern.indexOf("(");
|
|
21490
|
-
const reportPos = idx + 1 + (rel >= 0 ? rel : 0);
|
|
21491
|
-
const prefix = content.slice(0, reportPos);
|
|
21492
|
-
const line = (prefix.match(/\r?\n/g) || []).length + 1;
|
|
21493
|
-
const col = reportPos - (prefix.lastIndexOf(`
|
|
21494
|
-
`) + 1) + 1;
|
|
21495
|
-
issues.push({
|
|
21496
|
-
filePath,
|
|
21497
|
-
line,
|
|
21498
|
-
column: col,
|
|
21499
|
-
ruleId: "regexp/no-unused-capturing-group",
|
|
21500
|
-
message: "Unused capturing group in regular expression",
|
|
21501
|
-
severity: "error"
|
|
21502
|
-
});
|
|
21503
|
-
}
|
|
21504
|
-
idx = closedAt + 1;
|
|
21642
|
+
continue;
|
|
21643
|
+
}
|
|
21644
|
+
if (ch === "/") {
|
|
21645
|
+
const info = parseRegexLiteral(content, idx);
|
|
21646
|
+
if (!info) {
|
|
21647
|
+
idx++;
|
|
21505
21648
|
continue;
|
|
21506
21649
|
}
|
|
21650
|
+
if (!areCapturesUsed(content, info.patternStart, info.patternEnd)) {
|
|
21651
|
+
const reportPos = info.patternStart + 1 + (info.firstCapOffset >= 0 ? info.firstCapOffset : 0);
|
|
21652
|
+
const prefix = content.slice(0, reportPos);
|
|
21653
|
+
const line = (prefix.match(/\r?\n/g) || []).length + 1;
|
|
21654
|
+
const col = reportPos - (prefix.lastIndexOf(`
|
|
21655
|
+
`) + 1) + 1;
|
|
21656
|
+
issues.push({
|
|
21657
|
+
filePath,
|
|
21658
|
+
line,
|
|
21659
|
+
column: col,
|
|
21660
|
+
ruleId: "regexp/no-unused-capturing-group",
|
|
21661
|
+
message: "Unused capturing group in regular expression; use non-capturing group (?:...) instead",
|
|
21662
|
+
severity: "error"
|
|
21663
|
+
});
|
|
21664
|
+
}
|
|
21665
|
+
idx = info.patternEnd;
|
|
21666
|
+
continue;
|
|
21507
21667
|
}
|
|
21508
21668
|
idx++;
|
|
21509
21669
|
}
|
|
@@ -21513,7 +21673,7 @@ var noUnusedCapturingGroupRule;
|
|
|
21513
21673
|
var init_no_unused_capturing_group = __esm(() => {
|
|
21514
21674
|
noUnusedCapturingGroupRule = {
|
|
21515
21675
|
meta: {
|
|
21516
|
-
docs: "Flags regex literals with capturing groups
|
|
21676
|
+
docs: "Flags regex literals with unused capturing groups (context-aware)",
|
|
21517
21677
|
recommended: false
|
|
21518
21678
|
},
|
|
21519
21679
|
check(content, ctx) {
|
|
@@ -21575,12 +21735,13 @@ var init_regexp = __esm(() => {
|
|
|
21575
21735
|
init_no_super_linear_backtracking();
|
|
21576
21736
|
init_no_unused_capturing_group();
|
|
21577
21737
|
init_no_useless_lazy();
|
|
21738
|
+
init_utils2();
|
|
21578
21739
|
regexpPlugin = {
|
|
21579
21740
|
name: "regexp",
|
|
21580
21741
|
rules: {
|
|
21581
|
-
"no-super-linear-backtracking": noSuperLinearBacktrackingRule,
|
|
21582
|
-
"no-unused-capturing-group": noUnusedCapturingGroupRule,
|
|
21583
|
-
"no-useless-lazy": noUselessLazy
|
|
21742
|
+
"no-super-linear-backtracking": codeOnly(noSuperLinearBacktrackingRule),
|
|
21743
|
+
"no-unused-capturing-group": codeOnly(noUnusedCapturingGroupRule),
|
|
21744
|
+
"no-useless-lazy": codeOnly(noUselessLazy)
|
|
21584
21745
|
}
|
|
21585
21746
|
};
|
|
21586
21747
|
});
|
|
@@ -25781,22 +25942,7 @@ var init_yield_star_spacing = __esm(() => {
|
|
|
25781
25942
|
});
|
|
25782
25943
|
|
|
25783
25944
|
// src/plugins/style.ts
|
|
25784
|
-
|
|
25785
|
-
return {
|
|
25786
|
-
meta: rule.meta,
|
|
25787
|
-
check: (content, context) => {
|
|
25788
|
-
if (!CODE_EXTS2.test(context.filePath))
|
|
25789
|
-
return [];
|
|
25790
|
-
return rule.check(content, context);
|
|
25791
|
-
},
|
|
25792
|
-
fix: rule.fix ? (content, context) => {
|
|
25793
|
-
if (!CODE_EXTS2.test(context.filePath))
|
|
25794
|
-
return content;
|
|
25795
|
-
return rule.fix(content, context);
|
|
25796
|
-
} : undefined
|
|
25797
|
-
};
|
|
25798
|
-
}
|
|
25799
|
-
var CODE_EXTS2, stylePlugin;
|
|
25945
|
+
var stylePlugin;
|
|
25800
25946
|
var init_style = __esm(() => {
|
|
25801
25947
|
init_array_bracket_spacing();
|
|
25802
25948
|
init_arrow_parens();
|
|
@@ -25848,7 +25994,7 @@ var init_style = __esm(() => {
|
|
|
25848
25994
|
init_template_tag_spacing();
|
|
25849
25995
|
init_wrap_iife();
|
|
25850
25996
|
init_yield_star_spacing();
|
|
25851
|
-
|
|
25997
|
+
init_utils2();
|
|
25852
25998
|
stylePlugin = {
|
|
25853
25999
|
name: "style",
|
|
25854
26000
|
rules: {
|
|
@@ -26443,9 +26589,9 @@ var init_no_top_level_await = __esm(() => {
|
|
|
26443
26589
|
}
|
|
26444
26590
|
if (!escape && ch === "'") {
|
|
26445
26591
|
inSQ = false;
|
|
26446
|
-
escape = false;
|
|
26447
|
-
continue;
|
|
26448
26592
|
}
|
|
26593
|
+
escape = false;
|
|
26594
|
+
continue;
|
|
26449
26595
|
}
|
|
26450
26596
|
if (inDQ) {
|
|
26451
26597
|
if (!escape && ch === "\\") {
|
|
@@ -26454,9 +26600,9 @@ var init_no_top_level_await = __esm(() => {
|
|
|
26454
26600
|
}
|
|
26455
26601
|
if (!escape && ch === '"') {
|
|
26456
26602
|
inDQ = false;
|
|
26457
|
-
escape = false;
|
|
26458
|
-
continue;
|
|
26459
26603
|
}
|
|
26604
|
+
escape = false;
|
|
26605
|
+
continue;
|
|
26460
26606
|
}
|
|
26461
26607
|
if (inTQ) {
|
|
26462
26608
|
if (!escape && ch === "\\") {
|
|
@@ -27248,22 +27394,23 @@ var init_ts = __esm(() => {
|
|
|
27248
27394
|
init_type_annotation_spacing();
|
|
27249
27395
|
init_type_generic_spacing();
|
|
27250
27396
|
init_type_named_tuple_spacing();
|
|
27397
|
+
init_utils2();
|
|
27251
27398
|
tsPlugin = {
|
|
27252
27399
|
name: "ts",
|
|
27253
27400
|
rules: {
|
|
27254
|
-
"no-require-imports": noRequireImportsRule,
|
|
27255
|
-
"no-top-level-await": noTopLevelAwaitRule,
|
|
27256
|
-
"no-ts-export-equal": noTsExportEqualRule,
|
|
27257
|
-
"no-explicit-any": noExplicitAnyRule,
|
|
27258
|
-
"prefer-nullish-coalescing": preferNullishCoalescingRule,
|
|
27259
|
-
"prefer-optional-chain": preferOptionalChainRule,
|
|
27260
|
-
"no-floating-promises": noFloatingPromisesRule,
|
|
27261
|
-
"no-misused-promises": noMisusedPromisesRule,
|
|
27262
|
-
"no-unsafe-assignment": noUnsafeAssignmentRule,
|
|
27263
|
-
"member-delimiter-style": memberDelimiterStyleRule,
|
|
27264
|
-
"type-annotation-spacing": typeAnnotationSpacingRule,
|
|
27265
|
-
"type-generic-spacing": typeGenericSpacingRule,
|
|
27266
|
-
"type-named-tuple-spacing": typeNamedTupleSpacingRule
|
|
27401
|
+
"no-require-imports": codeOnly(noRequireImportsRule),
|
|
27402
|
+
"no-top-level-await": codeOnly(noTopLevelAwaitRule),
|
|
27403
|
+
"no-ts-export-equal": codeOnly(noTsExportEqualRule),
|
|
27404
|
+
"no-explicit-any": codeOnly(noExplicitAnyRule),
|
|
27405
|
+
"prefer-nullish-coalescing": codeOnly(preferNullishCoalescingRule),
|
|
27406
|
+
"prefer-optional-chain": codeOnly(preferOptionalChainRule),
|
|
27407
|
+
"no-floating-promises": codeOnly(noFloatingPromisesRule),
|
|
27408
|
+
"no-misused-promises": codeOnly(noMisusedPromisesRule),
|
|
27409
|
+
"no-unsafe-assignment": codeOnly(noUnsafeAssignmentRule),
|
|
27410
|
+
"member-delimiter-style": codeOnly(memberDelimiterStyleRule),
|
|
27411
|
+
"type-annotation-spacing": codeOnly(typeAnnotationSpacingRule),
|
|
27412
|
+
"type-generic-spacing": codeOnly(typeGenericSpacingRule),
|
|
27413
|
+
"type-named-tuple-spacing": codeOnly(typeNamedTupleSpacingRule)
|
|
27267
27414
|
}
|
|
27268
27415
|
};
|
|
27269
27416
|
});
|
|
@@ -27272,11 +27419,12 @@ var init_ts = __esm(() => {
|
|
|
27272
27419
|
var unusedImportsPlugin;
|
|
27273
27420
|
var init_unused_imports = __esm(() => {
|
|
27274
27421
|
init_no_unused_vars();
|
|
27422
|
+
init_utils2();
|
|
27275
27423
|
unusedImportsPlugin = {
|
|
27276
27424
|
name: "unused-imports",
|
|
27277
27425
|
rules: {
|
|
27278
|
-
"no-unused-vars": noUnusedVarsRule,
|
|
27279
|
-
"no-unused-imports": noUnusedVarsRule
|
|
27426
|
+
"no-unused-vars": codeOnly(noUnusedVarsRule),
|
|
27427
|
+
"no-unused-imports": codeOnly(noUnusedVarsRule)
|
|
27280
27428
|
}
|
|
27281
27429
|
};
|
|
27282
27430
|
});
|
|
@@ -32678,7 +32826,7 @@ var require_package = __commonJS((exports, module) => {
|
|
|
32678
32826
|
module.exports = {
|
|
32679
32827
|
name: "pickier",
|
|
32680
32828
|
type: "module",
|
|
32681
|
-
version: "0.1.
|
|
32829
|
+
version: "0.1.18",
|
|
32682
32830
|
description: "Format, lint and more in a fraction of seconds.",
|
|
32683
32831
|
author: "Chris Breuer <chris@stacksjs.org>",
|
|
32684
32832
|
license: "MIT",
|