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/src/index.js
CHANGED
|
@@ -5255,7 +5255,7 @@ var init_config = __esm(async () => {
|
|
|
5255
5255
|
"markdown/proper-names": "off",
|
|
5256
5256
|
"markdown/no-alt-text": "warn",
|
|
5257
5257
|
"markdown/table-pipe-style": "warn",
|
|
5258
|
-
"markdown/table-column-count": "
|
|
5258
|
+
"markdown/table-column-count": "warn",
|
|
5259
5259
|
"markdown/table-column-style": "warn",
|
|
5260
5260
|
"lockfile/validate-host": ["warn", { allowedHosts: ["npm", "yarn"] }],
|
|
5261
5261
|
"lockfile/validate-https": "error",
|
|
@@ -14742,6 +14742,27 @@ var init_require_await = __esm(() => {
|
|
|
14742
14742
|
};
|
|
14743
14743
|
});
|
|
14744
14744
|
|
|
14745
|
+
// src/plugins/utils.ts
|
|
14746
|
+
function codeOnly(rule) {
|
|
14747
|
+
return {
|
|
14748
|
+
meta: rule.meta,
|
|
14749
|
+
check: (content, context) => {
|
|
14750
|
+
if (!CODE_EXTS2.test(context.filePath))
|
|
14751
|
+
return [];
|
|
14752
|
+
return rule.check(content, context);
|
|
14753
|
+
},
|
|
14754
|
+
fix: rule.fix ? (content, context) => {
|
|
14755
|
+
if (!CODE_EXTS2.test(context.filePath))
|
|
14756
|
+
return content;
|
|
14757
|
+
return rule.fix(content, context);
|
|
14758
|
+
} : undefined
|
|
14759
|
+
};
|
|
14760
|
+
}
|
|
14761
|
+
var CODE_EXTS2;
|
|
14762
|
+
var init_utils = __esm(() => {
|
|
14763
|
+
CODE_EXTS2 = /\.(?:ts|js|tsx|jsx|mts|mjs|cts|cjs)$/;
|
|
14764
|
+
});
|
|
14765
|
+
|
|
14745
14766
|
// src/plugins/eslint.ts
|
|
14746
14767
|
var eslintPlugin;
|
|
14747
14768
|
var init_eslint = __esm(() => {
|
|
@@ -14810,74 +14831,75 @@ var init_eslint = __esm(() => {
|
|
|
14810
14831
|
init_no_with();
|
|
14811
14832
|
init_prefer_arrow_callback();
|
|
14812
14833
|
init_require_await();
|
|
14834
|
+
init_utils();
|
|
14813
14835
|
eslintPlugin = {
|
|
14814
14836
|
name: "eslint",
|
|
14815
14837
|
rules: {
|
|
14816
|
-
"array-callback-return": arrayCallbackReturnRule,
|
|
14817
|
-
"constructor-super": constructorSuperRule,
|
|
14818
|
-
"for-direction": forDirectionRule,
|
|
14819
|
-
"getter-return": getterReturnRule,
|
|
14820
|
-
"no-async-promise-executor": noAsyncPromiseExecutorRule,
|
|
14821
|
-
"no-compare-neg-zero": noCompareNegZeroRule,
|
|
14822
|
-
"no-cond-assign": noCondAssignRule,
|
|
14823
|
-
"no-constant-condition": noConstantConditionRule,
|
|
14824
|
-
"no-const-assign": noConstAssignRule,
|
|
14825
|
-
"no-dupe-class-members": noDupeClassMembersRule,
|
|
14826
|
-
"no-dupe-keys": noDupeKeysRule,
|
|
14827
|
-
"no-duplicate-case": noDuplicateCaseRule,
|
|
14828
|
-
"no-empty-pattern": noEmptyPatternRule,
|
|
14829
|
-
"no-fallthrough": noFallthroughRule,
|
|
14830
|
-
"no-loss-of-precision": noLossOfPrecisionRule,
|
|
14831
|
-
"no-promise-executor-return": noPromiseExecutorReturnRule,
|
|
14832
|
-
"no-redeclare": noRedeclareRule,
|
|
14833
|
-
"no-self-assign": noSelfAssignRule,
|
|
14834
|
-
"no-self-compare": noSelfCompareRule,
|
|
14835
|
-
"no-sparse-arrays": noSparseArraysRule,
|
|
14836
|
-
"no-undef": noUndefRule,
|
|
14837
|
-
"no-unsafe-negation": noUnsafeNegationRule,
|
|
14838
|
-
"no-unreachable": noUnreachableRule,
|
|
14839
|
-
"no-useless-catch": noUselessCatchRule,
|
|
14840
|
-
"use-isnan": useIsNaNRule,
|
|
14841
|
-
"valid-typeof": validTypeofRule,
|
|
14842
|
-
"default-case": defaultCaseRule,
|
|
14843
|
-
eqeqeq: eqeqeqRule,
|
|
14844
|
-
"no-alert": noAlertRule,
|
|
14845
|
-
"no-await-in-loop": noAwaitInLoopRule,
|
|
14846
|
-
"no-caller": noCallerRule,
|
|
14847
|
-
"no-case-declarations": noCaseDeclarationsRule,
|
|
14848
|
-
"no-else-return": noElseReturnRule,
|
|
14849
|
-
"no-empty": noEmptyRule,
|
|
14850
|
-
"no-empty-function": noEmptyFunctionRule,
|
|
14851
|
-
"no-eval": noEvalRule,
|
|
14852
|
-
"no-extend-native": noExtendNativeRule,
|
|
14853
|
-
"no-global-assign": noGlobalAssignRule,
|
|
14854
|
-
"no-implied-eval": noImpliedEvalRule,
|
|
14855
|
-
"no-iterator": noIteratorRule,
|
|
14856
|
-
"no-new": noNewRule,
|
|
14857
|
-
"no-new-func": noNewFuncRule,
|
|
14858
|
-
"no-new-wrappers": noNewWrappersRule,
|
|
14859
|
-
"no-octal": noOctalRule,
|
|
14860
|
-
"no-param-reassign": noParamReassignRule,
|
|
14861
|
-
"no-proto": noProtoRule,
|
|
14862
|
-
"no-return-assign": noReturnAssignRule,
|
|
14863
|
-
"no-shadow": noShadowRule,
|
|
14864
|
-
"no-throw-literal": noThrowLiteralRule,
|
|
14865
|
-
"no-use-before-define": noUseBeforeDefineRule,
|
|
14866
|
-
"no-useless-call": noUselessCallRule,
|
|
14867
|
-
"no-with": noWithRule,
|
|
14868
|
-
"require-await": requireAwaitRule,
|
|
14869
|
-
complexity: complexityRule,
|
|
14870
|
-
"max-depth": maxDepthRule,
|
|
14871
|
-
"max-lines-per-function": maxLinesPerFunctionRule,
|
|
14872
|
-
"no-extra-boolean-cast": noExtraBooleanCastRule,
|
|
14873
|
-
"no-lonely-if": noLonelyIfRule,
|
|
14874
|
-
"no-sequences": noSequencesRule,
|
|
14875
|
-
"no-useless-concat": noUselessConcatRule,
|
|
14876
|
-
"no-useless-escape": noUselessEscapeRule,
|
|
14877
|
-
"no-useless-rename": noUselessRenameRule,
|
|
14878
|
-
"no-useless-return": noUselessReturnRule,
|
|
14879
|
-
"no-var": noVarRule,
|
|
14880
|
-
"prefer-arrow-callback": preferArrowCallbackRule
|
|
14838
|
+
"array-callback-return": codeOnly(arrayCallbackReturnRule),
|
|
14839
|
+
"constructor-super": codeOnly(constructorSuperRule),
|
|
14840
|
+
"for-direction": codeOnly(forDirectionRule),
|
|
14841
|
+
"getter-return": codeOnly(getterReturnRule),
|
|
14842
|
+
"no-async-promise-executor": codeOnly(noAsyncPromiseExecutorRule),
|
|
14843
|
+
"no-compare-neg-zero": codeOnly(noCompareNegZeroRule),
|
|
14844
|
+
"no-cond-assign": codeOnly(noCondAssignRule),
|
|
14845
|
+
"no-constant-condition": codeOnly(noConstantConditionRule),
|
|
14846
|
+
"no-const-assign": codeOnly(noConstAssignRule),
|
|
14847
|
+
"no-dupe-class-members": codeOnly(noDupeClassMembersRule),
|
|
14848
|
+
"no-dupe-keys": codeOnly(noDupeKeysRule),
|
|
14849
|
+
"no-duplicate-case": codeOnly(noDuplicateCaseRule),
|
|
14850
|
+
"no-empty-pattern": codeOnly(noEmptyPatternRule),
|
|
14851
|
+
"no-fallthrough": codeOnly(noFallthroughRule),
|
|
14852
|
+
"no-loss-of-precision": codeOnly(noLossOfPrecisionRule),
|
|
14853
|
+
"no-promise-executor-return": codeOnly(noPromiseExecutorReturnRule),
|
|
14854
|
+
"no-redeclare": codeOnly(noRedeclareRule),
|
|
14855
|
+
"no-self-assign": codeOnly(noSelfAssignRule),
|
|
14856
|
+
"no-self-compare": codeOnly(noSelfCompareRule),
|
|
14857
|
+
"no-sparse-arrays": codeOnly(noSparseArraysRule),
|
|
14858
|
+
"no-undef": codeOnly(noUndefRule),
|
|
14859
|
+
"no-unsafe-negation": codeOnly(noUnsafeNegationRule),
|
|
14860
|
+
"no-unreachable": codeOnly(noUnreachableRule),
|
|
14861
|
+
"no-useless-catch": codeOnly(noUselessCatchRule),
|
|
14862
|
+
"use-isnan": codeOnly(useIsNaNRule),
|
|
14863
|
+
"valid-typeof": codeOnly(validTypeofRule),
|
|
14864
|
+
"default-case": codeOnly(defaultCaseRule),
|
|
14865
|
+
eqeqeq: codeOnly(eqeqeqRule),
|
|
14866
|
+
"no-alert": codeOnly(noAlertRule),
|
|
14867
|
+
"no-await-in-loop": codeOnly(noAwaitInLoopRule),
|
|
14868
|
+
"no-caller": codeOnly(noCallerRule),
|
|
14869
|
+
"no-case-declarations": codeOnly(noCaseDeclarationsRule),
|
|
14870
|
+
"no-else-return": codeOnly(noElseReturnRule),
|
|
14871
|
+
"no-empty": codeOnly(noEmptyRule),
|
|
14872
|
+
"no-empty-function": codeOnly(noEmptyFunctionRule),
|
|
14873
|
+
"no-eval": codeOnly(noEvalRule),
|
|
14874
|
+
"no-extend-native": codeOnly(noExtendNativeRule),
|
|
14875
|
+
"no-global-assign": codeOnly(noGlobalAssignRule),
|
|
14876
|
+
"no-implied-eval": codeOnly(noImpliedEvalRule),
|
|
14877
|
+
"no-iterator": codeOnly(noIteratorRule),
|
|
14878
|
+
"no-new": codeOnly(noNewRule),
|
|
14879
|
+
"no-new-func": codeOnly(noNewFuncRule),
|
|
14880
|
+
"no-new-wrappers": codeOnly(noNewWrappersRule),
|
|
14881
|
+
"no-octal": codeOnly(noOctalRule),
|
|
14882
|
+
"no-param-reassign": codeOnly(noParamReassignRule),
|
|
14883
|
+
"no-proto": codeOnly(noProtoRule),
|
|
14884
|
+
"no-return-assign": codeOnly(noReturnAssignRule),
|
|
14885
|
+
"no-shadow": codeOnly(noShadowRule),
|
|
14886
|
+
"no-throw-literal": codeOnly(noThrowLiteralRule),
|
|
14887
|
+
"no-use-before-define": codeOnly(noUseBeforeDefineRule),
|
|
14888
|
+
"no-useless-call": codeOnly(noUselessCallRule),
|
|
14889
|
+
"no-with": codeOnly(noWithRule),
|
|
14890
|
+
"require-await": codeOnly(requireAwaitRule),
|
|
14891
|
+
complexity: codeOnly(complexityRule),
|
|
14892
|
+
"max-depth": codeOnly(maxDepthRule),
|
|
14893
|
+
"max-lines-per-function": codeOnly(maxLinesPerFunctionRule),
|
|
14894
|
+
"no-extra-boolean-cast": codeOnly(noExtraBooleanCastRule),
|
|
14895
|
+
"no-lonely-if": codeOnly(noLonelyIfRule),
|
|
14896
|
+
"no-sequences": codeOnly(noSequencesRule),
|
|
14897
|
+
"no-useless-concat": codeOnly(noUselessConcatRule),
|
|
14898
|
+
"no-useless-escape": codeOnly(noUselessEscapeRule),
|
|
14899
|
+
"no-useless-rename": codeOnly(noUselessRenameRule),
|
|
14900
|
+
"no-useless-return": codeOnly(noUselessReturnRule),
|
|
14901
|
+
"no-var": codeOnly(noVarRule),
|
|
14902
|
+
"prefer-arrow-callback": codeOnly(preferArrowCallbackRule)
|
|
14881
14903
|
}
|
|
14882
14904
|
};
|
|
14883
14905
|
});
|
|
@@ -14895,8 +14917,8 @@ var init_no_constructor_return = __esm(() => {
|
|
|
14895
14917
|
for (let i = 0;i < lines.length; i++) {
|
|
14896
14918
|
const line = lines[i];
|
|
14897
14919
|
const commentIdx = line.indexOf("//");
|
|
14898
|
-
const
|
|
14899
|
-
const constructorMatch =
|
|
14920
|
+
const codeOnly2 = commentIdx >= 0 ? line.slice(0, commentIdx) : line;
|
|
14921
|
+
const constructorMatch = codeOnly2.match(/\bconstructor\s*\(/);
|
|
14900
14922
|
if (!constructorMatch)
|
|
14901
14923
|
continue;
|
|
14902
14924
|
let braceDepth = 0;
|
|
@@ -15140,6 +15162,8 @@ var init_no_regex_spaces = __esm(() => {
|
|
|
15140
15162
|
const lines = content.split(/\r?\n/);
|
|
15141
15163
|
for (let i = 0;i < lines.length; i++) {
|
|
15142
15164
|
const line = lines[i];
|
|
15165
|
+
if (/^\s*\/\//.test(line))
|
|
15166
|
+
continue;
|
|
15143
15167
|
const regexLiteralPattern = /\/(?![*/])((?:\\.|[^/\\])+)\/[gimsuvy]*/g;
|
|
15144
15168
|
let match;
|
|
15145
15169
|
while ((match = regexLiteralPattern.exec(line)) !== null) {
|
|
@@ -15588,7 +15612,7 @@ var init_no_unused_vars = __esm(() => {
|
|
|
15588
15612
|
const line = lines[i];
|
|
15589
15613
|
if (/^\s*\/\//.test(line))
|
|
15590
15614
|
continue;
|
|
15591
|
-
let
|
|
15615
|
+
let codeOnly2 = line;
|
|
15592
15616
|
let inStr = null;
|
|
15593
15617
|
let inRegex = false;
|
|
15594
15618
|
let escaped = false;
|
|
@@ -15616,7 +15640,7 @@ var init_no_unused_vars = __esm(() => {
|
|
|
15616
15640
|
if (/[=([{,:;!?]/.test(prevChar) || prev2Chars === "&&" || prev2Chars === "||" || /^\s*$/.test(line.slice(0, idx))) {
|
|
15617
15641
|
inRegex = true;
|
|
15618
15642
|
} else if (next === "/") {
|
|
15619
|
-
|
|
15643
|
+
codeOnly2 = line.slice(0, idx);
|
|
15620
15644
|
break;
|
|
15621
15645
|
}
|
|
15622
15646
|
}
|
|
@@ -15658,7 +15682,7 @@ var init_no_unused_vars = __esm(() => {
|
|
|
15658
15682
|
}
|
|
15659
15683
|
return result;
|
|
15660
15684
|
};
|
|
15661
|
-
const codeNoRegex = stripRegex(
|
|
15685
|
+
const codeNoRegex = stripRegex(codeOnly2);
|
|
15662
15686
|
const m = codeNoRegex.match(/\bfunction\b/);
|
|
15663
15687
|
if (m) {
|
|
15664
15688
|
if (line.includes("function scanContent") || line.includes("function findMatching")) {
|
|
@@ -16009,11 +16033,11 @@ var init_prefer_object_spread = __esm(() => {
|
|
|
16009
16033
|
if (/^\s*\/\//.test(line))
|
|
16010
16034
|
continue;
|
|
16011
16035
|
const commentIdx = line.indexOf("//");
|
|
16012
|
-
const
|
|
16013
|
-
const assignMatches =
|
|
16036
|
+
const codeOnly2 = commentIdx >= 0 ? line.slice(0, commentIdx) : line;
|
|
16037
|
+
const assignMatches = codeOnly2.matchAll(/\bObject\.assign\s*\(/g);
|
|
16014
16038
|
for (const match of assignMatches) {
|
|
16015
16039
|
const startIdx = match.index;
|
|
16016
|
-
const beforeAssign =
|
|
16040
|
+
const beforeAssign = codeOnly2.slice(0, startIdx);
|
|
16017
16041
|
const singleQuotes = (beforeAssign.match(/'/g) || []).length;
|
|
16018
16042
|
const doubleQuotes = (beforeAssign.match(/"/g) || []).length;
|
|
16019
16043
|
const backticks = (beforeAssign.match(/`/g) || []).length;
|
|
@@ -16021,7 +16045,7 @@ var init_prefer_object_spread = __esm(() => {
|
|
|
16021
16045
|
continue;
|
|
16022
16046
|
}
|
|
16023
16047
|
const openParenIdx = startIdx + "Object.assign".length;
|
|
16024
|
-
const restOfLine =
|
|
16048
|
+
const restOfLine = codeOnly2.slice(openParenIdx);
|
|
16025
16049
|
let firstArgEnd = -1;
|
|
16026
16050
|
let parenDepth = 1;
|
|
16027
16051
|
let braceDepth = 0;
|
|
@@ -16193,43 +16217,44 @@ var init_general = __esm(() => {
|
|
|
16193
16217
|
init_prefer_template();
|
|
16194
16218
|
init_use_isnan();
|
|
16195
16219
|
init_valid_typeof();
|
|
16220
|
+
init_utils();
|
|
16196
16221
|
generalPlugin = {
|
|
16197
16222
|
name: "general",
|
|
16198
16223
|
rules: {
|
|
16199
|
-
"array-callback-return": arrayCallbackReturnRule,
|
|
16200
|
-
"constructor-super": constructorSuperRule,
|
|
16201
|
-
"for-direction": forDirectionRule,
|
|
16202
|
-
"getter-return": getterReturnRule,
|
|
16203
|
-
"no-async-promise-executor": noAsyncPromiseExecutorRule,
|
|
16204
|
-
"no-compare-neg-zero": noCompareNegZeroRule,
|
|
16205
|
-
"no-cond-assign": noCondAssignRule,
|
|
16206
|
-
"no-const-assign": noConstAssignRule,
|
|
16207
|
-
"no-constant-condition": noConstantConditionRule,
|
|
16208
|
-
"no-constructor-return": noConstructorReturnRule,
|
|
16209
|
-
"no-dupe-class-members": noDupeClassMembersRule,
|
|
16210
|
-
"no-dupe-keys": noDupeKeysRule,
|
|
16211
|
-
"no-duplicate-case": noDuplicateCaseRule,
|
|
16212
|
-
"no-empty-pattern": noEmptyPatternRule,
|
|
16213
|
-
"no-fallthrough": noFallthroughRule,
|
|
16214
|
-
"no-irregular-whitespace": noIrregularWhitespaceRule,
|
|
16215
|
-
"no-loss-of-precision": noLossOfPrecisionRule,
|
|
16216
|
-
"no-new": noNew,
|
|
16217
|
-
"no-regex-spaces": noRegexSpaces,
|
|
16218
|
-
"no-promise-executor-return": noPromiseExecutorReturnRule,
|
|
16219
|
-
"no-redeclare": noRedeclareRule,
|
|
16220
|
-
"no-self-assign": noSelfAssignRule,
|
|
16221
|
-
"no-self-compare": noSelfCompareRule,
|
|
16222
|
-
"no-sparse-arrays": noSparseArraysRule,
|
|
16223
|
-
"no-undef": noUndefRule,
|
|
16224
|
-
"no-unsafe-negation": noUnsafeNegationRule,
|
|
16225
|
-
"no-unreachable": noUnreachableRule,
|
|
16226
|
-
"no-unused-vars": noUnusedVarsRule,
|
|
16227
|
-
"no-useless-catch": noUselessCatchRule,
|
|
16228
|
-
"prefer-const": preferConstRule,
|
|
16229
|
-
"prefer-object-spread": preferObjectSpreadRule,
|
|
16230
|
-
"prefer-template": preferTemplate,
|
|
16231
|
-
"use-isnan": useIsNaNRule,
|
|
16232
|
-
"valid-typeof": validTypeofRule
|
|
16224
|
+
"array-callback-return": codeOnly(arrayCallbackReturnRule),
|
|
16225
|
+
"constructor-super": codeOnly(constructorSuperRule),
|
|
16226
|
+
"for-direction": codeOnly(forDirectionRule),
|
|
16227
|
+
"getter-return": codeOnly(getterReturnRule),
|
|
16228
|
+
"no-async-promise-executor": codeOnly(noAsyncPromiseExecutorRule),
|
|
16229
|
+
"no-compare-neg-zero": codeOnly(noCompareNegZeroRule),
|
|
16230
|
+
"no-cond-assign": codeOnly(noCondAssignRule),
|
|
16231
|
+
"no-const-assign": codeOnly(noConstAssignRule),
|
|
16232
|
+
"no-constant-condition": codeOnly(noConstantConditionRule),
|
|
16233
|
+
"no-constructor-return": codeOnly(noConstructorReturnRule),
|
|
16234
|
+
"no-dupe-class-members": codeOnly(noDupeClassMembersRule),
|
|
16235
|
+
"no-dupe-keys": codeOnly(noDupeKeysRule),
|
|
16236
|
+
"no-duplicate-case": codeOnly(noDuplicateCaseRule),
|
|
16237
|
+
"no-empty-pattern": codeOnly(noEmptyPatternRule),
|
|
16238
|
+
"no-fallthrough": codeOnly(noFallthroughRule),
|
|
16239
|
+
"no-irregular-whitespace": codeOnly(noIrregularWhitespaceRule),
|
|
16240
|
+
"no-loss-of-precision": codeOnly(noLossOfPrecisionRule),
|
|
16241
|
+
"no-new": codeOnly(noNew),
|
|
16242
|
+
"no-regex-spaces": codeOnly(noRegexSpaces),
|
|
16243
|
+
"no-promise-executor-return": codeOnly(noPromiseExecutorReturnRule),
|
|
16244
|
+
"no-redeclare": codeOnly(noRedeclareRule),
|
|
16245
|
+
"no-self-assign": codeOnly(noSelfAssignRule),
|
|
16246
|
+
"no-self-compare": codeOnly(noSelfCompareRule),
|
|
16247
|
+
"no-sparse-arrays": codeOnly(noSparseArraysRule),
|
|
16248
|
+
"no-undef": codeOnly(noUndefRule),
|
|
16249
|
+
"no-unsafe-negation": codeOnly(noUnsafeNegationRule),
|
|
16250
|
+
"no-unreachable": codeOnly(noUnreachableRule),
|
|
16251
|
+
"no-unused-vars": codeOnly(noUnusedVarsRule),
|
|
16252
|
+
"no-useless-catch": codeOnly(noUselessCatchRule),
|
|
16253
|
+
"prefer-const": codeOnly(preferConstRule),
|
|
16254
|
+
"prefer-object-spread": codeOnly(preferObjectSpreadRule),
|
|
16255
|
+
"prefer-template": codeOnly(preferTemplate),
|
|
16256
|
+
"use-isnan": codeOnly(useIsNaNRule),
|
|
16257
|
+
"valid-typeof": codeOnly(validTypeofRule)
|
|
16233
16258
|
}
|
|
16234
16259
|
};
|
|
16235
16260
|
});
|
|
@@ -18378,9 +18403,17 @@ var init_no_empty_links = __esm(() => {
|
|
|
18378
18403
|
check: (text, ctx) => {
|
|
18379
18404
|
const issues = [];
|
|
18380
18405
|
const lines = text.split(/\r?\n/);
|
|
18406
|
+
let inFence = false;
|
|
18381
18407
|
for (let i = 0;i < lines.length; i++) {
|
|
18382
18408
|
const line = lines[i];
|
|
18383
|
-
|
|
18409
|
+
if (/^(`{3,}|~{3,})/.test(line.trim())) {
|
|
18410
|
+
inFence = !inFence;
|
|
18411
|
+
continue;
|
|
18412
|
+
}
|
|
18413
|
+
if (inFence)
|
|
18414
|
+
continue;
|
|
18415
|
+
const stripped = line.replace(/`[^`]+`/g, (m) => "x".repeat(m.length));
|
|
18416
|
+
const emptyUrlMatches = stripped.matchAll(/\[[^\]]+\]\(\s*\)/g);
|
|
18384
18417
|
for (const match of emptyUrlMatches) {
|
|
18385
18418
|
const column = match.index + 1;
|
|
18386
18419
|
issues.push({
|
|
@@ -18392,7 +18425,7 @@ var init_no_empty_links = __esm(() => {
|
|
|
18392
18425
|
severity: "error"
|
|
18393
18426
|
});
|
|
18394
18427
|
}
|
|
18395
|
-
const emptyTextMatches =
|
|
18428
|
+
const emptyTextMatches = stripped.matchAll(/\[\s*\]\([^)]+\)/g);
|
|
18396
18429
|
for (const match of emptyTextMatches) {
|
|
18397
18430
|
const column = match.index + 1;
|
|
18398
18431
|
issues.push({
|
|
@@ -18420,8 +18453,15 @@ var init_no_hard_tabs = __esm(() => {
|
|
|
18420
18453
|
check: (text, ctx) => {
|
|
18421
18454
|
const issues = [];
|
|
18422
18455
|
const lines = text.split(/\r?\n/);
|
|
18456
|
+
let inFence = false;
|
|
18423
18457
|
for (let i = 0;i < lines.length; i++) {
|
|
18424
18458
|
const line = lines[i];
|
|
18459
|
+
if (/^(`{3,}|~{3,})/.test(line.trim())) {
|
|
18460
|
+
inFence = !inFence;
|
|
18461
|
+
continue;
|
|
18462
|
+
}
|
|
18463
|
+
if (inFence)
|
|
18464
|
+
continue;
|
|
18425
18465
|
const tabIndex = line.indexOf("\t");
|
|
18426
18466
|
if (tabIndex !== -1) {
|
|
18427
18467
|
issues.push({
|
|
@@ -20030,11 +20070,12 @@ var nodePlugin;
|
|
|
20030
20070
|
var init_node = __esm(() => {
|
|
20031
20071
|
init_prefer_global_buffer();
|
|
20032
20072
|
init_prefer_global_process();
|
|
20073
|
+
init_utils();
|
|
20033
20074
|
nodePlugin = {
|
|
20034
20075
|
name: "node",
|
|
20035
20076
|
rules: {
|
|
20036
|
-
"prefer-global/buffer": preferGlobalBuffer,
|
|
20037
|
-
"prefer-global/process": preferGlobalProcess
|
|
20077
|
+
"prefer-global/buffer": codeOnly(preferGlobalBuffer),
|
|
20078
|
+
"prefer-global/process": codeOnly(preferGlobalProcess)
|
|
20038
20079
|
}
|
|
20039
20080
|
};
|
|
20040
20081
|
});
|
|
@@ -20078,10 +20119,11 @@ ${rest}`;
|
|
|
20078
20119
|
var perfectionistPlugin;
|
|
20079
20120
|
var init_perfectionist = __esm(() => {
|
|
20080
20121
|
init_imports();
|
|
20122
|
+
init_utils();
|
|
20081
20123
|
perfectionistPlugin = {
|
|
20082
20124
|
name: "perfectionist",
|
|
20083
20125
|
rules: {
|
|
20084
|
-
"sort-imports": sortImportsRule
|
|
20126
|
+
"sort-imports": codeOnly(sortImportsRule)
|
|
20085
20127
|
}
|
|
20086
20128
|
};
|
|
20087
20129
|
});
|
|
@@ -20933,24 +20975,25 @@ var init_pickier = __esm(() => {
|
|
|
20933
20975
|
init_named_imports();
|
|
20934
20976
|
init_objects();
|
|
20935
20977
|
init_top_level_function();
|
|
20978
|
+
init_utils();
|
|
20936
20979
|
pickierPlugin = {
|
|
20937
20980
|
name: "pickier",
|
|
20938
20981
|
rules: {
|
|
20939
|
-
"sort-exports": sortExportsRule,
|
|
20940
|
-
"sort-objects": sortObjectsRule,
|
|
20941
|
-
"sort-imports": sortImportsRule,
|
|
20942
|
-
"sort-named-imports": sortNamedImportsRule,
|
|
20943
|
-
"sort-heritage-clauses": sortHeritageClausesRule,
|
|
20944
|
-
"sort-keys": sortKeysRule,
|
|
20945
|
-
"import-dedupe": importDedupeRule,
|
|
20946
|
-
"import-first": firstRule,
|
|
20947
|
-
"import-named": namedRule,
|
|
20948
|
-
"import-no-cycle": noCycleRule,
|
|
20949
|
-
"import-no-unresolved": noUnresolvedRule,
|
|
20950
|
-
"no-import-dist": noImportDistRule,
|
|
20951
|
-
"no-import-node-modules-by-path": noImportNodeModulesByPathRule,
|
|
20952
|
-
"no-duplicate-imports": noDuplicateImportsRule,
|
|
20953
|
-
"top-level-function": topLevelFunctionRule
|
|
20982
|
+
"sort-exports": codeOnly(sortExportsRule),
|
|
20983
|
+
"sort-objects": codeOnly(sortObjectsRule),
|
|
20984
|
+
"sort-imports": codeOnly(sortImportsRule),
|
|
20985
|
+
"sort-named-imports": codeOnly(sortNamedImportsRule),
|
|
20986
|
+
"sort-heritage-clauses": codeOnly(sortHeritageClausesRule),
|
|
20987
|
+
"sort-keys": codeOnly(sortKeysRule),
|
|
20988
|
+
"import-dedupe": codeOnly(importDedupeRule),
|
|
20989
|
+
"import-first": codeOnly(firstRule),
|
|
20990
|
+
"import-named": codeOnly(namedRule),
|
|
20991
|
+
"import-no-cycle": codeOnly(noCycleRule),
|
|
20992
|
+
"import-no-unresolved": codeOnly(noUnresolvedRule),
|
|
20993
|
+
"no-import-dist": codeOnly(noImportDistRule),
|
|
20994
|
+
"no-import-node-modules-by-path": codeOnly(noImportNodeModulesByPathRule),
|
|
20995
|
+
"no-duplicate-imports": codeOnly(noDuplicateImportsRule),
|
|
20996
|
+
"top-level-function": codeOnly(topLevelFunctionRule)
|
|
20954
20997
|
}
|
|
20955
20998
|
};
|
|
20956
20999
|
});
|
|
@@ -20997,48 +21040,49 @@ var init_quality = __esm(() => {
|
|
|
20997
21040
|
init_no_with();
|
|
20998
21041
|
init_prefer_arrow_callback();
|
|
20999
21042
|
init_require_await();
|
|
21043
|
+
init_utils();
|
|
21000
21044
|
qualityPlugin = {
|
|
21001
21045
|
name: "quality",
|
|
21002
21046
|
rules: {
|
|
21003
|
-
"default-case": defaultCaseRule,
|
|
21004
|
-
eqeqeq: eqeqeqRule,
|
|
21005
|
-
"no-alert": noAlertRule,
|
|
21006
|
-
"no-await-in-loop": noAwaitInLoopRule,
|
|
21007
|
-
"no-caller": noCallerRule,
|
|
21008
|
-
"no-case-declarations": noCaseDeclarationsRule,
|
|
21009
|
-
"no-else-return": noElseReturnRule,
|
|
21010
|
-
"no-empty": noEmptyRule,
|
|
21011
|
-
"no-empty-function": noEmptyFunctionRule,
|
|
21012
|
-
"no-eval": noEvalRule,
|
|
21013
|
-
"no-extend-native": noExtendNativeRule,
|
|
21014
|
-
"no-global-assign": noGlobalAssignRule,
|
|
21015
|
-
"no-implied-eval": noImpliedEvalRule,
|
|
21016
|
-
"no-iterator": noIteratorRule,
|
|
21017
|
-
"no-new": noNewRule,
|
|
21018
|
-
"no-new-func": noNewFuncRule,
|
|
21019
|
-
"no-new-wrappers": noNewWrappersRule,
|
|
21020
|
-
"no-octal": noOctalRule,
|
|
21021
|
-
"no-param-reassign": noParamReassignRule,
|
|
21022
|
-
"no-proto": noProtoRule,
|
|
21023
|
-
"no-return-assign": noReturnAssignRule,
|
|
21024
|
-
"no-shadow": noShadowRule,
|
|
21025
|
-
"no-throw-literal": noThrowLiteralRule,
|
|
21026
|
-
"no-use-before-define": noUseBeforeDefineRule,
|
|
21027
|
-
"no-useless-call": noUselessCallRule,
|
|
21028
|
-
"no-with": noWithRule,
|
|
21029
|
-
"require-await": requireAwaitRule,
|
|
21030
|
-
complexity: complexityRule,
|
|
21031
|
-
"max-depth": maxDepthRule,
|
|
21032
|
-
"max-lines-per-function": maxLinesPerFunctionRule,
|
|
21033
|
-
"no-extra-boolean-cast": noExtraBooleanCastRule,
|
|
21034
|
-
"no-lonely-if": noLonelyIfRule,
|
|
21035
|
-
"no-sequences": noSequencesRule,
|
|
21036
|
-
"no-useless-concat": noUselessConcatRule,
|
|
21037
|
-
"no-useless-escape": noUselessEscapeRule,
|
|
21038
|
-
"no-useless-rename": noUselessRenameRule,
|
|
21039
|
-
"no-useless-return": noUselessReturnRule,
|
|
21040
|
-
"no-var": noVarRule,
|
|
21041
|
-
"prefer-arrow-callback": preferArrowCallbackRule
|
|
21047
|
+
"default-case": codeOnly(defaultCaseRule),
|
|
21048
|
+
eqeqeq: codeOnly(eqeqeqRule),
|
|
21049
|
+
"no-alert": codeOnly(noAlertRule),
|
|
21050
|
+
"no-await-in-loop": codeOnly(noAwaitInLoopRule),
|
|
21051
|
+
"no-caller": codeOnly(noCallerRule),
|
|
21052
|
+
"no-case-declarations": codeOnly(noCaseDeclarationsRule),
|
|
21053
|
+
"no-else-return": codeOnly(noElseReturnRule),
|
|
21054
|
+
"no-empty": codeOnly(noEmptyRule),
|
|
21055
|
+
"no-empty-function": codeOnly(noEmptyFunctionRule),
|
|
21056
|
+
"no-eval": codeOnly(noEvalRule),
|
|
21057
|
+
"no-extend-native": codeOnly(noExtendNativeRule),
|
|
21058
|
+
"no-global-assign": codeOnly(noGlobalAssignRule),
|
|
21059
|
+
"no-implied-eval": codeOnly(noImpliedEvalRule),
|
|
21060
|
+
"no-iterator": codeOnly(noIteratorRule),
|
|
21061
|
+
"no-new": codeOnly(noNewRule),
|
|
21062
|
+
"no-new-func": codeOnly(noNewFuncRule),
|
|
21063
|
+
"no-new-wrappers": codeOnly(noNewWrappersRule),
|
|
21064
|
+
"no-octal": codeOnly(noOctalRule),
|
|
21065
|
+
"no-param-reassign": codeOnly(noParamReassignRule),
|
|
21066
|
+
"no-proto": codeOnly(noProtoRule),
|
|
21067
|
+
"no-return-assign": codeOnly(noReturnAssignRule),
|
|
21068
|
+
"no-shadow": codeOnly(noShadowRule),
|
|
21069
|
+
"no-throw-literal": codeOnly(noThrowLiteralRule),
|
|
21070
|
+
"no-use-before-define": codeOnly(noUseBeforeDefineRule),
|
|
21071
|
+
"no-useless-call": codeOnly(noUselessCallRule),
|
|
21072
|
+
"no-with": codeOnly(noWithRule),
|
|
21073
|
+
"require-await": codeOnly(requireAwaitRule),
|
|
21074
|
+
complexity: codeOnly(complexityRule),
|
|
21075
|
+
"max-depth": codeOnly(maxDepthRule),
|
|
21076
|
+
"max-lines-per-function": codeOnly(maxLinesPerFunctionRule),
|
|
21077
|
+
"no-extra-boolean-cast": codeOnly(noExtraBooleanCastRule),
|
|
21078
|
+
"no-lonely-if": codeOnly(noLonelyIfRule),
|
|
21079
|
+
"no-sequences": codeOnly(noSequencesRule),
|
|
21080
|
+
"no-useless-concat": codeOnly(noUselessConcatRule),
|
|
21081
|
+
"no-useless-escape": codeOnly(noUselessEscapeRule),
|
|
21082
|
+
"no-useless-rename": codeOnly(noUselessRenameRule),
|
|
21083
|
+
"no-useless-return": codeOnly(noUselessReturnRule),
|
|
21084
|
+
"no-var": codeOnly(noVarRule),
|
|
21085
|
+
"prefer-arrow-callback": codeOnly(preferArrowCallbackRule)
|
|
21042
21086
|
}
|
|
21043
21087
|
};
|
|
21044
21088
|
});
|
|
@@ -21085,74 +21129,194 @@ var init_no_super_linear_backtracking = __esm(() => {
|
|
|
21085
21129
|
});
|
|
21086
21130
|
|
|
21087
21131
|
// src/rules/regexp/no-unused-capturing-group.ts
|
|
21132
|
+
function parseRegexLiteral(content, idx) {
|
|
21133
|
+
let prevIdx = idx - 1;
|
|
21134
|
+
while (prevIdx >= 0 && (content[prevIdx] === " " || content[prevIdx] === "\t"))
|
|
21135
|
+
prevIdx--;
|
|
21136
|
+
const prevChar = prevIdx >= 0 ? content[prevIdx] : "";
|
|
21137
|
+
const regexPrecedes = "=(<>!&|?:;,{[+(~^%*/";
|
|
21138
|
+
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));
|
|
21139
|
+
if (!isRegex)
|
|
21140
|
+
return null;
|
|
21141
|
+
let i = idx + 1;
|
|
21142
|
+
let inClass = false;
|
|
21143
|
+
let escaped = false;
|
|
21144
|
+
let closedAt = -1;
|
|
21145
|
+
while (i < content.length) {
|
|
21146
|
+
const c = content[i];
|
|
21147
|
+
if (escaped) {
|
|
21148
|
+
escaped = false;
|
|
21149
|
+
} else if (c === "\\") {
|
|
21150
|
+
escaped = true;
|
|
21151
|
+
} else if (c === "[") {
|
|
21152
|
+
if (!inClass)
|
|
21153
|
+
inClass = true;
|
|
21154
|
+
} else if (c === "]") {
|
|
21155
|
+
if (inClass)
|
|
21156
|
+
inClass = false;
|
|
21157
|
+
} else if (c === "/" && !inClass) {
|
|
21158
|
+
closedAt = i;
|
|
21159
|
+
break;
|
|
21160
|
+
} else if (c === `
|
|
21161
|
+
`) {
|
|
21162
|
+
break;
|
|
21163
|
+
}
|
|
21164
|
+
i++;
|
|
21165
|
+
}
|
|
21166
|
+
if (closedAt <= idx)
|
|
21167
|
+
return null;
|
|
21168
|
+
const pattern = content.slice(idx + 1, closedAt);
|
|
21169
|
+
let flagEnd = closedAt + 1;
|
|
21170
|
+
while (flagEnd < content.length && /[gimsuy]/.test(content[flagEnd]))
|
|
21171
|
+
flagEnd++;
|
|
21172
|
+
if (/\\[1-9]/.test(pattern))
|
|
21173
|
+
return null;
|
|
21174
|
+
let capCount = 0;
|
|
21175
|
+
let firstCapOffset = -1;
|
|
21176
|
+
let inCharClass = false;
|
|
21177
|
+
for (let j = 0;j < pattern.length; j++) {
|
|
21178
|
+
if (pattern[j] === "\\") {
|
|
21179
|
+
j++;
|
|
21180
|
+
continue;
|
|
21181
|
+
}
|
|
21182
|
+
if (pattern[j] === "[" && !inCharClass) {
|
|
21183
|
+
inCharClass = true;
|
|
21184
|
+
continue;
|
|
21185
|
+
}
|
|
21186
|
+
if (pattern[j] === "]" && inCharClass) {
|
|
21187
|
+
inCharClass = false;
|
|
21188
|
+
continue;
|
|
21189
|
+
}
|
|
21190
|
+
if (inCharClass)
|
|
21191
|
+
continue;
|
|
21192
|
+
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) !== "?<!") {
|
|
21193
|
+
if (firstCapOffset < 0)
|
|
21194
|
+
firstCapOffset = j;
|
|
21195
|
+
capCount++;
|
|
21196
|
+
}
|
|
21197
|
+
}
|
|
21198
|
+
if (capCount === 0)
|
|
21199
|
+
return null;
|
|
21200
|
+
return { patternStart: idx, patternEnd: flagEnd, pattern, capCount, firstCapOffset };
|
|
21201
|
+
}
|
|
21202
|
+
function areCapturesUsed(content, regexStart, regexEnd) {
|
|
21203
|
+
let afterIdx = regexEnd;
|
|
21204
|
+
while (afterIdx < content.length && (content[afterIdx] === " " || content[afterIdx] === "\t"))
|
|
21205
|
+
afterIdx++;
|
|
21206
|
+
if (content[afterIdx] === ".") {
|
|
21207
|
+
const rest = content.slice(afterIdx + 1, afterIdx + 20);
|
|
21208
|
+
if (/^test\s*\(/.test(rest))
|
|
21209
|
+
return false;
|
|
21210
|
+
if (/^exec\s*\(/.test(rest))
|
|
21211
|
+
return true;
|
|
21212
|
+
}
|
|
21213
|
+
let beforeIdx = regexStart - 1;
|
|
21214
|
+
while (beforeIdx >= 0 && (content[beforeIdx] === " " || content[beforeIdx] === "\t"))
|
|
21215
|
+
beforeIdx--;
|
|
21216
|
+
if (content[beforeIdx] === "(") {
|
|
21217
|
+
let methodEnd = beforeIdx;
|
|
21218
|
+
let methodStart = methodEnd - 1;
|
|
21219
|
+
while (methodStart >= 0 && (content[methodStart] === " " || content[methodStart] === "\t"))
|
|
21220
|
+
methodStart--;
|
|
21221
|
+
const slice = content.slice(Math.max(0, methodStart - 20), methodStart + 1);
|
|
21222
|
+
if (/\.match\s*$/.test(slice))
|
|
21223
|
+
return true;
|
|
21224
|
+
if (/\.matchAll\s*$/.test(slice))
|
|
21225
|
+
return true;
|
|
21226
|
+
if (/\.exec\s*$/.test(slice))
|
|
21227
|
+
return true;
|
|
21228
|
+
if (/\.replace\s*$/.test(slice))
|
|
21229
|
+
return true;
|
|
21230
|
+
if (/\.replaceAll\s*$/.test(slice))
|
|
21231
|
+
return true;
|
|
21232
|
+
if (/\.split\s*$/.test(slice))
|
|
21233
|
+
return true;
|
|
21234
|
+
if (/\.search\s*$/.test(slice))
|
|
21235
|
+
return false;
|
|
21236
|
+
if (/\.test\s*$/.test(slice))
|
|
21237
|
+
return false;
|
|
21238
|
+
}
|
|
21239
|
+
const lineStart = content.lastIndexOf(`
|
|
21240
|
+
`, regexStart) + 1;
|
|
21241
|
+
const beforeRegex = content.slice(lineStart, regexStart).trim();
|
|
21242
|
+
const assignMatch = beforeRegex.match(/(?:const|let|var)\s+(\w+)\s*=\s*$/);
|
|
21243
|
+
if (assignMatch) {
|
|
21244
|
+
const varName = assignMatch[1];
|
|
21245
|
+
const afterContent = content.slice(regexEnd);
|
|
21246
|
+
const execPattern = new RegExp(`\\b${varName}\\.exec\\s*\\(`);
|
|
21247
|
+
const testPattern = new RegExp(`\\b${varName}\\.test\\s*\\(`);
|
|
21248
|
+
const matchPattern = new RegExp(`\\.match(?:All)?\\s*\\(\\s*${varName}\\s*\\)`);
|
|
21249
|
+
const replacePattern = new RegExp(`\\.replace(?:All)?\\s*\\(\\s*${varName}`);
|
|
21250
|
+
const hasExec = execPattern.test(afterContent);
|
|
21251
|
+
const hasMatch = matchPattern.test(afterContent);
|
|
21252
|
+
const hasReplace = replacePattern.test(afterContent);
|
|
21253
|
+
const hasTest = testPattern.test(afterContent);
|
|
21254
|
+
if (hasExec || hasMatch || hasReplace)
|
|
21255
|
+
return true;
|
|
21256
|
+
if (hasTest)
|
|
21257
|
+
return false;
|
|
21258
|
+
return true;
|
|
21259
|
+
}
|
|
21260
|
+
return true;
|
|
21261
|
+
}
|
|
21088
21262
|
function findIssues(content, ctx) {
|
|
21089
21263
|
const issues = [];
|
|
21090
21264
|
const filePath = ctx.filePath;
|
|
21091
|
-
const _re = /(^|[^\\\w])/g;
|
|
21092
21265
|
let idx = 0;
|
|
21093
21266
|
while (idx < content.length) {
|
|
21094
21267
|
const ch = content[idx];
|
|
21095
|
-
if (ch === "/") {
|
|
21096
|
-
|
|
21097
|
-
|
|
21098
|
-
|
|
21099
|
-
|
|
21100
|
-
|
|
21101
|
-
|
|
21102
|
-
|
|
21103
|
-
|
|
21104
|
-
|
|
21105
|
-
|
|
21106
|
-
|
|
21107
|
-
|
|
21108
|
-
|
|
21109
|
-
|
|
21110
|
-
|
|
21111
|
-
|
|
21112
|
-
|
|
21113
|
-
|
|
21268
|
+
if (ch === "/" && content[idx + 1] === "/") {
|
|
21269
|
+
while (idx < content.length && content[idx] !== `
|
|
21270
|
+
`)
|
|
21271
|
+
idx++;
|
|
21272
|
+
continue;
|
|
21273
|
+
}
|
|
21274
|
+
if (ch === "/" && content[idx + 1] === "*") {
|
|
21275
|
+
idx += 2;
|
|
21276
|
+
while (idx < content.length - 1 && !(content[idx] === "*" && content[idx + 1] === "/"))
|
|
21277
|
+
idx++;
|
|
21278
|
+
idx += 2;
|
|
21279
|
+
continue;
|
|
21280
|
+
}
|
|
21281
|
+
if (ch === "'" || ch === '"' || ch === "`") {
|
|
21282
|
+
const quote = ch;
|
|
21283
|
+
idx++;
|
|
21284
|
+
while (idx < content.length) {
|
|
21285
|
+
if (content[idx] === "\\") {
|
|
21286
|
+
idx += 2;
|
|
21287
|
+
continue;
|
|
21288
|
+
}
|
|
21289
|
+
if (content[idx] === quote) {
|
|
21290
|
+
idx++;
|
|
21114
21291
|
break;
|
|
21115
21292
|
}
|
|
21116
|
-
|
|
21293
|
+
idx++;
|
|
21117
21294
|
}
|
|
21118
|
-
|
|
21119
|
-
|
|
21120
|
-
|
|
21121
|
-
|
|
21122
|
-
|
|
21123
|
-
|
|
21124
|
-
let capCount = 0;
|
|
21125
|
-
for (let j = 0;j < pattern.length; j++) {
|
|
21126
|
-
const c = pattern[j];
|
|
21127
|
-
if (c === "(") {
|
|
21128
|
-
const prev = pattern[j - 1];
|
|
21129
|
-
const isEscaped = prev === "\\";
|
|
21130
|
-
if (!isEscaped) {
|
|
21131
|
-
const next2 = pattern.slice(j + 1, j + 3);
|
|
21132
|
-
if (next2 !== "?:")
|
|
21133
|
-
capCount++;
|
|
21134
|
-
}
|
|
21135
|
-
}
|
|
21136
|
-
}
|
|
21137
|
-
if (capCount > 0) {
|
|
21138
|
-
const rel = pattern.indexOf("(");
|
|
21139
|
-
const reportPos = idx + 1 + (rel >= 0 ? rel : 0);
|
|
21140
|
-
const prefix = content.slice(0, reportPos);
|
|
21141
|
-
const line = (prefix.match(/\r?\n/g) || []).length + 1;
|
|
21142
|
-
const col = reportPos - (prefix.lastIndexOf(`
|
|
21143
|
-
`) + 1) + 1;
|
|
21144
|
-
issues.push({
|
|
21145
|
-
filePath,
|
|
21146
|
-
line,
|
|
21147
|
-
column: col,
|
|
21148
|
-
ruleId: "regexp/no-unused-capturing-group",
|
|
21149
|
-
message: "Unused capturing group in regular expression",
|
|
21150
|
-
severity: "error"
|
|
21151
|
-
});
|
|
21152
|
-
}
|
|
21153
|
-
idx = closedAt + 1;
|
|
21295
|
+
continue;
|
|
21296
|
+
}
|
|
21297
|
+
if (ch === "/") {
|
|
21298
|
+
const info = parseRegexLiteral(content, idx);
|
|
21299
|
+
if (!info) {
|
|
21300
|
+
idx++;
|
|
21154
21301
|
continue;
|
|
21155
21302
|
}
|
|
21303
|
+
if (!areCapturesUsed(content, info.patternStart, info.patternEnd)) {
|
|
21304
|
+
const reportPos = info.patternStart + 1 + (info.firstCapOffset >= 0 ? info.firstCapOffset : 0);
|
|
21305
|
+
const prefix = content.slice(0, reportPos);
|
|
21306
|
+
const line = (prefix.match(/\r?\n/g) || []).length + 1;
|
|
21307
|
+
const col = reportPos - (prefix.lastIndexOf(`
|
|
21308
|
+
`) + 1) + 1;
|
|
21309
|
+
issues.push({
|
|
21310
|
+
filePath,
|
|
21311
|
+
line,
|
|
21312
|
+
column: col,
|
|
21313
|
+
ruleId: "regexp/no-unused-capturing-group",
|
|
21314
|
+
message: "Unused capturing group in regular expression; use non-capturing group (?:...) instead",
|
|
21315
|
+
severity: "error"
|
|
21316
|
+
});
|
|
21317
|
+
}
|
|
21318
|
+
idx = info.patternEnd;
|
|
21319
|
+
continue;
|
|
21156
21320
|
}
|
|
21157
21321
|
idx++;
|
|
21158
21322
|
}
|
|
@@ -21162,7 +21326,7 @@ var noUnusedCapturingGroupRule;
|
|
|
21162
21326
|
var init_no_unused_capturing_group = __esm(() => {
|
|
21163
21327
|
noUnusedCapturingGroupRule = {
|
|
21164
21328
|
meta: {
|
|
21165
|
-
docs: "Flags regex literals with capturing groups
|
|
21329
|
+
docs: "Flags regex literals with unused capturing groups (context-aware)",
|
|
21166
21330
|
recommended: false
|
|
21167
21331
|
},
|
|
21168
21332
|
check(content, ctx) {
|
|
@@ -21224,12 +21388,13 @@ var init_regexp = __esm(() => {
|
|
|
21224
21388
|
init_no_super_linear_backtracking();
|
|
21225
21389
|
init_no_unused_capturing_group();
|
|
21226
21390
|
init_no_useless_lazy();
|
|
21391
|
+
init_utils();
|
|
21227
21392
|
regexpPlugin = {
|
|
21228
21393
|
name: "regexp",
|
|
21229
21394
|
rules: {
|
|
21230
|
-
"no-super-linear-backtracking": noSuperLinearBacktrackingRule,
|
|
21231
|
-
"no-unused-capturing-group": noUnusedCapturingGroupRule,
|
|
21232
|
-
"no-useless-lazy": noUselessLazy
|
|
21395
|
+
"no-super-linear-backtracking": codeOnly(noSuperLinearBacktrackingRule),
|
|
21396
|
+
"no-unused-capturing-group": codeOnly(noUnusedCapturingGroupRule),
|
|
21397
|
+
"no-useless-lazy": codeOnly(noUselessLazy)
|
|
21233
21398
|
}
|
|
21234
21399
|
};
|
|
21235
21400
|
});
|
|
@@ -25430,22 +25595,7 @@ var init_yield_star_spacing = __esm(() => {
|
|
|
25430
25595
|
});
|
|
25431
25596
|
|
|
25432
25597
|
// src/plugins/style.ts
|
|
25433
|
-
|
|
25434
|
-
return {
|
|
25435
|
-
meta: rule.meta,
|
|
25436
|
-
check: (content, context) => {
|
|
25437
|
-
if (!CODE_EXTS2.test(context.filePath))
|
|
25438
|
-
return [];
|
|
25439
|
-
return rule.check(content, context);
|
|
25440
|
-
},
|
|
25441
|
-
fix: rule.fix ? (content, context) => {
|
|
25442
|
-
if (!CODE_EXTS2.test(context.filePath))
|
|
25443
|
-
return content;
|
|
25444
|
-
return rule.fix(content, context);
|
|
25445
|
-
} : undefined
|
|
25446
|
-
};
|
|
25447
|
-
}
|
|
25448
|
-
var CODE_EXTS2, stylePlugin;
|
|
25598
|
+
var stylePlugin;
|
|
25449
25599
|
var init_style = __esm(() => {
|
|
25450
25600
|
init_array_bracket_spacing();
|
|
25451
25601
|
init_arrow_parens();
|
|
@@ -25497,7 +25647,7 @@ var init_style = __esm(() => {
|
|
|
25497
25647
|
init_template_tag_spacing();
|
|
25498
25648
|
init_wrap_iife();
|
|
25499
25649
|
init_yield_star_spacing();
|
|
25500
|
-
|
|
25650
|
+
init_utils();
|
|
25501
25651
|
stylePlugin = {
|
|
25502
25652
|
name: "style",
|
|
25503
25653
|
rules: {
|
|
@@ -26092,9 +26242,9 @@ var init_no_top_level_await = __esm(() => {
|
|
|
26092
26242
|
}
|
|
26093
26243
|
if (!escape && ch === "'") {
|
|
26094
26244
|
inSQ = false;
|
|
26095
|
-
escape = false;
|
|
26096
|
-
continue;
|
|
26097
26245
|
}
|
|
26246
|
+
escape = false;
|
|
26247
|
+
continue;
|
|
26098
26248
|
}
|
|
26099
26249
|
if (inDQ) {
|
|
26100
26250
|
if (!escape && ch === "\\") {
|
|
@@ -26103,9 +26253,9 @@ var init_no_top_level_await = __esm(() => {
|
|
|
26103
26253
|
}
|
|
26104
26254
|
if (!escape && ch === '"') {
|
|
26105
26255
|
inDQ = false;
|
|
26106
|
-
escape = false;
|
|
26107
|
-
continue;
|
|
26108
26256
|
}
|
|
26257
|
+
escape = false;
|
|
26258
|
+
continue;
|
|
26109
26259
|
}
|
|
26110
26260
|
if (inTQ) {
|
|
26111
26261
|
if (!escape && ch === "\\") {
|
|
@@ -26897,22 +27047,23 @@ var init_ts = __esm(() => {
|
|
|
26897
27047
|
init_type_annotation_spacing();
|
|
26898
27048
|
init_type_generic_spacing();
|
|
26899
27049
|
init_type_named_tuple_spacing();
|
|
27050
|
+
init_utils();
|
|
26900
27051
|
tsPlugin = {
|
|
26901
27052
|
name: "ts",
|
|
26902
27053
|
rules: {
|
|
26903
|
-
"no-require-imports": noRequireImportsRule,
|
|
26904
|
-
"no-top-level-await": noTopLevelAwaitRule,
|
|
26905
|
-
"no-ts-export-equal": noTsExportEqualRule,
|
|
26906
|
-
"no-explicit-any": noExplicitAnyRule,
|
|
26907
|
-
"prefer-nullish-coalescing": preferNullishCoalescingRule,
|
|
26908
|
-
"prefer-optional-chain": preferOptionalChainRule,
|
|
26909
|
-
"no-floating-promises": noFloatingPromisesRule,
|
|
26910
|
-
"no-misused-promises": noMisusedPromisesRule,
|
|
26911
|
-
"no-unsafe-assignment": noUnsafeAssignmentRule,
|
|
26912
|
-
"member-delimiter-style": memberDelimiterStyleRule,
|
|
26913
|
-
"type-annotation-spacing": typeAnnotationSpacingRule,
|
|
26914
|
-
"type-generic-spacing": typeGenericSpacingRule,
|
|
26915
|
-
"type-named-tuple-spacing": typeNamedTupleSpacingRule
|
|
27054
|
+
"no-require-imports": codeOnly(noRequireImportsRule),
|
|
27055
|
+
"no-top-level-await": codeOnly(noTopLevelAwaitRule),
|
|
27056
|
+
"no-ts-export-equal": codeOnly(noTsExportEqualRule),
|
|
27057
|
+
"no-explicit-any": codeOnly(noExplicitAnyRule),
|
|
27058
|
+
"prefer-nullish-coalescing": codeOnly(preferNullishCoalescingRule),
|
|
27059
|
+
"prefer-optional-chain": codeOnly(preferOptionalChainRule),
|
|
27060
|
+
"no-floating-promises": codeOnly(noFloatingPromisesRule),
|
|
27061
|
+
"no-misused-promises": codeOnly(noMisusedPromisesRule),
|
|
27062
|
+
"no-unsafe-assignment": codeOnly(noUnsafeAssignmentRule),
|
|
27063
|
+
"member-delimiter-style": codeOnly(memberDelimiterStyleRule),
|
|
27064
|
+
"type-annotation-spacing": codeOnly(typeAnnotationSpacingRule),
|
|
27065
|
+
"type-generic-spacing": codeOnly(typeGenericSpacingRule),
|
|
27066
|
+
"type-named-tuple-spacing": codeOnly(typeNamedTupleSpacingRule)
|
|
26916
27067
|
}
|
|
26917
27068
|
};
|
|
26918
27069
|
});
|
|
@@ -26921,11 +27072,12 @@ var init_ts = __esm(() => {
|
|
|
26921
27072
|
var unusedImportsPlugin;
|
|
26922
27073
|
var init_unused_imports = __esm(() => {
|
|
26923
27074
|
init_no_unused_vars();
|
|
27075
|
+
init_utils();
|
|
26924
27076
|
unusedImportsPlugin = {
|
|
26925
27077
|
name: "unused-imports",
|
|
26926
27078
|
rules: {
|
|
26927
|
-
"no-unused-vars": noUnusedVarsRule,
|
|
26928
|
-
"no-unused-imports": noUnusedVarsRule
|
|
27079
|
+
"no-unused-vars": codeOnly(noUnusedVarsRule),
|
|
27080
|
+
"no-unused-imports": codeOnly(noUnusedVarsRule)
|
|
26929
27081
|
}
|
|
26930
27082
|
};
|
|
26931
27083
|
});
|
|
@@ -27026,13 +27178,9 @@ async function loadConfigFromPath(pathLike) {
|
|
|
27026
27178
|
return _cachedDefaultConfig;
|
|
27027
27179
|
}
|
|
27028
27180
|
try {
|
|
27029
|
-
const {
|
|
27030
|
-
const
|
|
27031
|
-
|
|
27032
|
-
if (existsSync10(configPath)) {
|
|
27033
|
-
const { config: config4 } = await init_config().then(() => exports_config);
|
|
27034
|
-
return mergeConfig(config4, {});
|
|
27035
|
-
}
|
|
27181
|
+
const { getConfig: getConfig2 } = await init_config().then(() => exports_config);
|
|
27182
|
+
const cfg = await getConfig2();
|
|
27183
|
+
return mergeConfig(defaultConfig3, cfg);
|
|
27036
27184
|
} catch {}
|
|
27037
27185
|
return mergeConfig(defaultConfig3, {});
|
|
27038
27186
|
}
|
|
@@ -27097,7 +27245,7 @@ function shouldIgnorePath(absPath, ignoreGlobs) {
|
|
|
27097
27245
|
return false;
|
|
27098
27246
|
}
|
|
27099
27247
|
var MAX_FIXER_PASSES = 5, ENV, UNIVERSAL_IGNORES, colors, _cachedDefaultConfig = null;
|
|
27100
|
-
var
|
|
27248
|
+
var init_utils2 = __esm(async () => {
|
|
27101
27249
|
await init_config();
|
|
27102
27250
|
ENV = {
|
|
27103
27251
|
get TRACE() {
|
|
@@ -27390,7 +27538,7 @@ var init_formatter = __esm(async () => {
|
|
|
27390
27538
|
init_plugins();
|
|
27391
27539
|
await __promiseAll([
|
|
27392
27540
|
init_src(),
|
|
27393
|
-
|
|
27541
|
+
init_utils2()
|
|
27394
27542
|
]);
|
|
27395
27543
|
});
|
|
27396
27544
|
|
|
@@ -28816,7 +28964,7 @@ var init_linter = __esm(async () => {
|
|
|
28816
28964
|
await __promiseAll([
|
|
28817
28965
|
init_src(),
|
|
28818
28966
|
init_formatter(),
|
|
28819
|
-
|
|
28967
|
+
init_utils2()
|
|
28820
28968
|
]);
|
|
28821
28969
|
});
|
|
28822
28970
|
|
|
@@ -28871,7 +29019,7 @@ async function runUnified(globs, options) {
|
|
|
28871
29019
|
}
|
|
28872
29020
|
var init_run = __esm(async () => {
|
|
28873
29021
|
init_format();
|
|
28874
|
-
await
|
|
29022
|
+
await init_utils2();
|
|
28875
29023
|
});
|
|
28876
29024
|
|
|
28877
29025
|
// src/index.ts
|
|
@@ -28882,7 +29030,7 @@ await __promiseAll([
|
|
|
28882
29030
|
init_run()
|
|
28883
29031
|
]);
|
|
28884
29032
|
init_format();
|
|
28885
|
-
|
|
29033
|
+
init_utils2();
|
|
28886
29034
|
export {
|
|
28887
29035
|
yellow5 as yellow,
|
|
28888
29036
|
shouldIgnorePath,
|