pickier 0.1.15 → 0.1.17

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 CHANGED
@@ -353,13 +353,18 @@ function detectQuoteIssues(line, preferred) {
353
353
  }
354
354
  return indices;
355
355
  }
356
- function hasIndentIssue(leading, indentSize, indentStyle = "spaces") {
356
+ function hasIndentIssue(leading, indentSize, indentStyle = "spaces", lineContent) {
357
357
  if (indentStyle === "tabs") {
358
358
  return /[^\t]/.test(leading);
359
359
  }
360
360
  if (/\t/.test(leading))
361
361
  return true;
362
362
  const spaces = leading.length;
363
+ if (lineContent && spaces % indentSize === 1) {
364
+ const trimmed = lineContent.trimStart();
365
+ if (trimmed.startsWith("* ") || trimmed.startsWith("*/") || trimmed === "*")
366
+ return false;
367
+ }
363
368
  return spaces % indentSize !== 0;
364
369
  }
365
370
  function maskStrings(input) {
@@ -6131,7 +6136,7 @@ var init_config = __esm(async () => {
6131
6136
  "markdown/proper-names": "off",
6132
6137
  "markdown/no-alt-text": "warn",
6133
6138
  "markdown/table-pipe-style": "warn",
6134
- "markdown/table-column-count": "error",
6139
+ "markdown/table-column-count": "warn",
6135
6140
  "markdown/table-column-style": "warn",
6136
6141
  "lockfile/validate-host": ["warn", { allowedHosts: ["npm", "yarn"] }],
6137
6142
  "lockfile/validate-https": "error",
@@ -6212,8 +6217,9 @@ async function loadConfigFromPath(pathLike) {
6212
6217
  const { join: join4 } = await import("path");
6213
6218
  const configPath = join4(process13.cwd(), "pickier.config.ts");
6214
6219
  if (existsSync6(configPath)) {
6215
- const { config: config4 } = await init_config().then(() => exports_config);
6216
- return mergeConfig(config4, {});
6220
+ const { getConfig: getConfig2 } = await init_config().then(() => exports_config);
6221
+ const cfg = await getConfig2();
6222
+ return mergeConfig(defaultConfig3, cfg);
6217
6223
  }
6218
6224
  } catch {}
6219
6225
  return mergeConfig(defaultConfig3, {});
@@ -15088,6 +15094,27 @@ var init_require_await = __esm(() => {
15088
15094
  };
15089
15095
  });
15090
15096
 
15097
+ // src/plugins/utils.ts
15098
+ function codeOnly(rule) {
15099
+ return {
15100
+ meta: rule.meta,
15101
+ check: (content, context) => {
15102
+ if (!CODE_EXTS2.test(context.filePath))
15103
+ return [];
15104
+ return rule.check(content, context);
15105
+ },
15106
+ fix: rule.fix ? (content, context) => {
15107
+ if (!CODE_EXTS2.test(context.filePath))
15108
+ return content;
15109
+ return rule.fix(content, context);
15110
+ } : undefined
15111
+ };
15112
+ }
15113
+ var CODE_EXTS2;
15114
+ var init_utils2 = __esm(() => {
15115
+ CODE_EXTS2 = /\.(?:ts|js|tsx|jsx|mts|mjs|cts|cjs)$/;
15116
+ });
15117
+
15091
15118
  // src/plugins/eslint.ts
15092
15119
  var eslintPlugin;
15093
15120
  var init_eslint = __esm(() => {
@@ -15156,74 +15183,75 @@ var init_eslint = __esm(() => {
15156
15183
  init_no_with();
15157
15184
  init_prefer_arrow_callback();
15158
15185
  init_require_await();
15186
+ init_utils2();
15159
15187
  eslintPlugin = {
15160
15188
  name: "eslint",
15161
15189
  rules: {
15162
- "array-callback-return": arrayCallbackReturnRule,
15163
- "constructor-super": constructorSuperRule,
15164
- "for-direction": forDirectionRule,
15165
- "getter-return": getterReturnRule,
15166
- "no-async-promise-executor": noAsyncPromiseExecutorRule,
15167
- "no-compare-neg-zero": noCompareNegZeroRule,
15168
- "no-cond-assign": noCondAssignRule,
15169
- "no-constant-condition": noConstantConditionRule,
15170
- "no-const-assign": noConstAssignRule,
15171
- "no-dupe-class-members": noDupeClassMembersRule,
15172
- "no-dupe-keys": noDupeKeysRule,
15173
- "no-duplicate-case": noDuplicateCaseRule,
15174
- "no-empty-pattern": noEmptyPatternRule,
15175
- "no-fallthrough": noFallthroughRule,
15176
- "no-loss-of-precision": noLossOfPrecisionRule,
15177
- "no-promise-executor-return": noPromiseExecutorReturnRule,
15178
- "no-redeclare": noRedeclareRule,
15179
- "no-self-assign": noSelfAssignRule,
15180
- "no-self-compare": noSelfCompareRule,
15181
- "no-sparse-arrays": noSparseArraysRule,
15182
- "no-undef": noUndefRule,
15183
- "no-unsafe-negation": noUnsafeNegationRule,
15184
- "no-unreachable": noUnreachableRule,
15185
- "no-useless-catch": noUselessCatchRule,
15186
- "use-isnan": useIsNaNRule,
15187
- "valid-typeof": validTypeofRule,
15188
- "default-case": defaultCaseRule,
15189
- eqeqeq: eqeqeqRule,
15190
- "no-alert": noAlertRule,
15191
- "no-await-in-loop": noAwaitInLoopRule,
15192
- "no-caller": noCallerRule,
15193
- "no-case-declarations": noCaseDeclarationsRule,
15194
- "no-else-return": noElseReturnRule,
15195
- "no-empty": noEmptyRule,
15196
- "no-empty-function": noEmptyFunctionRule,
15197
- "no-eval": noEvalRule,
15198
- "no-extend-native": noExtendNativeRule,
15199
- "no-global-assign": noGlobalAssignRule,
15200
- "no-implied-eval": noImpliedEvalRule,
15201
- "no-iterator": noIteratorRule,
15202
- "no-new": noNewRule,
15203
- "no-new-func": noNewFuncRule,
15204
- "no-new-wrappers": noNewWrappersRule,
15205
- "no-octal": noOctalRule,
15206
- "no-param-reassign": noParamReassignRule,
15207
- "no-proto": noProtoRule,
15208
- "no-return-assign": noReturnAssignRule,
15209
- "no-shadow": noShadowRule,
15210
- "no-throw-literal": noThrowLiteralRule,
15211
- "no-use-before-define": noUseBeforeDefineRule,
15212
- "no-useless-call": noUselessCallRule,
15213
- "no-with": noWithRule,
15214
- "require-await": requireAwaitRule,
15215
- complexity: complexityRule,
15216
- "max-depth": maxDepthRule,
15217
- "max-lines-per-function": maxLinesPerFunctionRule,
15218
- "no-extra-boolean-cast": noExtraBooleanCastRule,
15219
- "no-lonely-if": noLonelyIfRule,
15220
- "no-sequences": noSequencesRule,
15221
- "no-useless-concat": noUselessConcatRule,
15222
- "no-useless-escape": noUselessEscapeRule,
15223
- "no-useless-rename": noUselessRenameRule,
15224
- "no-useless-return": noUselessReturnRule,
15225
- "no-var": noVarRule,
15226
- "prefer-arrow-callback": preferArrowCallbackRule
15190
+ "array-callback-return": codeOnly(arrayCallbackReturnRule),
15191
+ "constructor-super": codeOnly(constructorSuperRule),
15192
+ "for-direction": codeOnly(forDirectionRule),
15193
+ "getter-return": codeOnly(getterReturnRule),
15194
+ "no-async-promise-executor": codeOnly(noAsyncPromiseExecutorRule),
15195
+ "no-compare-neg-zero": codeOnly(noCompareNegZeroRule),
15196
+ "no-cond-assign": codeOnly(noCondAssignRule),
15197
+ "no-constant-condition": codeOnly(noConstantConditionRule),
15198
+ "no-const-assign": codeOnly(noConstAssignRule),
15199
+ "no-dupe-class-members": codeOnly(noDupeClassMembersRule),
15200
+ "no-dupe-keys": codeOnly(noDupeKeysRule),
15201
+ "no-duplicate-case": codeOnly(noDuplicateCaseRule),
15202
+ "no-empty-pattern": codeOnly(noEmptyPatternRule),
15203
+ "no-fallthrough": codeOnly(noFallthroughRule),
15204
+ "no-loss-of-precision": codeOnly(noLossOfPrecisionRule),
15205
+ "no-promise-executor-return": codeOnly(noPromiseExecutorReturnRule),
15206
+ "no-redeclare": codeOnly(noRedeclareRule),
15207
+ "no-self-assign": codeOnly(noSelfAssignRule),
15208
+ "no-self-compare": codeOnly(noSelfCompareRule),
15209
+ "no-sparse-arrays": codeOnly(noSparseArraysRule),
15210
+ "no-undef": codeOnly(noUndefRule),
15211
+ "no-unsafe-negation": codeOnly(noUnsafeNegationRule),
15212
+ "no-unreachable": codeOnly(noUnreachableRule),
15213
+ "no-useless-catch": codeOnly(noUselessCatchRule),
15214
+ "use-isnan": codeOnly(useIsNaNRule),
15215
+ "valid-typeof": codeOnly(validTypeofRule),
15216
+ "default-case": codeOnly(defaultCaseRule),
15217
+ eqeqeq: codeOnly(eqeqeqRule),
15218
+ "no-alert": codeOnly(noAlertRule),
15219
+ "no-await-in-loop": codeOnly(noAwaitInLoopRule),
15220
+ "no-caller": codeOnly(noCallerRule),
15221
+ "no-case-declarations": codeOnly(noCaseDeclarationsRule),
15222
+ "no-else-return": codeOnly(noElseReturnRule),
15223
+ "no-empty": codeOnly(noEmptyRule),
15224
+ "no-empty-function": codeOnly(noEmptyFunctionRule),
15225
+ "no-eval": codeOnly(noEvalRule),
15226
+ "no-extend-native": codeOnly(noExtendNativeRule),
15227
+ "no-global-assign": codeOnly(noGlobalAssignRule),
15228
+ "no-implied-eval": codeOnly(noImpliedEvalRule),
15229
+ "no-iterator": codeOnly(noIteratorRule),
15230
+ "no-new": codeOnly(noNewRule),
15231
+ "no-new-func": codeOnly(noNewFuncRule),
15232
+ "no-new-wrappers": codeOnly(noNewWrappersRule),
15233
+ "no-octal": codeOnly(noOctalRule),
15234
+ "no-param-reassign": codeOnly(noParamReassignRule),
15235
+ "no-proto": codeOnly(noProtoRule),
15236
+ "no-return-assign": codeOnly(noReturnAssignRule),
15237
+ "no-shadow": codeOnly(noShadowRule),
15238
+ "no-throw-literal": codeOnly(noThrowLiteralRule),
15239
+ "no-use-before-define": codeOnly(noUseBeforeDefineRule),
15240
+ "no-useless-call": codeOnly(noUselessCallRule),
15241
+ "no-with": codeOnly(noWithRule),
15242
+ "require-await": codeOnly(requireAwaitRule),
15243
+ complexity: codeOnly(complexityRule),
15244
+ "max-depth": codeOnly(maxDepthRule),
15245
+ "max-lines-per-function": codeOnly(maxLinesPerFunctionRule),
15246
+ "no-extra-boolean-cast": codeOnly(noExtraBooleanCastRule),
15247
+ "no-lonely-if": codeOnly(noLonelyIfRule),
15248
+ "no-sequences": codeOnly(noSequencesRule),
15249
+ "no-useless-concat": codeOnly(noUselessConcatRule),
15250
+ "no-useless-escape": codeOnly(noUselessEscapeRule),
15251
+ "no-useless-rename": codeOnly(noUselessRenameRule),
15252
+ "no-useless-return": codeOnly(noUselessReturnRule),
15253
+ "no-var": codeOnly(noVarRule),
15254
+ "prefer-arrow-callback": codeOnly(preferArrowCallbackRule)
15227
15255
  }
15228
15256
  };
15229
15257
  });
@@ -15241,8 +15269,8 @@ var init_no_constructor_return = __esm(() => {
15241
15269
  for (let i = 0;i < lines.length; i++) {
15242
15270
  const line = lines[i];
15243
15271
  const commentIdx = line.indexOf("//");
15244
- const codeOnly = commentIdx >= 0 ? line.slice(0, commentIdx) : line;
15245
- const constructorMatch = codeOnly.match(/\bconstructor\s*\(/);
15272
+ const codeOnly2 = commentIdx >= 0 ? line.slice(0, commentIdx) : line;
15273
+ const constructorMatch = codeOnly2.match(/\bconstructor\s*\(/);
15246
15274
  if (!constructorMatch)
15247
15275
  continue;
15248
15276
  let braceDepth = 0;
@@ -15486,6 +15514,8 @@ var init_no_regex_spaces = __esm(() => {
15486
15514
  const lines = content.split(/\r?\n/);
15487
15515
  for (let i = 0;i < lines.length; i++) {
15488
15516
  const line = lines[i];
15517
+ if (/^\s*\/\//.test(line))
15518
+ continue;
15489
15519
  const regexLiteralPattern = /\/(?![*/])((?:\\.|[^/\\])+)\/[gimsuvy]*/g;
15490
15520
  let match;
15491
15521
  while ((match = regexLiteralPattern.exec(line)) !== null) {
@@ -15934,7 +15964,7 @@ var init_no_unused_vars = __esm(() => {
15934
15964
  const line = lines[i];
15935
15965
  if (/^\s*\/\//.test(line))
15936
15966
  continue;
15937
- let codeOnly = line;
15967
+ let codeOnly2 = line;
15938
15968
  let inStr = null;
15939
15969
  let inRegex = false;
15940
15970
  let escaped = false;
@@ -15962,7 +15992,7 @@ var init_no_unused_vars = __esm(() => {
15962
15992
  if (/[=([{,:;!?]/.test(prevChar) || prev2Chars === "&&" || prev2Chars === "||" || /^\s*$/.test(line.slice(0, idx))) {
15963
15993
  inRegex = true;
15964
15994
  } else if (next === "/") {
15965
- codeOnly = line.slice(0, idx);
15995
+ codeOnly2 = line.slice(0, idx);
15966
15996
  break;
15967
15997
  }
15968
15998
  }
@@ -16004,7 +16034,7 @@ var init_no_unused_vars = __esm(() => {
16004
16034
  }
16005
16035
  return result;
16006
16036
  };
16007
- const codeNoRegex = stripRegex(codeOnly);
16037
+ const codeNoRegex = stripRegex(codeOnly2);
16008
16038
  const m = codeNoRegex.match(/\bfunction\b/);
16009
16039
  if (m) {
16010
16040
  if (line.includes("function scanContent") || line.includes("function findMatching")) {
@@ -16355,11 +16385,11 @@ var init_prefer_object_spread = __esm(() => {
16355
16385
  if (/^\s*\/\//.test(line))
16356
16386
  continue;
16357
16387
  const commentIdx = line.indexOf("//");
16358
- const codeOnly = commentIdx >= 0 ? line.slice(0, commentIdx) : line;
16359
- const assignMatches = codeOnly.matchAll(/\bObject\.assign\s*\(/g);
16388
+ const codeOnly2 = commentIdx >= 0 ? line.slice(0, commentIdx) : line;
16389
+ const assignMatches = codeOnly2.matchAll(/\bObject\.assign\s*\(/g);
16360
16390
  for (const match of assignMatches) {
16361
16391
  const startIdx = match.index;
16362
- const beforeAssign = codeOnly.slice(0, startIdx);
16392
+ const beforeAssign = codeOnly2.slice(0, startIdx);
16363
16393
  const singleQuotes = (beforeAssign.match(/'/g) || []).length;
16364
16394
  const doubleQuotes = (beforeAssign.match(/"/g) || []).length;
16365
16395
  const backticks = (beforeAssign.match(/`/g) || []).length;
@@ -16367,7 +16397,7 @@ var init_prefer_object_spread = __esm(() => {
16367
16397
  continue;
16368
16398
  }
16369
16399
  const openParenIdx = startIdx + "Object.assign".length;
16370
- const restOfLine = codeOnly.slice(openParenIdx);
16400
+ const restOfLine = codeOnly2.slice(openParenIdx);
16371
16401
  let firstArgEnd = -1;
16372
16402
  let parenDepth = 1;
16373
16403
  let braceDepth = 0;
@@ -16539,43 +16569,44 @@ var init_general = __esm(() => {
16539
16569
  init_prefer_template();
16540
16570
  init_use_isnan();
16541
16571
  init_valid_typeof();
16572
+ init_utils2();
16542
16573
  generalPlugin = {
16543
16574
  name: "general",
16544
16575
  rules: {
16545
- "array-callback-return": arrayCallbackReturnRule,
16546
- "constructor-super": constructorSuperRule,
16547
- "for-direction": forDirectionRule,
16548
- "getter-return": getterReturnRule,
16549
- "no-async-promise-executor": noAsyncPromiseExecutorRule,
16550
- "no-compare-neg-zero": noCompareNegZeroRule,
16551
- "no-cond-assign": noCondAssignRule,
16552
- "no-const-assign": noConstAssignRule,
16553
- "no-constant-condition": noConstantConditionRule,
16554
- "no-constructor-return": noConstructorReturnRule,
16555
- "no-dupe-class-members": noDupeClassMembersRule,
16556
- "no-dupe-keys": noDupeKeysRule,
16557
- "no-duplicate-case": noDuplicateCaseRule,
16558
- "no-empty-pattern": noEmptyPatternRule,
16559
- "no-fallthrough": noFallthroughRule,
16560
- "no-irregular-whitespace": noIrregularWhitespaceRule,
16561
- "no-loss-of-precision": noLossOfPrecisionRule,
16562
- "no-new": noNew,
16563
- "no-regex-spaces": noRegexSpaces,
16564
- "no-promise-executor-return": noPromiseExecutorReturnRule,
16565
- "no-redeclare": noRedeclareRule,
16566
- "no-self-assign": noSelfAssignRule,
16567
- "no-self-compare": noSelfCompareRule,
16568
- "no-sparse-arrays": noSparseArraysRule,
16569
- "no-undef": noUndefRule,
16570
- "no-unsafe-negation": noUnsafeNegationRule,
16571
- "no-unreachable": noUnreachableRule,
16572
- "no-unused-vars": noUnusedVarsRule,
16573
- "no-useless-catch": noUselessCatchRule,
16574
- "prefer-const": preferConstRule,
16575
- "prefer-object-spread": preferObjectSpreadRule,
16576
- "prefer-template": preferTemplate,
16577
- "use-isnan": useIsNaNRule,
16578
- "valid-typeof": validTypeofRule
16576
+ "array-callback-return": codeOnly(arrayCallbackReturnRule),
16577
+ "constructor-super": codeOnly(constructorSuperRule),
16578
+ "for-direction": codeOnly(forDirectionRule),
16579
+ "getter-return": codeOnly(getterReturnRule),
16580
+ "no-async-promise-executor": codeOnly(noAsyncPromiseExecutorRule),
16581
+ "no-compare-neg-zero": codeOnly(noCompareNegZeroRule),
16582
+ "no-cond-assign": codeOnly(noCondAssignRule),
16583
+ "no-const-assign": codeOnly(noConstAssignRule),
16584
+ "no-constant-condition": codeOnly(noConstantConditionRule),
16585
+ "no-constructor-return": codeOnly(noConstructorReturnRule),
16586
+ "no-dupe-class-members": codeOnly(noDupeClassMembersRule),
16587
+ "no-dupe-keys": codeOnly(noDupeKeysRule),
16588
+ "no-duplicate-case": codeOnly(noDuplicateCaseRule),
16589
+ "no-empty-pattern": codeOnly(noEmptyPatternRule),
16590
+ "no-fallthrough": codeOnly(noFallthroughRule),
16591
+ "no-irregular-whitespace": codeOnly(noIrregularWhitespaceRule),
16592
+ "no-loss-of-precision": codeOnly(noLossOfPrecisionRule),
16593
+ "no-new": codeOnly(noNew),
16594
+ "no-regex-spaces": codeOnly(noRegexSpaces),
16595
+ "no-promise-executor-return": codeOnly(noPromiseExecutorReturnRule),
16596
+ "no-redeclare": codeOnly(noRedeclareRule),
16597
+ "no-self-assign": codeOnly(noSelfAssignRule),
16598
+ "no-self-compare": codeOnly(noSelfCompareRule),
16599
+ "no-sparse-arrays": codeOnly(noSparseArraysRule),
16600
+ "no-undef": codeOnly(noUndefRule),
16601
+ "no-unsafe-negation": codeOnly(noUnsafeNegationRule),
16602
+ "no-unreachable": codeOnly(noUnreachableRule),
16603
+ "no-unused-vars": codeOnly(noUnusedVarsRule),
16604
+ "no-useless-catch": codeOnly(noUselessCatchRule),
16605
+ "prefer-const": codeOnly(preferConstRule),
16606
+ "prefer-object-spread": codeOnly(preferObjectSpreadRule),
16607
+ "prefer-template": codeOnly(preferTemplate),
16608
+ "use-isnan": codeOnly(useIsNaNRule),
16609
+ "valid-typeof": codeOnly(validTypeofRule)
16579
16610
  }
16580
16611
  };
16581
16612
  });
@@ -17157,38 +17188,41 @@ var init_blanks_around_fences = __esm(() => {
17157
17188
  check: (text, ctx) => {
17158
17189
  const issues = [];
17159
17190
  const lines = text.split(/\r?\n/);
17191
+ let inFence = false;
17160
17192
  for (let i = 0;i < lines.length; i++) {
17161
17193
  const line = lines[i];
17162
- const prevLine = i > 0 ? lines[i - 1] : "";
17163
- const nextLine = i + 1 < lines.length ? lines[i + 1] : "";
17164
- const isFence = /^(`{3,}|~{3,})/.test(line);
17194
+ const isFence = /^(`{3,}|~{3,})/.test(line.trim());
17165
17195
  if (isFence) {
17166
- let isOpening = true;
17167
- for (let j = i - 1;j >= 0; j--) {
17168
- if (/^(`{3,}|~{3,})/.test(lines[j])) {
17169
- isOpening = false;
17170
- break;
17196
+ if (!inFence) {
17197
+ const prevLine = i > 0 ? lines[i - 1] : "";
17198
+ if (i > 0 && prevLine.trim().length > 0) {
17199
+ if (!/^:::/.test(prevLine.trim())) {
17200
+ issues.push({
17201
+ filePath: ctx.filePath,
17202
+ line: i + 1,
17203
+ column: 1,
17204
+ ruleId: "markdown/blanks-around-fences",
17205
+ message: "Fenced code blocks should be surrounded by blank lines",
17206
+ severity: "error"
17207
+ });
17208
+ }
17171
17209
  }
17172
- }
17173
- if (isOpening && i > 0 && prevLine.trim().length > 0) {
17174
- issues.push({
17175
- filePath: ctx.filePath,
17176
- line: i + 1,
17177
- column: 1,
17178
- ruleId: "markdown/blanks-around-fences",
17179
- message: "Fenced code blocks should be surrounded by blank lines",
17180
- severity: "error"
17181
- });
17182
- }
17183
- if (!isOpening && i + 1 < lines.length && nextLine.trim().length > 0) {
17184
- issues.push({
17185
- filePath: ctx.filePath,
17186
- line: i + 1,
17187
- column: 1,
17188
- ruleId: "markdown/blanks-around-fences",
17189
- message: "Fenced code blocks should be surrounded by blank lines",
17190
- severity: "error"
17191
- });
17210
+ inFence = true;
17211
+ } else {
17212
+ const nextLine = i + 1 < lines.length ? lines[i + 1] : "";
17213
+ if (i + 1 < lines.length && nextLine.trim().length > 0) {
17214
+ if (!/^:::/.test(nextLine.trim())) {
17215
+ issues.push({
17216
+ filePath: ctx.filePath,
17217
+ line: i + 1,
17218
+ column: 1,
17219
+ ruleId: "markdown/blanks-around-fences",
17220
+ message: "Fenced code blocks should be surrounded by blank lines",
17221
+ severity: "error"
17222
+ });
17223
+ }
17224
+ }
17225
+ inFence = false;
17192
17226
  }
17193
17227
  }
17194
17228
  }
@@ -17201,10 +17235,10 @@ var init_blanks_around_fences = __esm(() => {
17201
17235
  for (let i = 0;i < lines.length; i++) {
17202
17236
  const line = lines[i];
17203
17237
  const prevLine = i > 0 ? lines[i - 1] : "";
17204
- const isFence = /^(`{3,}|~{3,})/.test(line);
17238
+ const isFence = /^(`{3,}|~{3,})/.test(line.trim());
17205
17239
  if (isFence) {
17206
17240
  if (!inFence) {
17207
- if (i > 0 && prevLine.trim().length > 0 && result.length > 0) {
17241
+ if (i > 0 && prevLine.trim().length > 0 && !/^:::/.test(prevLine.trim()) && result.length > 0) {
17208
17242
  result.push("");
17209
17243
  }
17210
17244
  inFence = true;
@@ -17215,7 +17249,7 @@ var init_blanks_around_fences = __esm(() => {
17215
17249
  result.push(line);
17216
17250
  if (isFence && !inFence && i + 1 < lines.length) {
17217
17251
  const nextLine = lines[i + 1];
17218
- if (nextLine.trim().length > 0) {
17252
+ if (nextLine.trim().length > 0 && !/^:::/.test(nextLine.trim())) {
17219
17253
  result.push("");
17220
17254
  }
17221
17255
  }
@@ -17351,14 +17385,22 @@ var init_blanks_around_lists = __esm(() => {
17351
17385
  const issues = [];
17352
17386
  const lines = text.split(/\r?\n/);
17353
17387
  let inList = false;
17354
- let listStartLine = -1;
17388
+ let inFence = false;
17355
17389
  for (let i = 0;i < lines.length; i++) {
17356
17390
  const line = lines[i];
17357
17391
  const prevLine = i > 0 ? lines[i - 1] : "";
17392
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
17393
+ inFence = !inFence;
17394
+ if (inList)
17395
+ inList = false;
17396
+ continue;
17397
+ }
17398
+ if (inFence)
17399
+ continue;
17358
17400
  const isListItem = /^(\s*)([*\-+]|\d+\.)\s+/.test(line);
17401
+ const isListContinuation = inList && !isListItem && line.trim().length > 0 && /^\s+/.test(line);
17359
17402
  if (isListItem && !inList) {
17360
17403
  inList = true;
17361
- listStartLine = i;
17362
17404
  if (i > 0 && prevLine.trim().length > 0) {
17363
17405
  issues.push({
17364
17406
  filePath: ctx.filePath,
@@ -17369,7 +17411,7 @@ var init_blanks_around_lists = __esm(() => {
17369
17411
  severity: "error"
17370
17412
  });
17371
17413
  }
17372
- } else if (!isListItem && inList && line.trim().length > 0) {
17414
+ } else if (!isListItem && !isListContinuation && inList && line.trim().length > 0) {
17373
17415
  inList = false;
17374
17416
  const prevLineIsListItem = /^(\s*)([*\-+]|\d+\.)\s+/.test(prevLine);
17375
17417
  if (prevLineIsListItem) {
@@ -17430,15 +17472,21 @@ var init_blanks_around_tables = __esm(() => {
17430
17472
  const issues = [];
17431
17473
  const lines = text.split(/\r?\n/);
17432
17474
  let inTable = false;
17433
- let tableStartLine = -1;
17475
+ let inFence = false;
17434
17476
  for (let i = 0;i < lines.length; i++) {
17435
17477
  const line = lines[i];
17436
17478
  const prevLine = i > 0 ? lines[i - 1] : "";
17437
- const nextLine = i + 1 < lines.length ? lines[i + 1] : "";
17479
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
17480
+ inFence = !inFence;
17481
+ if (inTable)
17482
+ inTable = false;
17483
+ continue;
17484
+ }
17485
+ if (inFence)
17486
+ continue;
17438
17487
  const isTableLine = /\|/.test(line) && line.trim().length > 0;
17439
17488
  if (isTableLine && !inTable) {
17440
17489
  inTable = true;
17441
- tableStartLine = i;
17442
17490
  if (i > 0 && prevLine.trim().length > 0) {
17443
17491
  issues.push({
17444
17492
  filePath: ctx.filePath,
@@ -17920,8 +17968,15 @@ var init_heading_increment = __esm(() => {
17920
17968
  const issues = [];
17921
17969
  const lines = text.split(/\r?\n/);
17922
17970
  let previousLevel = 0;
17971
+ let inFence = false;
17923
17972
  for (let i = 0;i < lines.length; i++) {
17924
17973
  const line = lines[i];
17974
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
17975
+ inFence = !inFence;
17976
+ continue;
17977
+ }
17978
+ if (inFence)
17979
+ continue;
17925
17980
  const atxMatch = line.match(/^(#{1,6})\s/);
17926
17981
  if (atxMatch) {
17927
17982
  const level = atxMatch[1].length;
@@ -17953,8 +18008,15 @@ var init_heading_start_left = __esm(() => {
17953
18008
  check: (text, ctx) => {
17954
18009
  const issues = [];
17955
18010
  const lines = text.split(/\r?\n/);
18011
+ let inFence = false;
17956
18012
  for (let i = 0;i < lines.length; i++) {
17957
18013
  const line = lines[i];
18014
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
18015
+ inFence = !inFence;
18016
+ continue;
18017
+ }
18018
+ if (inFence)
18019
+ continue;
17958
18020
  const match = line.match(/^(\s+)(#{1,6}\s)/);
17959
18021
  if (match) {
17960
18022
  issues.push({
@@ -18249,8 +18311,24 @@ var init_link_image_style = __esm(() => {
18249
18311
  const options = ctx.options || {};
18250
18312
  const style = options.style || "consistent";
18251
18313
  let detectedStyle = null;
18314
+ let inFence = false;
18315
+ let inHtmlComment = false;
18252
18316
  for (let i = 0;i < lines.length; i++) {
18253
18317
  const line = lines[i];
18318
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
18319
+ inFence = !inFence;
18320
+ continue;
18321
+ }
18322
+ if (inFence)
18323
+ continue;
18324
+ if (line.includes("<!--"))
18325
+ inHtmlComment = true;
18326
+ if (line.includes("-->")) {
18327
+ inHtmlComment = false;
18328
+ continue;
18329
+ }
18330
+ if (inHtmlComment)
18331
+ continue;
18254
18332
  if (line.match(/^\[([^\]]+)\]:\s*\S+/)) {
18255
18333
  continue;
18256
18334
  }
@@ -18467,19 +18545,34 @@ var init_no_bare_urls = __esm(() => {
18467
18545
  check: (text, ctx) => {
18468
18546
  const issues = [];
18469
18547
  const lines = text.split(/\r?\n/);
18548
+ let inFence = false;
18549
+ let inHtmlComment = false;
18470
18550
  for (let i = 0;i < lines.length; i++) {
18471
18551
  const line = lines[i];
18472
- if (line.trim().startsWith("```") || line.trim().startsWith("~~~")) {
18552
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
18553
+ inFence = !inFence;
18554
+ continue;
18555
+ }
18556
+ if (inFence)
18557
+ continue;
18558
+ if (line.includes("<!--"))
18559
+ inHtmlComment = true;
18560
+ if (line.includes("-->")) {
18561
+ inHtmlComment = false;
18473
18562
  continue;
18474
18563
  }
18475
- const urlPattern = /(?<![<`(])https?:\/\/[^\s<>`)\]]+(?![>\])`])/g;
18476
- const matches = line.matchAll(urlPattern);
18564
+ if (inHtmlComment)
18565
+ continue;
18566
+ if (/^\[([^\]]+)\]:\s*\S+/.test(line))
18567
+ continue;
18568
+ const stripped = line.replace(/`[^`]+`/g, (m) => " ".repeat(m.length));
18569
+ const urlPattern = /(?<![<(="'])https?:\/\/[^\s<>`)\]"']+(?![>\])"'])/g;
18570
+ const matches = stripped.matchAll(urlPattern);
18477
18571
  for (const match of matches) {
18478
- const column = match.index + 1;
18479
18572
  issues.push({
18480
18573
  filePath: ctx.filePath,
18481
18574
  line: i + 1,
18482
- column,
18575
+ column: match.index + 1,
18483
18576
  ruleId: "markdown/no-bare-urls",
18484
18577
  message: "Bare URL used. Wrap in angle brackets: <url>",
18485
18578
  severity: "error"
@@ -18490,11 +18583,26 @@ var init_no_bare_urls = __esm(() => {
18490
18583
  },
18491
18584
  fix: (text) => {
18492
18585
  const lines = text.split(/\r?\n/);
18586
+ let inFence = false;
18587
+ let inHtmlComment = false;
18493
18588
  const fixedLines = lines.map((line) => {
18494
- if (line.trim().startsWith("```") || line.trim().startsWith("~~~")) {
18589
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
18590
+ inFence = !inFence;
18495
18591
  return line;
18496
18592
  }
18497
- return line.replace(/(?<![<`(])https?:\/\/[^\s<>`)\]]+(?![>\])`])/g, "<$&>");
18593
+ if (inFence)
18594
+ return line;
18595
+ if (line.includes("<!--"))
18596
+ inHtmlComment = true;
18597
+ if (line.includes("-->")) {
18598
+ inHtmlComment = false;
18599
+ return line;
18600
+ }
18601
+ if (inHtmlComment)
18602
+ return line;
18603
+ if (/^\[([^\]]+)\]:\s*\S+/.test(line))
18604
+ return line;
18605
+ return line.replace(/(?<![<(="'])https?:\/\/[^\s<>`)\]"']+(?![>\])"'])/g, "<$&>");
18498
18606
  });
18499
18607
  return fixedLines.join(`
18500
18608
  `);
@@ -18550,8 +18658,15 @@ var init_no_duplicate_heading = __esm(() => {
18550
18658
  const issues = [];
18551
18659
  const lines = text.split(/\r?\n/);
18552
18660
  const headings = new Map;
18661
+ let inFence = false;
18553
18662
  for (let i = 0;i < lines.length; i++) {
18554
18663
  const line = lines[i];
18664
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
18665
+ inFence = !inFence;
18666
+ continue;
18667
+ }
18668
+ if (inFence)
18669
+ continue;
18555
18670
  const atxMatch = line.match(/^#{1,6}\s+(.+?)(?:\s*#+\s*)?$/);
18556
18671
  if (atxMatch) {
18557
18672
  const content = atxMatch[1].trim();
@@ -18600,10 +18715,17 @@ var init_no_emphasis_as_heading = __esm(() => {
18600
18715
  check: (text, ctx) => {
18601
18716
  const issues = [];
18602
18717
  const lines = text.split(/\r?\n/);
18718
+ let inFence = false;
18603
18719
  for (let i = 0;i < lines.length; i++) {
18604
18720
  const line = lines[i];
18605
18721
  const prevLine = i > 0 ? lines[i - 1] : "";
18606
18722
  const nextLine = i + 1 < lines.length ? lines[i + 1] : "";
18723
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
18724
+ inFence = !inFence;
18725
+ continue;
18726
+ }
18727
+ if (inFence)
18728
+ continue;
18607
18729
  const isBoldLine = /^\*\*[^*]+\*\*\s*$/.test(line) || /^__[^_]+__\s*$/.test(line);
18608
18730
  const isItalicLine = /^\*[^*]+\*\s*$/.test(line) || /^_[^_]+_\s*$/.test(line);
18609
18731
  const isStandalone = prevLine.trim().length === 0 && nextLine.trim().length === 0;
@@ -18633,9 +18755,17 @@ var init_no_empty_links = __esm(() => {
18633
18755
  check: (text, ctx) => {
18634
18756
  const issues = [];
18635
18757
  const lines = text.split(/\r?\n/);
18758
+ let inFence = false;
18636
18759
  for (let i = 0;i < lines.length; i++) {
18637
18760
  const line = lines[i];
18638
- const emptyUrlMatches = line.matchAll(/\[[^\]]+\]\(\s*\)/g);
18761
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
18762
+ inFence = !inFence;
18763
+ continue;
18764
+ }
18765
+ if (inFence)
18766
+ continue;
18767
+ const stripped = line.replace(/`[^`]+`/g, (m) => "x".repeat(m.length));
18768
+ const emptyUrlMatches = stripped.matchAll(/\[[^\]]+\]\(\s*\)/g);
18639
18769
  for (const match of emptyUrlMatches) {
18640
18770
  const column = match.index + 1;
18641
18771
  issues.push({
@@ -18647,7 +18777,7 @@ var init_no_empty_links = __esm(() => {
18647
18777
  severity: "error"
18648
18778
  });
18649
18779
  }
18650
- const emptyTextMatches = line.matchAll(/\[\s*\]\([^)]+\)/g);
18780
+ const emptyTextMatches = stripped.matchAll(/\[\s*\]\([^)]+\)/g);
18651
18781
  for (const match of emptyTextMatches) {
18652
18782
  const column = match.index + 1;
18653
18783
  issues.push({
@@ -18675,8 +18805,15 @@ var init_no_hard_tabs = __esm(() => {
18675
18805
  check: (text, ctx) => {
18676
18806
  const issues = [];
18677
18807
  const lines = text.split(/\r?\n/);
18808
+ let inFence = false;
18678
18809
  for (let i = 0;i < lines.length; i++) {
18679
18810
  const line = lines[i];
18811
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
18812
+ inFence = !inFence;
18813
+ continue;
18814
+ }
18815
+ if (inFence)
18816
+ continue;
18680
18817
  const tabIndex = line.indexOf("\t");
18681
18818
  if (tabIndex !== -1) {
18682
18819
  issues.push({
@@ -18709,9 +18846,17 @@ var init_no_inline_html = __esm(() => {
18709
18846
  const lines = text.split(/\r?\n/);
18710
18847
  const options = ctx.options || {};
18711
18848
  const allowedElements = options.allowed_elements || [];
18849
+ let inFence = false;
18712
18850
  for (let i = 0;i < lines.length; i++) {
18713
18851
  const line = lines[i];
18714
- const matches = line.matchAll(/<\/?([a-z][a-z0-9]*)\b[^>]*>/gi);
18852
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
18853
+ inFence = !inFence;
18854
+ continue;
18855
+ }
18856
+ if (inFence)
18857
+ continue;
18858
+ const stripped = line.replace(/`[^`]+`/g, (m) => " ".repeat(m.length));
18859
+ const matches = stripped.matchAll(/<\/?([a-z][a-z0-9]*)\b[^>]*>/gi);
18715
18860
  for (const match of matches) {
18716
18861
  const tagName = match[1].toLowerCase();
18717
18862
  if (!allowedElements.includes(tagName)) {
@@ -19027,27 +19172,54 @@ var init_no_space_in_code = __esm(() => {
19027
19172
  check: (text, ctx) => {
19028
19173
  const issues = [];
19029
19174
  const lines = text.split(/\r?\n/);
19175
+ let inFence = false;
19030
19176
  for (let i = 0;i < lines.length; i++) {
19031
19177
  const line = lines[i];
19032
- const matches = line.matchAll(/(`+)\s+([^`]+?)\s+\1/g);
19033
- for (const match of matches) {
19034
- const column = match.index + 1;
19035
- issues.push({
19036
- filePath: ctx.filePath,
19037
- line: i + 1,
19038
- column,
19039
- ruleId: "markdown/no-space-in-code",
19040
- message: "Spaces inside code span elements",
19041
- severity: "error"
19042
- });
19178
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
19179
+ inFence = !inFence;
19180
+ continue;
19181
+ }
19182
+ if (inFence)
19183
+ continue;
19184
+ const codeSpanPattern = /(`+)([\s\S]*?)\1/g;
19185
+ for (const match of line.matchAll(codeSpanPattern)) {
19186
+ const content = match[2];
19187
+ if (content.startsWith(" ") && content.endsWith(" ") && content.trim().length > 0) {
19188
+ issues.push({
19189
+ filePath: ctx.filePath,
19190
+ line: i + 1,
19191
+ column: match.index + 1,
19192
+ ruleId: "markdown/no-space-in-code",
19193
+ message: "Spaces inside code span elements",
19194
+ severity: "error"
19195
+ });
19196
+ }
19043
19197
  }
19044
19198
  }
19045
19199
  return issues;
19046
19200
  },
19047
19201
  fix: (text) => {
19048
- return text.replace(/(`+)\s+([^`]+?)\s+\1/g, (match, backticks, content) => {
19049
- return `${backticks}${content.trim()}${backticks}`;
19050
- });
19202
+ const lines = text.split(/\r?\n/);
19203
+ let inFence = false;
19204
+ const result = [];
19205
+ for (const line of lines) {
19206
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
19207
+ inFence = !inFence;
19208
+ result.push(line);
19209
+ continue;
19210
+ }
19211
+ if (inFence) {
19212
+ result.push(line);
19213
+ continue;
19214
+ }
19215
+ result.push(line.replace(/(`+)([\s\S]*?)\1/g, (match, backticks, content) => {
19216
+ if (content.startsWith(" ") && content.endsWith(" ") && content.trim().length > 0)
19217
+ return `${backticks}${content.trim()}${backticks}`;
19218
+ return match;
19219
+ }));
19220
+ }
19221
+ return result.join(`
19222
+ `);
19051
19223
  }
19052
19224
  };
19053
19225
  });
@@ -19062,20 +19234,28 @@ var init_no_space_in_emphasis = __esm(() => {
19062
19234
  check: (text, ctx) => {
19063
19235
  const issues = [];
19064
19236
  const lines = text.split(/\r?\n/);
19237
+ let inFence = false;
19065
19238
  for (let i = 0;i < lines.length; i++) {
19066
19239
  const line = lines[i];
19240
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
19241
+ inFence = !inFence;
19242
+ continue;
19243
+ }
19244
+ if (inFence)
19245
+ continue;
19246
+ const stripped = line.replace(/`[^`]+`/g, (m) => "\x01".repeat(m.length));
19067
19247
  const patterns = [
19068
- /(\*\*|\*|__?)\s+/g,
19069
- /\s+(\*\*|\*|__?)/g
19248
+ /\*\*\s+[^*]+?\*\*/g,
19249
+ /\*\*[^*]+?\s+\*\*/g,
19250
+ /__\s+[^_]+?__/g,
19251
+ /__[^_]+?\s+__/g
19070
19252
  ];
19071
19253
  for (const pattern of patterns) {
19072
- const matches = line.matchAll(pattern);
19073
- for (const match of matches) {
19074
- const column = match.index + 1;
19254
+ for (const match of stripped.matchAll(pattern)) {
19075
19255
  issues.push({
19076
19256
  filePath: ctx.filePath,
19077
19257
  line: i + 1,
19078
- column,
19258
+ column: match.index + 1,
19079
19259
  ruleId: "markdown/no-space-in-emphasis",
19080
19260
  message: "Spaces inside emphasis markers",
19081
19261
  severity: "error"
@@ -19086,9 +19266,28 @@ var init_no_space_in_emphasis = __esm(() => {
19086
19266
  return issues;
19087
19267
  },
19088
19268
  fix: (text) => {
19089
- let fixed = text.replace(/(\*\*|\*|__?)\s+/g, "$1");
19090
- fixed = fixed.replace(/\s+(\*\*|\*|__?)/g, "$1");
19091
- return fixed;
19269
+ const lines = text.split(/\r?\n/);
19270
+ let inFence = false;
19271
+ const result = [];
19272
+ for (const line of lines) {
19273
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
19274
+ inFence = !inFence;
19275
+ result.push(line);
19276
+ continue;
19277
+ }
19278
+ if (inFence) {
19279
+ result.push(line);
19280
+ continue;
19281
+ }
19282
+ let fixed = line;
19283
+ fixed = fixed.replace(/\*\*\s+([^*]+?)\*\*/g, "**$1**");
19284
+ fixed = fixed.replace(/\*\*([^*]+?)\s+\*\*/g, "**$1**");
19285
+ fixed = fixed.replace(/__\s+([^_]+?)__/g, "__$1__");
19286
+ fixed = fixed.replace(/__([^_]+?)\s+__/g, "__$1__");
19287
+ result.push(fixed);
19288
+ }
19289
+ return result.join(`
19290
+ `);
19092
19291
  }
19093
19292
  };
19094
19293
  });
@@ -19392,20 +19591,37 @@ var init_reference_links_images = __esm(() => {
19392
19591
  definitions.add(defMatch[1].toLowerCase());
19393
19592
  }
19394
19593
  }
19594
+ let inFence = false;
19595
+ let inHtmlComment = false;
19395
19596
  for (let i = 0;i < lines.length; i++) {
19396
19597
  const line = lines[i];
19397
- const linkMatches = line.matchAll(/\[([^\]]+)\](?:\[([^\]]+)\])?(?!\()/g);
19598
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
19599
+ inFence = !inFence;
19600
+ continue;
19601
+ }
19602
+ if (inFence)
19603
+ continue;
19604
+ if (line.includes("<!--"))
19605
+ inHtmlComment = true;
19606
+ if (line.includes("-->")) {
19607
+ inHtmlComment = false;
19608
+ continue;
19609
+ }
19610
+ if (inHtmlComment)
19611
+ continue;
19612
+ if (/^\[([^\]]+)\]:\s*\S+/.test(line))
19613
+ continue;
19614
+ const stripped = line.replace(/`[^`]+`/g, (m) => " ".repeat(m.length));
19615
+ const linkMatches = stripped.matchAll(/\[([^\]]+)\](?:\[([^\]]+)\])?(?!\()/g);
19398
19616
  for (const match of linkMatches) {
19399
19617
  const label = (match[2] || match[1]).toLowerCase();
19400
- if (line.match(/^\[([^\]]+)\]:\s*\S+/)) {
19618
+ if (/^[xX ]$/.test(label))
19401
19619
  continue;
19402
- }
19403
19620
  if (!definitions.has(label)) {
19404
- const column = match.index + 1;
19405
19621
  issues.push({
19406
19622
  filePath: ctx.filePath,
19407
19623
  line: i + 1,
19408
- column,
19624
+ column: match.index + 1,
19409
19625
  ruleId: "markdown/reference-links-images",
19410
19626
  message: `Reference link '[${label}]' is not defined`,
19411
19627
  severity: "error"
@@ -19748,8 +19964,15 @@ var init_table_pipe_style = __esm(() => {
19748
19964
  const lines = text.split(/\r?\n/);
19749
19965
  const options = ctx.options || {};
19750
19966
  const style = options.style || "leading_and_trailing";
19967
+ let inFence = false;
19751
19968
  for (let i = 0;i < lines.length; i++) {
19752
19969
  const line = lines[i];
19970
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
19971
+ inFence = !inFence;
19972
+ continue;
19973
+ }
19974
+ if (inFence)
19975
+ continue;
19753
19976
  if (/\|/.test(line) && line.trim().length > 0) {
19754
19977
  const hasLeading = line.trim().startsWith("|");
19755
19978
  const hasTrailing = line.trim().endsWith("|");
@@ -19817,8 +20040,15 @@ var init_ul_indent = __esm(() => {
19817
20040
  const lines = text.split(/\r?\n/);
19818
20041
  const options = ctx.options || {};
19819
20042
  const expectedIndent = options.indent || 2;
20043
+ let inFence = false;
19820
20044
  for (let i = 0;i < lines.length; i++) {
19821
20045
  const line = lines[i];
20046
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
20047
+ inFence = !inFence;
20048
+ continue;
20049
+ }
20050
+ if (inFence)
20051
+ continue;
19822
20052
  const match = line.match(/^(\s*)([*\-+])\s+/);
19823
20053
  if (match) {
19824
20054
  const indent = match[1].length;
@@ -19932,18 +20162,49 @@ var init_ul_style = __esm(() => {
19932
20162
  });
19933
20163
 
19934
20164
  // src/plugins/markdown.ts
20165
+ function stripFrontmatter(content) {
20166
+ const lines = content.split(/\r?\n/);
20167
+ if (lines[0]?.trim() !== "---")
20168
+ return { text: content, frontmatter: null, frontmatterEndLine: 0 };
20169
+ for (let i = 1;i < lines.length; i++) {
20170
+ if (lines[i].trim() === "---") {
20171
+ const frontmatter = lines.slice(0, i + 1);
20172
+ const blanked = frontmatter.map(() => "");
20173
+ return {
20174
+ text: [...blanked, ...lines.slice(i + 1)].join(`
20175
+ `),
20176
+ frontmatter,
20177
+ frontmatterEndLine: i + 1
20178
+ };
20179
+ }
20180
+ }
20181
+ return { text: content, frontmatter: null, frontmatterEndLine: 0 };
20182
+ }
20183
+ function restoreFrontmatter(content, frontmatter) {
20184
+ if (!frontmatter)
20185
+ return content;
20186
+ const lines = content.split(/\r?\n/);
20187
+ return [...frontmatter, ...lines.slice(frontmatter.length)].join(`
20188
+ `);
20189
+ }
19935
20190
  function markdownOnly(rule) {
19936
20191
  return {
19937
20192
  meta: rule.meta,
19938
20193
  check: (content, context) => {
19939
20194
  if (!context.filePath.endsWith(".md"))
19940
20195
  return [];
19941
- return rule.check(content, context);
20196
+ const { text, frontmatterEndLine } = stripFrontmatter(content);
20197
+ const issues = rule.check(text, context);
20198
+ if (frontmatterEndLine > 0)
20199
+ return issues.filter((issue) => issue.line > frontmatterEndLine + 1);
20200
+ return issues;
19942
20201
  },
19943
20202
  fix: rule.fix ? (content, context) => {
19944
20203
  if (!context.filePath.endsWith(".md"))
19945
20204
  return content;
19946
- return rule.fix(content, context);
20205
+ const { text, frontmatter } = stripFrontmatter(content);
20206
+ const fixed = rule.fix(text, context);
20207
+ return restoreFrontmatter(fixed, frontmatter);
19947
20208
  } : undefined
19948
20209
  };
19949
20210
  }
@@ -20161,11 +20422,12 @@ var nodePlugin;
20161
20422
  var init_node = __esm(() => {
20162
20423
  init_prefer_global_buffer();
20163
20424
  init_prefer_global_process();
20425
+ init_utils2();
20164
20426
  nodePlugin = {
20165
20427
  name: "node",
20166
20428
  rules: {
20167
- "prefer-global/buffer": preferGlobalBuffer,
20168
- "prefer-global/process": preferGlobalProcess
20429
+ "prefer-global/buffer": codeOnly(preferGlobalBuffer),
20430
+ "prefer-global/process": codeOnly(preferGlobalProcess)
20169
20431
  }
20170
20432
  };
20171
20433
  });
@@ -20209,10 +20471,11 @@ ${rest}`;
20209
20471
  var perfectionistPlugin;
20210
20472
  var init_perfectionist = __esm(() => {
20211
20473
  init_imports();
20474
+ init_utils2();
20212
20475
  perfectionistPlugin = {
20213
20476
  name: "perfectionist",
20214
20477
  rules: {
20215
- "sort-imports": sortImportsRule
20478
+ "sort-imports": codeOnly(sortImportsRule)
20216
20479
  }
20217
20480
  };
20218
20481
  });
@@ -21064,24 +21327,25 @@ var init_pickier = __esm(() => {
21064
21327
  init_named_imports();
21065
21328
  init_objects();
21066
21329
  init_top_level_function();
21330
+ init_utils2();
21067
21331
  pickierPlugin = {
21068
21332
  name: "pickier",
21069
21333
  rules: {
21070
- "sort-exports": sortExportsRule,
21071
- "sort-objects": sortObjectsRule,
21072
- "sort-imports": sortImportsRule,
21073
- "sort-named-imports": sortNamedImportsRule,
21074
- "sort-heritage-clauses": sortHeritageClausesRule,
21075
- "sort-keys": sortKeysRule,
21076
- "import-dedupe": importDedupeRule,
21077
- "import-first": firstRule,
21078
- "import-named": namedRule,
21079
- "import-no-cycle": noCycleRule,
21080
- "import-no-unresolved": noUnresolvedRule,
21081
- "no-import-dist": noImportDistRule,
21082
- "no-import-node-modules-by-path": noImportNodeModulesByPathRule,
21083
- "no-duplicate-imports": noDuplicateImportsRule,
21084
- "top-level-function": topLevelFunctionRule
21334
+ "sort-exports": codeOnly(sortExportsRule),
21335
+ "sort-objects": codeOnly(sortObjectsRule),
21336
+ "sort-imports": codeOnly(sortImportsRule),
21337
+ "sort-named-imports": codeOnly(sortNamedImportsRule),
21338
+ "sort-heritage-clauses": codeOnly(sortHeritageClausesRule),
21339
+ "sort-keys": codeOnly(sortKeysRule),
21340
+ "import-dedupe": codeOnly(importDedupeRule),
21341
+ "import-first": codeOnly(firstRule),
21342
+ "import-named": codeOnly(namedRule),
21343
+ "import-no-cycle": codeOnly(noCycleRule),
21344
+ "import-no-unresolved": codeOnly(noUnresolvedRule),
21345
+ "no-import-dist": codeOnly(noImportDistRule),
21346
+ "no-import-node-modules-by-path": codeOnly(noImportNodeModulesByPathRule),
21347
+ "no-duplicate-imports": codeOnly(noDuplicateImportsRule),
21348
+ "top-level-function": codeOnly(topLevelFunctionRule)
21085
21349
  }
21086
21350
  };
21087
21351
  });
@@ -21128,48 +21392,49 @@ var init_quality = __esm(() => {
21128
21392
  init_no_with();
21129
21393
  init_prefer_arrow_callback();
21130
21394
  init_require_await();
21395
+ init_utils2();
21131
21396
  qualityPlugin = {
21132
21397
  name: "quality",
21133
21398
  rules: {
21134
- "default-case": defaultCaseRule,
21135
- eqeqeq: eqeqeqRule,
21136
- "no-alert": noAlertRule,
21137
- "no-await-in-loop": noAwaitInLoopRule,
21138
- "no-caller": noCallerRule,
21139
- "no-case-declarations": noCaseDeclarationsRule,
21140
- "no-else-return": noElseReturnRule,
21141
- "no-empty": noEmptyRule,
21142
- "no-empty-function": noEmptyFunctionRule,
21143
- "no-eval": noEvalRule,
21144
- "no-extend-native": noExtendNativeRule,
21145
- "no-global-assign": noGlobalAssignRule,
21146
- "no-implied-eval": noImpliedEvalRule,
21147
- "no-iterator": noIteratorRule,
21148
- "no-new": noNewRule,
21149
- "no-new-func": noNewFuncRule,
21150
- "no-new-wrappers": noNewWrappersRule,
21151
- "no-octal": noOctalRule,
21152
- "no-param-reassign": noParamReassignRule,
21153
- "no-proto": noProtoRule,
21154
- "no-return-assign": noReturnAssignRule,
21155
- "no-shadow": noShadowRule,
21156
- "no-throw-literal": noThrowLiteralRule,
21157
- "no-use-before-define": noUseBeforeDefineRule,
21158
- "no-useless-call": noUselessCallRule,
21159
- "no-with": noWithRule,
21160
- "require-await": requireAwaitRule,
21161
- complexity: complexityRule,
21162
- "max-depth": maxDepthRule,
21163
- "max-lines-per-function": maxLinesPerFunctionRule,
21164
- "no-extra-boolean-cast": noExtraBooleanCastRule,
21165
- "no-lonely-if": noLonelyIfRule,
21166
- "no-sequences": noSequencesRule,
21167
- "no-useless-concat": noUselessConcatRule,
21168
- "no-useless-escape": noUselessEscapeRule,
21169
- "no-useless-rename": noUselessRenameRule,
21170
- "no-useless-return": noUselessReturnRule,
21171
- "no-var": noVarRule,
21172
- "prefer-arrow-callback": preferArrowCallbackRule
21399
+ "default-case": codeOnly(defaultCaseRule),
21400
+ eqeqeq: codeOnly(eqeqeqRule),
21401
+ "no-alert": codeOnly(noAlertRule),
21402
+ "no-await-in-loop": codeOnly(noAwaitInLoopRule),
21403
+ "no-caller": codeOnly(noCallerRule),
21404
+ "no-case-declarations": codeOnly(noCaseDeclarationsRule),
21405
+ "no-else-return": codeOnly(noElseReturnRule),
21406
+ "no-empty": codeOnly(noEmptyRule),
21407
+ "no-empty-function": codeOnly(noEmptyFunctionRule),
21408
+ "no-eval": codeOnly(noEvalRule),
21409
+ "no-extend-native": codeOnly(noExtendNativeRule),
21410
+ "no-global-assign": codeOnly(noGlobalAssignRule),
21411
+ "no-implied-eval": codeOnly(noImpliedEvalRule),
21412
+ "no-iterator": codeOnly(noIteratorRule),
21413
+ "no-new": codeOnly(noNewRule),
21414
+ "no-new-func": codeOnly(noNewFuncRule),
21415
+ "no-new-wrappers": codeOnly(noNewWrappersRule),
21416
+ "no-octal": codeOnly(noOctalRule),
21417
+ "no-param-reassign": codeOnly(noParamReassignRule),
21418
+ "no-proto": codeOnly(noProtoRule),
21419
+ "no-return-assign": codeOnly(noReturnAssignRule),
21420
+ "no-shadow": codeOnly(noShadowRule),
21421
+ "no-throw-literal": codeOnly(noThrowLiteralRule),
21422
+ "no-use-before-define": codeOnly(noUseBeforeDefineRule),
21423
+ "no-useless-call": codeOnly(noUselessCallRule),
21424
+ "no-with": codeOnly(noWithRule),
21425
+ "require-await": codeOnly(requireAwaitRule),
21426
+ complexity: codeOnly(complexityRule),
21427
+ "max-depth": codeOnly(maxDepthRule),
21428
+ "max-lines-per-function": codeOnly(maxLinesPerFunctionRule),
21429
+ "no-extra-boolean-cast": codeOnly(noExtraBooleanCastRule),
21430
+ "no-lonely-if": codeOnly(noLonelyIfRule),
21431
+ "no-sequences": codeOnly(noSequencesRule),
21432
+ "no-useless-concat": codeOnly(noUselessConcatRule),
21433
+ "no-useless-escape": codeOnly(noUselessEscapeRule),
21434
+ "no-useless-rename": codeOnly(noUselessRenameRule),
21435
+ "no-useless-return": codeOnly(noUselessReturnRule),
21436
+ "no-var": codeOnly(noVarRule),
21437
+ "prefer-arrow-callback": codeOnly(preferArrowCallbackRule)
21173
21438
  }
21174
21439
  };
21175
21440
  });
@@ -21216,74 +21481,194 @@ var init_no_super_linear_backtracking = __esm(() => {
21216
21481
  });
21217
21482
 
21218
21483
  // src/rules/regexp/no-unused-capturing-group.ts
21484
+ function parseRegexLiteral(content, idx) {
21485
+ let prevIdx = idx - 1;
21486
+ while (prevIdx >= 0 && (content[prevIdx] === " " || content[prevIdx] === "\t"))
21487
+ prevIdx--;
21488
+ const prevChar = prevIdx >= 0 ? content[prevIdx] : "";
21489
+ const regexPrecedes = "=(<>!&|?:;,{[+(~^%*/";
21490
+ 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));
21491
+ if (!isRegex)
21492
+ return null;
21493
+ let i = idx + 1;
21494
+ let inClass = false;
21495
+ let escaped = false;
21496
+ let closedAt = -1;
21497
+ while (i < content.length) {
21498
+ const c = content[i];
21499
+ if (escaped) {
21500
+ escaped = false;
21501
+ } else if (c === "\\") {
21502
+ escaped = true;
21503
+ } else if (c === "[") {
21504
+ if (!inClass)
21505
+ inClass = true;
21506
+ } else if (c === "]") {
21507
+ if (inClass)
21508
+ inClass = false;
21509
+ } else if (c === "/" && !inClass) {
21510
+ closedAt = i;
21511
+ break;
21512
+ } else if (c === `
21513
+ `) {
21514
+ break;
21515
+ }
21516
+ i++;
21517
+ }
21518
+ if (closedAt <= idx)
21519
+ return null;
21520
+ const pattern = content.slice(idx + 1, closedAt);
21521
+ let flagEnd = closedAt + 1;
21522
+ while (flagEnd < content.length && /[gimsuy]/.test(content[flagEnd]))
21523
+ flagEnd++;
21524
+ if (/\\[1-9]/.test(pattern))
21525
+ return null;
21526
+ let capCount = 0;
21527
+ let firstCapOffset = -1;
21528
+ let inCharClass = false;
21529
+ for (let j = 0;j < pattern.length; j++) {
21530
+ if (pattern[j] === "\\") {
21531
+ j++;
21532
+ continue;
21533
+ }
21534
+ if (pattern[j] === "[" && !inCharClass) {
21535
+ inCharClass = true;
21536
+ continue;
21537
+ }
21538
+ if (pattern[j] === "]" && inCharClass) {
21539
+ inCharClass = false;
21540
+ continue;
21541
+ }
21542
+ if (inCharClass)
21543
+ continue;
21544
+ 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) !== "?<!") {
21545
+ if (firstCapOffset < 0)
21546
+ firstCapOffset = j;
21547
+ capCount++;
21548
+ }
21549
+ }
21550
+ if (capCount === 0)
21551
+ return null;
21552
+ return { patternStart: idx, patternEnd: flagEnd, pattern, capCount, firstCapOffset };
21553
+ }
21554
+ function areCapturesUsed(content, regexStart, regexEnd) {
21555
+ let afterIdx = regexEnd;
21556
+ while (afterIdx < content.length && (content[afterIdx] === " " || content[afterIdx] === "\t"))
21557
+ afterIdx++;
21558
+ if (content[afterIdx] === ".") {
21559
+ const rest = content.slice(afterIdx + 1, afterIdx + 20);
21560
+ if (/^test\s*\(/.test(rest))
21561
+ return false;
21562
+ if (/^exec\s*\(/.test(rest))
21563
+ return true;
21564
+ }
21565
+ let beforeIdx = regexStart - 1;
21566
+ while (beforeIdx >= 0 && (content[beforeIdx] === " " || content[beforeIdx] === "\t"))
21567
+ beforeIdx--;
21568
+ if (content[beforeIdx] === "(") {
21569
+ let methodEnd = beforeIdx;
21570
+ let methodStart = methodEnd - 1;
21571
+ while (methodStart >= 0 && (content[methodStart] === " " || content[methodStart] === "\t"))
21572
+ methodStart--;
21573
+ const slice = content.slice(Math.max(0, methodStart - 20), methodStart + 1);
21574
+ if (/\.match\s*$/.test(slice))
21575
+ return true;
21576
+ if (/\.matchAll\s*$/.test(slice))
21577
+ return true;
21578
+ if (/\.exec\s*$/.test(slice))
21579
+ return true;
21580
+ if (/\.replace\s*$/.test(slice))
21581
+ return true;
21582
+ if (/\.replaceAll\s*$/.test(slice))
21583
+ return true;
21584
+ if (/\.split\s*$/.test(slice))
21585
+ return true;
21586
+ if (/\.search\s*$/.test(slice))
21587
+ return false;
21588
+ if (/\.test\s*$/.test(slice))
21589
+ return false;
21590
+ }
21591
+ const lineStart = content.lastIndexOf(`
21592
+ `, regexStart) + 1;
21593
+ const beforeRegex = content.slice(lineStart, regexStart).trim();
21594
+ const assignMatch = beforeRegex.match(/(?:const|let|var)\s+(\w+)\s*=\s*$/);
21595
+ if (assignMatch) {
21596
+ const varName = assignMatch[1];
21597
+ const afterContent = content.slice(regexEnd);
21598
+ const execPattern = new RegExp(`\\b${varName}\\.exec\\s*\\(`);
21599
+ const testPattern = new RegExp(`\\b${varName}\\.test\\s*\\(`);
21600
+ const matchPattern = new RegExp(`\\.match(?:All)?\\s*\\(\\s*${varName}\\s*\\)`);
21601
+ const replacePattern = new RegExp(`\\.replace(?:All)?\\s*\\(\\s*${varName}`);
21602
+ const hasExec = execPattern.test(afterContent);
21603
+ const hasMatch = matchPattern.test(afterContent);
21604
+ const hasReplace = replacePattern.test(afterContent);
21605
+ const hasTest = testPattern.test(afterContent);
21606
+ if (hasExec || hasMatch || hasReplace)
21607
+ return true;
21608
+ if (hasTest)
21609
+ return false;
21610
+ return true;
21611
+ }
21612
+ return true;
21613
+ }
21219
21614
  function findIssues(content, ctx) {
21220
21615
  const issues = [];
21221
21616
  const filePath = ctx.filePath;
21222
- const _re = /(^|[^\\\w])/g;
21223
21617
  let idx = 0;
21224
21618
  while (idx < content.length) {
21225
21619
  const ch = content[idx];
21226
- if (ch === "/") {
21227
- let i = idx + 1;
21228
- let inClass = false;
21229
- let escaped = false;
21230
- let closedAt = -1;
21231
- while (i < content.length) {
21232
- const c = content[i];
21233
- if (escaped) {
21234
- escaped = false;
21235
- } else if (c === "\\") {
21236
- escaped = true;
21237
- } else if (c === "[") {
21238
- if (!inClass)
21239
- inClass = true;
21240
- } else if (c === "]") {
21241
- if (inClass)
21242
- inClass = false;
21243
- } else if (c === "/" && !inClass) {
21244
- closedAt = i;
21620
+ if (ch === "/" && content[idx + 1] === "/") {
21621
+ while (idx < content.length && content[idx] !== `
21622
+ `)
21623
+ idx++;
21624
+ continue;
21625
+ }
21626
+ if (ch === "/" && content[idx + 1] === "*") {
21627
+ idx += 2;
21628
+ while (idx < content.length - 1 && !(content[idx] === "*" && content[idx + 1] === "/"))
21629
+ idx++;
21630
+ idx += 2;
21631
+ continue;
21632
+ }
21633
+ if (ch === "'" || ch === '"' || ch === "`") {
21634
+ const quote = ch;
21635
+ idx++;
21636
+ while (idx < content.length) {
21637
+ if (content[idx] === "\\") {
21638
+ idx += 2;
21639
+ continue;
21640
+ }
21641
+ if (content[idx] === quote) {
21642
+ idx++;
21245
21643
  break;
21246
21644
  }
21247
- i++;
21645
+ idx++;
21248
21646
  }
21249
- if (closedAt > idx) {
21250
- const pattern = content.slice(idx + 1, closedAt);
21251
- if (/\\[1-9]/.test(pattern)) {
21252
- idx = closedAt + 1;
21253
- continue;
21254
- }
21255
- let capCount = 0;
21256
- for (let j = 0;j < pattern.length; j++) {
21257
- const c = pattern[j];
21258
- if (c === "(") {
21259
- const prev = pattern[j - 1];
21260
- const isEscaped = prev === "\\";
21261
- if (!isEscaped) {
21262
- const next2 = pattern.slice(j + 1, j + 3);
21263
- if (next2 !== "?:")
21264
- capCount++;
21265
- }
21266
- }
21267
- }
21268
- if (capCount > 0) {
21269
- const rel = pattern.indexOf("(");
21270
- const reportPos = idx + 1 + (rel >= 0 ? rel : 0);
21271
- const prefix = content.slice(0, reportPos);
21272
- const line = (prefix.match(/\r?\n/g) || []).length + 1;
21273
- const col = reportPos - (prefix.lastIndexOf(`
21274
- `) + 1) + 1;
21275
- issues.push({
21276
- filePath,
21277
- line,
21278
- column: col,
21279
- ruleId: "regexp/no-unused-capturing-group",
21280
- message: "Unused capturing group in regular expression",
21281
- severity: "error"
21282
- });
21283
- }
21284
- idx = closedAt + 1;
21647
+ continue;
21648
+ }
21649
+ if (ch === "/") {
21650
+ const info = parseRegexLiteral(content, idx);
21651
+ if (!info) {
21652
+ idx++;
21285
21653
  continue;
21286
21654
  }
21655
+ if (!areCapturesUsed(content, info.patternStart, info.patternEnd)) {
21656
+ const reportPos = info.patternStart + 1 + (info.firstCapOffset >= 0 ? info.firstCapOffset : 0);
21657
+ const prefix = content.slice(0, reportPos);
21658
+ const line = (prefix.match(/\r?\n/g) || []).length + 1;
21659
+ const col = reportPos - (prefix.lastIndexOf(`
21660
+ `) + 1) + 1;
21661
+ issues.push({
21662
+ filePath,
21663
+ line,
21664
+ column: col,
21665
+ ruleId: "regexp/no-unused-capturing-group",
21666
+ message: "Unused capturing group in regular expression; use non-capturing group (?:...) instead",
21667
+ severity: "error"
21668
+ });
21669
+ }
21670
+ idx = info.patternEnd;
21671
+ continue;
21287
21672
  }
21288
21673
  idx++;
21289
21674
  }
@@ -21293,7 +21678,7 @@ var noUnusedCapturingGroupRule;
21293
21678
  var init_no_unused_capturing_group = __esm(() => {
21294
21679
  noUnusedCapturingGroupRule = {
21295
21680
  meta: {
21296
- docs: "Flags regex literals with capturing groups when there is no numeric backreference present",
21681
+ docs: "Flags regex literals with unused capturing groups (context-aware)",
21297
21682
  recommended: false
21298
21683
  },
21299
21684
  check(content, ctx) {
@@ -21355,12 +21740,13 @@ var init_regexp = __esm(() => {
21355
21740
  init_no_super_linear_backtracking();
21356
21741
  init_no_unused_capturing_group();
21357
21742
  init_no_useless_lazy();
21743
+ init_utils2();
21358
21744
  regexpPlugin = {
21359
21745
  name: "regexp",
21360
21746
  rules: {
21361
- "no-super-linear-backtracking": noSuperLinearBacktrackingRule,
21362
- "no-unused-capturing-group": noUnusedCapturingGroupRule,
21363
- "no-useless-lazy": noUselessLazy
21747
+ "no-super-linear-backtracking": codeOnly(noSuperLinearBacktrackingRule),
21748
+ "no-unused-capturing-group": codeOnly(noUnusedCapturingGroupRule),
21749
+ "no-useless-lazy": codeOnly(noUselessLazy)
21364
21750
  }
21365
21751
  };
21366
21752
  });
@@ -25561,22 +25947,7 @@ var init_yield_star_spacing = __esm(() => {
25561
25947
  });
25562
25948
 
25563
25949
  // src/plugins/style.ts
25564
- function codeOnly(rule) {
25565
- return {
25566
- meta: rule.meta,
25567
- check: (content, context) => {
25568
- if (!CODE_EXTS2.test(context.filePath))
25569
- return [];
25570
- return rule.check(content, context);
25571
- },
25572
- fix: rule.fix ? (content, context) => {
25573
- if (!CODE_EXTS2.test(context.filePath))
25574
- return content;
25575
- return rule.fix(content, context);
25576
- } : undefined
25577
- };
25578
- }
25579
- var CODE_EXTS2, stylePlugin;
25950
+ var stylePlugin;
25580
25951
  var init_style = __esm(() => {
25581
25952
  init_array_bracket_spacing();
25582
25953
  init_arrow_parens();
@@ -25628,17 +25999,17 @@ var init_style = __esm(() => {
25628
25999
  init_template_tag_spacing();
25629
26000
  init_wrap_iife();
25630
26001
  init_yield_star_spacing();
25631
- CODE_EXTS2 = /\.(ts|js|tsx|jsx|mts|mjs|cts|cjs)$/;
26002
+ init_utils2();
25632
26003
  stylePlugin = {
25633
26004
  name: "style",
25634
26005
  rules: {
25635
- "brace-style": braceStyle,
25636
- curly: curlyRule,
25637
- "max-statements-per-line": maxStatementsPerLineRule,
25638
- "if-newline": ifNewlineRule,
25639
- "consistent-chaining": consistentChainingRule,
25640
- "consistent-list-newline": consistentListNewlineRule,
25641
- "indent-unindent": indentUnindentRule,
26006
+ "brace-style": codeOnly(braceStyle),
26007
+ curly: codeOnly(curlyRule),
26008
+ "max-statements-per-line": codeOnly(maxStatementsPerLineRule),
26009
+ "if-newline": codeOnly(ifNewlineRule),
26010
+ "consistent-chaining": codeOnly(consistentChainingRule),
26011
+ "consistent-list-newline": codeOnly(consistentListNewlineRule),
26012
+ "indent-unindent": codeOnly(indentUnindentRule),
25642
26013
  "no-multi-spaces": noMultiSpaces,
25643
26014
  "no-multiple-empty-lines": noMultipleEmptyLines,
25644
26015
  "no-trailing-spaces": noTrailingSpaces,
@@ -26223,9 +26594,9 @@ var init_no_top_level_await = __esm(() => {
26223
26594
  }
26224
26595
  if (!escape && ch === "'") {
26225
26596
  inSQ = false;
26226
- escape = false;
26227
- continue;
26228
26597
  }
26598
+ escape = false;
26599
+ continue;
26229
26600
  }
26230
26601
  if (inDQ) {
26231
26602
  if (!escape && ch === "\\") {
@@ -26234,9 +26605,9 @@ var init_no_top_level_await = __esm(() => {
26234
26605
  }
26235
26606
  if (!escape && ch === '"') {
26236
26607
  inDQ = false;
26237
- escape = false;
26238
- continue;
26239
26608
  }
26609
+ escape = false;
26610
+ continue;
26240
26611
  }
26241
26612
  if (inTQ) {
26242
26613
  if (!escape && ch === "\\") {
@@ -27028,22 +27399,23 @@ var init_ts = __esm(() => {
27028
27399
  init_type_annotation_spacing();
27029
27400
  init_type_generic_spacing();
27030
27401
  init_type_named_tuple_spacing();
27402
+ init_utils2();
27031
27403
  tsPlugin = {
27032
27404
  name: "ts",
27033
27405
  rules: {
27034
- "no-require-imports": noRequireImportsRule,
27035
- "no-top-level-await": noTopLevelAwaitRule,
27036
- "no-ts-export-equal": noTsExportEqualRule,
27037
- "no-explicit-any": noExplicitAnyRule,
27038
- "prefer-nullish-coalescing": preferNullishCoalescingRule,
27039
- "prefer-optional-chain": preferOptionalChainRule,
27040
- "no-floating-promises": noFloatingPromisesRule,
27041
- "no-misused-promises": noMisusedPromisesRule,
27042
- "no-unsafe-assignment": noUnsafeAssignmentRule,
27043
- "member-delimiter-style": memberDelimiterStyleRule,
27044
- "type-annotation-spacing": typeAnnotationSpacingRule,
27045
- "type-generic-spacing": typeGenericSpacingRule,
27046
- "type-named-tuple-spacing": typeNamedTupleSpacingRule
27406
+ "no-require-imports": codeOnly(noRequireImportsRule),
27407
+ "no-top-level-await": codeOnly(noTopLevelAwaitRule),
27408
+ "no-ts-export-equal": codeOnly(noTsExportEqualRule),
27409
+ "no-explicit-any": codeOnly(noExplicitAnyRule),
27410
+ "prefer-nullish-coalescing": codeOnly(preferNullishCoalescingRule),
27411
+ "prefer-optional-chain": codeOnly(preferOptionalChainRule),
27412
+ "no-floating-promises": codeOnly(noFloatingPromisesRule),
27413
+ "no-misused-promises": codeOnly(noMisusedPromisesRule),
27414
+ "no-unsafe-assignment": codeOnly(noUnsafeAssignmentRule),
27415
+ "member-delimiter-style": codeOnly(memberDelimiterStyleRule),
27416
+ "type-annotation-spacing": codeOnly(typeAnnotationSpacingRule),
27417
+ "type-generic-spacing": codeOnly(typeGenericSpacingRule),
27418
+ "type-named-tuple-spacing": codeOnly(typeNamedTupleSpacingRule)
27047
27419
  }
27048
27420
  };
27049
27421
  });
@@ -27052,11 +27424,12 @@ var init_ts = __esm(() => {
27052
27424
  var unusedImportsPlugin;
27053
27425
  var init_unused_imports = __esm(() => {
27054
27426
  init_no_unused_vars();
27427
+ init_utils2();
27055
27428
  unusedImportsPlugin = {
27056
27429
  name: "unused-imports",
27057
27430
  rules: {
27058
- "no-unused-vars": noUnusedVarsRule,
27059
- "no-unused-imports": noUnusedVarsRule
27431
+ "no-unused-vars": codeOnly(noUnusedVarsRule),
27432
+ "no-unused-imports": codeOnly(noUnusedVarsRule)
27060
27433
  }
27061
27434
  };
27062
27435
  });
@@ -28052,6 +28425,18 @@ function scanContentOptimized(filePath, content, cfg, suppress, commentLines) {
28052
28425
  const wantNoCondAssign = sevMap(cfg.rules.noCondAssign);
28053
28426
  const consoleCall = /\bconsole\.log\s*\(/;
28054
28427
  const debuggerStmt = /^\s*debugger\b/;
28428
+ const linesInFencedCodeBlock = new Set;
28429
+ if (fileExt === "md") {
28430
+ let inFence = false;
28431
+ for (let li = 0;li < lines.length; li++) {
28432
+ if (/^(`{3,}|~{3,})/.test(lines[li].trim())) {
28433
+ inFence = !inFence;
28434
+ continue;
28435
+ }
28436
+ if (inFence)
28437
+ linesInFencedCodeBlock.add(li + 1);
28438
+ }
28439
+ }
28055
28440
  const linesInTemplate = new Set;
28056
28441
  let inTemplate = false;
28057
28442
  let escaped = false;
@@ -28100,7 +28485,7 @@ function scanContentOptimized(filePath, content, cfg, suppress, commentLines) {
28100
28485
  }
28101
28486
  const leadingMatch = line.match(/^[ \t]*/);
28102
28487
  const leading = leadingMatch ? leadingMatch[0] : "";
28103
- if (leading.length > 0 && hasIndentIssue(leading, cfg.format.indent, cfg.format.indentStyle)) {
28488
+ if (leading.length > 0 && !linesInFencedCodeBlock.has(lineNo) && hasIndentIssue(leading, cfg.format.indent, cfg.format.indentStyle, line)) {
28104
28489
  if (!isSuppressed("indent", lineNo, suppress))
28105
28490
  issues.push({ filePath, line: lineNo, column: 1, ruleId: "indent", message: "Incorrect indentation detected", severity: "warning", help: `Use ${cfg.format.indentStyle === "spaces" ? `${cfg.format.indent} spaces` : "tabs"} for indentation. Configure with format.indent and format.indentStyle in your config` });
28106
28491
  }
@@ -32446,7 +32831,7 @@ var require_package = __commonJS((exports, module) => {
32446
32831
  module.exports = {
32447
32832
  name: "pickier",
32448
32833
  type: "module",
32449
- version: "0.1.15",
32834
+ version: "0.1.17",
32450
32835
  description: "Format, lint and more in a fraction of seconds.",
32451
32836
  author: "Chris Breuer <chris@stacksjs.org>",
32452
32837
  license: "MIT",