eslint-plugin-markdown-preferences 0.36.1 → 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.
@@ -373,7 +378,6 @@ type MarkdownPreferencesLinkBracketSpacing = [] | [{
373
378
  type MarkdownPreferencesLinkDestinationStyle = [] | [{
374
379
  style?: ("bare" | "pointy-brackets");
375
380
  avoidEscape?: boolean;
376
- [k: string]: unknown | undefined;
377
381
  }];
378
382
  type MarkdownPreferencesLinkParenNewline = [] | [{
379
383
  newline?: ("always" | "never" | "consistent");
@@ -385,7 +389,6 @@ type MarkdownPreferencesLinkParenSpacing = [] | [{
385
389
  type MarkdownPreferencesLinkTitleStyle = [] | [{
386
390
  style?: ("double" | "single" | "parentheses");
387
391
  avoidEscape?: boolean;
388
- [k: string]: unknown | undefined;
389
392
  }];
390
393
  type MarkdownPreferencesListMarkerAlignment = [] | [{
391
394
  align?: ("left" | "right");
@@ -438,9 +441,7 @@ type MarkdownPreferencesPreferInlineCodeWords = [] | [{
438
441
  node?: {
439
442
  [k: string]: unknown | undefined;
440
443
  };
441
- [k: string]: unknown | undefined;
442
444
  }[];
443
- [k: string]: unknown | undefined;
444
445
  }];
445
446
  type MarkdownPreferencesPreferLinkReferenceDefinitions = [] | [{
446
447
  minLinks?: number;
@@ -454,9 +455,7 @@ type MarkdownPreferencesPreferLinkedWords = [] | [{
454
455
  node?: {
455
456
  [k: string]: unknown | undefined;
456
457
  };
457
- [k: string]: unknown | undefined;
458
458
  }[];
459
- [k: string]: unknown | undefined;
460
459
  }];
461
460
  type MarkdownPreferencesSetextHeadingUnderlineLength = [] | [{
462
461
  mode?: ("exact" | "minimum" | "consistent" | "consistent-line-length");
@@ -468,7 +467,6 @@ type MarkdownPreferencesSortDefinitions = [] | [{
468
467
  match: (string | [string, ...(string)[]]);
469
468
  sort: ("alphabetical" | "ignore");
470
469
  })[];
471
- alphabetical?: boolean;
472
470
  }];
473
471
  type MarkdownPreferencesStrikethroughDelimitersStyle = [] | [{
474
472
  delimiter?: ("~" | "~~");
@@ -545,7 +543,7 @@ declare namespace meta_d_exports {
545
543
  export { name, version };
546
544
  }
547
545
  declare const name: "eslint-plugin-markdown-preferences";
548
- declare const version: "0.36.1";
546
+ declare const version: "0.36.3";
549
547
  //#endregion
550
548
  //#region src/language/ast-types.d.ts
551
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";
@@ -7083,7 +7083,8 @@ var link_destination_style_default = createRule("link-destination-style", {
7083
7083
  properties: {
7084
7084
  style: { enum: ["bare", "pointy-brackets"] },
7085
7085
  avoidEscape: { type: "boolean" }
7086
- }
7086
+ },
7087
+ additionalProperties: false
7087
7088
  }],
7088
7089
  messages: {
7089
7090
  expectedBare: "Link destination should not be enclosed in pointy brackets.",
@@ -7517,7 +7518,8 @@ var link_title_style_default = createRule("link-title-style", {
7517
7518
  "parentheses"
7518
7519
  ] },
7519
7520
  avoidEscape: { type: "boolean" }
7520
- }
7521
+ },
7522
+ additionalProperties: false
7521
7523
  }],
7522
7524
  messages: {
7523
7525
  expectedDouble: "Expected link title to be double quoted.",
@@ -9687,7 +9689,7 @@ const IGNORES_SCHEMA = {
9687
9689
  }] },
9688
9690
  node: { type: "object" }
9689
9691
  },
9690
- additionalProperties: true
9692
+ additionalProperties: false
9691
9693
  }
9692
9694
  };
9693
9695
  /**
@@ -9750,7 +9752,7 @@ var prefer_inline_code_words_default = createRule("prefer-inline-code-words", {
9750
9752
  ignores: IGNORES_SCHEMA
9751
9753
  },
9752
9754
  required: ["words"],
9753
- additionalProperties: true
9755
+ additionalProperties: false
9754
9756
  }],
9755
9757
  messages: { requireInlineCode: "The word \"{{name}}\" should be in inline code." }
9756
9758
  },
@@ -9846,6 +9848,9 @@ var prefer_link_reference_definitions_default = createRule("prefer-link-referenc
9846
9848
  for (const definition of definitions) getResourceNodes(definition).definitions.push(definition);
9847
9849
  for (const map of resourceToNodes.values()) for (const nodes of map.values()) {
9848
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];
9849
9854
  for (const link of nodes.links) {
9850
9855
  const linkInfo = getLinkInfo(link);
9851
9856
  if (linkInfo.label === "") continue;
@@ -9865,6 +9870,10 @@ var prefer_link_reference_definitions_default = createRule("prefer-link-referenc
9865
9870
  while (definitions.some((def) => def.identifier === identifier)) identifier = `${original}-${++seq}`;
9866
9871
  }
9867
9872
  }
9873
+ if (firstLink !== link) {
9874
+ const firstLinkRange = sourceCode.getRange(firstLink);
9875
+ yield fixer.insertTextBeforeRange([firstLinkRange[0], firstLinkRange[0]], "");
9876
+ }
9868
9877
  yield fixer.replaceTextRange([linkInfo.bracketsRange[0], sourceCode.getRange(link)[1]], `${sourceCode.text.slice(...linkInfo.bracketsRange)}${identifier === linkInfo.label ? "" : `[${identifier}]`}`);
9869
9878
  if (!definition) {
9870
9879
  const linkRange = sourceCode.getRange(link);
@@ -9877,6 +9886,10 @@ var prefer_link_reference_definitions_default = createRule("prefer-link-referenc
9877
9886
  } else insertIndex = sourceCode.text.trimEnd().length;
9878
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" : ""}`);
9879
9888
  }
9889
+ if (lastLink !== link) {
9890
+ const lastLinkRange = sourceCode.getRange(lastLink);
9891
+ yield fixer.insertTextAfterRange([lastLinkRange[1], lastLinkRange[1]], "");
9892
+ }
9880
9893
  }
9881
9894
  });
9882
9895
  }
@@ -9993,7 +10006,7 @@ var prefer_linked_words_default = createRule("prefer-linked-words", {
9993
10006
  ignores: IGNORES_SCHEMA
9994
10007
  },
9995
10008
  required: ["words"],
9996
- additionalProperties: true
10009
+ additionalProperties: false
9997
10010
  }],
9998
10011
  messages: { requireLink: "The word \"{{name}}\" should be a link." }
9999
10012
  },
@@ -10385,37 +10398,34 @@ var sort_definitions_default = createRule("sort-definitions", {
10385
10398
  hasSuggestions: false,
10386
10399
  schema: [{
10387
10400
  type: "object",
10388
- properties: {
10389
- order: {
10390
- type: "array",
10391
- items: { anyOf: [
10392
- { type: "string" },
10393
- {
10394
- type: "array",
10395
- items: { type: "string" },
10396
- uniqueItems: true,
10397
- 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"] }
10398
10421
  },
10399
- {
10400
- type: "object",
10401
- properties: {
10402
- match: { anyOf: [{ type: "string" }, {
10403
- type: "array",
10404
- items: { type: "string" },
10405
- uniqueItems: true,
10406
- minItems: 1
10407
- }] },
10408
- sort: { enum: ["alphabetical", "ignore"] }
10409
- },
10410
- required: ["match", "sort"],
10411
- additionalProperties: false
10412
- }
10413
- ] },
10414
- uniqueItems: true,
10415
- additionalItems: false
10416
- },
10417
- alphabetical: { type: "boolean" }
10418
- },
10422
+ required: ["match", "sort"],
10423
+ additionalProperties: false
10424
+ }
10425
+ ] },
10426
+ uniqueItems: true,
10427
+ additionalItems: false
10428
+ } },
10419
10429
  additionalProperties: false
10420
10430
  }],
10421
10431
  messages: {
@@ -12226,7 +12236,7 @@ var meta_exports = /* @__PURE__ */ __export({
12226
12236
  version: () => version
12227
12237
  });
12228
12238
  const name = "eslint-plugin-markdown-preferences";
12229
- const version = "0.36.1";
12239
+ const version = "0.36.3";
12230
12240
 
12231
12241
  //#endregion
12232
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.1",
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",