codelaw-rules-data 0.2.0__py3-none-any.whl

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.
Files changed (84) hide show
  1. codelaw_rules_data/LICENSE +23 -0
  2. codelaw_rules_data/NOTICE +31 -0
  3. codelaw_rules_data/README.md +130 -0
  4. codelaw_rules_data/codelaw-pack.toml +6 -0
  5. codelaw_rules_data/corpus.toml +41 -0
  6. codelaw_rules_data/data/schemas/github-action.json +1 -0
  7. codelaw_rules_data/data/schemas/github-workflow.json +1 -0
  8. codelaw_rules_data/data/schemas/package.json +1 -0
  9. codelaw_rules_data/data/schemas/pyproject.json +1 -0
  10. codelaw_rules_data/data/schemas/tsconfig.json +1 -0
  11. codelaw_rules_data/licenses/SchemaStore-Apache-2.0.txt +202 -0
  12. codelaw_rules_data/presets/data/conventions.toml +5 -0
  13. codelaw_rules_data/presets/data/github-actions.toml +6 -0
  14. codelaw_rules_data/presets/data/package-json.toml +7 -0
  15. codelaw_rules_data/presets/data/pyproject.toml +6 -0
  16. codelaw_rules_data/presets/data/recommended.toml +9 -0
  17. codelaw_rules_data/presets/data/tsconfig.toml +5 -0
  18. codelaw_rules_data/presets/md/recommended.toml +20 -0
  19. codelaw_rules_data/rules/json/no-duplicate-keys.cases.md +27 -0
  20. codelaw_rules_data/rules/json/no-duplicate-keys.md +45 -0
  21. codelaw_rules_data/rules/json/package-deps-sorted.cases.md +90 -0
  22. codelaw_rules_data/rules/json/package-deps-sorted.md +54 -0
  23. codelaw_rules_data/rules/json/package-engines.cases.md +24 -0
  24. codelaw_rules_data/rules/json/package-engines.md +45 -0
  25. codelaw_rules_data/rules/json/package-json-schema.md +57 -0
  26. codelaw_rules_data/rules/json/package-scripts-sorted.cases.md +45 -0
  27. codelaw_rules_data/rules/json/package-scripts-sorted.md +53 -0
  28. codelaw_rules_data/rules/json/tsconfig-schema.md +59 -0
  29. codelaw_rules_data/rules/json/tsconfig-strict.cases.md +57 -0
  30. codelaw_rules_data/rules/json/tsconfig-strict.md +45 -0
  31. codelaw_rules_data/rules/md/commands-show-output.cases.md +14 -0
  32. codelaw_rules_data/rules/md/commands-show-output.md +39 -0
  33. codelaw_rules_data/rules/md/descriptive-link-text.md +41 -0
  34. codelaw_rules_data/rules/md/fence-language.md +47 -0
  35. codelaw_rules_data/rules/md/first-line-heading.cases.md +28 -0
  36. codelaw_rules_data/rules/md/first-line-heading.md +46 -0
  37. codelaw_rules_data/rules/md/heading-increment.cases.md +61 -0
  38. codelaw_rules_data/rules/md/heading-increment.md +46 -0
  39. codelaw_rules_data/rules/md/link-fragments.cases.md +57 -0
  40. codelaw_rules_data/rules/md/link-fragments.md +49 -0
  41. codelaw_rules_data/rules/md/link-image-reference-definitions.cases.md +51 -0
  42. codelaw_rules_data/rules/md/link-image-reference-definitions.md +40 -0
  43. codelaw_rules_data/rules/md/no-alt-text.md +47 -0
  44. codelaw_rules_data/rules/md/no-bare-urls.cases.md +37 -0
  45. codelaw_rules_data/rules/md/no-bare-urls.md +37 -0
  46. codelaw_rules_data/rules/md/no-duplicate-heading.cases.md +19 -0
  47. codelaw_rules_data/rules/md/no-duplicate-heading.md +61 -0
  48. codelaw_rules_data/rules/md/no-emphasis-as-heading.cases.md +23 -0
  49. codelaw_rules_data/rules/md/no-emphasis-as-heading.md +49 -0
  50. codelaw_rules_data/rules/md/no-empty-links.md +50 -0
  51. codelaw_rules_data/rules/md/no-inline-html.cases.md +13 -0
  52. codelaw_rules_data/rules/md/no-inline-html.md +45 -0
  53. codelaw_rules_data/rules/md/no-reversed-links.md +33 -0
  54. codelaw_rules_data/rules/md/reference-links-images.cases.md +40 -0
  55. codelaw_rules_data/rules/md/reference-links-images.md +44 -0
  56. codelaw_rules_data/rules/md/relative-links.md +46 -0
  57. codelaw_rules_data/rules/md/single-h1.cases.md +29 -0
  58. codelaw_rules_data/rules/md/single-h1.md +57 -0
  59. codelaw_rules_data/rules/md/table-column-count.md +43 -0
  60. codelaw_rules_data/rules/toml/deps-sorted.cases.md +28 -0
  61. codelaw_rules_data/rules/toml/deps-sorted.md +49 -0
  62. codelaw_rules_data/rules/toml/no-duplicate-keys.cases.md +43 -0
  63. codelaw_rules_data/rules/toml/no-duplicate-keys.md +43 -0
  64. codelaw_rules_data/rules/toml/pyproject-requires-python.cases.md +24 -0
  65. codelaw_rules_data/rules/toml/pyproject-requires-python.md +41 -0
  66. codelaw_rules_data/rules/toml/pyproject-schema.md +55 -0
  67. codelaw_rules_data/rules/yaml/document-start.cases.md +31 -0
  68. codelaw_rules_data/rules/yaml/document-start.md +36 -0
  69. codelaw_rules_data/rules/yaml/gha-action-schema.md +59 -0
  70. codelaw_rules_data/rules/yaml/gha-pin-sha.cases.md +25 -0
  71. codelaw_rules_data/rules/yaml/gha-pin-sha.md +57 -0
  72. codelaw_rules_data/rules/yaml/gha-workflow-schema.md +57 -0
  73. codelaw_rules_data/rules/yaml/no-ambiguous-booleans.cases.md +29 -0
  74. codelaw_rules_data/rules/yaml/no-ambiguous-booleans.md +43 -0
  75. codelaw_rules_data/rules/yaml/no-ambiguous-numbers.cases.md +24 -0
  76. codelaw_rules_data/rules/yaml/no-ambiguous-numbers.md +46 -0
  77. codelaw_rules_data/rules/yaml/no-duplicate-keys.cases.md +35 -0
  78. codelaw_rules_data/rules/yaml/no-duplicate-keys.md +43 -0
  79. codelaw_rules_data/rules/yaml/no-undeclared-alias.cases.md +13 -0
  80. codelaw_rules_data/rules/yaml/no-undeclared-alias.md +46 -0
  81. codelaw_rules_data-0.2.0.dist-info/METADATA +140 -0
  82. codelaw_rules_data-0.2.0.dist-info/RECORD +84 -0
  83. codelaw_rules_data-0.2.0.dist-info/WHEEL +4 -0
  84. codelaw_rules_data-0.2.0.dist-info/licenses/LICENSE +23 -0
@@ -0,0 +1,53 @@
1
+ ---
2
+ id: json/package-scripts-sorted
3
+ title: "package.json scripts are sorted by name"
4
+ languages: [json]
5
+ files: ["**/package.json"]
6
+ fix: auto
7
+ stability: preview
8
+ since: 0.1.0
9
+ ---
10
+
11
+ The `scripts` of a `package.json` are in name order. A `pre<name>` or `post<name>` script sorts next to the `<name>` script it hooks into.
12
+
13
+ **Why:** A sorted list is quicker to scan and gives smaller diffs when scripts are added; npm runs scripts by name, so their order means nothing to it.
14
+
15
+ ```codelaw
16
+ native: json/package-scripts-sorted
17
+ ```
18
+
19
+ ## Examples
20
+
21
+ ### JSON
22
+
23
+ #### Don't
24
+
25
+ ```json path=package.json
26
+ {
27
+ "name": "app",
28
+ "scripts": {
29
+ "test": "vitest",
30
+ "build": "tsc",
31
+ "pretest": "npm run build",
32
+ "lint": "codelaw check"
33
+ }
34
+ }
35
+ ```
36
+
37
+ #### Do
38
+
39
+ ```json path=package.json
40
+ {
41
+ "name": "app",
42
+ "scripts": {
43
+ "build": "tsc",
44
+ "lint": "codelaw check",
45
+ "pretest": "npm run build",
46
+ "test": "vitest"
47
+ }
48
+ }
49
+ ```
50
+
51
+ ## Notes
52
+
53
+ Names compare by Unicode code point. A `scripts` object that uses `npm-run-all`, `run-s` or `run-p` is left alone: those runners expand patterns such as `build:*` in the order the scripts are written, so sorting would change what runs. A `scripts` object with comments in it is reported without a fix, because the comments would stay behind while the scripts move.
@@ -0,0 +1,59 @@
1
+ ---
2
+ id: json/tsconfig-schema
3
+ title: "tsconfig.json matches its schema"
4
+ languages: [json]
5
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"]
6
+ fix: manual
7
+ fix_reason: "a misspelt or misshapen option has several possible meanings; the author picks the one they intended"
8
+ stability: preview
9
+ ported_from: [schemastore/tsconfig.json]
10
+ since: 0.1.0
11
+ ---
12
+
13
+ A `tsconfig.json` matches SchemaStore's schema for it: every compiler option is one TypeScript knows, with a value of the type it takes.
14
+
15
+ **Why:** `tsc` reports an unknown option only when it runs, and many editors and bundlers that read `tsconfig.json` skip it silently, so a misspelt `"stirct": true` leaves the project less strict than it looks.
16
+
17
+ ```codelaw
18
+ target: $
19
+ assert: { schema: schemas/tsconfig }
20
+ message: "$ERROR"
21
+ ```
22
+
23
+ ## How to fix
24
+
25
+ 1. Read the message: it names the option and what the schema expects, and suggests the option meant when the name is misspelt.
26
+ 2. Correct the name or the value; remove an option TypeScript no longer has.
27
+ 3. Run `codelaw check` on the file again until it is clean.
28
+
29
+ ## Examples
30
+
31
+ ### JSON
32
+
33
+ #### Don't
34
+
35
+ ```json path=tsconfig.json
36
+ {
37
+ "compilerOptions": {
38
+ "target": "es2022",
39
+ "stirct": true,
40
+ "noEmit": "true"
41
+ }
42
+ }
43
+ ```
44
+
45
+ #### Do
46
+
47
+ ```json path=tsconfig.json
48
+ {
49
+ "compilerOptions": {
50
+ "target": "es2022",
51
+ "strict": true,
52
+ "noEmit": true
53
+ }
54
+ }
55
+ ```
56
+
57
+ ## Notes
58
+
59
+ The schema is SchemaStore's `tsconfig.json` schema, shipped with the pack in `data/schemas/tsconfig.json` with its descriptions removed; nothing is fetched. Comments and trailing commas are allowed, as `tsc` allows them. `oneOf` is read as `anyOf`.
@@ -0,0 +1,57 @@
1
+ # json/tsconfig-strict — edge cases
2
+
3
+ ### case: extends a base config
4
+
5
+ ```json
6
+ {
7
+ "extends": "@tsconfig/node22/tsconfig.json",
8
+ "compilerOptions": { "outDir": "dist" }
9
+ }
10
+ ```
11
+
12
+ ```expect
13
+ (none)
14
+ ```
15
+
16
+ ### case: strict turned off
17
+
18
+ ```json
19
+ {
20
+ "compilerOptions": {
21
+ "strict": false
22
+ }
23
+ }
24
+ ```
25
+
26
+ ```expect
27
+ 3:15 json/tsconfig-strict
28
+ ```
29
+
30
+ ```fixed
31
+ {
32
+ "compilerOptions": {
33
+ "strict": true
34
+ }
35
+ }
36
+ ```
37
+
38
+ ### case: no compilerOptions
39
+
40
+ ```json
41
+ {
42
+ "include": ["src"]
43
+ }
44
+ ```
45
+
46
+ ```expect
47
+ 1:1 json/tsconfig-strict
48
+ ```
49
+
50
+ ```fixed
51
+ {
52
+ "compilerOptions": {
53
+ "strict": true
54
+ },
55
+ "include": ["src"]
56
+ }
57
+ ```
@@ -0,0 +1,45 @@
1
+ ---
2
+ id: json/tsconfig-strict
3
+ title: "tsconfig.json turns on strict mode"
4
+ languages: [json]
5
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"]
6
+ fix: suggest
7
+ fix_reason: "turning on strict mode can surface type errors the code then has to fix"
8
+ stability: preview
9
+ since: 0.1.0
10
+ ---
11
+
12
+ A `tsconfig.json` sets `"strict": true` in `compilerOptions`. A config that `extends` another and doesn't set `strict` itself is left alone, since it may inherit it.
13
+
14
+ **Why:** Strict mode turns on the checks that catch `null` and `undefined` mistakes and implicit `any`; without it the compiler lets most of those bugs through.
15
+
16
+ ```codelaw
17
+ native: json/tsconfig-strict
18
+ ```
19
+
20
+ ## Examples
21
+
22
+ ### JSON
23
+
24
+ #### Don't
25
+
26
+ ```json path=tsconfig.json
27
+ {
28
+ "compilerOptions": {
29
+ "target": "es2022",
30
+ "module": "nodenext"
31
+ }
32
+ }
33
+ ```
34
+
35
+ #### Do
36
+
37
+ ```json path=tsconfig.json
38
+ {
39
+ "compilerOptions": {
40
+ "strict": true,
41
+ "target": "es2022",
42
+ "module": "nodenext"
43
+ }
44
+ }
45
+ ```
@@ -0,0 +1,14 @@
1
+ # md/commands-show-output — edge cases
2
+
3
+ ### case: output shown
4
+
5
+ ````md
6
+ ```sh
7
+ $ node --version
8
+ v22.11.0
9
+ ```
10
+ ````
11
+
12
+ ```expect
13
+ (none)
14
+ ```
@@ -0,0 +1,39 @@
1
+ ---
2
+ id: md/commands-show-output
3
+ title: "No $ before shell commands that show no output"
4
+ languages: [markdown]
5
+ fix: auto
6
+ stability: preview
7
+ ported_from: [markdownlint/MD014]
8
+ since: 0.1.0
9
+ ---
10
+
11
+ A code block in which every line is a command starting with `$` drops the `$`. A block that also shows output keeps it, since the `$` then tells commands from output.
12
+
13
+ **Why:** Readers copy commands straight from the block, and a pasted `$` makes every one of them fail.
14
+
15
+ ```codelaw
16
+ native: md/commands-show-output
17
+ ```
18
+
19
+ ## Examples
20
+
21
+ ### Markdown
22
+
23
+ #### Don't
24
+
25
+ ````md
26
+ ```sh
27
+ $ npm install
28
+ $ npm test
29
+ ```
30
+ ````
31
+
32
+ #### Do
33
+
34
+ ````md
35
+ ```sh
36
+ npm install
37
+ npm test
38
+ ```
39
+ ````
@@ -0,0 +1,41 @@
1
+ ---
2
+ id: md/descriptive-link-text
3
+ title: "Link text says where the link goes"
4
+ languages: [markdown]
5
+ fix: manual
6
+ fix_reason: "describing the target needs the author"
7
+ stability: preview
8
+ options:
9
+ prohibited_texts: { type: "string[]", default: ["click here", "here", "link", "more"], description: "link texts that say nothing about the target, compared ignoring case and punctuation" }
10
+ ported_from: [markdownlint/MD059]
11
+ since: 0.1.0
12
+ ---
13
+
14
+ A link's text is not a generic phrase such as "click here", "here", "link" or "more".
15
+
16
+ **Why:** Screen-reader users often jump from link to link, hearing only the link text; "here" tells them nothing.
17
+
18
+ ```codelaw
19
+ native: md/descriptive-link-text
20
+ ```
21
+
22
+ ## How to fix
23
+
24
+ 1. Say in a few words what the link leads to.
25
+ 2. Make those words the link text.
26
+
27
+ ## Examples
28
+
29
+ ### Markdown
30
+
31
+ #### Don't
32
+
33
+ ````md
34
+ For details, click [here](docs/setup.md).
35
+ ````
36
+
37
+ #### Do
38
+
39
+ ````md
40
+ For details, see [the setup guide](docs/setup.md).
41
+ ````
@@ -0,0 +1,47 @@
1
+ ---
2
+ id: md/fence-language
3
+ title: "Fenced code blocks name their language"
4
+ languages: [markdown]
5
+ fix: manual
6
+ fix_reason: "which language the code is in can't always be told from the code"
7
+ stability: preview
8
+ ported_from: [markdownlint/MD040]
9
+ since: 0.1.0
10
+ ---
11
+
12
+ A fenced code block names its language after the opening fence: ` ```ts `, ` ```sh `, or ` ```text ` for plain output.
13
+
14
+ **Why:** The language drives syntax highlighting, and lets tools — codelaw's `lint_code_blocks` among them — check the code inside.
15
+
16
+ ```codelaw
17
+ match:
18
+ kind: fenced_code_block
19
+ not:
20
+ has: { kind: info_string }
21
+ message: "Name the code's language after the opening fence, or `text` for plain output"
22
+ ```
23
+
24
+ ## How to fix
25
+
26
+ 1. Work out what the block holds.
27
+ 2. Add its language after the opening fence, or `text` when it is plain output.
28
+
29
+ ## Examples
30
+
31
+ ### Markdown
32
+
33
+ #### Don't
34
+
35
+ ````md
36
+ ```
37
+ npm install codelaw
38
+ ```
39
+ ````
40
+
41
+ #### Do
42
+
43
+ ````md
44
+ ```sh
45
+ npm install codelaw
46
+ ```
47
+ ````
@@ -0,0 +1,28 @@
1
+ # md/first-line-heading — edge cases
2
+
3
+ ### case: HTML title and leading comment
4
+
5
+ ````md
6
+ <!-- generated -->
7
+ <h1 align="center">Tool</h1>
8
+
9
+ Text.
10
+ ````
11
+
12
+ ```expect
13
+ (none)
14
+ ```
15
+
16
+ ### case: front matter title
17
+
18
+ ````md
19
+ ---
20
+ title: Tool
21
+ ---
22
+
23
+ Text.
24
+ ````
25
+
26
+ ```expect
27
+ (none)
28
+ ```
@@ -0,0 +1,46 @@
1
+ ---
2
+ id: md/first-line-heading
3
+ title: "A document starts with its title heading"
4
+ languages: [markdown]
5
+ fix: manual
6
+ fix_reason: "the title text needs the author"
7
+ stability: preview
8
+ options:
9
+ level: { type: "integer", default: 1, description: "the level of the title heading" }
10
+ allow_preamble: { type: "boolean", default: false, description: "allow text before the title heading" }
11
+ ported_from: [markdownlint/MD041]
12
+ since: 0.1.0
13
+ ---
14
+
15
+ The first block of a document, after any front matter and HTML comments, is a level-1 heading — Markdown, or an HTML `<h1>`. A front matter `title:` counts as the heading.
16
+
17
+ **Why:** The first heading names the document for readers, search results and tools that build navigation from it.
18
+
19
+ ```codelaw
20
+ native: md/first-line-heading
21
+ ```
22
+
23
+ ## How to fix
24
+
25
+ 1. Write a heading that names the document.
26
+ 2. Put it first, above any introduction.
27
+
28
+ ## Examples
29
+
30
+ ### Markdown
31
+
32
+ #### Don't
33
+
34
+ ````md
35
+ This tool formats code.
36
+
37
+ # Formatter
38
+ ````
39
+
40
+ #### Do
41
+
42
+ ````md
43
+ # Formatter
44
+
45
+ This tool formats code.
46
+ ````
@@ -0,0 +1,61 @@
1
+ # md/heading-increment — edge cases
2
+
3
+ ### case: front matter title
4
+
5
+ ````md
6
+ ---
7
+ title: Guide
8
+ ---
9
+
10
+ ### Setup
11
+ ````
12
+
13
+ ```expect
14
+ 5:1 md/heading-increment
15
+ ```
16
+
17
+ ````fixed
18
+ ---
19
+ title: Guide
20
+ ---
21
+
22
+ ## Setup
23
+ ````
24
+
25
+ ### case: subsections move with the fixed heading
26
+
27
+ ````md
28
+ # A
29
+
30
+ ### B
31
+
32
+ #### C
33
+
34
+ ## D
35
+ ````
36
+
37
+ ```expect
38
+ 3:1 md/heading-increment
39
+ ```
40
+
41
+ ````fixed
42
+ # A
43
+
44
+ ## B
45
+
46
+ ### C
47
+
48
+ ## D
49
+ ````
50
+
51
+ ### case: first heading may start deep
52
+
53
+ ````md
54
+ ## A
55
+
56
+ ### B
57
+ ````
58
+
59
+ ```expect
60
+ (none)
61
+ ```
@@ -0,0 +1,46 @@
1
+ ---
2
+ id: md/heading-increment
3
+ title: "Heading levels go down one at a time"
4
+ languages: [markdown]
5
+ fix: suggest
6
+ fix_reason: "the fix raises the skipped heading and its subsections, which changes the outline readers and tools see"
7
+ stability: preview
8
+ ported_from: [markdownlint/MD001]
9
+ since: 0.1.0
10
+ ---
11
+
12
+ A heading is at most one level deeper than the heading before it: `#` can be followed by `##`, not by `###`. When the front matter has a `title:`, it counts as the level-1 heading.
13
+
14
+ **Why:** Headings are the document's outline; a skipped level leaves a section with no parent, which confuses screen readers and tables of contents.
15
+
16
+ ```codelaw
17
+ native: md/heading-increment
18
+ ```
19
+
20
+ ## Examples
21
+
22
+ ### Markdown
23
+
24
+ #### Don't
25
+
26
+ ````md
27
+ # Install
28
+
29
+ ### From npm
30
+
31
+ Run the installer.
32
+ ````
33
+
34
+ #### Do
35
+
36
+ ````md
37
+ # Install
38
+
39
+ ## From npm
40
+
41
+ Run the installer.
42
+ ````
43
+
44
+ ## Differences from the source
45
+
46
+ The fix renumbers the whole outline at once: a raised heading's subsections move up with it.
@@ -0,0 +1,57 @@
1
+ # md/link-fragments — edge cases
2
+
3
+ ### case: repeated headings, HTML anchor, line anchor
4
+
5
+ ````md
6
+ # Notes
7
+
8
+ ## Usage: `x`
9
+
10
+ ## Usage: `x`
11
+
12
+ <a id="custom"></a>
13
+
14
+ [a](#usage-x-1) [b](#custom) [c](#L10) [d](#top)
15
+ ````
16
+
17
+ ```expect
18
+ (none)
19
+ ```
20
+
21
+ ### case: wrong case
22
+
23
+ ````md
24
+ # My Title
25
+
26
+ [a](#My-Title)
27
+ ````
28
+
29
+ ```expect
30
+ 3:1 md/link-fragments
31
+ ```
32
+
33
+ ### case: reference definition
34
+
35
+ ````md
36
+ # Title
37
+
38
+ [a][x]
39
+
40
+ [x]: #nowhere
41
+ ````
42
+
43
+ ```expect
44
+ 5:1 md/link-fragments
45
+ ```
46
+
47
+ ### case: percent before a multi-byte character
48
+
49
+ ````md
50
+ # Title
51
+
52
+ [a](#%aé) [b](#%74itle)
53
+ ````
54
+
55
+ ```expect
56
+ 3:1 md/link-fragments
57
+ ```
@@ -0,0 +1,49 @@
1
+ ---
2
+ id: md/link-fragments
3
+ title: "In-page links point at a heading or anchor that exists"
4
+ languages: [markdown]
5
+ fix: manual
6
+ fix_reason: "which section the link meant needs the author"
7
+ stability: preview
8
+ options:
9
+ ignore_case: { type: "boolean", default: false, description: "compare fragments with anchors ignoring case" }
10
+ ported_from: [markdownlint/MD051]
11
+ since: 0.1.0
12
+ ---
13
+
14
+ A link to `#fragment` in the same document matches an anchor: a heading's GitHub-style id (lower case, punctuation dropped, spaces as dashes, `-1`, `-2` … for repeats), a `{#id}` after a heading, or an HTML `id` or `name`. `#top` and GitHub line anchors such as `#L20` are always valid.
15
+
16
+ **Why:** A fragment that matches nothing scrolls nowhere; it is usually a heading that was renamed after the link was written.
17
+
18
+ ```codelaw
19
+ native: md/link-fragments
20
+ ```
21
+
22
+ ## How to fix
23
+
24
+ 1. Find the section the link meant.
25
+ 2. Change the fragment to that heading's id, or add an anchor where the link should land.
26
+
27
+ ## Examples
28
+
29
+ ### Markdown
30
+
31
+ #### Don't
32
+
33
+ ````md
34
+ # Guide
35
+
36
+ ## Getting started
37
+
38
+ See [the first steps](#getting-startd).
39
+ ````
40
+
41
+ #### Do
42
+
43
+ ````md
44
+ # Guide
45
+
46
+ ## Getting started
47
+
48
+ See [the first steps](#getting-started).
49
+ ````
@@ -0,0 +1,51 @@
1
+ # md/link-image-reference-definitions — edge cases
2
+
3
+ ### case: comment idiom and shortcut use
4
+
5
+ ````md
6
+ [//]: # (a comment)
7
+
8
+ See [docs].
9
+
10
+ [docs]: https://example.com
11
+ ````
12
+
13
+ ```expect
14
+ (none)
15
+ ```
16
+
17
+ ### case: unused definition of a fragment
18
+
19
+ ````md
20
+ Text.
21
+
22
+ [end]: #end
23
+ ````
24
+
25
+ ```expect
26
+ 3:1 md/link-image-reference-definitions
27
+ ```
28
+
29
+ ````fixed
30
+ Text.
31
+
32
+ ````
33
+
34
+ ### case: defined twice
35
+
36
+ ````md
37
+ See [a].
38
+
39
+ [a]: https://one.example
40
+ [a]: https://two.example
41
+ ````
42
+
43
+ ```expect
44
+ 4:1 md/link-image-reference-definitions
45
+ ```
46
+
47
+ ````fixed
48
+ See [a].
49
+
50
+ [a]: https://one.example
51
+ ````