eslint-plugin-markdown-preferences 0.36.2 → 0.36.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -259,4 +259,4 @@ See the [LICENSE](./LICENSE) file for license rights and limitations (MIT).
259
259
 
260
260
  [documentation site]: https://ota-meshi.github.io/eslint-plugin-markdown-preferences/
261
261
  [npm-package]: https://www.npmjs.com/package/eslint-plugin-markdown-preferences
262
- [npmtrends]: http://www.npmtrends.com/eslint-plugin-markdown-preferences
262
+ [npmtrends]: https://www.npmtrends.com/eslint-plugin-markdown-preferences
@@ -10,4 +10,4 @@ var __export = (all) => {
10
10
  };
11
11
 
12
12
  //#endregion
13
- export { __export };
13
+ export { __export as t };
package/lib/index.d.ts CHANGED
@@ -14,6 +14,11 @@ declare module 'eslint' {
14
14
  interface RulesRecord extends RuleOptions {}
15
15
  }
16
16
  }
17
+ declare module '@eslint/core' {
18
+ interface RulesConfig extends RuleOptions {
19
+ [key: string]: RuleConfig;
20
+ }
21
+ }
17
22
  interface RuleOptions {
18
23
  /**
19
24
  * enforce consistent use of closing sequence in ATX headings.
@@ -462,7 +467,6 @@ type MarkdownPreferencesSortDefinitions = [] | [{
462
467
  match: (string | [string, ...(string)[]]);
463
468
  sort: ("alphabetical" | "ignore");
464
469
  })[];
465
- alphabetical?: boolean;
466
470
  }];
467
471
  type MarkdownPreferencesStrikethroughDelimitersStyle = [] | [{
468
472
  delimiter?: ("~" | "~~");
@@ -539,7 +543,7 @@ declare namespace meta_d_exports {
539
543
  export { name, version };
540
544
  }
541
545
  declare const name: "eslint-plugin-markdown-preferences";
542
- declare const version: "0.36.2";
546
+ declare const version: "0.36.3";
543
547
  //#endregion
544
548
  //#region src/language/ast-types.d.ts
545
549
  type Node = mdast.Node;
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { __export } from "./chunk-CTAAG5j7.js";
1
+ import { t as __export } from "./chunk-Bp6m_JJh.js";
2
2
  import stringWidth from "string-width";
3
3
  import emojiRegex from "emoji-regex-xs";
4
4
  import path from "node:path";
@@ -9848,6 +9848,9 @@ var prefer_link_reference_definitions_default = createRule("prefer-link-referenc
9848
9848
  for (const definition of definitions) getResourceNodes(definition).definitions.push(definition);
9849
9849
  for (const map of resourceToNodes.values()) for (const nodes of map.values()) {
9850
9850
  if (nodes.links.length === 0 || nodes.links.length + nodes.references.length < minLinks) continue;
9851
+ nodes.links.sort((a, b) => sourceCode.getRange(a)[0] - sourceCode.getRange(b)[0]);
9852
+ const firstLink = nodes.links[0];
9853
+ const lastLink = nodes.links[nodes.links.length - 1];
9851
9854
  for (const link of nodes.links) {
9852
9855
  const linkInfo = getLinkInfo(link);
9853
9856
  if (linkInfo.label === "") continue;
@@ -9867,6 +9870,10 @@ var prefer_link_reference_definitions_default = createRule("prefer-link-referenc
9867
9870
  while (definitions.some((def) => def.identifier === identifier)) identifier = `${original}-${++seq}`;
9868
9871
  }
9869
9872
  }
9873
+ if (firstLink !== link) {
9874
+ const firstLinkRange = sourceCode.getRange(firstLink);
9875
+ yield fixer.insertTextBeforeRange([firstLinkRange[0], firstLinkRange[0]], "");
9876
+ }
9870
9877
  yield fixer.replaceTextRange([linkInfo.bracketsRange[0], sourceCode.getRange(link)[1]], `${sourceCode.text.slice(...linkInfo.bracketsRange)}${identifier === linkInfo.label ? "" : `[${identifier}]`}`);
9871
9878
  if (!definition) {
9872
9879
  const linkRange = sourceCode.getRange(link);
@@ -9879,6 +9886,10 @@ var prefer_link_reference_definitions_default = createRule("prefer-link-referenc
9879
9886
  } else insertIndex = sourceCode.text.trimEnd().length;
9880
9887
  yield fixer.insertTextAfterRange([insertIndex, insertIndex], `${sourceCode.text[insertIndex - 1] === "\n" ? "" : "\n"}\n[${identifier}]: ${sourceCode.text.slice(linkInfo.urlAndTitleRange[0] + 1, linkInfo.urlAndTitleRange[1] - 1).trim()}${nextSectionHeading ? "\n" : ""}`);
9881
9888
  }
9889
+ if (lastLink !== link) {
9890
+ const lastLinkRange = sourceCode.getRange(lastLink);
9891
+ yield fixer.insertTextAfterRange([lastLinkRange[1], lastLinkRange[1]], "");
9892
+ }
9882
9893
  }
9883
9894
  });
9884
9895
  }
@@ -10387,37 +10398,34 @@ var sort_definitions_default = createRule("sort-definitions", {
10387
10398
  hasSuggestions: false,
10388
10399
  schema: [{
10389
10400
  type: "object",
10390
- properties: {
10391
- order: {
10392
- type: "array",
10393
- items: { anyOf: [
10394
- { type: "string" },
10395
- {
10396
- type: "array",
10397
- items: { type: "string" },
10398
- uniqueItems: true,
10399
- minItems: 1
10401
+ properties: { order: {
10402
+ type: "array",
10403
+ items: { anyOf: [
10404
+ { type: "string" },
10405
+ {
10406
+ type: "array",
10407
+ items: { type: "string" },
10408
+ uniqueItems: true,
10409
+ minItems: 1
10410
+ },
10411
+ {
10412
+ type: "object",
10413
+ properties: {
10414
+ match: { anyOf: [{ type: "string" }, {
10415
+ type: "array",
10416
+ items: { type: "string" },
10417
+ uniqueItems: true,
10418
+ minItems: 1
10419
+ }] },
10420
+ sort: { enum: ["alphabetical", "ignore"] }
10400
10421
  },
10401
- {
10402
- type: "object",
10403
- properties: {
10404
- match: { anyOf: [{ type: "string" }, {
10405
- type: "array",
10406
- items: { type: "string" },
10407
- uniqueItems: true,
10408
- minItems: 1
10409
- }] },
10410
- sort: { enum: ["alphabetical", "ignore"] }
10411
- },
10412
- required: ["match", "sort"],
10413
- additionalProperties: false
10414
- }
10415
- ] },
10416
- uniqueItems: true,
10417
- additionalItems: false
10418
- },
10419
- alphabetical: { type: "boolean" }
10420
- },
10422
+ required: ["match", "sort"],
10423
+ additionalProperties: false
10424
+ }
10425
+ ] },
10426
+ uniqueItems: true,
10427
+ additionalItems: false
10428
+ } },
10421
10429
  additionalProperties: false
10422
10430
  }],
10423
10431
  messages: {
@@ -12228,7 +12236,7 @@ var meta_exports = /* @__PURE__ */ __export({
12228
12236
  version: () => version
12229
12237
  });
12230
12238
  const name = "eslint-plugin-markdown-preferences";
12231
- const version = "0.36.2";
12239
+ const version = "0.36.3";
12232
12240
 
12233
12241
  //#endregion
12234
12242
  //#region src/language/extensions/micromark-custom-container.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-markdown-preferences",
3
- "version": "0.36.2",
3
+ "version": "0.36.3",
4
4
  "description": "ESLint plugin that enforces our markdown preferences",
5
5
  "type": "module",
6
6
  "exports": {
@@ -80,7 +80,7 @@
80
80
  "@changesets/changelog-github": "^0.5.1",
81
81
  "@changesets/cli": "^2.28.1",
82
82
  "@changesets/get-release-plan": "^4.0.8",
83
- "@eslint/core": "^0.16.0",
83
+ "@eslint/core": "^0.17.0",
84
84
  "@eslint/markdown": "^7.4.0",
85
85
  "@ota-meshi/eslint-plugin": "^0.18.0",
86
86
  "@shikijs/vitepress-twoslash": "^3.0.0",
@@ -91,7 +91,7 @@
91
91
  "@types/json-schema": "^7.0.15",
92
92
  "@types/mdast": "^4.0.4",
93
93
  "@types/mocha": "^10.0.10",
94
- "@types/node": "^22.13.10",
94
+ "@types/node": "^24.0.0",
95
95
  "@types/semver": "^7.5.8",
96
96
  "assert": "^2.1.0",
97
97
  "c8": "^10.1.3",
@@ -102,7 +102,7 @@
102
102
  "eslint-plugin-eslint-comments": "^3.2.0",
103
103
  "eslint-plugin-eslint-plugin": "^7.0.0",
104
104
  "eslint-plugin-jsdoc": "^55.0.0",
105
- "eslint-plugin-json-schema-validator": "^5.3.1",
105
+ "eslint-plugin-json-schema-validator": "^5.5.0",
106
106
  "eslint-plugin-jsonc": "^2.19.1",
107
107
  "eslint-plugin-markdown": "^5.1.0",
108
108
  "eslint-plugin-markdown-links": "^0.6.0",
@@ -126,7 +126,7 @@
126
126
  "stylelint-config-recommended-vue": "^1.6.0",
127
127
  "stylelint-config-standard": "^39.0.0",
128
128
  "stylelint-config-standard-vue": "^1.0.0",
129
- "tsdown": "^0.15.0",
129
+ "tsdown": "^0.16.0",
130
130
  "tsx": "^4.19.3",
131
131
  "twoslash-eslint": "^0.3.1",
132
132
  "type-fest": "^5.0.0",