@redocly/recheck 0.15.0 → 2.58.0
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 +71 -1886
- package/examples/appendices/google.appendix.yaml +1 -1
- package/examples/appendices/inclusive-language.appendix.yaml +1 -1
- package/examples/appendices/microsoft.appendix.yaml +1 -1
- package/examples/appendices/plain-language.appendix.yaml +1 -1
- package/examples/appendices/technical-english.appendix.yaml +1 -1
- package/examples/google.yaml +7 -7
- package/examples/inclusive-language.yaml +7 -7
- package/examples/microsoft.yaml +7 -7
- package/examples/plain-language.yaml +7 -7
- package/examples/technical-english.yaml +7 -7
- package/lib/actions/baseline.d.ts +15 -0
- package/lib/actions/baseline.d.ts.map +1 -0
- package/lib/actions/baseline.js +51 -0
- package/lib/actions/baseline.js.map +1 -0
- package/lib/actions/lint.d.ts +51 -0
- package/lib/actions/lint.d.ts.map +1 -0
- package/lib/actions/lint.js +123 -0
- package/lib/actions/lint.js.map +1 -0
- package/lib/actions/markdoc-schema.d.ts +34 -0
- package/lib/actions/markdoc-schema.d.ts.map +1 -0
- package/lib/actions/markdoc-schema.js +106 -0
- package/lib/actions/markdoc-schema.js.map +1 -0
- package/lib/actions/readability.d.ts +25 -0
- package/lib/actions/readability.d.ts.map +1 -0
- package/lib/actions/readability.js +47 -0
- package/lib/actions/readability.js.map +1 -0
- package/lib/actions/roots.d.ts +7 -0
- package/lib/actions/roots.d.ts.map +1 -0
- package/lib/actions/roots.js +36 -0
- package/lib/actions/roots.js.map +1 -0
- package/lib/config/presets/api-descriptions.d.ts +8 -0
- package/lib/config/presets/api-descriptions.d.ts.map +1 -0
- package/lib/config/presets/api-descriptions.js +24 -0
- package/lib/config/presets/api-descriptions.js.map +1 -0
- package/lib/config/presets/google.d.ts +3 -0
- package/lib/config/presets/google.d.ts.map +1 -0
- package/lib/config/presets/google.js +1086 -0
- package/lib/config/presets/google.js.map +1 -0
- package/lib/config/presets/inclusive-language.d.ts +3 -0
- package/lib/config/presets/inclusive-language.d.ts.map +1 -0
- package/lib/config/presets/inclusive-language.js +151 -0
- package/lib/config/presets/inclusive-language.js.map +1 -0
- package/lib/config/presets/index.d.ts +16 -0
- package/lib/config/presets/index.d.ts.map +1 -0
- package/lib/config/presets/index.js +38 -0
- package/lib/config/presets/index.js.map +1 -0
- package/lib/config/presets/markdoc.d.ts +3 -0
- package/lib/config/presets/markdoc.d.ts.map +1 -0
- package/lib/config/presets/markdoc.js +45 -0
- package/lib/config/presets/markdoc.js.map +1 -0
- package/lib/config/presets/markdown-relaxed.d.ts +3 -0
- package/lib/config/presets/markdown-relaxed.d.ts.map +1 -0
- package/lib/config/presets/markdown-relaxed.js +34 -0
- package/lib/config/presets/markdown-relaxed.js.map +1 -0
- package/lib/config/presets/markdown.d.ts +11 -0
- package/lib/config/presets/markdown.d.ts.map +1 -0
- package/lib/config/presets/markdown.js +73 -0
- package/lib/config/presets/markdown.js.map +1 -0
- package/lib/config/presets/microsoft.d.ts +3 -0
- package/lib/config/presets/microsoft.d.ts.map +1 -0
- package/lib/config/presets/microsoft.js +1260 -0
- package/lib/config/presets/microsoft.js.map +1 -0
- package/lib/config/presets/minimal.d.ts +3 -0
- package/lib/config/presets/minimal.d.ts.map +1 -0
- package/lib/config/presets/minimal.js +13 -0
- package/lib/config/presets/minimal.js.map +1 -0
- package/lib/config/presets/plain-language.d.ts +3 -0
- package/lib/config/presets/plain-language.d.ts.map +1 -0
- package/lib/config/presets/plain-language.js +175 -0
- package/lib/config/presets/plain-language.js.map +1 -0
- package/lib/config/presets/prose.d.ts +3 -0
- package/lib/config/presets/prose.d.ts.map +1 -0
- package/lib/config/presets/prose.js +60 -0
- package/lib/config/presets/prose.js.map +1 -0
- package/lib/config/presets/technical-english.d.ts +22 -0
- package/lib/config/presets/technical-english.d.ts.map +1 -0
- package/lib/config/presets/technical-english.js +61 -0
- package/lib/config/presets/technical-english.js.map +1 -0
- package/lib/config/resolve.d.ts +36 -0
- package/lib/config/resolve.d.ts.map +1 -0
- package/lib/config/resolve.js +106 -0
- package/lib/config/resolve.js.map +1 -0
- package/lib/config/schema.d.ts +215 -0
- package/lib/config/schema.d.ts.map +1 -0
- package/lib/config/schema.js +152 -0
- package/lib/config/schema.js.map +1 -0
- package/lib/config/validate.d.ts +19 -0
- package/lib/config/validate.d.ts.map +1 -0
- package/lib/config/validate.js +1049 -0
- package/lib/config/validate.js.map +1 -0
- package/lib/core/auto-fix.d.ts.map +1 -0
- package/lib/core/auto-fix.js +94 -0
- package/lib/core/auto-fix.js.map +1 -0
- package/lib/core/baseline.d.ts +43 -0
- package/lib/core/baseline.d.ts.map +1 -0
- package/lib/core/baseline.js +142 -0
- package/lib/core/baseline.js.map +1 -0
- package/lib/core/case-preserve.d.ts +11 -0
- package/lib/core/case-preserve.d.ts.map +1 -0
- package/lib/core/case-preserve.js +22 -0
- package/lib/core/case-preserve.js.map +1 -0
- package/lib/core/directives.d.ts.map +1 -0
- package/lib/core/directives.js +66 -0
- package/lib/core/directives.js.map +1 -0
- package/lib/core/files.d.ts +31 -0
- package/lib/core/files.d.ts.map +1 -0
- package/lib/core/files.js +184 -0
- package/lib/core/files.js.map +1 -0
- package/lib/core/inline-code.d.ts +33 -0
- package/lib/core/inline-code.d.ts.map +1 -0
- package/lib/core/inline-code.js +50 -0
- package/lib/core/inline-code.js.map +1 -0
- package/lib/core/line-endings.d.ts +13 -0
- package/lib/core/line-endings.d.ts.map +1 -0
- package/lib/core/line-endings.js +39 -0
- package/lib/core/line-endings.js.map +1 -0
- package/lib/core/markdoc-tags.d.ts +48 -0
- package/lib/core/markdoc-tags.d.ts.map +1 -0
- package/lib/core/markdoc-tags.js +102 -0
- package/lib/core/markdoc-tags.js.map +1 -0
- package/lib/core/prose-extract.d.ts +6 -0
- package/lib/core/prose-extract.d.ts.map +1 -0
- package/lib/core/prose-extract.js +71 -0
- package/lib/core/prose-extract.js.map +1 -0
- package/lib/core/readability.d.ts +17 -0
- package/lib/core/readability.d.ts.map +1 -0
- package/lib/core/readability.js +34 -0
- package/lib/core/readability.js.map +1 -0
- package/lib/core/rule-filters.d.ts +29 -0
- package/lib/core/rule-filters.d.ts.map +1 -0
- package/lib/core/rule-filters.js +88 -0
- package/lib/core/rule-filters.js.map +1 -0
- package/lib/core/runner.d.ts +60 -0
- package/lib/core/runner.d.ts.map +1 -0
- package/lib/core/runner.js +305 -0
- package/lib/core/runner.js.map +1 -0
- package/lib/core/summary.d.ts +4 -0
- package/lib/core/summary.d.ts.map +1 -0
- package/lib/core/summary.js +37 -0
- package/lib/core/summary.js.map +1 -0
- package/lib/core/timing.d.ts +9 -0
- package/lib/core/timing.d.ts.map +1 -0
- package/lib/core/timing.js +19 -0
- package/lib/core/timing.js.map +1 -0
- package/lib/data/markdoc-realm-schema.d.ts.map +1 -0
- package/lib/data/markdoc-realm-schema.js +782 -0
- package/lib/data/markdoc-realm-schema.js.map +1 -0
- package/lib/data/proper-nouns.d.ts.map +1 -0
- package/lib/data/proper-nouns.js +42 -0
- package/lib/data/proper-nouns.js.map +1 -0
- package/lib/data/realm-front-matter-schema.d.ts +12 -0
- package/lib/data/realm-front-matter-schema.d.ts.map +1 -0
- package/lib/data/realm-front-matter-schema.js +51 -0
- package/lib/data/realm-front-matter-schema.js.map +1 -0
- package/lib/index.d.ts +81 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +114 -0
- package/lib/index.js.map +1 -0
- package/lib/metrics/formulas.d.ts +9 -0
- package/lib/metrics/formulas.d.ts.map +1 -0
- package/lib/metrics/formulas.js +59 -0
- package/lib/metrics/formulas.js.map +1 -0
- package/lib/metrics/statistics.d.ts +14 -0
- package/lib/metrics/statistics.d.ts.map +1 -0
- package/lib/metrics/statistics.js +35 -0
- package/lib/metrics/statistics.js.map +1 -0
- package/lib/parser/index.d.ts +13 -0
- package/lib/parser/index.d.ts.map +1 -0
- package/lib/parser/index.js +123 -0
- package/lib/parser/index.js.map +1 -0
- package/lib/parser/markdoc/extract-statics.d.ts +28 -0
- package/lib/parser/markdoc/extract-statics.d.ts.map +1 -0
- package/lib/parser/markdoc/extract-statics.js +80 -0
- package/lib/parser/markdoc/extract-statics.js.map +1 -0
- package/lib/parser/markdoc/pairing.d.ts +38 -0
- package/lib/parser/markdoc/pairing.d.ts.map +1 -0
- package/lib/parser/markdoc/pairing.js +77 -0
- package/lib/parser/markdoc/pairing.js.map +1 -0
- package/lib/parser/markdoc/schema.d.ts +56 -0
- package/lib/parser/markdoc/schema.d.ts.map +1 -0
- package/lib/parser/markdoc/schema.js +60 -0
- package/lib/parser/markdoc/schema.js.map +1 -0
- package/lib/parser/markdoc/span.d.ts +52 -0
- package/lib/parser/markdoc/span.d.ts.map +1 -0
- package/lib/parser/markdoc/span.js +577 -0
- package/lib/parser/markdoc/span.js.map +1 -0
- package/lib/parser/markdoc/structure.d.ts +17 -0
- package/lib/parser/markdoc/structure.d.ts.map +1 -0
- package/lib/parser/markdoc/structure.js +121 -0
- package/lib/parser/markdoc/structure.js.map +1 -0
- package/lib/parser/markdoc/syntax.d.ts +17 -0
- package/lib/parser/markdoc/syntax.d.ts.map +1 -0
- package/lib/parser/markdoc/syntax.js +262 -0
- package/lib/parser/markdoc/syntax.js.map +1 -0
- package/lib/parser/types.d.ts.map +1 -0
- package/lib/presets.d.ts +6 -0
- package/lib/presets.d.ts.map +1 -0
- package/lib/presets.js +12 -0
- package/lib/presets.js.map +1 -0
- package/lib/rules/registry.d.ts +13 -0
- package/lib/rules/registry.d.ts.map +1 -0
- package/lib/rules/registry.js +54 -0
- package/lib/rules/registry.js.map +1 -0
- package/lib/rules/scope/capitalization.d.ts.map +1 -0
- package/lib/rules/scope/capitalization.js +128 -0
- package/lib/rules/scope/capitalization.js.map +1 -0
- package/lib/rules/scope/conditional.d.ts.map +1 -0
- package/lib/rules/scope/conditional.js +93 -0
- package/lib/rules/scope/conditional.js.map +1 -0
- package/lib/rules/scope/consistency.d.ts.map +1 -0
- package/lib/rules/scope/consistency.js +118 -0
- package/lib/rules/scope/consistency.js.map +1 -0
- package/lib/rules/scope/length.d.ts.map +1 -0
- package/lib/rules/scope/length.js +50 -0
- package/lib/rules/scope/length.js.map +1 -0
- package/lib/rules/scope/max-image-size.d.ts.map +1 -0
- package/lib/rules/scope/max-image-size.js +55 -0
- package/lib/rules/scope/max-image-size.js.map +1 -0
- package/lib/rules/scope/metric.d.ts +3 -0
- package/lib/rules/scope/metric.d.ts.map +1 -0
- package/lib/rules/scope/metric.js +59 -0
- package/lib/rules/scope/metric.js.map +1 -0
- package/lib/rules/scope/occurrence.d.ts.map +1 -0
- package/lib/rules/scope/occurrence.js +41 -0
- package/lib/rules/scope/occurrence.js.map +1 -0
- package/lib/rules/scope/pattern.d.ts.map +1 -0
- package/lib/rules/scope/pattern.js +58 -0
- package/lib/rules/scope/pattern.js.map +1 -0
- package/lib/rules/scope/repetition.d.ts.map +1 -0
- package/lib/rules/scope/repetition.js +134 -0
- package/lib/rules/scope/repetition.js.map +1 -0
- package/lib/rules/scope/semantic-line-breaks.d.ts.map +1 -0
- package/lib/rules/scope/semantic-line-breaks.js +180 -0
- package/lib/rules/scope/semantic-line-breaks.js.map +1 -0
- package/lib/rules/scope/spelling.d.ts +11 -0
- package/lib/rules/scope/spelling.d.ts.map +1 -0
- package/lib/rules/scope/spelling.js +146 -0
- package/lib/rules/scope/spelling.js.map +1 -0
- package/lib/rules/scope/swap.d.ts.map +1 -0
- package/lib/rules/scope/swap.js +111 -0
- package/lib/rules/scope/swap.js.map +1 -0
- package/lib/rules/scope/title-case.d.ts +24 -0
- package/lib/rules/scope/title-case.d.ts.map +1 -0
- package/lib/rules/scope/title-case.js +216 -0
- package/lib/rules/scope/title-case.js.map +1 -0
- package/lib/rules/token/blanks-around-fences.d.ts.map +1 -0
- package/lib/rules/token/blanks-around-fences.js.map +1 -0
- package/lib/rules/token/blanks-around-headings.d.ts.map +1 -0
- package/lib/rules/token/blanks-around-headings.js +96 -0
- package/lib/rules/token/blanks-around-headings.js.map +1 -0
- package/lib/rules/token/blanks-around-lists.d.ts.map +1 -0
- package/lib/rules/token/blanks-around-lists.js +48 -0
- package/lib/rules/token/blanks-around-lists.js.map +1 -0
- package/lib/rules/token/blanks-around-tables.d.ts.map +1 -0
- package/lib/rules/token/blanks-around-tables.js +40 -0
- package/lib/rules/token/blanks-around-tables.js.map +1 -0
- package/lib/rules/token/code-block-style.d.ts.map +1 -0
- package/lib/rules/token/code-block-style.js.map +1 -0
- package/lib/rules/token/code-fence-style.d.ts.map +1 -0
- package/lib/rules/token/code-fence-style.js.map +1 -0
- package/lib/rules/token/commands-show-output.d.ts.map +1 -0
- package/lib/rules/token/commands-show-output.js.map +1 -0
- package/lib/rules/token/descriptive-link-text.d.ts.map +1 -0
- package/lib/rules/token/descriptive-link-text.js +46 -0
- package/lib/rules/token/descriptive-link-text.js.map +1 -0
- package/lib/rules/token/fenced-code-language.d.ts.map +1 -0
- package/lib/rules/token/fenced-code-language.js.map +1 -0
- package/lib/rules/token/first-line-h1.d.ts.map +1 -0
- package/lib/rules/token/first-line-h1.js +83 -0
- package/lib/rules/token/first-line-h1.js.map +1 -0
- package/lib/rules/token/front-matter.d.ts.map +1 -0
- package/lib/rules/token/front-matter.js +169 -0
- package/lib/rules/token/front-matter.js.map +1 -0
- package/lib/rules/token/heading-increment.d.ts.map +1 -0
- package/lib/rules/token/heading-increment.js +26 -0
- package/lib/rules/token/heading-increment.js.map +1 -0
- package/lib/rules/token/heading-start-left.d.ts.map +1 -0
- package/lib/rules/token/heading-start-left.js.map +1 -0
- package/lib/rules/token/heading-style.d.ts.map +1 -0
- package/lib/rules/token/heading-style.js.map +1 -0
- package/lib/rules/token/helpers.d.ts +115 -0
- package/lib/rules/token/helpers.d.ts.map +1 -0
- package/lib/rules/token/helpers.js +502 -0
- package/lib/rules/token/helpers.js.map +1 -0
- package/lib/rules/token/hr-style.d.ts.map +1 -0
- package/lib/rules/token/hr-style.js.map +1 -0
- package/lib/rules/token/index.d.ts +65 -0
- package/lib/rules/token/index.d.ts.map +1 -0
- package/lib/rules/token/index.js +157 -0
- package/lib/rules/token/index.js.map +1 -0
- package/lib/rules/token/line-length.d.ts.map +1 -0
- package/lib/rules/token/line-length.js +96 -0
- package/lib/rules/token/line-length.js.map +1 -0
- package/lib/rules/token/link-fragments.d.ts.map +1 -0
- package/lib/rules/token/link-fragments.js +398 -0
- package/lib/rules/token/link-fragments.js.map +1 -0
- package/lib/rules/token/link-image-reference-definitions.d.ts.map +1 -0
- package/lib/rules/token/link-image-reference-definitions.js.map +1 -0
- package/lib/rules/token/link-image-style.d.ts.map +1 -0
- package/lib/rules/token/link-image-style.js +138 -0
- package/lib/rules/token/link-image-style.js.map +1 -0
- package/lib/rules/token/list-indent.d.ts.map +1 -0
- package/lib/rules/token/list-indent.js.map +1 -0
- package/lib/rules/token/list-length.d.ts.map +1 -0
- package/lib/rules/token/list-length.js +31 -0
- package/lib/rules/token/list-length.js.map +1 -0
- package/lib/rules/token/list-marker-space.d.ts.map +1 -0
- package/lib/rules/token/list-marker-space.js.map +1 -0
- package/lib/rules/token/markdoc-attributes.d.ts.map +1 -0
- package/lib/rules/token/markdoc-attributes.js +198 -0
- package/lib/rules/token/markdoc-attributes.js.map +1 -0
- package/lib/rules/token/markdoc-pairing.d.ts.map +1 -0
- package/lib/rules/token/markdoc-pairing.js +65 -0
- package/lib/rules/token/markdoc-pairing.js.map +1 -0
- package/lib/rules/token/markdoc-syntax.d.ts.map +1 -0
- package/lib/rules/token/markdoc-syntax.js +84 -0
- package/lib/rules/token/markdoc-syntax.js.map +1 -0
- package/lib/rules/token/markdoc-unknown-tag.d.ts.map +1 -0
- package/lib/rules/token/markdoc-unknown-tag.js +44 -0
- package/lib/rules/token/markdoc-unknown-tag.js.map +1 -0
- package/lib/rules/token/no-alt-text.d.ts.map +1 -0
- package/lib/rules/token/no-alt-text.js +43 -0
- package/lib/rules/token/no-alt-text.js.map +1 -0
- package/lib/rules/token/no-bare-urls.d.ts.map +1 -0
- package/lib/rules/token/no-bare-urls.js +74 -0
- package/lib/rules/token/no-bare-urls.js.map +1 -0
- package/lib/rules/token/no-blanks-blockquote.d.ts.map +1 -0
- package/lib/rules/token/no-blanks-blockquote.js.map +1 -0
- package/lib/rules/token/no-duplicate-heading.d.ts.map +1 -0
- package/lib/rules/token/no-duplicate-heading.js +89 -0
- package/lib/rules/token/no-duplicate-heading.js.map +1 -0
- package/lib/rules/token/no-duplicate-link-destinations.d.ts.map +1 -0
- package/lib/rules/token/no-duplicate-link-destinations.js +54 -0
- package/lib/rules/token/no-duplicate-link-destinations.js.map +1 -0
- package/lib/rules/token/no-emphasis-as-heading.d.ts.map +1 -0
- package/lib/rules/token/no-emphasis-as-heading.js +39 -0
- package/lib/rules/token/no-emphasis-as-heading.js.map +1 -0
- package/lib/rules/token/no-empty-headings.d.ts.map +1 -0
- package/lib/rules/token/no-empty-headings.js +21 -0
- package/lib/rules/token/no-empty-headings.js.map +1 -0
- package/lib/rules/token/no-empty-links.d.ts.map +1 -0
- package/lib/rules/token/no-empty-links.js.map +1 -0
- package/lib/rules/token/no-hard-tabs.d.ts.map +1 -0
- package/lib/rules/token/no-hard-tabs.js.map +1 -0
- package/lib/rules/token/no-inline-html.d.ts.map +1 -0
- package/lib/rules/token/no-inline-html.js +41 -0
- package/lib/rules/token/no-inline-html.js.map +1 -0
- package/lib/rules/token/no-multiple-blanks.d.ts.map +1 -0
- package/lib/rules/token/no-multiple-blanks.js.map +1 -0
- package/lib/rules/token/no-multiple-space-atx.d.ts +9 -0
- package/lib/rules/token/no-multiple-space-atx.d.ts.map +1 -0
- package/lib/rules/token/no-multiple-space-atx.js +46 -0
- package/lib/rules/token/no-multiple-space-atx.js.map +1 -0
- package/lib/rules/token/no-multiple-space-closed-atx.d.ts.map +1 -0
- package/lib/rules/token/no-multiple-space-closed-atx.js.map +1 -0
- package/lib/rules/token/no-reversed-links.d.ts.map +1 -0
- package/lib/rules/token/no-reversed-links.js.map +1 -0
- package/lib/rules/token/no-space-in-code.d.ts.map +1 -0
- package/lib/rules/token/no-space-in-code.js.map +1 -0
- package/lib/rules/token/no-space-in-emphasis.d.ts.map +1 -0
- package/lib/rules/token/no-space-in-emphasis.js +72 -0
- package/lib/rules/token/no-space-in-emphasis.js.map +1 -0
- package/lib/rules/token/no-space-in-links.d.ts.map +1 -0
- package/lib/rules/token/no-space-in-links.js.map +1 -0
- package/lib/rules/token/no-trailing-punctuation.d.ts.map +1 -0
- package/lib/rules/token/no-trailing-punctuation.js.map +1 -0
- package/lib/rules/token/no-trailing-spaces.d.ts.map +1 -0
- package/lib/rules/token/no-trailing-spaces.js.map +1 -0
- package/lib/rules/token/ol-prefix.d.ts.map +1 -0
- package/lib/rules/token/ol-prefix.js.map +1 -0
- package/lib/rules/token/proper-names.d.ts.map +1 -0
- package/lib/rules/token/proper-names.js +87 -0
- package/lib/rules/token/proper-names.js.map +1 -0
- package/lib/rules/token/reference-links-images.d.ts.map +1 -0
- package/lib/rules/token/reference-links-images.js.map +1 -0
- package/lib/rules/token/required-headings.d.ts.map +1 -0
- package/lib/rules/token/required-headings.js +73 -0
- package/lib/rules/token/required-headings.js.map +1 -0
- package/lib/rules/token/single-h1.d.ts.map +1 -0
- package/lib/rules/token/single-h1.js +43 -0
- package/lib/rules/token/single-h1.js.map +1 -0
- package/lib/rules/token/table-column-count.d.ts.map +1 -0
- package/lib/rules/token/table-column-count.js.map +1 -0
- package/lib/rules/token/table-column-style.d.ts.map +1 -0
- package/lib/rules/token/table-column-style.js +162 -0
- package/lib/rules/token/table-column-style.js.map +1 -0
- package/lib/rules/token/table-pipe-style.d.ts.map +1 -0
- package/lib/rules/token/table-pipe-style.js.map +1 -0
- package/lib/rules/token/ul-indent.d.ts.map +1 -0
- package/lib/rules/token/ul-indent.js.map +1 -0
- package/lib/rules/token/ul-style.d.ts.map +1 -0
- package/lib/rules/token/ul-style.js +70 -0
- package/lib/rules/token/ul-style.js.map +1 -0
- package/lib/rules/types.d.ts +62 -0
- package/lib/rules/types.d.ts.map +1 -0
- package/lib/rules/utils.d.ts +18 -0
- package/lib/rules/utils.d.ts.map +1 -0
- package/lib/rules/utils.js +75 -0
- package/lib/rules/utils.js.map +1 -0
- package/lib/scopes/extractor.d.ts +6 -0
- package/lib/scopes/extractor.d.ts.map +1 -0
- package/lib/scopes/extractor.js +398 -0
- package/lib/scopes/extractor.js.map +1 -0
- package/lib/scopes/selector.d.ts +26 -0
- package/lib/scopes/selector.d.ts.map +1 -0
- package/lib/scopes/selector.js +78 -0
- package/lib/scopes/selector.js.map +1 -0
- package/lib/scopes/sentences.d.ts +13 -0
- package/lib/scopes/sentences.d.ts.map +1 -0
- package/lib/scopes/sentences.js +237 -0
- package/lib/scopes/sentences.js.map +1 -0
- package/lib/scopes/types.d.ts +35 -0
- package/lib/scopes/types.d.ts.map +1 -0
- package/lib/scopes/vocabulary.d.ts +12 -0
- package/lib/scopes/vocabulary.d.ts.map +1 -0
- package/lib/scopes/vocabulary.js +56 -0
- package/lib/scopes/vocabulary.js.map +1 -0
- package/lib/types/assertions.d.ts +97 -0
- package/lib/types/assertions.d.ts.map +1 -0
- package/lib/types/reporting.d.ts +23 -0
- package/lib/types/reporting.d.ts.map +1 -0
- package/lib/types/rules.d.ts +53 -0
- package/lib/types/rules.d.ts.map +1 -0
- package/lib/types/validation.d.ts +5 -0
- package/lib/types/validation.d.ts.map +1 -0
- package/lib/utils/is-plain-object.d.ts +2 -0
- package/lib/utils/is-plain-object.d.ts.map +1 -0
- package/lib/utils/is-plain-object.js +5 -0
- package/lib/utils/is-plain-object.js.map +1 -0
- package/package.json +58 -61
- package/presets/google/PROVENANCE.md +217 -221
- package/presets/inclusive-language/PROVENANCE.md +20 -19
- package/presets/microsoft/PROVENANCE.md +242 -243
- package/presets/plain-language/PROVENANCE.md +66 -60
- package/presets/technical-english/PROVENANCE.md +5 -5
- package/skills/recheck-config/SKILL.md +70 -20
- package/skills/recheck-lint/SKILL.md +37 -13
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -228
- package/dist/cli.js.map +0 -1
- package/dist/commands/baseline.d.ts +0 -10
- package/dist/commands/baseline.d.ts.map +0 -1
- package/dist/commands/baseline.js +0 -59
- package/dist/commands/baseline.js.map +0 -1
- package/dist/commands/markdoc-schema.d.ts +0 -17
- package/dist/commands/markdoc-schema.d.ts.map +0 -1
- package/dist/commands/markdoc-schema.js +0 -127
- package/dist/commands/markdoc-schema.js.map +0 -1
- package/dist/commands/readability.d.ts +0 -10
- package/dist/commands/readability.d.ts.map +0 -1
- package/dist/commands/readability.js +0 -90
- package/dist/commands/readability.js.map +0 -1
- package/dist/commands/run.d.ts +0 -21
- package/dist/commands/run.d.ts.map +0 -1
- package/dist/commands/run.js +0 -236
- package/dist/commands/run.js.map +0 -1
- package/dist/commands/validate.d.ts +0 -8
- package/dist/commands/validate.d.ts.map +0 -1
- package/dist/commands/validate.js +0 -43
- package/dist/commands/validate.js.map +0 -1
- package/dist/config/load.d.ts +0 -33
- package/dist/config/load.d.ts.map +0 -1
- package/dist/config/load.js +0 -98
- package/dist/config/load.js.map +0 -1
- package/dist/config/presets/api-descriptions.d.ts +0 -8
- package/dist/config/presets/api-descriptions.d.ts.map +0 -1
- package/dist/config/presets/api-descriptions.js +0 -24
- package/dist/config/presets/api-descriptions.js.map +0 -1
- package/dist/config/presets/google.d.ts +0 -3
- package/dist/config/presets/google.d.ts.map +0 -1
- package/dist/config/presets/google.js +0 -1671
- package/dist/config/presets/google.js.map +0 -1
- package/dist/config/presets/inclusive-language.d.ts +0 -3
- package/dist/config/presets/inclusive-language.d.ts.map +0 -1
- package/dist/config/presets/inclusive-language.js +0 -321
- package/dist/config/presets/inclusive-language.js.map +0 -1
- package/dist/config/presets/index.d.ts +0 -67
- package/dist/config/presets/index.d.ts.map +0 -1
- package/dist/config/presets/index.js +0 -141
- package/dist/config/presets/index.js.map +0 -1
- package/dist/config/presets/markdoc.d.ts +0 -21
- package/dist/config/presets/markdoc.d.ts.map +0 -1
- package/dist/config/presets/markdoc.js +0 -101
- package/dist/config/presets/markdoc.js.map +0 -1
- package/dist/config/presets/markdown-relaxed.d.ts +0 -3
- package/dist/config/presets/markdown-relaxed.d.ts.map +0 -1
- package/dist/config/presets/markdown-relaxed.js +0 -98
- package/dist/config/presets/markdown-relaxed.js.map +0 -1
- package/dist/config/presets/markdown.d.ts +0 -43
- package/dist/config/presets/markdown.d.ts.map +0 -1
- package/dist/config/presets/markdown.js +0 -132
- package/dist/config/presets/markdown.js.map +0 -1
- package/dist/config/presets/microsoft.d.ts +0 -3
- package/dist/config/presets/microsoft.d.ts.map +0 -1
- package/dist/config/presets/microsoft.js +0 -2268
- package/dist/config/presets/microsoft.js.map +0 -1
- package/dist/config/presets/minimal.d.ts +0 -3
- package/dist/config/presets/minimal.d.ts.map +0 -1
- package/dist/config/presets/minimal.js +0 -21
- package/dist/config/presets/minimal.js.map +0 -1
- package/dist/config/presets/plain-language.d.ts +0 -3
- package/dist/config/presets/plain-language.d.ts.map +0 -1
- package/dist/config/presets/plain-language.js +0 -351
- package/dist/config/presets/plain-language.js.map +0 -1
- package/dist/config/presets/prose.d.ts +0 -52
- package/dist/config/presets/prose.d.ts.map +0 -1
- package/dist/config/presets/prose.js +0 -138
- package/dist/config/presets/prose.js.map +0 -1
- package/dist/config/presets/technical-english.d.ts +0 -34
- package/dist/config/presets/technical-english.d.ts.map +0 -1
- package/dist/config/presets/technical-english.js +0 -79
- package/dist/config/presets/technical-english.js.map +0 -1
- package/dist/config/schema.d.ts +0 -226
- package/dist/config/schema.d.ts.map +0 -1
- package/dist/config/schema.js +0 -196
- package/dist/config/schema.js.map +0 -1
- package/dist/config/validate.d.ts +0 -22
- package/dist/config/validate.d.ts.map +0 -1
- package/dist/config/validate.js +0 -1315
- package/dist/config/validate.js.map +0 -1
- package/dist/core/auto-fix.d.ts.map +0 -1
- package/dist/core/auto-fix.js +0 -101
- package/dist/core/auto-fix.js.map +0 -1
- package/dist/core/baseline.d.ts +0 -49
- package/dist/core/baseline.d.ts.map +0 -1
- package/dist/core/baseline.js +0 -0
- package/dist/core/baseline.js.map +0 -1
- package/dist/core/case-preserve.d.ts +0 -46
- package/dist/core/case-preserve.d.ts.map +0 -1
- package/dist/core/case-preserve.js +0 -57
- package/dist/core/case-preserve.js.map +0 -1
- package/dist/core/directives.d.ts.map +0 -1
- package/dist/core/directives.js +0 -73
- package/dist/core/directives.js.map +0 -1
- package/dist/core/files.d.ts +0 -69
- package/dist/core/files.d.ts.map +0 -1
- package/dist/core/files.js +0 -260
- package/dist/core/files.js.map +0 -1
- package/dist/core/inline-code.d.ts +0 -87
- package/dist/core/inline-code.d.ts.map +0 -1
- package/dist/core/inline-code.js +0 -104
- package/dist/core/inline-code.js.map +0 -1
- package/dist/core/line-endings.d.ts +0 -32
- package/dist/core/line-endings.d.ts.map +0 -1
- package/dist/core/line-endings.js +0 -65
- package/dist/core/line-endings.js.map +0 -1
- package/dist/core/markdoc-tags.d.ts +0 -79
- package/dist/core/markdoc-tags.d.ts.map +0 -1
- package/dist/core/markdoc-tags.js +0 -131
- package/dist/core/markdoc-tags.js.map +0 -1
- package/dist/core/prose-extract.d.ts +0 -6
- package/dist/core/prose-extract.d.ts.map +0 -1
- package/dist/core/prose-extract.js +0 -79
- package/dist/core/prose-extract.js.map +0 -1
- package/dist/core/readability.d.ts +0 -17
- package/dist/core/readability.d.ts.map +0 -1
- package/dist/core/readability.js +0 -37
- package/dist/core/readability.js.map +0 -1
- package/dist/core/rule-filters.d.ts +0 -45
- package/dist/core/rule-filters.d.ts.map +0 -1
- package/dist/core/rule-filters.js +0 -118
- package/dist/core/rule-filters.js.map +0 -1
- package/dist/core/runner.d.ts +0 -98
- package/dist/core/runner.d.ts.map +0 -1
- package/dist/core/runner.js +0 -401
- package/dist/core/runner.js.map +0 -1
- package/dist/core/timing.d.ts +0 -24
- package/dist/core/timing.d.ts.map +0 -1
- package/dist/core/timing.js +0 -39
- package/dist/core/timing.js.map +0 -1
- package/dist/data/markdoc-realm-schema.d.ts.map +0 -1
- package/dist/data/markdoc-realm-schema.js +0 -798
- package/dist/data/markdoc-realm-schema.js.map +0 -1
- package/dist/data/proper-nouns.d.ts.map +0 -1
- package/dist/data/proper-nouns.js +0 -47
- package/dist/data/proper-nouns.js.map +0 -1
- package/dist/data/realm-front-matter-schema.d.ts +0 -28
- package/dist/data/realm-front-matter-schema.d.ts.map +0 -1
- package/dist/data/realm-front-matter-schema.js +0 -73
- package/dist/data/realm-front-matter-schema.js.map +0 -1
- package/dist/index.d.ts +0 -90
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -152
- package/dist/index.js.map +0 -1
- package/dist/metrics/formulas.d.ts +0 -17
- package/dist/metrics/formulas.d.ts.map +0 -1
- package/dist/metrics/formulas.js +0 -70
- package/dist/metrics/formulas.js.map +0 -1
- package/dist/metrics/statistics.d.ts +0 -27
- package/dist/metrics/statistics.d.ts.map +0 -1
- package/dist/metrics/statistics.js +0 -56
- package/dist/metrics/statistics.js.map +0 -1
- package/dist/parser/index.d.ts +0 -19
- package/dist/parser/index.d.ts.map +0 -1
- package/dist/parser/index.js +0 -174
- package/dist/parser/index.js.map +0 -1
- package/dist/parser/markdoc/extract-statics.d.ts +0 -45
- package/dist/parser/markdoc/extract-statics.d.ts.map +0 -1
- package/dist/parser/markdoc/extract-statics.js +0 -139
- package/dist/parser/markdoc/extract-statics.js.map +0 -1
- package/dist/parser/markdoc/pairing.d.ts +0 -63
- package/dist/parser/markdoc/pairing.d.ts.map +0 -1
- package/dist/parser/markdoc/pairing.js +0 -94
- package/dist/parser/markdoc/pairing.js.map +0 -1
- package/dist/parser/markdoc/schema.d.ts +0 -85
- package/dist/parser/markdoc/schema.d.ts.map +0 -1
- package/dist/parser/markdoc/schema.js +0 -86
- package/dist/parser/markdoc/schema.js.map +0 -1
- package/dist/parser/markdoc/span.d.ts +0 -64
- package/dist/parser/markdoc/span.d.ts.map +0 -1
- package/dist/parser/markdoc/span.js +0 -729
- package/dist/parser/markdoc/span.js.map +0 -1
- package/dist/parser/markdoc/structure.d.ts +0 -28
- package/dist/parser/markdoc/structure.d.ts.map +0 -1
- package/dist/parser/markdoc/structure.js +0 -153
- package/dist/parser/markdoc/structure.js.map +0 -1
- package/dist/parser/markdoc/syntax.d.ts +0 -44
- package/dist/parser/markdoc/syntax.d.ts.map +0 -1
- package/dist/parser/markdoc/syntax.js +0 -317
- package/dist/parser/markdoc/syntax.js.map +0 -1
- package/dist/parser/types.d.ts.map +0 -1
- package/dist/reporter/fixes.d.ts +0 -3
- package/dist/reporter/fixes.d.ts.map +0 -1
- package/dist/reporter/fixes.js +0 -41
- package/dist/reporter/fixes.js.map +0 -1
- package/dist/reporter/formats/github-actions.d.ts +0 -6
- package/dist/reporter/formats/github-actions.d.ts.map +0 -1
- package/dist/reporter/formats/github-actions.js +0 -20
- package/dist/reporter/formats/github-actions.js.map +0 -1
- package/dist/reporter/formats/json.d.ts +0 -10
- package/dist/reporter/formats/json.d.ts.map +0 -1
- package/dist/reporter/formats/json.js +0 -25
- package/dist/reporter/formats/json.js.map +0 -1
- package/dist/reporter/formats/sarif.d.ts +0 -10
- package/dist/reporter/formats/sarif.d.ts.map +0 -1
- package/dist/reporter/formats/sarif.js +0 -66
- package/dist/reporter/formats/sarif.js.map +0 -1
- package/dist/reporter/formats/table.d.ts +0 -6
- package/dist/reporter/formats/table.d.ts.map +0 -1
- package/dist/reporter/formats/table.js +0 -43
- package/dist/reporter/formats/table.js.map +0 -1
- package/dist/reporter/index.d.ts +0 -10
- package/dist/reporter/index.d.ts.map +0 -1
- package/dist/reporter/index.js +0 -42
- package/dist/reporter/index.js.map +0 -1
- package/dist/reporter/prioritize-problems.d.ts +0 -7
- package/dist/reporter/prioritize-problems.d.ts.map +0 -1
- package/dist/reporter/prioritize-problems.js +0 -29
- package/dist/reporter/prioritize-problems.js.map +0 -1
- package/dist/reporter/statistics.d.ts +0 -10
- package/dist/reporter/statistics.d.ts.map +0 -1
- package/dist/reporter/statistics.js +0 -52
- package/dist/reporter/statistics.js.map +0 -1
- package/dist/reporter/summary.d.ts +0 -10
- package/dist/reporter/summary.d.ts.map +0 -1
- package/dist/reporter/summary.js +0 -49
- package/dist/reporter/summary.js.map +0 -1
- package/dist/rules/registry.d.ts +0 -15
- package/dist/rules/registry.d.ts.map +0 -1
- package/dist/rules/registry.js +0 -81
- package/dist/rules/registry.js.map +0 -1
- package/dist/rules/scope/capitalization.d.ts.map +0 -1
- package/dist/rules/scope/capitalization.js +0 -164
- package/dist/rules/scope/capitalization.js.map +0 -1
- package/dist/rules/scope/conditional.d.ts.map +0 -1
- package/dist/rules/scope/conditional.js +0 -112
- package/dist/rules/scope/conditional.js.map +0 -1
- package/dist/rules/scope/consistency.d.ts.map +0 -1
- package/dist/rules/scope/consistency.js +0 -179
- package/dist/rules/scope/consistency.js.map +0 -1
- package/dist/rules/scope/length.d.ts.map +0 -1
- package/dist/rules/scope/length.js +0 -73
- package/dist/rules/scope/length.js.map +0 -1
- package/dist/rules/scope/max-image-size.d.ts.map +0 -1
- package/dist/rules/scope/max-image-size.js +0 -65
- package/dist/rules/scope/max-image-size.js.map +0 -1
- package/dist/rules/scope/metric.d.ts +0 -5
- package/dist/rules/scope/metric.d.ts.map +0 -1
- package/dist/rules/scope/metric.js +0 -74
- package/dist/rules/scope/metric.js.map +0 -1
- package/dist/rules/scope/occurrence.d.ts.map +0 -1
- package/dist/rules/scope/occurrence.js +0 -48
- package/dist/rules/scope/occurrence.js.map +0 -1
- package/dist/rules/scope/pattern.d.ts.map +0 -1
- package/dist/rules/scope/pattern.js +0 -75
- package/dist/rules/scope/pattern.js.map +0 -1
- package/dist/rules/scope/repetition.d.ts.map +0 -1
- package/dist/rules/scope/repetition.js +0 -139
- package/dist/rules/scope/repetition.js.map +0 -1
- package/dist/rules/scope/semantic-line-breaks.d.ts.map +0 -1
- package/dist/rules/scope/semantic-line-breaks.js +0 -236
- package/dist/rules/scope/semantic-line-breaks.js.map +0 -1
- package/dist/rules/scope/spelling.d.ts +0 -27
- package/dist/rules/scope/spelling.d.ts.map +0 -1
- package/dist/rules/scope/spelling.js +0 -227
- package/dist/rules/scope/spelling.js.map +0 -1
- package/dist/rules/scope/swap.d.ts.map +0 -1
- package/dist/rules/scope/swap.js +0 -149
- package/dist/rules/scope/swap.js.map +0 -1
- package/dist/rules/scope/title-case.d.ts +0 -46
- package/dist/rules/scope/title-case.d.ts.map +0 -1
- package/dist/rules/scope/title-case.js +0 -301
- package/dist/rules/scope/title-case.js.map +0 -1
- package/dist/rules/token/blanks-around-fences.d.ts.map +0 -1
- package/dist/rules/token/blanks-around-fences.js.map +0 -1
- package/dist/rules/token/blanks-around-headings.d.ts.map +0 -1
- package/dist/rules/token/blanks-around-headings.js +0 -108
- package/dist/rules/token/blanks-around-headings.js.map +0 -1
- package/dist/rules/token/blanks-around-lists.d.ts.map +0 -1
- package/dist/rules/token/blanks-around-lists.js +0 -56
- package/dist/rules/token/blanks-around-lists.js.map +0 -1
- package/dist/rules/token/blanks-around-tables.d.ts.map +0 -1
- package/dist/rules/token/blanks-around-tables.js +0 -42
- package/dist/rules/token/blanks-around-tables.js.map +0 -1
- package/dist/rules/token/code-block-style.d.ts.map +0 -1
- package/dist/rules/token/code-block-style.js.map +0 -1
- package/dist/rules/token/code-fence-style.d.ts.map +0 -1
- package/dist/rules/token/code-fence-style.js.map +0 -1
- package/dist/rules/token/commands-show-output.d.ts.map +0 -1
- package/dist/rules/token/commands-show-output.js.map +0 -1
- package/dist/rules/token/descriptive-link-text.d.ts.map +0 -1
- package/dist/rules/token/descriptive-link-text.js +0 -53
- package/dist/rules/token/descriptive-link-text.js.map +0 -1
- package/dist/rules/token/fenced-code-language.d.ts.map +0 -1
- package/dist/rules/token/fenced-code-language.js.map +0 -1
- package/dist/rules/token/first-line-h1.d.ts.map +0 -1
- package/dist/rules/token/first-line-h1.js +0 -107
- package/dist/rules/token/first-line-h1.js.map +0 -1
- package/dist/rules/token/front-matter.d.ts.map +0 -1
- package/dist/rules/token/front-matter.js +0 -177
- package/dist/rules/token/front-matter.js.map +0 -1
- package/dist/rules/token/heading-increment.d.ts.map +0 -1
- package/dist/rules/token/heading-increment.js +0 -27
- package/dist/rules/token/heading-increment.js.map +0 -1
- package/dist/rules/token/heading-start-left.d.ts.map +0 -1
- package/dist/rules/token/heading-start-left.js.map +0 -1
- package/dist/rules/token/heading-style.d.ts.map +0 -1
- package/dist/rules/token/heading-style.js.map +0 -1
- package/dist/rules/token/helpers.d.ts +0 -313
- package/dist/rules/token/helpers.d.ts.map +0 -1
- package/dist/rules/token/helpers.js +0 -746
- package/dist/rules/token/helpers.js.map +0 -1
- package/dist/rules/token/hr-style.d.ts.map +0 -1
- package/dist/rules/token/hr-style.js.map +0 -1
- package/dist/rules/token/index.d.ts +0 -76
- package/dist/rules/token/index.d.ts.map +0 -1
- package/dist/rules/token/index.js +0 -229
- package/dist/rules/token/index.js.map +0 -1
- package/dist/rules/token/line-length.d.ts.map +0 -1
- package/dist/rules/token/line-length.js +0 -120
- package/dist/rules/token/line-length.js.map +0 -1
- package/dist/rules/token/link-fragments.d.ts.map +0 -1
- package/dist/rules/token/link-fragments.js +0 -393
- package/dist/rules/token/link-fragments.js.map +0 -1
- package/dist/rules/token/link-image-reference-definitions.d.ts.map +0 -1
- package/dist/rules/token/link-image-reference-definitions.js.map +0 -1
- package/dist/rules/token/link-image-style.d.ts.map +0 -1
- package/dist/rules/token/link-image-style.js +0 -131
- package/dist/rules/token/link-image-style.js.map +0 -1
- package/dist/rules/token/list-indent.d.ts.map +0 -1
- package/dist/rules/token/list-indent.js.map +0 -1
- package/dist/rules/token/list-length.d.ts.map +0 -1
- package/dist/rules/token/list-length.js +0 -55
- package/dist/rules/token/list-length.js.map +0 -1
- package/dist/rules/token/list-marker-space.d.ts.map +0 -1
- package/dist/rules/token/list-marker-space.js.map +0 -1
- package/dist/rules/token/markdoc-attributes.d.ts.map +0 -1
- package/dist/rules/token/markdoc-attributes.js +0 -269
- package/dist/rules/token/markdoc-attributes.js.map +0 -1
- package/dist/rules/token/markdoc-pairing.d.ts.map +0 -1
- package/dist/rules/token/markdoc-pairing.js +0 -73
- package/dist/rules/token/markdoc-pairing.js.map +0 -1
- package/dist/rules/token/markdoc-syntax.d.ts.map +0 -1
- package/dist/rules/token/markdoc-syntax.js +0 -119
- package/dist/rules/token/markdoc-syntax.js.map +0 -1
- package/dist/rules/token/markdoc-unknown-tag.d.ts.map +0 -1
- package/dist/rules/token/markdoc-unknown-tag.js +0 -64
- package/dist/rules/token/markdoc-unknown-tag.js.map +0 -1
- package/dist/rules/token/no-alt-text.d.ts.map +0 -1
- package/dist/rules/token/no-alt-text.js +0 -47
- package/dist/rules/token/no-alt-text.js.map +0 -1
- package/dist/rules/token/no-bare-urls.d.ts.map +0 -1
- package/dist/rules/token/no-bare-urls.js +0 -88
- package/dist/rules/token/no-bare-urls.js.map +0 -1
- package/dist/rules/token/no-blanks-blockquote.d.ts.map +0 -1
- package/dist/rules/token/no-blanks-blockquote.js.map +0 -1
- package/dist/rules/token/no-duplicate-heading.d.ts.map +0 -1
- package/dist/rules/token/no-duplicate-heading.js +0 -101
- package/dist/rules/token/no-duplicate-heading.js.map +0 -1
- package/dist/rules/token/no-duplicate-link-destinations.d.ts.map +0 -1
- package/dist/rules/token/no-duplicate-link-destinations.js +0 -65
- package/dist/rules/token/no-duplicate-link-destinations.js.map +0 -1
- package/dist/rules/token/no-emphasis-as-heading.d.ts.map +0 -1
- package/dist/rules/token/no-emphasis-as-heading.js +0 -44
- package/dist/rules/token/no-emphasis-as-heading.js.map +0 -1
- package/dist/rules/token/no-empty-headings.d.ts.map +0 -1
- package/dist/rules/token/no-empty-headings.js +0 -28
- package/dist/rules/token/no-empty-headings.js.map +0 -1
- package/dist/rules/token/no-empty-links.d.ts.map +0 -1
- package/dist/rules/token/no-empty-links.js.map +0 -1
- package/dist/rules/token/no-hard-tabs.d.ts.map +0 -1
- package/dist/rules/token/no-hard-tabs.js.map +0 -1
- package/dist/rules/token/no-inline-html.d.ts.map +0 -1
- package/dist/rules/token/no-inline-html.js +0 -45
- package/dist/rules/token/no-inline-html.js.map +0 -1
- package/dist/rules/token/no-multiple-blanks.d.ts.map +0 -1
- package/dist/rules/token/no-multiple-blanks.js.map +0 -1
- package/dist/rules/token/no-multiple-space-atx.d.ts +0 -13
- package/dist/rules/token/no-multiple-space-atx.d.ts.map +0 -1
- package/dist/rules/token/no-multiple-space-atx.js +0 -50
- package/dist/rules/token/no-multiple-space-atx.js.map +0 -1
- package/dist/rules/token/no-multiple-space-closed-atx.d.ts.map +0 -1
- package/dist/rules/token/no-multiple-space-closed-atx.js.map +0 -1
- package/dist/rules/token/no-reversed-links.d.ts.map +0 -1
- package/dist/rules/token/no-reversed-links.js.map +0 -1
- package/dist/rules/token/no-space-in-code.d.ts.map +0 -1
- package/dist/rules/token/no-space-in-code.js.map +0 -1
- package/dist/rules/token/no-space-in-emphasis.d.ts.map +0 -1
- package/dist/rules/token/no-space-in-emphasis.js +0 -79
- package/dist/rules/token/no-space-in-emphasis.js.map +0 -1
- package/dist/rules/token/no-space-in-links.d.ts.map +0 -1
- package/dist/rules/token/no-space-in-links.js.map +0 -1
- package/dist/rules/token/no-trailing-punctuation.d.ts.map +0 -1
- package/dist/rules/token/no-trailing-punctuation.js.map +0 -1
- package/dist/rules/token/no-trailing-spaces.d.ts.map +0 -1
- package/dist/rules/token/no-trailing-spaces.js.map +0 -1
- package/dist/rules/token/ol-prefix.d.ts.map +0 -1
- package/dist/rules/token/ol-prefix.js.map +0 -1
- package/dist/rules/token/proper-names.d.ts.map +0 -1
- package/dist/rules/token/proper-names.js +0 -93
- package/dist/rules/token/proper-names.js.map +0 -1
- package/dist/rules/token/reference-links-images.d.ts.map +0 -1
- package/dist/rules/token/reference-links-images.js.map +0 -1
- package/dist/rules/token/required-headings.d.ts.map +0 -1
- package/dist/rules/token/required-headings.js +0 -83
- package/dist/rules/token/required-headings.js.map +0 -1
- package/dist/rules/token/single-h1.d.ts.map +0 -1
- package/dist/rules/token/single-h1.js +0 -56
- package/dist/rules/token/single-h1.js.map +0 -1
- package/dist/rules/token/table-column-count.d.ts.map +0 -1
- package/dist/rules/token/table-column-count.js.map +0 -1
- package/dist/rules/token/table-column-style.d.ts.map +0 -1
- package/dist/rules/token/table-column-style.js +0 -179
- package/dist/rules/token/table-column-style.js.map +0 -1
- package/dist/rules/token/table-pipe-style.d.ts.map +0 -1
- package/dist/rules/token/table-pipe-style.js.map +0 -1
- package/dist/rules/token/ul-indent.d.ts.map +0 -1
- package/dist/rules/token/ul-indent.js.map +0 -1
- package/dist/rules/token/ul-style.d.ts.map +0 -1
- package/dist/rules/token/ul-style.js +0 -80
- package/dist/rules/token/ul-style.js.map +0 -1
- package/dist/rules/types.d.ts +0 -83
- package/dist/rules/types.d.ts.map +0 -1
- package/dist/rules/utils.d.ts +0 -31
- package/dist/rules/utils.d.ts.map +0 -1
- package/dist/rules/utils.js +0 -90
- package/dist/rules/utils.js.map +0 -1
- package/dist/scopes/extractor.d.ts +0 -7
- package/dist/scopes/extractor.d.ts.map +0 -1
- package/dist/scopes/extractor.js +0 -536
- package/dist/scopes/extractor.js.map +0 -1
- package/dist/scopes/selector.d.ts +0 -51
- package/dist/scopes/selector.d.ts.map +0 -1
- package/dist/scopes/selector.js +0 -121
- package/dist/scopes/selector.js.map +0 -1
- package/dist/scopes/sentences.d.ts +0 -15
- package/dist/scopes/sentences.d.ts.map +0 -1
- package/dist/scopes/sentences.js +0 -202
- package/dist/scopes/sentences.js.map +0 -1
- package/dist/scopes/types.d.ts +0 -46
- package/dist/scopes/types.d.ts.map +0 -1
- package/dist/scopes/vocabulary.d.ts +0 -16
- package/dist/scopes/vocabulary.d.ts.map +0 -1
- package/dist/scopes/vocabulary.js +0 -70
- package/dist/scopes/vocabulary.js.map +0 -1
- package/dist/types/assertions.d.ts +0 -121
- package/dist/types/assertions.d.ts.map +0 -1
- package/dist/types/reporting.d.ts +0 -32
- package/dist/types/reporting.d.ts.map +0 -1
- package/dist/types/rules.d.ts +0 -41
- package/dist/types/rules.d.ts.map +0 -1
- package/dist/types/validation.d.ts +0 -6
- package/dist/types/validation.d.ts.map +0 -1
- /package/{dist → lib}/core/auto-fix.d.ts +0 -0
- /package/{dist → lib}/core/directives.d.ts +0 -0
- /package/{dist → lib}/data/markdoc-realm-schema.d.ts +0 -0
- /package/{dist → lib}/data/proper-nouns.d.ts +0 -0
- /package/{dist → lib}/metrics/index.d.ts +0 -0
- /package/{dist → lib}/metrics/index.d.ts.map +0 -0
- /package/{dist → lib}/metrics/index.js +0 -0
- /package/{dist → lib}/metrics/index.js.map +0 -0
- /package/{dist → lib}/parser/types.d.ts +0 -0
- /package/{dist → lib}/parser/types.js +0 -0
- /package/{dist → lib}/parser/types.js.map +0 -0
- /package/{dist → lib}/rules/scope/capitalization.d.ts +0 -0
- /package/{dist → lib}/rules/scope/conditional.d.ts +0 -0
- /package/{dist → lib}/rules/scope/consistency.d.ts +0 -0
- /package/{dist → lib}/rules/scope/length.d.ts +0 -0
- /package/{dist → lib}/rules/scope/max-image-size.d.ts +0 -0
- /package/{dist → lib}/rules/scope/occurrence.d.ts +0 -0
- /package/{dist → lib}/rules/scope/pattern.d.ts +0 -0
- /package/{dist → lib}/rules/scope/repetition.d.ts +0 -0
- /package/{dist → lib}/rules/scope/semantic-line-breaks.d.ts +0 -0
- /package/{dist → lib}/rules/scope/swap.d.ts +0 -0
- /package/{dist → lib}/rules/token/blanks-around-fences.d.ts +0 -0
- /package/{dist → lib}/rules/token/blanks-around-fences.js +0 -0
- /package/{dist → lib}/rules/token/blanks-around-headings.d.ts +0 -0
- /package/{dist → lib}/rules/token/blanks-around-lists.d.ts +0 -0
- /package/{dist → lib}/rules/token/blanks-around-tables.d.ts +0 -0
- /package/{dist → lib}/rules/token/code-block-style.d.ts +0 -0
- /package/{dist → lib}/rules/token/code-block-style.js +0 -0
- /package/{dist → lib}/rules/token/code-fence-style.d.ts +0 -0
- /package/{dist → lib}/rules/token/code-fence-style.js +0 -0
- /package/{dist → lib}/rules/token/commands-show-output.d.ts +0 -0
- /package/{dist → lib}/rules/token/commands-show-output.js +0 -0
- /package/{dist → lib}/rules/token/descriptive-link-text.d.ts +0 -0
- /package/{dist → lib}/rules/token/emphasis-style.d.ts +0 -0
- /package/{dist → lib}/rules/token/emphasis-style.d.ts.map +0 -0
- /package/{dist → lib}/rules/token/emphasis-style.js +0 -0
- /package/{dist → lib}/rules/token/emphasis-style.js.map +0 -0
- /package/{dist → lib}/rules/token/fenced-code-language.d.ts +0 -0
- /package/{dist → lib}/rules/token/fenced-code-language.js +0 -0
- /package/{dist → lib}/rules/token/first-line-h1.d.ts +0 -0
- /package/{dist → lib}/rules/token/front-matter.d.ts +0 -0
- /package/{dist → lib}/rules/token/heading-increment.d.ts +0 -0
- /package/{dist → lib}/rules/token/heading-start-left.d.ts +0 -0
- /package/{dist → lib}/rules/token/heading-start-left.js +0 -0
- /package/{dist → lib}/rules/token/heading-style.d.ts +0 -0
- /package/{dist → lib}/rules/token/heading-style.js +0 -0
- /package/{dist → lib}/rules/token/hr-style.d.ts +0 -0
- /package/{dist → lib}/rules/token/hr-style.js +0 -0
- /package/{dist → lib}/rules/token/line-length.d.ts +0 -0
- /package/{dist → lib}/rules/token/link-fragments.d.ts +0 -0
- /package/{dist → lib}/rules/token/link-image-reference-definitions.d.ts +0 -0
- /package/{dist → lib}/rules/token/link-image-reference-definitions.js +0 -0
- /package/{dist → lib}/rules/token/link-image-style.d.ts +0 -0
- /package/{dist → lib}/rules/token/list-indent.d.ts +0 -0
- /package/{dist → lib}/rules/token/list-indent.js +0 -0
- /package/{dist → lib}/rules/token/list-length.d.ts +0 -0
- /package/{dist → lib}/rules/token/list-marker-space.d.ts +0 -0
- /package/{dist → lib}/rules/token/list-marker-space.js +0 -0
- /package/{dist → lib}/rules/token/markdoc-attributes.d.ts +0 -0
- /package/{dist → lib}/rules/token/markdoc-pairing.d.ts +0 -0
- /package/{dist → lib}/rules/token/markdoc-syntax.d.ts +0 -0
- /package/{dist → lib}/rules/token/markdoc-unknown-tag.d.ts +0 -0
- /package/{dist → lib}/rules/token/messages.d.ts +0 -0
- /package/{dist → lib}/rules/token/messages.d.ts.map +0 -0
- /package/{dist → lib}/rules/token/messages.js +0 -0
- /package/{dist → lib}/rules/token/messages.js.map +0 -0
- /package/{dist → lib}/rules/token/no-alt-text.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-bare-urls.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-blanks-blockquote.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-blanks-blockquote.js +0 -0
- /package/{dist → lib}/rules/token/no-duplicate-heading.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-duplicate-link-destinations.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-emphasis-as-heading.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-empty-headings.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-empty-links.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-empty-links.js +0 -0
- /package/{dist → lib}/rules/token/no-hard-tabs.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-hard-tabs.js +0 -0
- /package/{dist → lib}/rules/token/no-inline-html.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-missing-space-atx.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-missing-space-atx.d.ts.map +0 -0
- /package/{dist → lib}/rules/token/no-missing-space-atx.js +0 -0
- /package/{dist → lib}/rules/token/no-missing-space-atx.js.map +0 -0
- /package/{dist → lib}/rules/token/no-missing-space-closed-atx.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-missing-space-closed-atx.d.ts.map +0 -0
- /package/{dist → lib}/rules/token/no-missing-space-closed-atx.js +0 -0
- /package/{dist → lib}/rules/token/no-missing-space-closed-atx.js.map +0 -0
- /package/{dist → lib}/rules/token/no-multiple-blanks.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-multiple-blanks.js +0 -0
- /package/{dist → lib}/rules/token/no-multiple-space-blockquote.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-multiple-space-blockquote.d.ts.map +0 -0
- /package/{dist → lib}/rules/token/no-multiple-space-blockquote.js +0 -0
- /package/{dist → lib}/rules/token/no-multiple-space-blockquote.js.map +0 -0
- /package/{dist → lib}/rules/token/no-multiple-space-closed-atx.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-multiple-space-closed-atx.js +0 -0
- /package/{dist → lib}/rules/token/no-reversed-links.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-reversed-links.js +0 -0
- /package/{dist → lib}/rules/token/no-space-in-code.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-space-in-code.js +0 -0
- /package/{dist → lib}/rules/token/no-space-in-emphasis.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-space-in-links.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-space-in-links.js +0 -0
- /package/{dist → lib}/rules/token/no-trailing-punctuation.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-trailing-punctuation.js +0 -0
- /package/{dist → lib}/rules/token/no-trailing-spaces.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-trailing-spaces.js +0 -0
- /package/{dist → lib}/rules/token/ol-prefix.d.ts +0 -0
- /package/{dist → lib}/rules/token/ol-prefix.js +0 -0
- /package/{dist → lib}/rules/token/proper-names.d.ts +0 -0
- /package/{dist → lib}/rules/token/reference-links-images.d.ts +0 -0
- /package/{dist → lib}/rules/token/reference-links-images.js +0 -0
- /package/{dist → lib}/rules/token/required-headings.d.ts +0 -0
- /package/{dist → lib}/rules/token/single-h1.d.ts +0 -0
- /package/{dist → lib}/rules/token/single-trailing-newline.d.ts +0 -0
- /package/{dist → lib}/rules/token/single-trailing-newline.d.ts.map +0 -0
- /package/{dist → lib}/rules/token/single-trailing-newline.js +0 -0
- /package/{dist → lib}/rules/token/single-trailing-newline.js.map +0 -0
- /package/{dist → lib}/rules/token/strong-style.d.ts +0 -0
- /package/{dist → lib}/rules/token/strong-style.d.ts.map +0 -0
- /package/{dist → lib}/rules/token/strong-style.js +0 -0
- /package/{dist → lib}/rules/token/strong-style.js.map +0 -0
- /package/{dist → lib}/rules/token/table-column-count.d.ts +0 -0
- /package/{dist → lib}/rules/token/table-column-count.js +0 -0
- /package/{dist → lib}/rules/token/table-column-style.d.ts +0 -0
- /package/{dist → lib}/rules/token/table-pipe-style.d.ts +0 -0
- /package/{dist → lib}/rules/token/table-pipe-style.js +0 -0
- /package/{dist → lib}/rules/token/ul-indent.d.ts +0 -0
- /package/{dist → lib}/rules/token/ul-indent.js +0 -0
- /package/{dist → lib}/rules/token/ul-style.d.ts +0 -0
- /package/{dist → lib}/rules/types.js +0 -0
- /package/{dist → lib}/rules/types.js.map +0 -0
- /package/{dist → lib}/scopes/types.js +0 -0
- /package/{dist → lib}/scopes/types.js.map +0 -0
- /package/{dist → lib}/types/assertions.js +0 -0
- /package/{dist → lib}/types/assertions.js.map +0 -0
- /package/{dist → lib}/types/index.d.ts +0 -0
- /package/{dist → lib}/types/index.d.ts.map +0 -0
- /package/{dist → lib}/types/index.js +0 -0
- /package/{dist → lib}/types/index.js.map +0 -0
- /package/{dist → lib}/types/problems.d.ts +0 -0
- /package/{dist → lib}/types/problems.d.ts.map +0 -0
- /package/{dist → lib}/types/problems.js +0 -0
- /package/{dist → lib}/types/problems.js.map +0 -0
- /package/{dist → lib}/types/reporting.js +0 -0
- /package/{dist → lib}/types/reporting.js.map +0 -0
- /package/{dist → lib}/types/rules.js +0 -0
- /package/{dist → lib}/types/rules.js.map +0 -0
- /package/{dist → lib}/types/validation.js +0 -0
- /package/{dist → lib}/types/validation.js.map +0 -0
package/dist/rules/scope/swap.js
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { offsetToLineColumn } from '../../core/line-endings.js';
|
|
2
|
-
import { overlapsAnyRange } from '../../core/inline-code.js';
|
|
3
|
-
import { nonProseRanges } from '../utils.js';
|
|
4
|
-
import { applyMatchCase } from '../../core/case-preserve.js';
|
|
5
|
-
// De-overlap matches from DIFFERENT pairs by source span: when two matches
|
|
6
|
-
// overlap, keep the LONGER one (ties: the earlier-starting one; identical
|
|
7
|
-
// spans: first pair in config order, via the sort's stability). Without
|
|
8
|
-
// this, a compound pair like 'he/she' overlapping standalone keys ('he',
|
|
9
|
-
// 'she') emitted all three matches and --fix corrupted 'he/she' to
|
|
10
|
-
// 'they/they'. Zero-width matches have an empty span, so they never
|
|
11
|
-
// overlap anything and pass through unchanged.
|
|
12
|
-
function dropOverlappedShorterMatches(raw) {
|
|
13
|
-
const byPriority = [...raw].sort((a, b) => b.match.length - a.match.length || a.index - b.index);
|
|
14
|
-
const kept = [];
|
|
15
|
-
for (const candidate of byPriority) {
|
|
16
|
-
const overlapsKept = kept.some((winner) => candidate.index < winner.index + winner.match.length &&
|
|
17
|
-
winner.index < candidate.index + candidate.match.length);
|
|
18
|
-
if (!overlapsKept)
|
|
19
|
-
kept.push(candidate);
|
|
20
|
-
}
|
|
21
|
-
return kept.sort((a, b) => a.index - b.index);
|
|
22
|
-
}
|
|
23
|
-
// Prose rules must not lint code: a swap like master -> primary would fire
|
|
24
|
-
// inside `git checkout master`, the usage Google's guide explicitly
|
|
25
|
-
// sanctions in code font. The same goes for a markdoc tag's span, which is
|
|
26
|
-
// markup, not prose.
|
|
27
|
-
//
|
|
28
|
-
// `content` is the original segment content -- the regex always runs against it
|
|
29
|
-
// directly, never against a masked stand-in, because an arbitrary user regex
|
|
30
|
-
// such as a negated-class `keysAreRegex` key like `[^\s,]+` can match straight
|
|
31
|
-
// through a masked run. A match whose span overlaps an `excluded` entry (inline
|
|
32
|
-
// code spans and masked markdoc tag spans -- see `nonProseRanges`) is skipped
|
|
33
|
-
// below rather than recorded.
|
|
34
|
-
function findMatches(content, excluded, options) {
|
|
35
|
-
const raw = [];
|
|
36
|
-
const pairs = options.pairs || {};
|
|
37
|
-
for (const [from, to] of Object.entries(pairs)) {
|
|
38
|
-
// An empty pair key (only reachable when a caller bypasses validate())
|
|
39
|
-
// would escape to a zero-width pattern matching nearly every position,
|
|
40
|
-
// flooding every segment with problems. Skip it, same as
|
|
41
|
-
// consistency.ts's empty-variant skip.
|
|
42
|
-
if (String(from).length === 0)
|
|
43
|
-
continue;
|
|
44
|
-
const escaped = options.keysAreRegex
|
|
45
|
-
? from
|
|
46
|
-
: String(from).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
47
|
-
const pattern = options.wordBoundary ? `\\b${escaped}\\b` : escaped;
|
|
48
|
-
const flags = options.ignoreCase ? 'gi' : 'g';
|
|
49
|
-
let regex;
|
|
50
|
-
try {
|
|
51
|
-
regex = new RegExp(pattern, flags);
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
// ignore an invalid regex key (reachable via keysAreRegex) -- this
|
|
55
|
-
// pair only, so the rule's other pairs still run.
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
let match;
|
|
59
|
-
while ((match = regex.exec(content)) !== null) {
|
|
60
|
-
// A zero-width match (e.g. a `keysAreRegex` pattern like `a*`) never
|
|
61
|
-
// advances lastIndex on its own -- bump it or the loop hangs. It's
|
|
62
|
-
// also semantically meaningless for swap (there's no text to find or
|
|
63
|
-
// replace), so skip recording it too -- otherwise --fix would turn
|
|
64
|
-
// every such position into a zero-length insert, rewriting the file
|
|
65
|
-
// at every character offset the pattern passes through.
|
|
66
|
-
if (match[0].length === 0) {
|
|
67
|
-
regex.lastIndex++;
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
const matchEnd = match.index + match[0].length;
|
|
71
|
-
if (overlapsAnyRange(match.index, matchEnd, excluded)) {
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
raw.push({
|
|
75
|
-
index: match.index,
|
|
76
|
-
match: content.slice(match.index, match.index + match[0].length),
|
|
77
|
-
replacement: String(to),
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return dropOverlappedShorterMatches(raw).map(({ index, match, replacement }) => {
|
|
82
|
-
// offsetToLineColumn (never a bare '\n' split): on a CR-only file a
|
|
83
|
-
// '\n'-based mapping kept every match on line 1 with a column
|
|
84
|
-
// counted from the start of the content, so --fix edited the wrong
|
|
85
|
-
// position entirely.
|
|
86
|
-
const { line, column } = offsetToLineColumn(content, index);
|
|
87
|
-
return { line, column, match, replacement };
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
// A match's `column` from findMatches() is relative to its own line within
|
|
91
|
-
// segment.content. On the segment's first line, segment.content starts
|
|
92
|
-
// mid-source-line (e.g. a heading segment's content excludes the '## '
|
|
93
|
-
// marker), so segment.startColumn must be added to get the true source
|
|
94
|
-
// column. Matches on later lines start at source column 1, so they're
|
|
95
|
-
// unaffected.
|
|
96
|
-
function toSourceColumn(segment, localLine, localColumn) {
|
|
97
|
-
return localLine === 1 ? segment.startColumn + (localColumn - 1) : localColumn;
|
|
98
|
-
}
|
|
99
|
-
const execute = async (rule, file, ctx) => {
|
|
100
|
-
const options = rule.assertions['swap'];
|
|
101
|
-
const problems = [];
|
|
102
|
-
for (const segment of ctx.segments) {
|
|
103
|
-
const excluded = nonProseRanges(segment, options.includeCode);
|
|
104
|
-
for (const found of findMatches(segment.content, excluded, options)) {
|
|
105
|
-
problems.push({
|
|
106
|
-
file,
|
|
107
|
-
line: segment.startLine + found.line - 1,
|
|
108
|
-
column: toSourceColumn(segment, found.line, found.column),
|
|
109
|
-
// Legacy convention (text === match), kept as-is to avoid changing
|
|
110
|
-
// swap's reported output.
|
|
111
|
-
text: found.match,
|
|
112
|
-
match: found.match,
|
|
113
|
-
ruleName: rule.name,
|
|
114
|
-
severity: rule.severity,
|
|
115
|
-
message: (rule.message ?? '').replace('%s', found.replacement).replace('%s', found.match),
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return problems;
|
|
120
|
-
};
|
|
121
|
-
const fix = async (rule, file, ctx) => {
|
|
122
|
-
const options = rule.assertions['swap'];
|
|
123
|
-
const fixes = [];
|
|
124
|
-
for (const segment of ctx.segments) {
|
|
125
|
-
const excluded = nonProseRanges(segment, options.includeCode);
|
|
126
|
-
for (const found of findMatches(segment.content, excluded, options)) {
|
|
127
|
-
fixes.push({
|
|
128
|
-
file,
|
|
129
|
-
ruleName: rule.name,
|
|
130
|
-
lineNumber: segment.startLine + found.line - 1,
|
|
131
|
-
editColumn: toSourceColumn(segment, found.line, found.column),
|
|
132
|
-
deleteCount: found.match.length,
|
|
133
|
-
// Apply the MATCHED text's observed casing to the replacement,
|
|
134
|
-
// not the configured replacement literally: with `ignoreCase:
|
|
135
|
-
// true`, a sentence-initial "Behaviour" would otherwise be
|
|
136
|
-
// replaced by literal "behavior", silently lowercasing the start
|
|
137
|
-
// of the sentence. Works the same for a `keysAreRegex` key --
|
|
138
|
-
// applyMatchCase reads the MATCHED string, not the key -- though a
|
|
139
|
-
// regex key whose match has internal mixed case (e.g. "bEhAvIoUr")
|
|
140
|
-
// falls into the "no confident inference" branch and inserts the
|
|
141
|
-
// replacement exactly as configured, no guessing.
|
|
142
|
-
insertText: applyMatchCase(found.match, found.replacement),
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return fixes;
|
|
147
|
-
};
|
|
148
|
-
export const swap = { id: 'swap', fixable: true, execute, fix };
|
|
149
|
-
//# sourceMappingURL=swap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"swap.js","sourceRoot":"","sources":["../../../src/rules/scope/swap.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAe7D,2EAA2E;AAC3E,0EAA0E;AAC1E,wEAAwE;AACxE,yEAAyE;AACzE,mEAAmE;AACnE,oEAAoE;AACpE,+CAA+C;AAC/C,SAAS,4BAA4B,CAAC,GAAmB;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,CAAC;gBACT,IAAI;gBACJ,QAAQ,EAAE,IAAI,CAAC,IAAI;gBACnB,UAAU,EAAE,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,GAAG,CAAC;gBAC9C,UAAU,EAAE,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;gBAC7D,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM;gBAC/B,+DAA+D;gBAC/D,8DAA8D;gBAC9D,2DAA2D;gBAC3D,iEAAiE;gBACjE,8DAA8D;gBAC9D,mEAAmE;gBACnE,mEAAmE;gBACnE,iEAAiE;gBACjE,kDAAkD;gBAClD,UAAU,EAAE,cAAc,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC;aAC3D,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAc,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* True for a word that's already an ALL-CAPS acronym (2+ letters, e.g.
|
|
3
|
-
* 'API', 'HTML5') -- both styles leave these exactly as written rather
|
|
4
|
-
* than lowercasing or capitalizing them. Non-letter characters (digits)
|
|
5
|
-
* don't count toward the length or case check.
|
|
6
|
-
*/
|
|
7
|
-
export declare function isAllCapsWord(word: string): boolean;
|
|
8
|
-
/** The `v2` of `v2.0`, or `v3`. The `v` must be the whole alphabetic part,
|
|
9
|
-
* so an ordinary word like `vector3` is untouched. */
|
|
10
|
-
export declare function isVersionToken(word: string): boolean;
|
|
11
|
-
/** `x-metadata`, `x-codeSamples`. Case-sensitive: matching `X-` too would
|
|
12
|
-
* freeze `X-ray` and AWS `X-Ray`. */
|
|
13
|
-
export declare function isVendorExtensionToken(word: string): boolean;
|
|
14
|
-
/** Tokens whose own casing is already correct. Must be checked before
|
|
15
|
-
* hyphen splitting -- an extension's `-` is part of its name. */
|
|
16
|
-
export declare function keepsOwnCasing(word: string): boolean;
|
|
17
|
-
export interface ExceptionPlan {
|
|
18
|
-
wordMap: Map<string, string>;
|
|
19
|
-
phrases: string[];
|
|
20
|
-
}
|
|
21
|
-
export declare function buildExceptionPlan(exceptions: string[]): ExceptionPlan;
|
|
22
|
-
/**
|
|
23
|
-
* Rebuilds `text` with every word re-cased by `caseWord`, which receives the
|
|
24
|
-
* word, its `index`, the sequence `total`, and whether it opens a sentence.
|
|
25
|
-
* Separators are copied through verbatim.
|
|
26
|
-
*
|
|
27
|
-
* Phrase-exception and mask tokens are emitted as-written but still OCCUPY an
|
|
28
|
-
* index, so a leading one cannot hand position 0 to a neighbour (#25610).
|
|
29
|
-
*
|
|
30
|
-
* Shared by apTitleCase/chicagoTitleCase and capitalization.ts's sentenceCase.
|
|
31
|
-
* Length-preserving whenever `caseWord` is.
|
|
32
|
-
*/
|
|
33
|
-
export declare function recaseWords(text: string, phrases: string[], caseWord: (word: string, index: number, total: number, startsSentence: boolean) => string): string;
|
|
34
|
-
/**
|
|
35
|
-
* AP style: lowercases articles, coordinating conjunctions, and
|
|
36
|
-
* prepositions of 3 letters or fewer -- everything else is capitalized,
|
|
37
|
-
* except `exceptions` (kept as-written) and ALL-CAPS words (left alone).
|
|
38
|
-
* The first and last word are always capitalized.
|
|
39
|
-
*/
|
|
40
|
-
export declare function apTitleCase(text: string, exceptions?: string[]): string;
|
|
41
|
-
/**
|
|
42
|
-
* Chicago style: like AP, but lowercases EVERY preposition regardless of
|
|
43
|
-
* length (not just the 3-letters-or-fewer ones AP lowercases).
|
|
44
|
-
*/
|
|
45
|
-
export declare function chicagoTitleCase(text: string, exceptions?: string[]): string;
|
|
46
|
-
//# sourceMappingURL=title-case.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"title-case.d.ts","sourceRoot":"","sources":["../../../src/rules/scope/title-case.ts"],"names":[],"mappings":"AA4EA;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGnD;AAED;uDACuD;AACvD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;sCACsC;AACtC,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED;kEACkE;AAClE,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAuBD,MAAM,WAAW,aAAa;IAG5B,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAI7B,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,aAAa,CAStE;AAmJD;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EAAE,EACjB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,KAAK,MAAM,GACxF,MAAM,CAcR;AAuED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,GAAE,MAAM,EAAO,GAAG,MAAM,CAE3E;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,GAAE,MAAM,EAAO,GAAG,MAAM,CAEhF"}
|
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
// Pure AP/Chicago title-case algorithms backing the Vale-parity
|
|
2
|
-
// `capitalization` assertion's `$title` match (see ./capitalization.ts).
|
|
3
|
-
// Deliberately no markdown/Vale awareness here -- these functions operate
|
|
4
|
-
// on plain text only. Scope/segment handling, backtick-span freezing, and
|
|
5
|
-
// the problem/fix wiring all live in capitalization.ts. The one import below
|
|
6
|
-
// is the mask CHARACTER, not any markdown handling: masking happens in
|
|
7
|
-
// capitalization.ts, and the tokenizer here only has to recognize the result.
|
|
8
|
-
//
|
|
9
|
-
// Shared casing rules (both styles):
|
|
10
|
-
// - The FIRST and LAST word are ALWAYS capitalized, regardless of any
|
|
11
|
-
// stopword list below.
|
|
12
|
-
// - A word listed in `exceptions` (matched case-insensitively) is
|
|
13
|
-
// rewritten to its EXACT as-written form from that list, everywhere in
|
|
14
|
-
// the title -- including first/last position -- overriding every rule
|
|
15
|
-
// below (e.g. 'GitHub', 'iPhone').
|
|
16
|
-
// - A word already in ALL-CAPS (2+ letters, e.g. an acronym like 'API') is
|
|
17
|
-
// left exactly as written, also overriding the stopword/position rules.
|
|
18
|
-
// - A hyphenated compound (e.g. 'editor-in-chief' -> 'Editor-in-Chief')
|
|
19
|
-
// runs each hyphen part through the same rules a standalone word gets --
|
|
20
|
-
// see capitalizeHyphenated.
|
|
21
|
-
// - Every other (non-edge, non-hyphenated, non-exception, non-ALL-CAPS)
|
|
22
|
-
// word is either forced lowercase (a stopword for the active style) or
|
|
23
|
-
// capitalized (initial letter upper, rest lower).
|
|
24
|
-
//
|
|
25
|
-
// Style difference (the stopword list lowercased mid-title):
|
|
26
|
-
// - AP: articles, coordinating conjunctions, and prepositions of THREE
|
|
27
|
-
// letters or fewer.
|
|
28
|
-
// - Chicago: articles, coordinating conjunctions, and EVERY preposition
|
|
29
|
-
// regardless of length -- via the fixed list below (JS has no built-in
|
|
30
|
-
// dictionary of "all English prepositions" to draw on).
|
|
31
|
-
import { INLINE_CODE_MASK_CHAR } from '../../core/inline-code.js';
|
|
32
|
-
import { ABBREVIATIONS, lastWordBefore } from '../../scopes/sentences.js';
|
|
33
|
-
const ARTICLES = ['a', 'an', 'the'];
|
|
34
|
-
const COORDINATING_CONJUNCTIONS = ['and', 'but', 'or', 'nor', 'for', 'so', 'yet'];
|
|
35
|
-
// Every entry here is <= 3 letters -- both AP and Chicago lowercase these.
|
|
36
|
-
const SHORT_PREPOSITIONS = ['at', 'by', 'in', 'of', 'off', 'on', 'out', 'to', 'up', 'via'];
|
|
37
|
-
// Chicago-only: prepositions of 4+ letters. AP capitalizes these mid-title
|
|
38
|
-
// (they're not in AP_STOPWORDS); Chicago lowercases them like any other
|
|
39
|
-
// preposition.
|
|
40
|
-
const LONG_PREPOSITIONS = [
|
|
41
|
-
'about',
|
|
42
|
-
'above',
|
|
43
|
-
'across',
|
|
44
|
-
'after',
|
|
45
|
-
'against',
|
|
46
|
-
'along',
|
|
47
|
-
'among',
|
|
48
|
-
'around',
|
|
49
|
-
'before',
|
|
50
|
-
'behind',
|
|
51
|
-
'below',
|
|
52
|
-
'between',
|
|
53
|
-
'during',
|
|
54
|
-
'through',
|
|
55
|
-
'toward',
|
|
56
|
-
'under',
|
|
57
|
-
'until',
|
|
58
|
-
'with',
|
|
59
|
-
'within',
|
|
60
|
-
'without',
|
|
61
|
-
];
|
|
62
|
-
const AP_STOPWORDS = new Set([...ARTICLES, ...COORDINATING_CONJUNCTIONS, ...SHORT_PREPOSITIONS]);
|
|
63
|
-
const CHICAGO_STOPWORDS = new Set([
|
|
64
|
-
...ARTICLES,
|
|
65
|
-
...COORDINATING_CONJUNCTIONS,
|
|
66
|
-
...SHORT_PREPOSITIONS,
|
|
67
|
-
...LONG_PREPOSITIONS,
|
|
68
|
-
]);
|
|
69
|
-
// One "word" is a run of letters/digits, optionally joined by internal
|
|
70
|
-
// hyphens ('well-known') or apostrophes ("don't"); anything else is a
|
|
71
|
-
// separator copied through verbatim. Phrase exceptions never reach the
|
|
72
|
-
// tokenizer -- tokenizeCasingWords carves them out first.
|
|
73
|
-
/**
|
|
74
|
-
* True for a word that's already an ALL-CAPS acronym (2+ letters, e.g.
|
|
75
|
-
* 'API', 'HTML5') -- both styles leave these exactly as written rather
|
|
76
|
-
* than lowercasing or capitalizing them. Non-letter characters (digits)
|
|
77
|
-
* don't count toward the length or case check.
|
|
78
|
-
*/
|
|
79
|
-
export function isAllCapsWord(word) {
|
|
80
|
-
const letters = word.replace(/[^A-Za-z]/g, '');
|
|
81
|
-
return letters.length >= 2 && letters === letters.toUpperCase();
|
|
82
|
-
}
|
|
83
|
-
/** The `v2` of `v2.0`, or `v3`. The `v` must be the whole alphabetic part,
|
|
84
|
-
* so an ordinary word like `vector3` is untouched. */
|
|
85
|
-
export function isVersionToken(word) {
|
|
86
|
-
return /^v\d+$/i.test(word);
|
|
87
|
-
}
|
|
88
|
-
/** `x-metadata`, `x-codeSamples`. Case-sensitive: matching `X-` too would
|
|
89
|
-
* freeze `X-ray` and AWS `X-Ray`. */
|
|
90
|
-
export function isVendorExtensionToken(word) {
|
|
91
|
-
return /^x-./.test(word);
|
|
92
|
-
}
|
|
93
|
-
/** Tokens whose own casing is already correct. Must be checked before
|
|
94
|
-
* hyphen splitting -- an extension's `-` is part of its name. */
|
|
95
|
-
export function keepsOwnCasing(word) {
|
|
96
|
-
return isAllCapsWord(word) || isVersionToken(word) || isVendorExtensionToken(word);
|
|
97
|
-
}
|
|
98
|
-
function capitalizeWord(word) {
|
|
99
|
-
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
100
|
-
}
|
|
101
|
-
export function buildExceptionPlan(exceptions) {
|
|
102
|
-
const phrases = exceptions.filter((e) => /[\s.]/.test(e)).sort((a, b) => b.length - a.length);
|
|
103
|
-
const phraseSet = new Set(phrases);
|
|
104
|
-
const wordMap = new Map();
|
|
105
|
-
for (const exception of exceptions) {
|
|
106
|
-
if (phraseSet.has(exception))
|
|
107
|
-
continue; // phrases are matched separately, below
|
|
108
|
-
wordMap.set(exception.toLowerCase(), exception);
|
|
109
|
-
}
|
|
110
|
-
return { wordMap, phrases };
|
|
111
|
-
}
|
|
112
|
-
function escapeRegExp(text) {
|
|
113
|
-
return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
114
|
-
}
|
|
115
|
-
// Finds every non-overlapping occurrence of a phrase exception in `text`,
|
|
116
|
-
// case-insensitively but otherwise LITERALLY -- no whitespace normalization,
|
|
117
|
-
// no word-boundary requirement, and no regex sourced from config (every
|
|
118
|
-
// candidate is a fixed exception string, run through escapeRegExp). Literal
|
|
119
|
-
// matching is what guarantees a match is always exactly `phrase.length`
|
|
120
|
-
// characters long, which is in turn what lets a matched span be replaced by
|
|
121
|
-
// the as-written exception without shifting any later offset (see
|
|
122
|
-
// CasingToken.exception).
|
|
123
|
-
// `phrases` is already longest-first (buildExceptionPlan), so a match
|
|
124
|
-
// recorded for an earlier (longer) phrase claims its range and a later
|
|
125
|
-
// (shorter) phrase cannot also match any part of it.
|
|
126
|
-
function findPhraseMatches(text, phrases) {
|
|
127
|
-
const matches = [];
|
|
128
|
-
for (const phrase of phrases) {
|
|
129
|
-
const pattern = new RegExp(escapeRegExp(phrase), 'gi');
|
|
130
|
-
let match;
|
|
131
|
-
while ((match = pattern.exec(text)) !== null) {
|
|
132
|
-
const start = match.index;
|
|
133
|
-
const end = start + match[0].length;
|
|
134
|
-
if (!matches.some((claimed) => start < claimed.end && claimed.start < end)) {
|
|
135
|
-
matches.push({ start, end, exception: phrase });
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return matches.sort((a, b) => a.start - b.start);
|
|
140
|
-
}
|
|
141
|
-
// A mask run is one inline code span (core/inline-code.ts). It gets its own
|
|
142
|
-
// token so it OCCUPIES a position, like a phrase exception (#25610) -- a
|
|
143
|
-
// heading opening with a code span must not hand position 0 to the next word.
|
|
144
|
-
// `exception` is the run itself so it survives byte for byte; restoreInlineCode
|
|
145
|
-
// splices by offset.
|
|
146
|
-
const WORD_OR_MASK_RE = new RegExp(`${INLINE_CODE_MASK_CHAR}+|[A-Za-z0-9]+(?:['’-][A-Za-z0-9]+)*`, 'g');
|
|
147
|
-
function pushWordTokens(text, from, to, tokens) {
|
|
148
|
-
if (from >= to)
|
|
149
|
-
return;
|
|
150
|
-
for (const match of text.slice(from, to).matchAll(WORD_OR_MASK_RE)) {
|
|
151
|
-
const start = from + (match.index ?? 0);
|
|
152
|
-
const isMask = match[0].startsWith(INLINE_CODE_MASK_CHAR);
|
|
153
|
-
tokens.push({
|
|
154
|
-
text: match[0],
|
|
155
|
-
start,
|
|
156
|
-
end: start + match[0].length,
|
|
157
|
-
...(isMask ? { exception: match[0] } : {}),
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Tokenizes `text` into the word sequence the `$`-styles case, with every
|
|
163
|
-
* non-overlapping phrase-exception match collapsed into a single token.
|
|
164
|
-
*
|
|
165
|
-
* Ordinary words are tokenized only in the GAPS between phrase matches, which
|
|
166
|
-
* makes a phrase span a hard token boundary: a word can never straddle one
|
|
167
|
-
* (e.g. with the phrase 'VS Code', the text 'xVS Codey' yields 'x', the
|
|
168
|
-
* phrase, then 'y'). That is exactly the boundary the previous placeholder run
|
|
169
|
-
* produced, since the placeholder sat outside WORD_RE's character class.
|
|
170
|
-
*/
|
|
171
|
-
function tokenizeCasingWords(text, phrases) {
|
|
172
|
-
const tokens = [];
|
|
173
|
-
let cursor = 0;
|
|
174
|
-
for (const { start, end, exception } of findPhraseMatches(text, phrases)) {
|
|
175
|
-
pushWordTokens(text, cursor, start, tokens);
|
|
176
|
-
tokens.push({ text: text.slice(start, end), start, end, exception });
|
|
177
|
-
cursor = end;
|
|
178
|
-
}
|
|
179
|
-
pushWordTokens(text, cursor, text.length, tokens);
|
|
180
|
-
return tokens;
|
|
181
|
-
}
|
|
182
|
-
// Trailing whitespace is required: a bare dot is usually a dotted identifier
|
|
183
|
-
// or version (`element.focus()`, `v2.0`), not a sentence end. No ':' -- both
|
|
184
|
-
// style guides lowercase after a colon unless a full sentence follows, which
|
|
185
|
-
// nothing here can detect.
|
|
186
|
-
const SENTENCE_BREAK_RE = /[.?!]["'’”)\]]*\s/;
|
|
187
|
-
// ABBREVIATIONS is the sentence splitter's own list, reused so the two cannot
|
|
188
|
-
// disagree about what ends a sentence (`Cost vs. value` is one sentence).
|
|
189
|
-
function gapEndsSentence(text, gapStart, gap) {
|
|
190
|
-
const match = SENTENCE_BREAK_RE.exec(gap);
|
|
191
|
-
if (!match)
|
|
192
|
-
return false;
|
|
193
|
-
if (match[0][0] !== '.')
|
|
194
|
-
return true; // '?' and '!' never abbreviate
|
|
195
|
-
return !ABBREVIATIONS.has(lastWordBefore(text, gapStart + (match.index ?? 0)));
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Rebuilds `text` with every word re-cased by `caseWord`, which receives the
|
|
199
|
-
* word, its `index`, the sequence `total`, and whether it opens a sentence.
|
|
200
|
-
* Separators are copied through verbatim.
|
|
201
|
-
*
|
|
202
|
-
* Phrase-exception and mask tokens are emitted as-written but still OCCUPY an
|
|
203
|
-
* index, so a leading one cannot hand position 0 to a neighbour (#25610).
|
|
204
|
-
*
|
|
205
|
-
* Shared by apTitleCase/chicagoTitleCase and capitalization.ts's sentenceCase.
|
|
206
|
-
* Length-preserving whenever `caseWord` is.
|
|
207
|
-
*/
|
|
208
|
-
export function recaseWords(text, phrases, caseWord) {
|
|
209
|
-
const tokens = tokenizeCasingWords(text, phrases);
|
|
210
|
-
if (tokens.length === 0)
|
|
211
|
-
return text;
|
|
212
|
-
let result = '';
|
|
213
|
-
let cursor = 0;
|
|
214
|
-
tokens.forEach((token, index) => {
|
|
215
|
-
const separator = text.slice(cursor, token.start);
|
|
216
|
-
const startsSentence = index === 0 || gapEndsSentence(text, cursor, separator);
|
|
217
|
-
result += separator;
|
|
218
|
-
result += token.exception ?? caseWord(token.text, index, tokens.length, startsSentence);
|
|
219
|
-
cursor = token.end;
|
|
220
|
-
});
|
|
221
|
-
return result + text.slice(cursor);
|
|
222
|
-
}
|
|
223
|
-
// Each hyphen part gets its own exceptions/ALL-CAPS decision first, then
|
|
224
|
-
// the same stopword test a standalone word gets. The first/last part also
|
|
225
|
-
// inherits the compound's own first/last-word treatment, so a stopword
|
|
226
|
-
// part still capitalizes when the compound opens/closes the title.
|
|
227
|
-
function capitalizeHyphenated(word, isFirstWord, isLastWord, stopwords, exceptionMap) {
|
|
228
|
-
const parts = word.split('-');
|
|
229
|
-
const lastPartIndex = parts.length - 1;
|
|
230
|
-
return parts
|
|
231
|
-
.map((part, partIndex) => {
|
|
232
|
-
if (part.length === 0)
|
|
233
|
-
return part; // leading/trailing/doubled hyphen -- nothing to capitalize
|
|
234
|
-
const exceptionHit = exceptionMap.get(part.toLowerCase());
|
|
235
|
-
if (exceptionHit !== undefined)
|
|
236
|
-
return exceptionHit;
|
|
237
|
-
if (isAllCapsWord(part))
|
|
238
|
-
return part;
|
|
239
|
-
if (partIndex === 0 && isFirstWord)
|
|
240
|
-
return capitalizeWord(part);
|
|
241
|
-
if (partIndex === lastPartIndex && isLastWord)
|
|
242
|
-
return capitalizeWord(part);
|
|
243
|
-
if (stopwords.has(part.toLowerCase()))
|
|
244
|
-
return part.toLowerCase();
|
|
245
|
-
return capitalizeWord(part);
|
|
246
|
-
})
|
|
247
|
-
.join('-');
|
|
248
|
-
}
|
|
249
|
-
function transformWord(word, isFirstWord, isLastWord, stopwords, exceptionMap) {
|
|
250
|
-
// Whole-compound exception check FIRST, before any hyphen splitting: an
|
|
251
|
-
// exceptions entry may itself be an entire hyphenated compound (e.g.
|
|
252
|
-
// 'e-commerce'), which must be preserved as-written rather than falling
|
|
253
|
-
// through to per-part handling below -- $sentence (capitalization.ts's
|
|
254
|
-
// sentenceCase) already treats a hyphenated compound as one token and
|
|
255
|
-
// honors this, so $title must agree on the same documented behavior.
|
|
256
|
-
const exceptionHit = exceptionMap.get(word.toLowerCase());
|
|
257
|
-
if (exceptionHit !== undefined)
|
|
258
|
-
return exceptionHit;
|
|
259
|
-
// Before the hyphen split: `x-codeSamples` split into parts became
|
|
260
|
-
// `X-codesamples`. An exceptions entry still wins, above.
|
|
261
|
-
if (keepsOwnCasing(word))
|
|
262
|
-
return word;
|
|
263
|
-
// Hyphenation check: with no whole-compound exception match, a hyphenated
|
|
264
|
-
// compound is stopword-tested part by part instead (the stopword lists
|
|
265
|
-
// only contain single words, so a whole-string lookup against them would
|
|
266
|
-
// never hit anyway). Per-part exceptions (e.g. 'GitHub' inside
|
|
267
|
-
// 'github-hosted') are still handled inside capitalizeHyphenated.
|
|
268
|
-
if (word.includes('-')) {
|
|
269
|
-
return capitalizeHyphenated(word, isFirstWord, isLastWord, stopwords, exceptionMap);
|
|
270
|
-
}
|
|
271
|
-
if (isFirstWord || isLastWord)
|
|
272
|
-
return capitalizeWord(word);
|
|
273
|
-
if (stopwords.has(word.toLowerCase()))
|
|
274
|
-
return word.toLowerCase();
|
|
275
|
-
return capitalizeWord(word);
|
|
276
|
-
}
|
|
277
|
-
function titleCase(text, stopwords, exceptions) {
|
|
278
|
-
// Phrase entries become atomic tokens in the sequence recaseWords walks
|
|
279
|
-
// (each emitted as-written, each counting toward first/last position);
|
|
280
|
-
// `wordMap` holds the single-token entries transformWord looks up per word
|
|
281
|
-
// and per hyphen part. Both come from the one shared exception plan.
|
|
282
|
-
const { wordMap, phrases } = buildExceptionPlan(exceptions);
|
|
283
|
-
return recaseWords(text, phrases, (word, index, total) => transformWord(word, index === 0, index === total - 1, stopwords, wordMap));
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* AP style: lowercases articles, coordinating conjunctions, and
|
|
287
|
-
* prepositions of 3 letters or fewer -- everything else is capitalized,
|
|
288
|
-
* except `exceptions` (kept as-written) and ALL-CAPS words (left alone).
|
|
289
|
-
* The first and last word are always capitalized.
|
|
290
|
-
*/
|
|
291
|
-
export function apTitleCase(text, exceptions = []) {
|
|
292
|
-
return titleCase(text, AP_STOPWORDS, exceptions);
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Chicago style: like AP, but lowercases EVERY preposition regardless of
|
|
296
|
-
* length (not just the 3-letters-or-fewer ones AP lowercases).
|
|
297
|
-
*/
|
|
298
|
-
export function chicagoTitleCase(text, exceptions = []) {
|
|
299
|
-
return titleCase(text, CHICAGO_STOPWORDS, exceptions);
|
|
300
|
-
}
|
|
301
|
-
//# sourceMappingURL=title-case.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"title-case.js","sourceRoot":"","sources":["../../../src/rules/scope/title-case.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,yEAAyE;AACzE,0EAA0E;AAC1E,0EAA0E;AAC1E,6EAA6E;AAC7E,uEAAuE;AACvE,8EAA8E;AAC9E,EAAE;AACF,qCAAqC;AACrC,sEAAsE;AACtE,yBAAyB;AACzB,kEAAkE;AAClE,yEAAyE;AACzE,wEAAwE;AACxE,qCAAqC;AACrC,2EAA2E;AAC3E,0EAA0E;AAC1E,wEAAwE;AACxE,2EAA2E;AAC3E,8BAA8B;AAC9B,wEAAwE;AACxE,yEAAyE;AACzE,oDAAoD;AACpD,EAAE;AACF,6DAA6D;AAC7D,uEAAuE;AACvE,sBAAsB;AACtB,wEAAwE;AACxE,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE1E,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AACpC,MAAM,yBAAyB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AAClF,2EAA2E;AAC3E,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AAC3F,2EAA2E;AAC3E,wEAAwE;AACxE,eAAe;AACf,MAAM,iBAAiB,GAAG;IACxB,OAAO;IACP,OAAO;IACP,QAAQ;I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AAY,EAAE,UAAU,GAAa,EAAE;IACtE,OAAO,SAAS,CAAC,IAAI,EAAE,iBAAiB,EAAE,UAAU,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blanks-around-fences.d.ts","sourceRoot":"","sources":["../../../src/rules/token/blanks-around-fences.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,aAAa,CAAC;AA6B/D,eAAO,MAAM,kBAAkB,EAAE,SAuBhC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blanks-around-fences.js","sourceRoot":"","sources":["../../../src/rules/token/blanks-around-fences.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE5D,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAEvC,SAAS,aAAa,CACpB,GAAqB,EACrB,KAAwB,EACxB,UAAkB,EAClB,GAAY;IAEZ,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACzC,MAAM,WAAW,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC;IAChC,GAAG,CAAC,OAAO,CAAC;QACV,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE;QACpB,OAAO,EACL,MAAM,KAAK,SAAS;YAClB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC;gBACE,UAAU,EAAE,UAAU,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACtC,UAAU,EAAE,CAAC;gBACb,UAAU,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,OAA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,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blanks-around-headings.d.ts","sourceRoot":"","sources":["../../../src/rules/token/blanks-around-headings.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAwD7C,eAAO,MAAM,oBAAoB,EAAE,SA0ElC,CAAC"}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { filterByTypes } from '../../parser/index.js';
|
|
2
|
-
import { getBlockQuotePrefixText, getHeadingLevel, isBlankLine } from './helpers.js';
|
|
3
|
-
const defaultLines = 1;
|
|
4
|
-
/**
|
|
5
|
-
* Upstream's `getLinesFunction`: `linesAbove`/`linesBelow` config can be a
|
|
6
|
-
* single number applied to every heading level, or a `number[6]` (one
|
|
7
|
-
* entry per heading level 1-6, missing/short entries fall back to the
|
|
8
|
-
* default of 1).
|
|
9
|
-
*/
|
|
10
|
-
function getLinesFunction(linesParam) {
|
|
11
|
-
if (Array.isArray(linesParam)) {
|
|
12
|
-
const linesArray = new Array(6).fill(defaultLines);
|
|
13
|
-
for (const [index, value] of linesParam.slice(0, 6).entries()) {
|
|
14
|
-
linesArray[index] = Number(value);
|
|
15
|
-
}
|
|
16
|
-
return (heading) => linesArray[getHeadingLevel(heading) - 1];
|
|
17
|
-
}
|
|
18
|
-
const lines = linesParam === undefined ? defaultLines : Number(linesParam);
|
|
19
|
-
return () => lines;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Gets a 0-based line's text for the "lines above" scan. Upstream strips
|
|
23
|
-
* front matter out of `params.lines` entirely and only reconstructs it via
|
|
24
|
-
* a separate `frontMatterLines` array for negative indices; Recheck keeps
|
|
25
|
-
* front matter in-band as a real `yaml` token occupying real line numbers
|
|
26
|
-
* in `ctx.lines`. To preserve upstream's documented default ("front matter
|
|
27
|
-
* is ignored" — i.e. no blank line is required between it and the first
|
|
28
|
-
* heading), a line that falls inside the yaml token's span is treated as
|
|
29
|
-
* blank (returns `''`) unless `includeFrontMatter` is set, in which case
|
|
30
|
-
* its real text is returned like any other line.
|
|
31
|
-
*/
|
|
32
|
-
function getLineAbove(lines, index, frontMatterRange, includeFrontMatter) {
|
|
33
|
-
if (index < 0 || index >= lines.length)
|
|
34
|
-
return '';
|
|
35
|
-
const lineNumber = index + 1;
|
|
36
|
-
if (!includeFrontMatter &&
|
|
37
|
-
frontMatterRange &&
|
|
38
|
-
lineNumber >= frontMatterRange.start &&
|
|
39
|
-
lineNumber <= frontMatterRange.end) {
|
|
40
|
-
return '';
|
|
41
|
-
}
|
|
42
|
-
return lines[index];
|
|
43
|
-
}
|
|
44
|
-
export const blanksAroundHeadings = {
|
|
45
|
-
name: 'blanks-around-headings',
|
|
46
|
-
tags: ['headings', 'blank_lines'],
|
|
47
|
-
fixable: true,
|
|
48
|
-
defaults: {
|
|
49
|
-
message: 'Headings should be surrounded by blank lines',
|
|
50
|
-
includeFrontMatter: false,
|
|
51
|
-
linesAbove: 1,
|
|
52
|
-
linesBelow: 1,
|
|
53
|
-
},
|
|
54
|
-
check(ctx) {
|
|
55
|
-
const getLinesAbove = getLinesFunction(ctx.config.linesAbove);
|
|
56
|
-
const getLinesBelow = getLinesFunction(ctx.config.linesBelow);
|
|
57
|
-
const includeFrontMatter = !!ctx.config.includeFrontMatter;
|
|
58
|
-
const { lines } = ctx;
|
|
59
|
-
const frontmatter = ctx.tree.flat.find((token) => token.type === 'yaml');
|
|
60
|
-
const frontMatterRange = frontmatter
|
|
61
|
-
? { start: frontmatter.startLine, end: frontmatter.endLine }
|
|
62
|
-
: undefined;
|
|
63
|
-
for (const heading of filterByTypes(ctx.tree, ['atxHeading', 'setextHeading'])) {
|
|
64
|
-
const { startLine, endLine } = heading;
|
|
65
|
-
const lineText = (lines[startLine - 1] ?? '').trim();
|
|
66
|
-
const linesAbove = getLinesAbove(heading);
|
|
67
|
-
if (linesAbove >= 0) {
|
|
68
|
-
let actualAbove = 0;
|
|
69
|
-
for (let i = 0; i < linesAbove &&
|
|
70
|
-
isBlankLine(getLineAbove(lines, startLine - 2 - i, frontMatterRange, includeFrontMatter)); i++) {
|
|
71
|
-
actualAbove++;
|
|
72
|
-
}
|
|
73
|
-
if (linesAbove !== actualAbove) {
|
|
74
|
-
ctx.onError({
|
|
75
|
-
line: startLine,
|
|
76
|
-
detail: `Expected: ${linesAbove}; Actual: ${actualAbove}; Above`,
|
|
77
|
-
context: lineText,
|
|
78
|
-
fixInfo: {
|
|
79
|
-
lineNumber: startLine,
|
|
80
|
-
editColumn: 1,
|
|
81
|
-
insertText: getBlockQuotePrefixText(ctx.tree, startLine - 1, linesAbove - actualAbove),
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
const linesBelow = getLinesBelow(heading);
|
|
87
|
-
if (linesBelow >= 0) {
|
|
88
|
-
let actualBelow = 0;
|
|
89
|
-
for (let i = 0; i < linesBelow && isBlankLine(lines[endLine + i] ?? ''); i++) {
|
|
90
|
-
actualBelow++;
|
|
91
|
-
}
|
|
92
|
-
if (linesBelow !== actualBelow) {
|
|
93
|
-
ctx.onError({
|
|
94
|
-
line: startLine,
|
|
95
|
-
detail: `Expected: ${linesBelow}; Actual: ${actualBelow}; Below`,
|
|
96
|
-
context: lineText,
|
|
97
|
-
fixInfo: {
|
|
98
|
-
lineNumber: endLine + 1,
|
|
99
|
-
editColumn: 1,
|
|
100
|
-
insertText: getBlockQuotePrefixText(ctx.tree, endLine + 1, linesBelow - actualBelow),
|
|
101
|
-
},
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
//# sourceMappingURL=blanks-around-headings.js.map
|