chaffjs 0.17.0 → 0.19.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 +52 -56
- package/bin/chaff.js +17 -2
- package/dist/acronym-expansions.d.ts +26 -0
- package/dist/acronym-expansions.d.ts.map +1 -0
- package/dist/acronym-expansions.js +88 -0
- package/dist/acronym-expansions.js.map +1 -0
- package/dist/announced-count.d.ts +26 -0
- package/dist/announced-count.d.ts.map +1 -0
- package/dist/announced-count.js +138 -0
- package/dist/announced-count.js.map +1 -0
- package/dist/announced-list.d.ts +30 -0
- package/dist/announced-list.d.ts.map +1 -0
- package/dist/announced-list.js +95 -0
- package/dist/announced-list.js.map +1 -0
- package/dist/api.d.ts +168 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +10 -0
- package/dist/api.js.map +1 -0
- package/dist/bare-url.d.ts +14 -0
- package/dist/bare-url.d.ts.map +1 -0
- package/dist/bare-url.js +28 -0
- package/dist/bare-url.js.map +1 -0
- package/dist/baseline.d.ts +5 -0
- package/dist/baseline.d.ts.map +1 -1
- package/dist/baseline.js +16 -1
- package/dist/baseline.js.map +1 -1
- package/dist/body-section.d.ts +7 -0
- package/dist/body-section.d.ts.map +1 -0
- package/dist/body-section.js +6 -0
- package/dist/body-section.js.map +1 -0
- package/dist/calendar-number.d.ts +2 -0
- package/dist/calendar-number.d.ts.map +1 -1
- package/dist/calendar-number.js +9 -2
- package/dist/calendar-number.js.map +1 -1
- package/dist/cli-args.d.ts +4 -0
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +5 -0
- package/dist/cli-args.js.map +1 -1
- package/dist/cli-text.d.ts +0 -1
- package/dist/cli-text.d.ts.map +1 -1
- package/dist/cli-text.js +14 -18
- package/dist/cli-text.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +83 -84
- package/dist/cli.js.map +1 -1
- package/dist/closing-paragraph.d.ts +7 -0
- package/dist/closing-paragraph.d.ts.map +1 -0
- package/dist/closing-paragraph.js +22 -0
- package/dist/closing-paragraph.js.map +1 -0
- package/dist/commands/compare.d.ts +15 -0
- package/dist/commands/compare.d.ts.map +1 -0
- package/dist/commands/compare.js +64 -0
- package/dist/commands/compare.js.map +1 -0
- package/dist/commands/document-commands.d.ts +9 -0
- package/dist/commands/document-commands.d.ts.map +1 -0
- package/dist/commands/document-commands.js +17 -0
- package/dist/commands/document-commands.js.map +1 -0
- package/dist/commands/eval.d.ts.map +1 -1
- package/dist/commands/eval.js +19 -10
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/facts.d.ts +8 -0
- package/dist/commands/facts.d.ts.map +1 -0
- package/dist/commands/facts.js +30 -0
- package/dist/commands/facts.js.map +1 -0
- package/dist/commands/feedback.d.ts +15 -2
- package/dist/commands/feedback.d.ts.map +1 -1
- package/dist/commands/feedback.js +36 -6
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/fix-plan.d.ts +13 -0
- package/dist/commands/fix-plan.d.ts.map +1 -0
- package/dist/commands/fix-plan.js +44 -0
- package/dist/commands/fix-plan.js.map +1 -0
- package/dist/commands/outline.d.ts +8 -0
- package/dist/commands/outline.d.ts.map +1 -0
- package/dist/commands/outline.js +43 -0
- package/dist/commands/outline.js.map +1 -0
- package/dist/commands/read-document.d.ts +14 -0
- package/dist/commands/read-document.d.ts.map +1 -0
- package/dist/commands/read-document.js +21 -0
- package/dist/commands/read-document.js.map +1 -0
- package/dist/commands/suppressions.d.ts +7 -0
- package/dist/commands/suppressions.d.ts.map +1 -0
- package/dist/commands/suppressions.js +9 -0
- package/dist/commands/suppressions.js.map +1 -0
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +3 -5
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/tree.d.ts +13 -0
- package/dist/commands/tree.d.ts.map +1 -1
- package/dist/commands/tree.js +35 -5
- package/dist/commands/tree.js.map +1 -1
- package/dist/compare/atom.d.ts +31 -0
- package/dist/compare/atom.d.ts.map +1 -0
- package/dist/compare/atom.js +4 -0
- package/dist/compare/atom.js.map +1 -0
- package/dist/compare/clock-time.d.ts +8 -0
- package/dist/compare/clock-time.d.ts.map +1 -0
- package/dist/compare/clock-time.js +68 -0
- package/dist/compare/clock-time.js.map +1 -0
- package/dist/compare/distinct.d.ts +9 -0
- package/dist/compare/distinct.d.ts.map +1 -0
- package/dist/compare/distinct.js +12 -0
- package/dist/compare/distinct.js.map +1 -0
- package/dist/compare/extract.d.ts +15 -0
- package/dist/compare/extract.d.ts.map +1 -0
- package/dist/compare/extract.js +60 -0
- package/dist/compare/extract.js.map +1 -0
- package/dist/compare/fact-key.d.ts +17 -0
- package/dist/compare/fact-key.d.ts.map +1 -0
- package/dist/compare/fact-key.js +25 -0
- package/dist/compare/fact-key.js.map +1 -0
- package/dist/compare/fact-text.d.ts +28 -0
- package/dist/compare/fact-text.d.ts.map +1 -0
- package/dist/compare/fact-text.js +61 -0
- package/dist/compare/fact-text.js.map +1 -0
- package/dist/compare/facts-render.d.ts +17 -0
- package/dist/compare/facts-render.d.ts.map +1 -0
- package/dist/compare/facts-render.js +43 -0
- package/dist/compare/facts-render.js.map +1 -0
- package/dist/compare/facts-text.d.ts +15 -0
- package/dist/compare/facts-text.d.ts.map +1 -0
- package/dist/compare/facts-text.js +27 -0
- package/dist/compare/facts-text.js.map +1 -0
- package/dist/compare/markup-atoms.d.ts +11 -0
- package/dist/compare/markup-atoms.d.ts.map +1 -0
- package/dist/compare/markup-atoms.js +23 -0
- package/dist/compare/markup-atoms.js.map +1 -0
- package/dist/compare/match.d.ts +20 -0
- package/dist/compare/match.d.ts.map +1 -0
- package/dist/compare/match.js +84 -0
- package/dist/compare/match.js.map +1 -0
- package/dist/compare/outcome.d.ts +36 -0
- package/dist/compare/outcome.d.ts.map +1 -0
- package/dist/compare/outcome.js +46 -0
- package/dist/compare/outcome.js.map +1 -0
- package/dist/compare/proper-nouns.d.ts +19 -0
- package/dist/compare/proper-nouns.d.ts.map +1 -0
- package/dist/compare/proper-nouns.js +43 -0
- package/dist/compare/proper-nouns.js.map +1 -0
- package/dist/compare/render.d.ts +13 -0
- package/dist/compare/render.d.ts.map +1 -0
- package/dist/compare/render.js +64 -0
- package/dist/compare/render.js.map +1 -0
- package/dist/compare/spans.d.ts +9 -0
- package/dist/compare/spans.d.ts.map +1 -0
- package/dist/compare/spans.js +11 -0
- package/dist/compare/spans.js.map +1 -0
- package/dist/compare/text-atoms.d.ts +27 -0
- package/dist/compare/text-atoms.d.ts.map +1 -0
- package/dist/compare/text-atoms.js +69 -0
- package/dist/compare/text-atoms.js.map +1 -0
- package/dist/compare/text.d.ts +24 -0
- package/dist/compare/text.d.ts.map +1 -0
- package/dist/compare/text.js +90 -0
- package/dist/compare/text.js.map +1 -0
- package/dist/compare/tree-atoms.d.ts +20 -0
- package/dist/compare/tree-atoms.d.ts.map +1 -0
- package/dist/compare/tree-atoms.js +58 -0
- package/dist/compare/tree-atoms.js.map +1 -0
- package/dist/compare/written-names.d.ts +8 -0
- package/dist/compare/written-names.d.ts.map +1 -0
- package/dist/compare/written-names.js +24 -0
- package/dist/compare/written-names.js.map +1 -0
- package/dist/config/load.d.ts +23 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +6 -0
- package/dist/config/load.js.map +1 -1
- package/dist/config/option-problems.d.ts +17 -0
- package/dist/config/option-problems.d.ts.map +1 -0
- package/dist/config/option-problems.js +59 -0
- package/dist/config/option-problems.js.map +1 -0
- package/dist/config/read.d.ts +4 -0
- package/dist/config/read.d.ts.map +1 -0
- package/dist/config/read.js +8 -0
- package/dist/config/read.js.map +1 -0
- package/dist/config/rule-problems.d.ts +2 -4
- package/dist/config/rule-problems.d.ts.map +1 -1
- package/dist/config/rule-problems.js +7 -1
- package/dist/config/rule-problems.js.map +1 -1
- package/dist/config/style.d.ts +21 -0
- package/dist/config/style.d.ts.map +1 -0
- package/dist/config/style.js +48 -0
- package/dist/config/style.js.map +1 -0
- package/dist/config/warnings.d.ts +6 -0
- package/dist/config/warnings.d.ts.map +1 -0
- package/dist/config/warnings.js +10 -0
- package/dist/config/warnings.js.map +1 -0
- package/dist/config/write.d.ts.map +1 -1
- package/dist/config/write.js +17 -4
- package/dist/config/write.js.map +1 -1
- package/dist/custom/bounded-match.d.ts +15 -0
- package/dist/custom/bounded-match.d.ts.map +1 -0
- package/dist/custom/bounded-match.js +43 -0
- package/dist/custom/bounded-match.js.map +1 -0
- package/dist/custom/load.d.ts +11 -0
- package/dist/custom/load.d.ts.map +1 -0
- package/dist/custom/load.js +19 -0
- package/dist/custom/load.js.map +1 -0
- package/dist/custom/module-path.d.ts +11 -0
- package/dist/custom/module-path.d.ts.map +1 -0
- package/dist/custom/module-path.js +15 -0
- package/dist/custom/module-path.js.map +1 -0
- package/dist/custom/parse.d.ts +84 -0
- package/dist/custom/parse.d.ts.map +1 -0
- package/dist/custom/parse.js +258 -0
- package/dist/custom/parse.js.map +1 -0
- package/dist/custom/problems.d.ts +8 -0
- package/dist/custom/problems.d.ts.map +1 -0
- package/dist/custom/problems.js +95 -0
- package/dist/custom/problems.js.map +1 -0
- package/dist/custom/regex-safety.d.ts +11 -0
- package/dist/custom/regex-safety.d.ts.map +1 -0
- package/dist/custom/regex-safety.js +110 -0
- package/dist/custom/regex-safety.js.map +1 -0
- package/dist/custom/token-pattern.d.ts +8 -0
- package/dist/custom/token-pattern.d.ts.map +1 -0
- package/dist/custom/token-pattern.js +75 -0
- package/dist/custom/token-pattern.js.map +1 -0
- package/dist/detect-language.js +1 -1
- package/dist/detect.d.ts.map +1 -1
- package/dist/detect.js +30 -2
- package/dist/detect.js.map +1 -1
- package/dist/detectors/acronym-context.d.ts +2 -0
- package/dist/detectors/acronym-context.d.ts.map +1 -1
- package/dist/detectors/acronym-context.js +12 -4
- package/dist/detectors/acronym-context.js.map +1 -1
- package/dist/detectors/ai-phrasing.d.ts +23 -0
- package/dist/detectors/ai-phrasing.d.ts.map +1 -0
- package/dist/detectors/ai-phrasing.js +116 -0
- package/dist/detectors/ai-phrasing.js.map +1 -0
- package/dist/detectors/announced-count.d.ts +4 -0
- package/dist/detectors/announced-count.d.ts.map +1 -0
- package/dist/detectors/announced-count.js +20 -0
- package/dist/detectors/announced-count.js.map +1 -0
- package/dist/detectors/bold-label.d.ts +10 -0
- package/dist/detectors/bold-label.d.ts.map +1 -0
- package/dist/detectors/bold-label.js +44 -0
- package/dist/detectors/bold-label.js.map +1 -0
- package/dist/detectors/broken-link.d.ts +17 -0
- package/dist/detectors/broken-link.d.ts.map +1 -0
- package/dist/detectors/broken-link.js +66 -0
- package/dist/detectors/broken-link.js.map +1 -0
- package/dist/detectors/cited-name.d.ts.map +1 -1
- package/dist/detectors/cited-name.js +4 -4
- package/dist/detectors/cited-name.js.map +1 -1
- package/dist/detectors/cited-title.d.ts +11 -0
- package/dist/detectors/cited-title.d.ts.map +1 -0
- package/dist/detectors/cited-title.js +75 -0
- package/dist/detectors/cited-title.js.map +1 -0
- package/dist/detectors/concrete-evidence.d.ts +1 -1
- package/dist/detectors/concrete-evidence.d.ts.map +1 -1
- package/dist/detectors/concrete-evidence.js +2 -1
- package/dist/detectors/concrete-evidence.js.map +1 -1
- package/dist/detectors/contrast-frame.d.ts +17 -0
- package/dist/detectors/contrast-frame.d.ts.map +1 -0
- package/dist/detectors/contrast-frame.js +32 -0
- package/dist/detectors/contrast-frame.js.map +1 -0
- package/dist/detectors/custom.d.ts +8 -0
- package/dist/detectors/custom.d.ts.map +1 -0
- package/dist/detectors/custom.js +71 -0
- package/dist/detectors/custom.js.map +1 -0
- package/dist/detectors/dangling-figure.d.ts +7 -0
- package/dist/detectors/dangling-figure.d.ts.map +1 -0
- package/dist/detectors/dangling-figure.js +20 -0
- package/dist/detectors/dangling-figure.js.map +1 -0
- package/dist/detectors/definition-use.d.ts +8 -0
- package/dist/detectors/definition-use.d.ts.map +1 -0
- package/dist/detectors/definition-use.js +32 -0
- package/dist/detectors/definition-use.js.map +1 -0
- package/dist/detectors/doubled-punctuation.d.ts +9 -0
- package/dist/detectors/doubled-punctuation.d.ts.map +1 -0
- package/dist/detectors/doubled-punctuation.js +35 -0
- package/dist/detectors/doubled-punctuation.js.map +1 -0
- package/dist/detectors/doubled-word.d.ts +5 -0
- package/dist/detectors/doubled-word.d.ts.map +1 -1
- package/dist/detectors/doubled-word.js +24 -11
- package/dist/detectors/doubled-word.js.map +1 -1
- package/dist/detectors/duplicate-heading.d.ts +14 -0
- package/dist/detectors/duplicate-heading.d.ts.map +1 -0
- package/dist/detectors/duplicate-heading.js +39 -0
- package/dist/detectors/duplicate-heading.js.map +1 -0
- package/dist/detectors/empty-section.d.ts +8 -0
- package/dist/detectors/empty-section.d.ts.map +1 -0
- package/dist/detectors/empty-section.js +16 -0
- package/dist/detectors/empty-section.js.map +1 -0
- package/dist/detectors/enumerated-runs.d.ts +1 -1
- package/dist/detectors/enumerated-runs.d.ts.map +1 -1
- package/dist/detectors/enumerated-runs.js +15 -4
- package/dist/detectors/enumerated-runs.js.map +1 -1
- package/dist/detectors/fullwidth-alnum.d.ts +24 -0
- package/dist/detectors/fullwidth-alnum.d.ts.map +1 -0
- package/dist/detectors/fullwidth-alnum.js +88 -0
- package/dist/detectors/fullwidth-alnum.js.map +1 -0
- package/dist/detectors/gram-furniture.d.ts +6 -0
- package/dist/detectors/gram-furniture.d.ts.map +1 -0
- package/dist/detectors/gram-furniture.js +21 -0
- package/dist/detectors/gram-furniture.js.map +1 -0
- package/dist/detectors/gram-place.d.ts +2 -0
- package/dist/detectors/gram-place.d.ts.map +1 -1
- package/dist/detectors/gram-place.js +9 -7
- package/dist/detectors/gram-place.js.map +1 -1
- package/dist/detectors/gram-windows.d.ts +9 -0
- package/dist/detectors/gram-windows.d.ts.map +1 -0
- package/dist/detectors/gram-windows.js +27 -0
- package/dist/detectors/gram-windows.js.map +1 -0
- package/dist/detectors/hankaku-kana.d.ts +9 -0
- package/dist/detectors/hankaku-kana.d.ts.map +1 -0
- package/dist/detectors/hankaku-kana.js +27 -0
- package/dist/detectors/hankaku-kana.js.map +1 -0
- package/dist/detectors/heading-case.d.ts +2 -0
- package/dist/detectors/heading-case.d.ts.map +1 -1
- package/dist/detectors/heading-case.js +29 -2
- package/dist/detectors/heading-case.js.map +1 -1
- package/dist/detectors/heading-code-words.d.ts +6 -0
- package/dist/detectors/heading-code-words.d.ts.map +1 -0
- package/dist/detectors/heading-code-words.js +29 -0
- package/dist/detectors/heading-code-words.js.map +1 -0
- package/dist/detectors/heading-echo.d.ts.map +1 -1
- package/dist/detectors/heading-echo.js +7 -4
- package/dist/detectors/heading-echo.js.map +1 -1
- package/dist/detectors/heading-level-skip.d.ts +12 -0
- package/dist/detectors/heading-level-skip.d.ts.map +1 -0
- package/dist/detectors/heading-level-skip.js +11 -0
- package/dist/detectors/heading-level-skip.js.map +1 -0
- package/dist/detectors/image-alt-text.d.ts +3 -0
- package/dist/detectors/image-alt-text.d.ts.map +1 -0
- package/dist/detectors/image-alt-text.js +9 -0
- package/dist/detectors/image-alt-text.js.map +1 -0
- package/dist/detectors/index.d.ts.map +1 -1
- package/dist/detectors/index.js +70 -1
- package/dist/detectors/index.js.map +1 -1
- package/dist/detectors/invisible-character.d.ts +20 -0
- package/dist/detectors/invisible-character.d.ts.map +1 -0
- package/dist/detectors/invisible-character.js +143 -0
- package/dist/detectors/invisible-character.js.map +1 -0
- package/dist/detectors/kutoten-consistency.d.ts +24 -0
- package/dist/detectors/kutoten-consistency.d.ts.map +1 -0
- package/dist/detectors/kutoten-consistency.js +77 -0
- package/dist/detectors/kutoten-consistency.js.map +1 -0
- package/dist/detectors/lead-in.d.ts +1 -0
- package/dist/detectors/lead-in.d.ts.map +1 -1
- package/dist/detectors/lead-in.js +2 -1
- package/dist/detectors/lead-in.js.map +1 -1
- package/dist/detectors/lexicon-match.d.ts +14 -1
- package/dist/detectors/lexicon-match.d.ts.map +1 -1
- package/dist/detectors/lexicon-match.js +32 -2
- package/dist/detectors/lexicon-match.js.map +1 -1
- package/dist/detectors/lexicon.d.ts +6 -1
- package/dist/detectors/lexicon.d.ts.map +1 -1
- package/dist/detectors/lexicon.js +31 -13
- package/dist/detectors/lexicon.js.map +1 -1
- package/dist/detectors/list-item.d.ts +45 -0
- package/dist/detectors/list-item.d.ts.map +1 -0
- package/dist/detectors/list-item.js +88 -0
- package/dist/detectors/list-item.js.map +1 -0
- package/dist/detectors/list-items.d.ts +31 -0
- package/dist/detectors/list-items.d.ts.map +1 -0
- package/dist/detectors/list-items.js +113 -0
- package/dist/detectors/list-items.js.map +1 -0
- package/dist/detectors/list-lead-in.d.ts +7 -0
- package/dist/detectors/list-lead-in.d.ts.map +1 -0
- package/dist/detectors/list-lead-in.js +28 -0
- package/dist/detectors/list-lead-in.js.map +1 -0
- package/dist/detectors/list-sentence.d.ts +67 -0
- package/dist/detectors/list-sentence.d.ts.map +1 -0
- package/dist/detectors/list-sentence.js +130 -0
- package/dist/detectors/list-sentence.js.map +1 -0
- package/dist/detectors/list-view.d.ts +34 -0
- package/dist/detectors/list-view.d.ts.map +1 -0
- package/dist/detectors/list-view.js +137 -0
- package/dist/detectors/list-view.js.map +1 -0
- package/dist/detectors/long-vowel.d.ts +7 -0
- package/dist/detectors/long-vowel.d.ts.map +1 -0
- package/dist/detectors/long-vowel.js +71 -0
- package/dist/detectors/long-vowel.js.map +1 -0
- package/dist/detectors/markup-finding.d.ts +8 -0
- package/dist/detectors/markup-finding.d.ts.map +1 -0
- package/dist/detectors/markup-finding.js +29 -0
- package/dist/detectors/markup-finding.js.map +1 -0
- package/dist/detectors/modal-conflict.d.ts +4 -0
- package/dist/detectors/modal-conflict.d.ts.map +1 -0
- package/dist/detectors/modal-conflict.js +22 -0
- package/dist/detectors/modal-conflict.js.map +1 -0
- package/dist/detectors/name-numeral.d.ts +1 -1
- package/dist/detectors/name-numeral.d.ts.map +1 -1
- package/dist/detectors/name-numeral.js +2 -7
- package/dist/detectors/name-numeral.js.map +1 -1
- package/dist/detectors/name-variant.d.ts +4 -0
- package/dist/detectors/name-variant.d.ts.map +1 -0
- package/dist/detectors/name-variant.js +13 -0
- package/dist/detectors/name-variant.js.map +1 -0
- package/dist/detectors/nominalization.d.ts +11 -0
- package/dist/detectors/nominalization.d.ts.map +1 -0
- package/dist/detectors/nominalization.js +56 -0
- package/dist/detectors/nominalization.js.map +1 -0
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +72 -37
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/outside-announced-list.d.ts +4 -0
- package/dist/detectors/outside-announced-list.d.ts.map +1 -0
- package/dist/detectors/outside-announced-list.js +24 -0
- package/dist/detectors/outside-announced-list.js.map +1 -0
- package/dist/detectors/oxford-comma.d.ts +7 -1
- package/dist/detectors/oxford-comma.d.ts.map +1 -1
- package/dist/detectors/oxford-comma.js +136 -229
- package/dist/detectors/oxford-comma.js.map +1 -1
- package/dist/detectors/phrase-match.d.ts +4 -1
- package/dist/detectors/phrase-match.d.ts.map +1 -1
- package/dist/detectors/phrase-match.js +26 -7
- package/dist/detectors/phrase-match.js.map +1 -1
- package/dist/detectors/place-run.d.ts.map +1 -1
- package/dist/detectors/place-run.js +10 -6
- package/dist/detectors/place-run.js.map +1 -1
- package/dist/detectors/placeholder-text.d.ts +9 -0
- package/dist/detectors/placeholder-text.d.ts.map +1 -0
- package/dist/detectors/placeholder-text.js +18 -0
- package/dist/detectors/placeholder-text.js.map +1 -0
- package/dist/detectors/quote-around.d.ts +3 -0
- package/dist/detectors/quote-around.d.ts.map +1 -0
- package/dist/detectors/quote-around.js +8 -0
- package/dist/detectors/quote-around.js.map +1 -0
- package/dist/detectors/ra-nuki.d.ts +9 -0
- package/dist/detectors/ra-nuki.d.ts.map +1 -0
- package/dist/detectors/ra-nuki.js +30 -0
- package/dist/detectors/ra-nuki.js.map +1 -0
- package/dist/detectors/register.d.ts +11 -3
- package/dist/detectors/register.d.ts.map +1 -1
- package/dist/detectors/register.js +28 -9
- package/dist/detectors/register.js.map +1 -1
- package/dist/detectors/requirement-modal.d.ts +5 -0
- package/dist/detectors/requirement-modal.d.ts.map +1 -0
- package/dist/detectors/requirement-modal.js +54 -0
- package/dist/detectors/requirement-modal.js.map +1 -0
- package/dist/detectors/requirement-smell.d.ts +4 -0
- package/dist/detectors/requirement-smell.d.ts.map +1 -0
- package/dist/detectors/requirement-smell.js +41 -0
- package/dist/detectors/requirement-smell.js.map +1 -0
- package/dist/detectors/roman-numeral.d.ts +2 -0
- package/dist/detectors/roman-numeral.d.ts.map +1 -1
- package/dist/detectors/roman-numeral.js +2 -0
- package/dist/detectors/roman-numeral.js.map +1 -1
- package/dist/detectors/sentence-ending.d.ts +17 -1
- package/dist/detectors/sentence-ending.d.ts.map +1 -1
- package/dist/detectors/sentence-ending.js +13 -7
- package/dist/detectors/sentence-ending.js.map +1 -1
- package/dist/detectors/sentence-length.d.ts.map +1 -1
- package/dist/detectors/sentence-length.js +13 -4
- package/dist/detectors/sentence-length.js.map +1 -1
- package/dist/detectors/signals.d.ts +8 -0
- package/dist/detectors/signals.d.ts.map +1 -1
- package/dist/detectors/signals.js +67 -46
- package/dist/detectors/signals.js.map +1 -1
- package/dist/detectors/space-before-punctuation.d.ts +8 -0
- package/dist/detectors/space-before-punctuation.d.ts.map +1 -0
- package/dist/detectors/space-before-punctuation.js +24 -0
- package/dist/detectors/space-before-punctuation.js.map +1 -0
- package/dist/detectors/spelling-variety.d.ts +23 -0
- package/dist/detectors/spelling-variety.d.ts.map +1 -0
- package/dist/detectors/spelling-variety.js +59 -0
- package/dist/detectors/spelling-variety.js.map +1 -0
- package/dist/detectors/structure-tree.d.ts +6 -0
- package/dist/detectors/structure-tree.d.ts.map +1 -1
- package/dist/detectors/structure-tree.js +39 -1
- package/dist/detectors/structure-tree.js.map +1 -1
- package/dist/detectors/structure.d.ts +1 -3
- package/dist/detectors/structure.d.ts.map +1 -1
- package/dist/detectors/structure.js +19 -6
- package/dist/detectors/structure.js.map +1 -1
- package/dist/detectors/superlative-comparison.d.ts +20 -0
- package/dist/detectors/superlative-comparison.d.ts.map +1 -0
- package/dist/detectors/superlative-comparison.js +32 -0
- package/dist/detectors/superlative-comparison.js.map +1 -0
- package/dist/detectors/superlative-name.d.ts.map +1 -1
- package/dist/detectors/superlative-name.js +8 -5
- package/dist/detectors/superlative-name.js.map +1 -1
- package/dist/detectors/superlative-scope.d.ts.map +1 -1
- package/dist/detectors/superlative-scope.js +9 -4
- package/dist/detectors/superlative-scope.js.map +1 -1
- package/dist/detectors/token-column.d.ts +46 -0
- package/dist/detectors/token-column.d.ts.map +1 -0
- package/dist/detectors/token-column.js +95 -0
- package/dist/detectors/token-column.js.map +1 -0
- package/dist/detectors/unbalanced-bracket.d.ts +22 -0
- package/dist/detectors/unbalanced-bracket.d.ts.map +1 -0
- package/dist/detectors/unbalanced-bracket.js +119 -0
- package/dist/detectors/unbalanced-bracket.js.map +1 -0
- package/dist/detectors/url-run-on.d.ts +9 -0
- package/dist/detectors/url-run-on.d.ts.map +1 -0
- package/dist/detectors/url-run-on.js +24 -0
- package/dist/detectors/url-run-on.js.map +1 -0
- package/dist/detectors/vague-figure-pointer.d.ts +10 -0
- package/dist/detectors/vague-figure-pointer.d.ts.map +1 -0
- package/dist/detectors/vague-figure-pointer.js +46 -0
- package/dist/detectors/vague-figure-pointer.js.map +1 -0
- package/dist/detectors/word-list.d.ts +2 -0
- package/dist/detectors/word-list.d.ts.map +1 -1
- package/dist/detectors/word-list.js +4 -1
- package/dist/detectors/word-list.js.map +1 -1
- package/dist/document-sections.d.ts +13 -0
- package/dist/document-sections.d.ts.map +1 -0
- package/dist/document-sections.js +32 -0
- package/dist/document-sections.js.map +1 -0
- package/dist/document.d.ts +20 -7
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +140 -125
- package/dist/document.js.map +1 -1
- package/dist/email-parts.d.ts +28 -0
- package/dist/email-parts.d.ts.map +1 -0
- package/dist/email-parts.js +230 -0
- package/dist/email-parts.js.map +1 -0
- package/dist/eval.d.ts +2 -1
- package/dist/eval.d.ts.map +1 -1
- package/dist/eval.js +16 -4
- package/dist/eval.js.map +1 -1
- package/dist/extension/document-view.d.ts +7 -0
- package/dist/extension/document-view.d.ts.map +1 -0
- package/dist/extension/document-view.js +91 -0
- package/dist/extension/document-view.js.map +1 -0
- package/dist/extension/failure-text.d.ts +5 -0
- package/dist/extension/failure-text.d.ts.map +1 -0
- package/dist/extension/failure-text.js +33 -0
- package/dist/extension/failure-text.js.map +1 -0
- package/dist/extension/import-default.d.ts +7 -0
- package/dist/extension/import-default.d.ts.map +1 -0
- package/dist/extension/import-default.js +21 -0
- package/dist/extension/import-default.js.map +1 -0
- package/dist/extension/load.d.ts +28 -0
- package/dist/extension/load.d.ts.map +1 -0
- package/dist/extension/load.js +51 -0
- package/dist/extension/load.js.map +1 -0
- package/dist/extension/module-detector.d.ts +21 -0
- package/dist/extension/module-detector.d.ts.map +1 -0
- package/dist/extension/module-detector.js +49 -0
- package/dist/extension/module-detector.js.map +1 -0
- package/dist/extension/plugin-load.d.ts +9 -0
- package/dist/extension/plugin-load.d.ts.map +1 -0
- package/dist/extension/plugin-load.js +68 -0
- package/dist/extension/plugin-load.js.map +1 -0
- package/dist/extension/plugin-name.d.ts +8 -0
- package/dist/extension/plugin-name.d.ts.map +1 -0
- package/dist/extension/plugin-name.js +22 -0
- package/dist/extension/plugin-name.js.map +1 -0
- package/dist/extension/plugin-parse.d.ts +41 -0
- package/dist/extension/plugin-parse.d.ts.map +1 -0
- package/dist/extension/plugin-parse.js +156 -0
- package/dist/extension/plugin-parse.js.map +1 -0
- package/dist/extension/problem-text.d.ts +5 -0
- package/dist/extension/problem-text.d.ts.map +1 -0
- package/dist/extension/problem-text.js +74 -0
- package/dist/extension/problem-text.js.map +1 -0
- package/dist/extension/real-path.d.ts +3 -0
- package/dist/extension/real-path.d.ts.map +1 -0
- package/dist/extension/real-path.js +8 -0
- package/dist/extension/real-path.js.map +1 -0
- package/dist/extension/returned-findings.d.ts +17 -0
- package/dist/extension/returned-findings.d.ts.map +1 -0
- package/dist/extension/returned-findings.js +48 -0
- package/dist/extension/returned-findings.js.map +1 -0
- package/dist/extension/rule-export.d.ts +13 -0
- package/dist/extension/rule-export.d.ts.map +1 -0
- package/dist/extension/rule-export.js +16 -0
- package/dist/extension/rule-export.js.map +1 -0
- package/dist/feedback/draft.d.ts +2 -0
- package/dist/feedback/draft.d.ts.map +1 -1
- package/dist/feedback/draft.js +3 -0
- package/dist/feedback/draft.js.map +1 -1
- package/dist/figure-references.d.ts +39 -0
- package/dist/figure-references.d.ts.map +1 -0
- package/dist/figure-references.js +113 -0
- package/dist/figure-references.js.map +1 -0
- package/dist/files.d.ts +2 -0
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +4 -0
- package/dist/files.js.map +1 -1
- package/dist/finding-order.d.ts +9 -0
- package/dist/finding-order.d.ts.map +1 -0
- package/dist/finding-order.js +3 -0
- package/dist/finding-order.js.map +1 -0
- package/dist/fix-plan/mode.d.ts +21 -0
- package/dist/fix-plan/mode.d.ts.map +1 -0
- package/dist/fix-plan/mode.js +16 -0
- package/dist/fix-plan/mode.js.map +1 -0
- package/dist/fix-plan/plan.d.ts +77 -0
- package/dist/fix-plan/plan.d.ts.map +1 -0
- package/dist/fix-plan/plan.js +100 -0
- package/dist/fix-plan/plan.js.map +1 -0
- package/dist/fix-plan/render.d.ts +6 -0
- package/dist/fix-plan/render.d.ts.map +1 -0
- package/dist/fix-plan/render.js +101 -0
- package/dist/fix-plan/render.js.map +1 -0
- package/dist/fix-plan/text.d.ts +35 -0
- package/dist/fix-plan/text.d.ts.map +1 -0
- package/dist/fix-plan/text.js +95 -0
- package/dist/fix-plan/text.js.map +1 -0
- package/dist/heading-label.d.ts +22 -0
- package/dist/heading-label.d.ts.map +1 -0
- package/dist/heading-label.js +50 -0
- package/dist/heading-label.js.map +1 -0
- package/dist/in-page-nav.d.ts +4 -1
- package/dist/in-page-nav.d.ts.map +1 -1
- package/dist/in-page-nav.js +53 -18
- package/dist/in-page-nav.js.map +1 -1
- package/dist/joined-view.d.ts.map +1 -1
- package/dist/joined-view.js +1 -0
- package/dist/joined-view.js.map +1 -1
- package/dist/language-sample.d.ts +2 -0
- package/dist/language-sample.d.ts.map +1 -0
- package/dist/language-sample.js +41 -0
- package/dist/language-sample.js.map +1 -0
- package/dist/levels.d.ts +5 -1
- package/dist/levels.d.ts.map +1 -1
- package/dist/levels.js +9 -0
- package/dist/levels.js.map +1 -1
- package/dist/line-paragraphs.d.ts +8 -0
- package/dist/line-paragraphs.d.ts.map +1 -1
- package/dist/line-paragraphs.js +33 -10
- package/dist/line-paragraphs.js.map +1 -1
- package/dist/link-line.d.ts +8 -0
- package/dist/link-line.d.ts.map +1 -0
- package/dist/link-line.js +12 -0
- package/dist/link-line.js.map +1 -0
- package/dist/long-vowel.d.ts +38 -0
- package/dist/long-vowel.d.ts.map +1 -0
- package/dist/long-vowel.js +78 -0
- package/dist/long-vowel.js.map +1 -0
- package/dist/markdown-node.d.ts +19 -0
- package/dist/markdown-node.d.ts.map +1 -0
- package/dist/markdown-node.js +6 -0
- package/dist/markdown-node.js.map +1 -0
- package/dist/markdown-read.d.ts +17 -0
- package/dist/markdown-read.d.ts.map +1 -0
- package/dist/markdown-read.js +37 -0
- package/dist/markdown-read.js.map +1 -0
- package/dist/markup.d.ts +22 -0
- package/dist/markup.d.ts.map +1 -0
- package/dist/markup.js +182 -0
- package/dist/markup.js.map +1 -0
- package/dist/mask.js +8 -5
- package/dist/mask.js.map +1 -1
- package/dist/name-variants.d.ts +25 -0
- package/dist/name-variants.d.ts.map +1 -0
- package/dist/name-variants.js +181 -0
- package/dist/name-variants.js.map +1 -0
- package/dist/node-version.d.ts +7 -0
- package/dist/node-version.d.ts.map +1 -0
- package/dist/node-version.js +19 -0
- package/dist/node-version.js.map +1 -0
- package/dist/not-run.d.ts +14 -0
- package/dist/not-run.d.ts.map +1 -0
- package/dist/not-run.js +12 -0
- package/dist/not-run.js.map +1 -0
- package/dist/number-name.d.ts +21 -5
- package/dist/number-name.d.ts.map +1 -1
- package/dist/number-name.js +119 -17
- package/dist/number-name.js.map +1 -1
- package/dist/orthography.d.ts +10 -1
- package/dist/orthography.d.ts.map +1 -1
- package/dist/orthography.js +42 -16
- package/dist/orthography.js.map +1 -1
- package/dist/outline/render.d.ts +18 -0
- package/dist/outline/render.d.ts.map +1 -0
- package/dist/outline/render.js +60 -0
- package/dist/outline/render.js.map +1 -0
- package/dist/outline/shape.d.ts +26 -0
- package/dist/outline/shape.d.ts.map +1 -0
- package/dist/outline/shape.js +37 -0
- package/dist/outline/shape.js.map +1 -0
- package/dist/outline/text.d.ts +21 -0
- package/dist/outline/text.d.ts.map +1 -0
- package/dist/outline/text.js +30 -0
- package/dist/outline/text.js.map +1 -0
- package/dist/page-furniture.d.ts +5 -2
- package/dist/page-furniture.d.ts.map +1 -1
- package/dist/page-furniture.js +8 -2
- package/dist/page-furniture.js.map +1 -1
- package/dist/plain-source.d.ts +1 -0
- package/dist/plain-source.d.ts.map +1 -1
- package/dist/plain-source.js +2 -1
- package/dist/plain-source.js.map +1 -1
- package/dist/plugin.d.ts +138 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/profile/for-file.d.ts.map +1 -1
- package/dist/profile/for-file.js +3 -1
- package/dist/profile/for-file.js.map +1 -1
- package/dist/quoted-span.d.ts.map +1 -1
- package/dist/quoted-span.js +8 -3
- package/dist/quoted-span.js.map +1 -1
- package/dist/reasons.d.ts +4 -0
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +8 -0
- package/dist/reasons.js.map +1 -1
- package/dist/reference-lists.d.ts +3 -0
- package/dist/reference-lists.d.ts.map +1 -0
- package/dist/reference-lists.js +75 -0
- package/dist/reference-lists.js.map +1 -0
- package/dist/render/compact.d.ts +3 -1
- package/dist/render/compact.d.ts.map +1 -1
- package/dist/render/compact.js +8 -2
- package/dist/render/compact.js.map +1 -1
- package/dist/render/explain.d.ts +9 -1
- package/dist/render/explain.d.ts.map +1 -1
- package/dist/render/explain.js +54 -13
- package/dist/render/explain.js.map +1 -1
- package/dist/render/friendly.d.ts.map +1 -1
- package/dist/render/friendly.js +19 -9
- package/dist/render/friendly.js.map +1 -1
- package/dist/render/options.d.ts +7 -0
- package/dist/render/options.d.ts.map +1 -0
- package/dist/render/options.js +50 -0
- package/dist/render/options.js.map +1 -0
- package/dist/render/rules-json.d.ts +4 -1
- package/dist/render/rules-json.d.ts.map +1 -1
- package/dist/render/rules-json.js +110 -16
- package/dist/render/rules-json.js.map +1 -1
- package/dist/render/rules-table.d.ts +4 -0
- package/dist/render/rules-table.d.ts.map +1 -0
- package/dist/render/rules-table.js +70 -0
- package/dist/render/rules-table.js.map +1 -0
- package/dist/render/sarif.js +4 -4
- package/dist/render/sarif.js.map +1 -1
- package/dist/render/semantic.js +3 -3
- package/dist/render/semantic.js.map +1 -1
- package/dist/render/severity-name.d.ts +6 -0
- package/dist/render/severity-name.d.ts.map +1 -0
- package/dist/render/severity-name.js +7 -0
- package/dist/render/severity-name.js.map +1 -0
- package/dist/render/suppressions.d.ts +3 -0
- package/dist/render/suppressions.d.ts.map +1 -1
- package/dist/render/suppressions.js +20 -1
- package/dist/render/suppressions.js.map +1 -1
- package/dist/render/text.d.ts +7 -2
- package/dist/render/text.d.ts.map +1 -1
- package/dist/render/text.js +15 -4
- package/dist/render/text.js.map +1 -1
- package/dist/resolve-genre.d.ts +1 -1
- package/dist/resolve-genre.d.ts.map +1 -1
- package/dist/resolve-genre.js +4 -1
- package/dist/resolve-genre.js.map +1 -1
- package/dist/rule-genres.d.ts +24 -0
- package/dist/rule-genres.d.ts.map +1 -0
- package/dist/rule-genres.js +11 -0
- package/dist/rule-genres.js.map +1 -0
- package/dist/rule-guide.d.ts +73 -0
- package/dist/rule-guide.d.ts.map +1 -0
- package/dist/rule-guide.js +95 -0
- package/dist/rule-guide.js.map +1 -0
- package/dist/rule-load.d.ts.map +1 -1
- package/dist/rule-load.js +87 -33
- package/dist/rule-load.js.map +1 -1
- package/dist/rule-options.d.ts +50 -0
- package/dist/rule-options.d.ts.map +1 -0
- package/dist/rule-options.js +106 -0
- package/dist/rule-options.js.map +1 -0
- package/dist/run-semantic.d.ts.map +1 -1
- package/dist/run-semantic.js +2 -1
- package/dist/run-semantic.js.map +1 -1
- package/dist/run.d.ts +18 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +80 -19
- package/dist/run.js.map +1 -1
- package/dist/sentence-shape.d.ts.map +1 -1
- package/dist/sentence-shape.js +4 -4
- package/dist/sentence-shape.js.map +1 -1
- package/dist/setting-problems.d.ts +2 -1
- package/dist/setting-problems.d.ts.map +1 -1
- package/dist/setting-problems.js +8 -1
- package/dist/setting-problems.js.map +1 -1
- package/dist/spacing-minority.d.ts +16 -0
- package/dist/spacing-minority.d.ts.map +1 -0
- package/dist/spacing-minority.js +23 -0
- package/dist/spacing-minority.js.map +1 -0
- package/dist/span-cut.d.ts +6 -0
- package/dist/span-cut.d.ts.map +1 -0
- package/dist/span-cut.js +22 -0
- package/dist/span-cut.js.map +1 -0
- package/dist/stet-block.d.ts +5 -0
- package/dist/stet-block.d.ts.map +1 -0
- package/dist/stet-block.js +59 -0
- package/dist/stet-block.js.map +1 -0
- package/dist/stet.d.ts +4 -0
- package/dist/stet.d.ts.map +1 -1
- package/dist/stet.js +31 -11
- package/dist/stet.js.map +1 -1
- package/dist/structure/aside-depth.d.ts +21 -0
- package/dist/structure/aside-depth.d.ts.map +1 -0
- package/dist/structure/aside-depth.js +65 -0
- package/dist/structure/aside-depth.js.map +1 -0
- package/dist/structure/build.d.ts +5 -1
- package/dist/structure/build.d.ts.map +1 -1
- package/dist/structure/build.js +29 -17
- package/dist/structure/build.js.map +1 -1
- package/dist/structure/closed-pairs.d.ts +8 -0
- package/dist/structure/closed-pairs.d.ts.map +1 -0
- package/dist/structure/closed-pairs.js +22 -0
- package/dist/structure/closed-pairs.js.map +1 -0
- package/dist/structure/date-range.d.ts +31 -0
- package/dist/structure/date-range.d.ts.map +1 -0
- package/dist/structure/date-range.js +77 -0
- package/dist/structure/date-range.js.map +1 -0
- package/dist/structure/definition-use.d.ts +32 -0
- package/dist/structure/definition-use.d.ts.map +1 -0
- package/dist/structure/definition-use.js +102 -0
- package/dist/structure/definition-use.js.map +1 -0
- package/dist/structure/known-mentions.d.ts +18 -0
- package/dist/structure/known-mentions.d.ts.map +1 -0
- package/dist/structure/known-mentions.js +78 -0
- package/dist/structure/known-mentions.js.map +1 -0
- package/dist/structure/lazy-tree.d.ts +8 -0
- package/dist/structure/lazy-tree.d.ts.map +1 -0
- package/dist/structure/lazy-tree.js +14 -0
- package/dist/structure/lazy-tree.js.map +1 -0
- package/dist/structure/modal-conflict.d.ts +28 -0
- package/dist/structure/modal-conflict.d.ts.map +1 -0
- package/dist/structure/modal-conflict.js +74 -0
- package/dist/structure/modal-conflict.js.map +1 -0
- package/dist/structure/numbered-clauses.d.ts +4 -0
- package/dist/structure/numbered-clauses.d.ts.map +1 -0
- package/dist/structure/numbered-clauses.js +9 -0
- package/dist/structure/numbered-clauses.js.map +1 -0
- package/dist/structure/numbering.d.ts +1 -0
- package/dist/structure/numbering.d.ts.map +1 -1
- package/dist/structure/numbering.js +11 -6
- package/dist/structure/numbering.js.map +1 -1
- package/dist/structure/of.d.ts +3 -1
- package/dist/structure/of.d.ts.map +1 -1
- package/dist/structure/of.js +5 -1
- package/dist/structure/of.js.map +1 -1
- package/dist/structure/percent-sum.d.ts +16 -0
- package/dist/structure/percent-sum.d.ts.map +1 -0
- package/dist/structure/percent-sum.js +104 -0
- package/dist/structure/percent-sum.js.map +1 -0
- package/dist/structure/quoted-number.d.ts +8 -0
- package/dist/structure/quoted-number.d.ts.map +1 -0
- package/dist/structure/quoted-number.js +34 -0
- package/dist/structure/quoted-number.js.map +1 -0
- package/dist/structure/relative-find.d.ts.map +1 -1
- package/dist/structure/relative-find.js +34 -46
- package/dist/structure/relative-find.js.map +1 -1
- package/dist/structure/relative-resolve.d.ts.map +1 -1
- package/dist/structure/relative-resolve.js +76 -30
- package/dist/structure/relative-resolve.js.map +1 -1
- package/dist/structure/runs.d.ts +2 -0
- package/dist/structure/runs.d.ts.map +1 -1
- package/dist/structure/runs.js +2 -2
- package/dist/structure/runs.js.map +1 -1
- package/dist/structure/sexp.d.ts +1 -1
- package/dist/structure/sexp.d.ts.map +1 -1
- package/dist/structure/sexp.js +18 -6
- package/dist/structure/sexp.js.map +1 -1
- package/dist/structure/total.d.ts +3 -0
- package/dist/structure/total.d.ts.map +1 -1
- package/dist/structure/total.js +2 -2
- package/dist/structure/total.js.map +1 -1
- package/dist/structure/universal.d.ts +14 -2
- package/dist/structure/universal.d.ts.map +1 -1
- package/dist/structure/universal.js +24 -3
- package/dist/structure/universal.js.map +1 -1
- package/dist/structure/wrapped-tail.d.ts +14 -7
- package/dist/structure/wrapped-tail.d.ts.map +1 -1
- package/dist/structure/wrapped-tail.js +33 -8
- package/dist/structure/wrapped-tail.js.map +1 -1
- package/dist/style-load.d.ts +4 -0
- package/dist/style-load.d.ts.map +1 -0
- package/dist/style-load.js +28 -0
- package/dist/style-load.js.map +1 -0
- package/dist/style-parse.d.ts +25 -0
- package/dist/style-parse.d.ts.map +1 -0
- package/dist/style-parse.js +88 -0
- package/dist/style-parse.js.map +1 -0
- package/dist/subheading-line.d.ts +23 -0
- package/dist/subheading-line.d.ts.map +1 -0
- package/dist/subheading-line.js +85 -0
- package/dist/subheading-line.js.map +1 -0
- package/dist/tag-coverage.d.ts +8 -0
- package/dist/tag-coverage.d.ts.map +1 -0
- package/dist/tag-coverage.js +7 -0
- package/dist/tag-coverage.js.map +1 -0
- package/dist/template-syntax.d.ts +17 -0
- package/dist/template-syntax.d.ts.map +1 -0
- package/dist/template-syntax.js +140 -0
- package/dist/template-syntax.js.map +1 -0
- package/dist/text-above.d.ts +19 -0
- package/dist/text-above.d.ts.map +1 -0
- package/dist/text-above.js +43 -0
- package/dist/text-above.js.map +1 -0
- package/dist/text-figures.d.ts +10 -0
- package/dist/text-figures.d.ts.map +1 -0
- package/dist/text-figures.js +131 -0
- package/dist/text-figures.js.map +1 -0
- package/dist/trailing-aside.d.ts +2 -0
- package/dist/trailing-aside.d.ts.map +1 -0
- package/dist/trailing-aside.js +53 -0
- package/dist/trailing-aside.js.map +1 -0
- package/dist/tree-walk.d.ts +18 -0
- package/dist/tree-walk.d.ts.map +1 -0
- package/dist/tree-walk.js +45 -0
- package/dist/tree-walk.js.map +1 -0
- package/genres.yaml +68 -0
- package/package.json +9 -3
- package/reference-headings.yaml +17 -0
- package/rules/acronym-expansion-conflict.yaml +82 -0
- package/rules/adverb-overuse.yaml +19 -0
- package/rules/agentless-passive.yaml +47 -0
- package/rules/agreement-slip.yaml +14 -1
- package/rules/ai-generated-composite.yaml +102 -0
- package/rules/ai-tell.yaml +57 -0
- package/rules/announced-count-mismatch.yaml +57 -0
- package/rules/announcing-opener.yaml +82 -0
- package/rules/assistant-residue.yaml +82 -0
- package/rules/bold-density.yaml +59 -0
- package/rules/bold-label-list.yaml +81 -0
- package/rules/broken-link.yaml +65 -0
- package/rules/closing-cliche.yaml +58 -0
- package/rules/colon-lead-in.yaml +83 -0
- package/rules/concrete-evidence-density.yaml +41 -0
- package/rules/contraction-consistency.yaml +18 -0
- package/rules/contrast-framing.yaml +88 -0
- package/rules/cushion-phrase-density.yaml +53 -1
- package/rules/dangling-figure-reference.yaml +61 -0
- package/rules/dangling-reference.yaml +54 -1
- package/rules/date-order.yaml +34 -1
- package/rules/date-range-reversed.yaml +46 -0
- package/rules/date-weekday-mismatch.yaml +17 -1
- package/rules/double-keigo.yaml +16 -0
- package/rules/double-negative.yaml +51 -0
- package/rules/doubled-punctuation.yaml +45 -0
- package/rules/doubled-word.yaml +18 -2
- package/rules/duplicate-definition.yaml +59 -1
- package/rules/duplicate-heading.yaml +78 -0
- package/rules/emoji-density.yaml +28 -2
- package/rules/empty-conclusion.yaml +28 -0
- package/rules/empty-intensifier.yaml +44 -0
- package/rules/empty-section.yaml +74 -0
- package/rules/excessive-hedging.yaml +49 -2
- package/rules/expletive-construction.yaml +19 -0
- package/rules/fullwidth-alnum-consistency.yaml +53 -0
- package/rules/hankaku-kana.yaml +41 -0
- package/rules/heading-echo.yaml +31 -0
- package/rules/heading-level-skip.yaml +78 -0
- package/rules/hiragana-fukushi.yaml +16 -0
- package/rules/image-alt-text.yaml +54 -0
- package/rules/internal-jargon.yaml +21 -0
- package/rules/invisible-character.yaml +63 -0
- package/rules/katakana-long-vowel.yaml +99 -0
- package/rules/kutoten-consistency.yaml +53 -0
- package/rules/latin-spacing.yaml +30 -4
- package/rules/max-kanji-continuous.yaml +17 -0
- package/rules/max-paragraph-length.yaml +34 -0
- package/rules/max-sentence-length.yaml +58 -0
- package/rules/modal-conflict.yaml +106 -0
- package/rules/name-variant.yaml +88 -0
- package/rules/ngram-repetition.yaml +29 -2
- package/rules/no-doubled-joshi.yaml +17 -0
- package/rules/no-em-dash.yaml +49 -0
- package/rules/no-mixed-desumasu.yaml +28 -2
- package/rules/no-nakaguro-parallel.yaml +20 -0
- package/rules/nominalization.yaml +89 -0
- package/rules/numbering-gap.yaml +53 -1
- package/rules/outside-announced-list.yaml +80 -0
- package/rules/oxford-comma-consistency.yaml +18 -0
- package/rules/padded-intro.yaml +44 -0
- package/rules/paragraph-length-variance.yaml +73 -0
- package/rules/percent-sum-mismatch.yaml +58 -0
- package/rules/preamble-length.yaml +56 -0
- package/rules/preferred-term.yaml +28 -0
- package/rules/proper-noun-density.yaml +37 -2
- package/rules/ra-nuki.yaml +43 -0
- package/rules/repeated-conjunction.yaml +47 -0
- package/rules/repeated-sentence-head.yaml +23 -0
- package/rules/required-sections.yaml +49 -0
- package/rules/requirement-modal.yaml +94 -0
- package/rules/requirement-smell.yaml +70 -0
- package/rules/risk-disclosure.yaml +22 -0
- package/rules/rule-of-three.yaml +143 -0
- package/rules/sasete-itadaku.yaml +18 -0
- package/rules/section-length-uniformity.yaml +113 -0
- package/rules/sentence-initial-conjunction-run.yaml +18 -0
- package/rules/sentence-rhythm.yaml +51 -0
- package/rules/space-before-punctuation.yaml +41 -0
- package/rules/spelling-consistency.yaml +47 -0
- package/rules/stock-transition.yaml +86 -0
- package/rules/stray-space.yaml +18 -0
- package/rules/taigen-dome-in-prose.yaml +33 -0
- package/rules/title-case-consistency.yaml +42 -0
- package/rules/total-mismatch.yaml +38 -1
- package/rules/unbalanced-bracket.yaml +56 -0
- package/rules/undefined-acronym.yaml +23 -0
- package/rules/unfilled-placeholder.yaml +50 -0
- package/rules/unqualified-superlative.yaml +20 -0
- package/rules/unsourced-number.yaml +16 -0
- package/rules/unused-definition.yaml +75 -0
- package/rules/url-run-on.yaml +45 -0
- package/rules/use-before-definition.yaml +77 -0
- package/rules/vague-figure-reference.yaml +66 -0
- package/skills/chaff/SKILL.md +171 -1
- package/src/acronym-expansions.ts +106 -0
- package/src/announced-count.ts +190 -0
- package/src/announced-list.ts +120 -0
- package/src/api.ts +154 -0
- package/src/bare-url.ts +35 -0
- package/src/baseline.ts +17 -1
- package/src/body-section.ts +7 -0
- package/src/calendar-number.ts +18 -4
- package/src/cli-args.ts +6 -0
- package/src/cli-text.ts +14 -15
- package/src/cli.ts +93 -92
- package/src/closing-paragraph.ts +24 -0
- package/src/commands/compare.ts +73 -0
- package/src/commands/document-commands.ts +19 -0
- package/src/commands/eval.ts +22 -10
- package/src/commands/facts.ts +33 -0
- package/src/commands/feedback.ts +45 -7
- package/src/commands/fix-plan.ts +53 -0
- package/src/commands/outline.ts +49 -0
- package/src/commands/read-document.ts +24 -0
- package/src/commands/suppressions.ts +19 -0
- package/src/commands/test.ts +3 -5
- package/src/commands/tree.ts +41 -5
- package/src/compare/atom.ts +33 -0
- package/src/compare/clock-time.ts +89 -0
- package/src/compare/distinct.ts +13 -0
- package/src/compare/extract.ts +80 -0
- package/src/compare/fact-key.ts +31 -0
- package/src/compare/fact-text.ts +87 -0
- package/src/compare/facts-render.ts +63 -0
- package/src/compare/facts-text.ts +41 -0
- package/src/compare/markup-atoms.ts +29 -0
- package/src/compare/match.ts +105 -0
- package/src/compare/outcome.ts +80 -0
- package/src/compare/proper-nouns.ts +65 -0
- package/src/compare/render.ts +102 -0
- package/src/compare/spans.ts +17 -0
- package/src/compare/text-atoms.ts +96 -0
- package/src/compare/text.ts +121 -0
- package/src/compare/tree-atoms.ts +80 -0
- package/src/compare/written-names.ts +26 -0
- package/src/config/load.ts +30 -0
- package/src/config/option-problems.ts +72 -0
- package/src/config/read.ts +8 -0
- package/src/config/rule-problems.ts +12 -2
- package/src/config/style.ts +55 -0
- package/src/config/warnings.ts +13 -0
- package/src/config/write.ts +18 -4
- package/src/custom/bounded-match.ts +58 -0
- package/src/custom/load.ts +23 -0
- package/src/custom/module-path.ts +23 -0
- package/src/custom/parse.ts +323 -0
- package/src/custom/problems.ts +111 -0
- package/src/custom/regex-safety.ts +118 -0
- package/src/custom/token-pattern.ts +84 -0
- package/src/detect-language.ts +1 -1
- package/src/detect.ts +35 -2
- package/src/detectors/acronym-context.ts +16 -4
- package/src/detectors/ai-phrasing.ts +141 -0
- package/src/detectors/announced-count.ts +25 -0
- package/src/detectors/bold-label.ts +55 -0
- package/src/detectors/broken-link.ts +90 -0
- package/src/detectors/cited-name.ts +6 -5
- package/src/detectors/cited-title.ts +96 -0
- package/src/detectors/concrete-evidence.ts +3 -2
- package/src/detectors/contrast-frame.ts +54 -0
- package/src/detectors/custom.ts +89 -0
- package/src/detectors/dangling-figure.ts +26 -0
- package/src/detectors/definition-use.ts +41 -0
- package/src/detectors/doubled-punctuation.ts +52 -0
- package/src/detectors/doubled-word.ts +19 -4
- package/src/detectors/duplicate-heading.ts +47 -0
- package/src/detectors/empty-section.ts +21 -0
- package/src/detectors/enumerated-runs.ts +13 -4
- package/src/detectors/fullwidth-alnum.ts +118 -0
- package/src/detectors/gram-furniture.ts +30 -0
- package/src/detectors/gram-place.ts +9 -5
- package/src/detectors/gram-windows.ts +31 -0
- package/src/detectors/hankaku-kana.ts +38 -0
- package/src/detectors/heading-case.ts +30 -2
- package/src/detectors/heading-code-words.ts +35 -0
- package/src/detectors/heading-echo.ts +8 -4
- package/src/detectors/heading-level-skip.ts +19 -0
- package/src/detectors/image-alt-text.ts +11 -0
- package/src/detectors/index.ts +79 -1
- package/src/detectors/invisible-character.ts +190 -0
- package/src/detectors/kutoten-consistency.ts +96 -0
- package/src/detectors/lead-in.ts +3 -1
- package/src/detectors/lexicon-match.ts +41 -2
- package/src/detectors/lexicon.ts +40 -13
- package/src/detectors/list-item.ts +122 -0
- package/src/detectors/list-items.ts +163 -0
- package/src/detectors/list-lead-in.ts +33 -0
- package/src/detectors/list-sentence.ts +198 -0
- package/src/detectors/list-view.ts +157 -0
- package/src/detectors/long-vowel.ts +82 -0
- package/src/detectors/markup-finding.ts +39 -0
- package/src/detectors/modal-conflict.ts +26 -0
- package/src/detectors/name-numeral.ts +4 -2
- package/src/detectors/name-variant.ts +15 -0
- package/src/detectors/nominalization.ts +73 -0
- package/src/detectors/orthography.ts +97 -41
- package/src/detectors/outside-announced-list.ts +25 -0
- package/src/detectors/oxford-comma.ts +179 -283
- package/src/detectors/phrase-match.ts +27 -7
- package/src/detectors/place-run.ts +7 -4
- package/src/detectors/placeholder-text.ts +27 -0
- package/src/detectors/quote-around.ts +9 -0
- package/src/detectors/ra-nuki.ts +38 -0
- package/src/detectors/register.ts +37 -10
- package/src/detectors/requirement-modal.ts +67 -0
- package/src/detectors/requirement-smell.ts +52 -0
- package/src/detectors/roman-numeral.ts +3 -0
- package/src/detectors/sentence-ending.ts +14 -7
- package/src/detectors/sentence-length.ts +16 -5
- package/src/detectors/signals.ts +80 -46
- package/src/detectors/space-before-punctuation.ts +32 -0
- package/src/detectors/spelling-variety.ts +81 -0
- package/src/detectors/structure-tree.ts +47 -1
- package/src/detectors/structure.ts +20 -7
- package/src/detectors/superlative-comparison.ts +47 -0
- package/src/detectors/superlative-name.ts +7 -4
- package/src/detectors/superlative-scope.ts +8 -3
- package/src/detectors/token-column.ts +149 -0
- package/src/detectors/unbalanced-bracket.ts +153 -0
- package/src/detectors/url-run-on.ts +33 -0
- package/src/detectors/vague-figure-pointer.ts +58 -0
- package/src/detectors/word-list.ts +6 -1
- package/src/document-sections.ts +46 -0
- package/src/document.ts +188 -173
- package/src/email-parts.ts +269 -0
- package/src/eval.ts +14 -4
- package/src/extension/document-view.ts +109 -0
- package/src/extension/failure-text.ts +46 -0
- package/src/extension/import-default.ts +13 -0
- package/src/extension/load.ts +97 -0
- package/src/extension/module-detector.ts +61 -0
- package/src/extension/plugin-load.ts +82 -0
- package/src/extension/plugin-name.ts +26 -0
- package/src/extension/plugin-parse.ts +229 -0
- package/src/extension/problem-text.ts +103 -0
- package/src/extension/real-path.ts +10 -0
- package/src/extension/returned-findings.ts +62 -0
- package/src/extension/rule-export.ts +23 -0
- package/src/feedback/draft.ts +6 -0
- package/src/figure-references.ts +173 -0
- package/src/files.ts +5 -0
- package/src/finding-order.ts +3 -0
- package/src/fix-plan/mode.ts +34 -0
- package/src/fix-plan/plan.ts +181 -0
- package/src/fix-plan/render.ts +128 -0
- package/src/fix-plan/text.ts +133 -0
- package/src/heading-label.ts +55 -0
- package/src/in-page-nav.ts +48 -19
- package/src/joined-view.ts +1 -0
- package/src/language-sample.ts +48 -0
- package/src/levels.ts +14 -1
- package/src/line-paragraphs.ts +52 -9
- package/src/link-line.ts +13 -0
- package/src/long-vowel.ts +109 -0
- package/src/markdown-node.ts +19 -0
- package/src/markdown-read.ts +44 -0
- package/src/markup.ts +212 -0
- package/src/mask.ts +8 -8
- package/src/name-variants.ts +217 -0
- package/src/node-version.ts +22 -0
- package/src/not-run.ts +16 -0
- package/src/number-name.ts +151 -24
- package/src/orthography.ts +50 -14
- package/src/outline/render.ts +85 -0
- package/src/outline/shape.ts +72 -0
- package/src/outline/text.ts +50 -0
- package/src/page-furniture.ts +11 -2
- package/src/plain-source.ts +2 -1
- package/src/plugin.ts +120 -3
- package/src/profile/for-file.ts +3 -1
- package/src/quoted-span.ts +9 -3
- package/src/reasons.ts +12 -0
- package/src/reference-lists.ts +91 -0
- package/src/render/compact.ts +13 -3
- package/src/render/explain.ts +75 -14
- package/src/render/friendly.ts +20 -9
- package/src/render/options.ts +58 -0
- package/src/render/rules-json.ts +140 -18
- package/src/render/rules-table.ts +91 -0
- package/src/render/sarif.ts +4 -4
- package/src/render/semantic.ts +3 -3
- package/src/render/severity-name.ts +10 -0
- package/src/render/suppressions.ts +30 -2
- package/src/render/text.ts +21 -7
- package/src/resolve-genre.ts +4 -1
- package/src/rule-genres.ts +25 -0
- package/src/rule-guide.ts +173 -0
- package/src/rule-load.ts +91 -34
- package/src/rule-options.ts +131 -0
- package/src/run-semantic.ts +2 -1
- package/src/run.ts +105 -22
- package/src/sentence-shape.ts +4 -5
- package/src/setting-problems.ts +9 -1
- package/src/spacing-minority.ts +27 -0
- package/src/span-cut.ts +28 -0
- package/src/stet-block.ts +60 -0
- package/src/stet.ts +41 -15
- package/src/structure/aside-depth.ts +67 -0
- package/src/structure/build.ts +38 -19
- package/src/structure/closed-pairs.ts +20 -0
- package/src/structure/date-range.ts +117 -0
- package/src/structure/definition-use.ts +130 -0
- package/src/structure/known-mentions.ts +96 -0
- package/src/structure/lazy-tree.ts +15 -0
- package/src/structure/modal-conflict.ts +86 -0
- package/src/structure/numbered-clauses.ts +11 -0
- package/src/structure/numbering.ts +9 -5
- package/src/structure/of.ts +11 -3
- package/src/structure/percent-sum.ts +135 -0
- package/src/structure/quoted-number.ts +36 -0
- package/src/structure/relative-find.ts +34 -47
- package/src/structure/relative-resolve.ts +77 -30
- package/src/structure/runs.ts +2 -2
- package/src/structure/sexp.ts +17 -5
- package/src/structure/total.ts +2 -2
- package/src/structure/universal.ts +33 -5
- package/src/structure/wrapped-tail.ts +38 -13
- package/src/style-load.ts +28 -0
- package/src/style-parse.ts +112 -0
- package/src/subheading-line.ts +106 -0
- package/src/tag-coverage.ts +13 -0
- package/src/template-syntax.ts +164 -0
- package/src/text-above.ts +49 -0
- package/src/text-figures.ts +147 -0
- package/src/trailing-aside.ts +50 -0
- package/src/tree-walk.ts +48 -0
- package/styles/bunkacho.yaml +25 -0
- package/styles/ieice.yaml +30 -0
- package/styles/jis-z8301-2011.yaml +28 -0
- package/styles/jis-z8301-2019.yaml +31 -0
- package/styles/koyobun.yaml +35 -0
- package/dist/legal-address.d.ts +0 -2
- package/dist/legal-address.d.ts.map +0 -1
- package/dist/legal-address.js +0 -16
- package/dist/legal-address.js.map +0 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Span } from "../plugin.ts";
|
|
2
|
+
|
|
3
|
+
// ひな形が項目ごとに繰り返す飾り(一覧の札、リンクの文字、記号の並び)。書き手の言い回しではない。
|
|
4
|
+
|
|
5
|
+
const MARK = /[\p{P}\p{S}]/gu;
|
|
6
|
+
|
|
7
|
+
const BRACKETED = /[([{([{]([^()[\]{}()[]{}]*)[)\]})]}]/gu;
|
|
8
|
+
|
|
9
|
+
/** 札の 1 項目。空白を含まない 1 語で、平仮名も含まない(日本語で平仮名を含めば、括弧の中は言い回し)。 */
|
|
10
|
+
const TAG_ITEM = /^\s*[^\s\p{Script=Hiragana}]+\s*$/u;
|
|
11
|
+
|
|
12
|
+
/** 括弧の中が、1 語か 1 語ずつの並び((replaced)、[pdf, html, other])。(if applicable) のような句は札ではない。 */
|
|
13
|
+
const isTag = (inside: string): boolean => inside.split(/[,、]/u).every((item) => TAG_ITEM.test(item));
|
|
14
|
+
|
|
15
|
+
const spansOf = (text: string, pattern: RegExp, keep: (match: RegExpExecArray) => boolean): Span[] =>
|
|
16
|
+
[...text.matchAll(pattern)].filter(keep).map((match) => ({ start: match.index, end: match.index + match[0].length }));
|
|
17
|
+
|
|
18
|
+
/** text の各位置(UTF-16 の単位)が飾りか。記号・句読点、括弧でくくった札、リンクの文字(linked が決める)。 */
|
|
19
|
+
export const furnitureMask = (text: string, linked: (index: number) => boolean): boolean[] => {
|
|
20
|
+
const mask = Array.from({ length: text.length }, (_, index) => linked(index));
|
|
21
|
+
[...spansOf(text, MARK, () => true), ...spansOf(text, BRACKETED, (match) => isTag(match[1] ?? ""))].forEach((span) => mask.fill(true, span.start, span.end));
|
|
22
|
+
return mask;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** 窓の中の空白でない文字の過半が飾りなら、その出現は飾り。 */
|
|
26
|
+
export const isFurniture = (text: string, mask: readonly boolean[], window: Span): boolean => {
|
|
27
|
+
const visible = Array.from({ length: window.end - window.start }, (_, step) => window.start + step).filter((index) => !/\s/u.test(text[index] ?? ""));
|
|
28
|
+
const marked = visible.filter((index) => mask[index] === true);
|
|
29
|
+
return visible.length > 0 && marked.length * 2 > visible.length;
|
|
30
|
+
};
|
|
@@ -37,12 +37,16 @@ export const compacted = (text: string, unit: LengthUnit): Compacted => {
|
|
|
37
37
|
return { text: chars.join(""), offsets };
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
/** 詰めた文の中の範囲を、元の文の範囲に戻す。 */
|
|
41
|
+
export const placeAt = (source: Compacted, window: Span): Span | undefined => {
|
|
42
|
+
const start = source.offsets[window.start];
|
|
43
|
+
const last = source.offsets[window.end - 1];
|
|
44
|
+
if (start === undefined || last === undefined) return undefined;
|
|
45
|
+
return { start, end: last + 1 };
|
|
46
|
+
};
|
|
47
|
+
|
|
40
48
|
/** 詰めた文の中の gram の最初の出現を、元の文の範囲に戻す。無ければ undefined。 */
|
|
41
49
|
export const placeOf = (source: Compacted, gram: string): Span | undefined => {
|
|
42
50
|
const at = source.text.indexOf(gram);
|
|
43
|
-
|
|
44
|
-
const start = source.offsets[at];
|
|
45
|
-
const last = source.offsets[at + gram.length - 1];
|
|
46
|
-
if (start === undefined || last === undefined) return undefined;
|
|
47
|
-
return { start, end: last + 1 };
|
|
51
|
+
return at === -1 ? undefined : placeAt(source, { start: at, end: at + gram.length });
|
|
48
52
|
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Span } from "../plugin.ts";
|
|
2
|
+
|
|
3
|
+
/** 1 文字ずつずらした、幅 width の窓。 */
|
|
4
|
+
export const charWindows = (text: string, width: number): Span[] =>
|
|
5
|
+
Array.from({ length: Math.max(0, text.length - width + 1) }, (_, start) => ({ start, end: start + width }));
|
|
6
|
+
|
|
7
|
+
/** first 番目の語から数えて、minLength 文字に届く最初の語。届く前に尽きるのは minLength 文字に満たない末尾だけなので、深くならない。 */
|
|
8
|
+
const reachingWord = (words: readonly Span[], first: number, minLength: number): Span | undefined => {
|
|
9
|
+
const start = words[first]?.start ?? 0;
|
|
10
|
+
const step = (index: number): Span | undefined => {
|
|
11
|
+
const word = words[index];
|
|
12
|
+
if (word === undefined || word.end - start >= minLength) return word;
|
|
13
|
+
return step(index + 1);
|
|
14
|
+
};
|
|
15
|
+
return step(first);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** 語。前後の句読点と括弧は含めない。"described," と "described" を別の語句として数えないため。 */
|
|
19
|
+
const WORD = /[\p{L}\p{N}](?:\S*[\p{L}\p{N}])?/gu;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 語の頭で始まり語の尾で終わる窓。語を 1 つずつ足して、minLength 文字に届いた最短のもの。
|
|
23
|
+
* 文字で切ると " generat" や "roductivity change a" のような語の断片が数えられる。
|
|
24
|
+
*/
|
|
25
|
+
export const wordWindows = (text: string, minLength: number): Span[] => {
|
|
26
|
+
const words = [...text.matchAll(WORD)].map((match) => ({ start: match.index, end: match.index + match[0].length }));
|
|
27
|
+
return words.flatMap((first, index) => {
|
|
28
|
+
const last = reachingWord(words, index, minLength);
|
|
29
|
+
return last === undefined ? [] : [{ start: first.start, end: last.end }];
|
|
30
|
+
});
|
|
31
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Detector, Finding, Span } from "../plugin.ts";
|
|
2
|
+
import { QUOTATION_MARKS, isWithinAny, quotedSpans } from "../quoted-span.ts";
|
|
3
|
+
import { quoteAround } from "./quote-around.ts";
|
|
4
|
+
|
|
5
|
+
/** 半角の片仮名と、半角の句読点・鉤括弧・中黒・長音・濁点(。「」、・ー゙゚)。 */
|
|
6
|
+
const HALFWIDTH_KANA_RUN = /[\uFF61-\uFF9F]+/gu;
|
|
7
|
+
|
|
8
|
+
export type HalfwidthRun = { readonly span: Span; readonly written: string };
|
|
9
|
+
|
|
10
|
+
/** 一行の中の、鉤括弧や引用符で引いたものの位置(行の頭を 0 とする)。引いた名前(「カナ表示」の画面名)は元の書き方のまま。 */
|
|
11
|
+
const quotedOnLine = (source: string, at: number): { readonly lineStart: number; readonly quoted: readonly Span[] } => {
|
|
12
|
+
const lineStart = source.lastIndexOf("\n", at - 1) + 1;
|
|
13
|
+
const lineEnd = source.indexOf("\n", at);
|
|
14
|
+
return { lineStart, quoted: quotedSpans(source.slice(lineStart, lineEnd === -1 ? source.length : lineEnd), QUOTATION_MARKS) };
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const isQuoted = (source: string, span: Span): boolean => {
|
|
18
|
+
const { lineStart, quoted } = quotedOnLine(source, span.start);
|
|
19
|
+
return isWithinAny(quoted, { start: span.start - lineStart, end: span.end - lineStart });
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** 字のまま見える範囲(texts)の中の、半角の片仮名の並び。引いたものの中は数えない。 */
|
|
23
|
+
export const halfwidthKanaRuns = (source: string, texts: readonly Span[]): HalfwidthRun[] =>
|
|
24
|
+
texts.flatMap((text) =>
|
|
25
|
+
[...source.slice(text.start, text.end).matchAll(HALFWIDTH_KANA_RUN)]
|
|
26
|
+
.map((match) => ({ span: { start: text.start + match.index, end: text.start + match.index + match[0].length }, written: match[0] }))
|
|
27
|
+
.filter((run) => !isQuoted(source, run.span)),
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
export const hankakuKana: Detector = (doc): Finding[] =>
|
|
31
|
+
halfwidthKanaRuns(doc.source, doc.markup?.texts ?? []).map(({ span, written }) => ({
|
|
32
|
+
rule: "",
|
|
33
|
+
severity: "warning",
|
|
34
|
+
line: 0,
|
|
35
|
+
column: 0,
|
|
36
|
+
quote: quoteAround(doc.source, span.start, span.end),
|
|
37
|
+
values: { kana: written, fullwidth: written.normalize("NFKC"), offset: span.start },
|
|
38
|
+
}));
|
|
@@ -1,7 +1,33 @@
|
|
|
1
|
+
import { straightApostrophes } from "../orthography.ts";
|
|
2
|
+
import { withoutCodeWords } from "./heading-code-words.ts";
|
|
3
|
+
|
|
4
|
+
/** 語の中のアポストロフィは ' に畳んでから読む(Fed’s)。’ を語の外に置くと、’s が小文字の語に見える。 */
|
|
1
5
|
const WORD = /[A-Za-z][A-Za-z'-]*/gu;
|
|
2
6
|
|
|
3
7
|
/** 小さい語は Title Case でも小文字のままなので、大文字化の判定から外す。 */
|
|
4
|
-
const
|
|
8
|
+
export const MINOR_WORDS: ReadonlySet<string> = new Set([
|
|
9
|
+
"a",
|
|
10
|
+
"an",
|
|
11
|
+
"the",
|
|
12
|
+
"and",
|
|
13
|
+
"or",
|
|
14
|
+
"but",
|
|
15
|
+
"of",
|
|
16
|
+
"in",
|
|
17
|
+
"on",
|
|
18
|
+
"at",
|
|
19
|
+
"to",
|
|
20
|
+
"for",
|
|
21
|
+
"with",
|
|
22
|
+
"as",
|
|
23
|
+
"by",
|
|
24
|
+
"from",
|
|
25
|
+
"is",
|
|
26
|
+
// 語の並び(WORD)は点を含まないので、vs. と v. は vs と v で拾う。
|
|
27
|
+
"vs",
|
|
28
|
+
"v",
|
|
29
|
+
"via",
|
|
30
|
+
]);
|
|
5
31
|
|
|
6
32
|
/** 大文字だけの語(PR・FCPs)は略語で、どちらの流儀でも大文字のまま。Title Case の証拠にならない。 */
|
|
7
33
|
const ACRONYM = /^[A-Z]{2,}s?$/u;
|
|
@@ -10,7 +36,9 @@ const TITLE_DEPTH = 1;
|
|
|
10
36
|
|
|
11
37
|
/** 見出しが Title Case か。判定できなければ undefined。 */
|
|
12
38
|
export const isTitleCase = (heading: string): boolean | undefined => {
|
|
13
|
-
const words = [...heading.matchAll(WORD)]
|
|
39
|
+
const words = [...withoutCodeWords(straightApostrophes(heading)).matchAll(WORD)]
|
|
40
|
+
.map((match) => match[0])
|
|
41
|
+
.filter((word) => !MINOR_WORDS.has(word.toLowerCase()) && !ACRONYM.test(word));
|
|
14
42
|
// 1 語の見出しは、どちらの流儀でも先頭が大文字になる。判定できない。
|
|
15
43
|
if (words.length < 2) return undefined;
|
|
16
44
|
const capitalized = words.filter((word) => word[0] === word[0]?.toUpperCase()).length;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// A code span closes at the next run of exactly as many backticks as opened it: ``a ` b`` is one span.
|
|
2
|
+
const CODE_SPAN = /(?<!`)(`+)(?!`)[\s\S]*?(?<!`)\1(?!`)/gu;
|
|
3
|
+
|
|
4
|
+
const OPENING = new Set("(\"'“‘[");
|
|
5
|
+
const CLOSING = new Set(")\"'”’].,:;!?");
|
|
6
|
+
|
|
7
|
+
/** The word without the punctuation around it: `(optional)` is `optional`, `Setup:` is `Setup`. */
|
|
8
|
+
const bareWord = (token: string): string => {
|
|
9
|
+
const chars = [...token];
|
|
10
|
+
const first = chars.findIndex((char) => !OPENING.has(char));
|
|
11
|
+
const last = chars.findLastIndex((char) => !CLOSING.has(char));
|
|
12
|
+
return first === -1 || last < first ? "" : chars.slice(first, last + 1).join("");
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** A mark a word of prose does not carry inside it: `config.yaml`, `snake_case`, `src/index`, `useEffect()`, `$HOME`. */
|
|
16
|
+
const CODE_MARK = /[._/\\=(){}[\]<>$@#*]/u;
|
|
17
|
+
|
|
18
|
+
/** A word that starts in lower case and has a capital after it (`useEffect`, `iPhone`): its case is its owner's. */
|
|
19
|
+
const CAMEL_CASE = /^[a-z]+[A-Z]/u;
|
|
20
|
+
|
|
21
|
+
const isCodeWord = (token: string): boolean => {
|
|
22
|
+
const bare = bareWord(token);
|
|
23
|
+
return bare.startsWith("-") || CAMEL_CASE.test(bare) || CODE_MARK.test(bare);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The heading without its code words: a code span, a flag (`--force`), a file name (`config.yaml`), an identifier
|
|
28
|
+
* (`useEffect`). They are written the same in Title Case and in sentence case, so they are evidence for neither.
|
|
29
|
+
*/
|
|
30
|
+
export const withoutCodeWords = (heading: string): string =>
|
|
31
|
+
heading
|
|
32
|
+
.replace(CODE_SPAN, " ")
|
|
33
|
+
.split(/\s+/u)
|
|
34
|
+
.filter((token) => !isCodeWord(token))
|
|
35
|
+
.join(" ");
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { lengthOf, proseText } from "../measure.ts";
|
|
2
2
|
import { newContentMorphemes } from "./content-morphemes.ts";
|
|
3
3
|
import { echoedHeadingUnits, trigrams } from "./heading-overlap.ts";
|
|
4
|
+
import { titleTokens } from "../heading-label.ts";
|
|
4
5
|
import { handsOver } from "./lead-in.ts";
|
|
5
6
|
import { withoutQuotedVariants } from "./quoted-variant.ts";
|
|
6
7
|
import type { Detector, Finding, LengthUnit, ProseDocument, Section } from "../plugin.ts";
|
|
@@ -37,12 +38,15 @@ const NEW_MATERIAL = { word: 6, char: 20 };
|
|
|
37
38
|
*/
|
|
38
39
|
const NEW_CONTENT_MORPHEMES = 1;
|
|
39
40
|
|
|
41
|
+
/** 重なりを測る見出し。頭の番号の札(例 3:、Step 3:、1.)は本文で繰り返されないので、数えると短い見出しほど重なりが下がる。 */
|
|
42
|
+
const measuredHeading = (section: Section): string => section.unlabeledHeading ?? section.heading;
|
|
43
|
+
|
|
40
44
|
const addsLittle = (section: Section, unit: LengthUnit): boolean => {
|
|
41
45
|
const first = section.firstSentence;
|
|
42
46
|
if (first === undefined) return false;
|
|
43
47
|
if (unit === "char" && first.tokens !== undefined && section.headingTokens !== undefined)
|
|
44
|
-
return newContentMorphemes(section.headingTokens, first.tokens) <= NEW_CONTENT_MORPHEMES;
|
|
45
|
-
return lengthOf(first, unit) - echoedHeadingUnits(section
|
|
48
|
+
return newContentMorphemes(titleTokens(section.heading, measuredHeading(section), section.headingTokens), first.tokens) <= NEW_CONTENT_MORPHEMES;
|
|
49
|
+
return lengthOf(first, unit) - echoedHeadingUnits(measuredHeading(section), proseText(first), unit) <= NEW_MATERIAL[unit];
|
|
46
50
|
};
|
|
47
51
|
|
|
48
52
|
/** 最初の文が、同じ節の後ろ(箇条書き・表・コード)へ読者を渡している。 */
|
|
@@ -52,14 +56,14 @@ const leadsIn = (doc: ProseDocument, section: Section, phrases: readonly string[
|
|
|
52
56
|
};
|
|
53
57
|
|
|
54
58
|
/** 見出しとの重なりを測る文。用語集や表記の手引きは見出しの語の別の書き方を引用する(Not “datacentre”)ので、それは数えない。 */
|
|
55
|
-
const echoedText = (section: Section): string => withoutQuotedVariants(section.firstSentence?.text ?? "", section
|
|
59
|
+
const echoedText = (section: Section): string => withoutQuotedVariants(section.firstSentence?.text ?? "", measuredHeading(section));
|
|
56
60
|
|
|
57
61
|
export const headingEcho: Detector = (doc, options): Finding[] => {
|
|
58
62
|
const leadIns = (doc.lexicons["lead-in"] ?? []).map((entry) => entry.pattern);
|
|
59
63
|
return doc.sections
|
|
60
64
|
.filter((section) => section.heading.length > 0 && section.firstSentence !== undefined && addsLittle(section, doc.lengthUnit))
|
|
61
65
|
.filter((section) => !leadsIn(doc, section, leadIns))
|
|
62
|
-
.map((section) => ({ section, overlap: Math.round(containment(trigrams(section
|
|
66
|
+
.map((section) => ({ section, overlap: Math.round(containment(trigrams(measuredHeading(section)), trigrams(echoedText(section))) * 100) }))
|
|
63
67
|
.filter(({ overlap }) => overlap >= options.limit)
|
|
64
68
|
.map(({ section, overlap }) => ({
|
|
65
69
|
rule: "heading-echo",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Detector, Finding, MarkupHeading } from "../plugin.ts";
|
|
2
|
+
import { findingAt, markupOf } from "./markup-finding.ts";
|
|
3
|
+
|
|
4
|
+
export type SkippedHeading = { readonly heading: MarkupHeading; readonly from: number };
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 一つ前の見出しより二段以上深い見出し(## の次の ####)。最初の見出しは何段から始めてもよい。
|
|
8
|
+
* 飛んだ後は、飛んだ先の深さを基準にする(#### の次の #### は飛んでいない)。markdownlint の MD001 と同じ数え方。
|
|
9
|
+
*/
|
|
10
|
+
export const skippedHeadings = (headings: readonly MarkupHeading[]): SkippedHeading[] =>
|
|
11
|
+
headings.flatMap((heading, index) => {
|
|
12
|
+
const previous = headings[index - 1];
|
|
13
|
+
return previous !== undefined && heading.depth > previous.depth + 1 ? [{ heading, from: previous.depth }] : [];
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const headingLevelSkip: Detector = (doc): Finding[] =>
|
|
17
|
+
skippedHeadings(markupOf(doc)?.headings ?? []).map(({ heading, from }) =>
|
|
18
|
+
findingAt(doc, heading, { heading: heading.text, from, to: heading.depth, expected: from + 1 }),
|
|
19
|
+
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Detector, Finding, MarkupImage } from "../plugin.ts";
|
|
2
|
+
import { findingAt, markupOf, quoteOf } from "./markup-finding.ts";
|
|
3
|
+
|
|
4
|
+
/** 代替テキストの無い画像。Markdown の `` は alt が空、HTML の `<img>` は alt 属性が無いもの。`alt=""` は飾りと明示したので数えない。 */
|
|
5
|
+
const lacksAlt = (source: string, image: MarkupImage): boolean => {
|
|
6
|
+
if (image.alt === undefined) return true;
|
|
7
|
+
return image.alt.trim() === "" && !source.startsWith("<", image.start);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const imageAltText: Detector = (doc): Finding[] =>
|
|
11
|
+
(markupOf(doc)?.images ?? []).filter((image) => lacksAlt(doc.source, image)).map((image) => findingAt(doc, image, { image: quoteOf(doc.source, image) }));
|
package/src/detectors/index.ts
CHANGED
|
@@ -17,9 +17,47 @@ import { paragraphLength, paragraphVariance, preambleLength, ruleOfThree, sectio
|
|
|
17
17
|
import { concreteEvidence, dashDensity, emojiDensity, ngramRepetition, undefinedAcronym } from "./signals.ts";
|
|
18
18
|
import { aiTell, contractionMix, cushionDensity, hedging, repeatedConjunction, unqualifiedSuperlative } from "./lexicon.ts";
|
|
19
19
|
import { internalJargon, properNounDensity, requiredSections } from "./team.ts";
|
|
20
|
+
import { nameVariant } from "./name-variant.ts";
|
|
20
21
|
import { latinSpacing, preferredTerm } from "./orthography.ts";
|
|
21
22
|
import { straySpace } from "./stray-space.ts";
|
|
22
|
-
import {
|
|
23
|
+
import { announcedCount } from "./announced-count.ts";
|
|
24
|
+
import { outsideAnnouncedList } from "./outside-announced-list.ts";
|
|
25
|
+
import { danglingFigure } from "./dangling-figure.ts";
|
|
26
|
+
import { nominalization } from "./nominalization.ts";
|
|
27
|
+
import { requirementSmell } from "./requirement-smell.ts";
|
|
28
|
+
import { requirementModal } from "./requirement-modal.ts";
|
|
29
|
+
import { modalConflict } from "./modal-conflict.ts";
|
|
30
|
+
import { vagueFigurePointer } from "./vague-figure-pointer.ts";
|
|
31
|
+
import {
|
|
32
|
+
danglingReference,
|
|
33
|
+
dateOrder,
|
|
34
|
+
dateRangeReversed,
|
|
35
|
+
dateWeekdayMismatch,
|
|
36
|
+
duplicateDefinition,
|
|
37
|
+
numberingGap,
|
|
38
|
+
percentSumMismatch,
|
|
39
|
+
totalMismatch,
|
|
40
|
+
} from "./structure-tree.ts";
|
|
41
|
+
import { headingLevelSkip } from "./heading-level-skip.ts";
|
|
42
|
+
import { imageAltText } from "./image-alt-text.ts";
|
|
43
|
+
import { brokenLink } from "./broken-link.ts";
|
|
44
|
+
import { urlRunOn } from "./url-run-on.ts";
|
|
45
|
+
import { unbalancedBracket } from "./unbalanced-bracket.ts";
|
|
46
|
+
import { doubledPunctuation } from "./doubled-punctuation.ts";
|
|
47
|
+
import { kutotenConsistency } from "./kutoten-consistency.ts";
|
|
48
|
+
import { hankakuKana } from "./hankaku-kana.ts";
|
|
49
|
+
import { invisibleCharacter } from "./invisible-character.ts";
|
|
50
|
+
import { spaceBeforePunctuation } from "./space-before-punctuation.ts";
|
|
51
|
+
import { duplicateHeading } from "./duplicate-heading.ts";
|
|
52
|
+
import { emptySection } from "./empty-section.ts";
|
|
53
|
+
import { fullwidthAlnum } from "./fullwidth-alnum.ts";
|
|
54
|
+
import { spellingVariety } from "./spelling-variety.ts";
|
|
55
|
+
import { raNuki } from "./ra-nuki.ts";
|
|
56
|
+
import { katakanaLongVowel } from "./long-vowel.ts";
|
|
57
|
+
import { customPattern, customTokens, customWords } from "./custom.ts";
|
|
58
|
+
import { boldLabelList } from "./bold-label.ts";
|
|
59
|
+
import { acronymExpansionConflict, unusedDefinition, useBeforeDefinition } from "./definition-use.ts";
|
|
60
|
+
import { assistantResidue, colonLeadIn, contrastFraming, openerDensity, openerPile, unfilledPlaceholder } from "./ai-phrasing.ts";
|
|
23
61
|
|
|
24
62
|
/** rule 定義の how_to_find がここを引く。rule 側は実装を知らない。 */
|
|
25
63
|
export const DETECTORS: Readonly<Record<string, Detector>> = {
|
|
@@ -58,17 +96,57 @@ export const DETECTORS: Readonly<Record<string, Detector>> = {
|
|
|
58
96
|
"unqualified-superlative": unqualifiedSuperlative,
|
|
59
97
|
"repeated-conjunction": repeatedConjunction,
|
|
60
98
|
"ai-tell": aiTell,
|
|
99
|
+
"contrast-framing": contrastFraming,
|
|
100
|
+
"stock-transition": openerDensity,
|
|
101
|
+
"opener-pile": openerPile,
|
|
102
|
+
"colon-lead-in": colonLeadIn,
|
|
103
|
+
"assistant-residue": assistantResidue,
|
|
104
|
+
"unfilled-placeholder": unfilledPlaceholder,
|
|
61
105
|
"contraction-mix": contractionMix,
|
|
62
106
|
"internal-jargon": internalJargon,
|
|
63
107
|
"required-sections": requiredSections,
|
|
64
108
|
"proper-noun-density": properNounDensity,
|
|
109
|
+
"name-variant": nameVariant,
|
|
65
110
|
"preferred-term": preferredTerm,
|
|
66
111
|
"latin-spacing": latinSpacing,
|
|
67
112
|
"stray-space": straySpace,
|
|
113
|
+
"katakana-long-vowel": katakanaLongVowel,
|
|
114
|
+
"custom-words": customWords,
|
|
115
|
+
"custom-pattern": customPattern,
|
|
116
|
+
"custom-tokens": customTokens,
|
|
68
117
|
"dangling-reference": danglingReference,
|
|
69
118
|
"date-weekday-mismatch": dateWeekdayMismatch,
|
|
70
119
|
"date-order": dateOrder,
|
|
71
120
|
"total-mismatch": totalMismatch,
|
|
72
121
|
"numbering-gap": numberingGap,
|
|
73
122
|
"duplicate-definition": duplicateDefinition,
|
|
123
|
+
"announced-count": announcedCount,
|
|
124
|
+
"outside-announced-list": outsideAnnouncedList,
|
|
125
|
+
"dangling-figure": danglingFigure,
|
|
126
|
+
nominalization: nominalization,
|
|
127
|
+
"requirement-smell": requirementSmell,
|
|
128
|
+
"requirement-modal": requirementModal,
|
|
129
|
+
"modal-conflict": modalConflict,
|
|
130
|
+
"vague-figure-pointer": vagueFigurePointer,
|
|
131
|
+
"date-range-reversed": dateRangeReversed,
|
|
132
|
+
"percent-sum-mismatch": percentSumMismatch,
|
|
133
|
+
"heading-level-skip": headingLevelSkip,
|
|
134
|
+
"image-alt-text": imageAltText,
|
|
135
|
+
"broken-link": brokenLink,
|
|
136
|
+
"url-run-on": urlRunOn,
|
|
137
|
+
"unbalanced-bracket": unbalancedBracket,
|
|
138
|
+
"doubled-punctuation": doubledPunctuation,
|
|
139
|
+
"kutoten-consistency": kutotenConsistency,
|
|
140
|
+
"hankaku-kana": hankakuKana,
|
|
141
|
+
"invisible-character": invisibleCharacter,
|
|
142
|
+
"space-before-punctuation": spaceBeforePunctuation,
|
|
143
|
+
"duplicate-heading": duplicateHeading,
|
|
144
|
+
"empty-section": emptySection,
|
|
145
|
+
"fullwidth-alnum": fullwidthAlnum,
|
|
146
|
+
"spelling-variety": spellingVariety,
|
|
147
|
+
"ra-nuki": raNuki,
|
|
148
|
+
"bold-label-list": boldLabelList,
|
|
149
|
+
"unused-definition": unusedDefinition,
|
|
150
|
+
"use-before-definition": useBeforeDefinition,
|
|
151
|
+
"acronym-expansion-conflict": acronymExpansionConflict,
|
|
74
152
|
};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import type { Detector, Finding, Span } from "../plugin.ts";
|
|
2
|
+
import { isJapanese } from "../orthography.ts";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 見えない字の種類。zero-width はゼロ幅の空白・接合子と途中の BOM、soft-hyphen は任意の改行位置の印、direction は文字の向きの指定、
|
|
6
|
+
* control は改行・タブ・改ページ以外の制御文字、hidden は字の後ろに隠せる印(タグ文字、二つ以上続く異体字の指定)、
|
|
7
|
+
* nbsp は普通の空白が要る所のノーブレークスペース。どれも画面では見えず、検索・コピー・リンクを壊す。向きの指定と隠せる印は、
|
|
8
|
+
* 読み手に見えるものと機械が読むものを食い違わせるのにも使える。
|
|
9
|
+
*/
|
|
10
|
+
export type InvisibleKind = "zero-width" | "soft-hyphen" | "direction" | "control" | "hidden" | "nbsp";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 種類ごとの字(正規表現の文字クラスの中身)。制御文字(Cc)には改行・タブ・改ページも入るので、それは isIntended が外す。
|
|
14
|
+
* hidden の異体字の指定は、字に一つ付いたものを isIntended が外す。
|
|
15
|
+
*/
|
|
16
|
+
const CLASSES: readonly (readonly [string, InvisibleKind])[] = [
|
|
17
|
+
["\\u200B-\\u200D\\u2060-\\u2064\\uFEFF", "zero-width"],
|
|
18
|
+
["\\u00AD", "soft-hyphen"],
|
|
19
|
+
["\\u200E\\u200F\\u061C\\u202A-\\u202E\\u2066-\\u2069", "direction"],
|
|
20
|
+
["\\p{Cc}", "control"],
|
|
21
|
+
["\\u{E0001}\\u{E0020}-\\u{E007F}\\p{Variation_Selector}", "hidden"],
|
|
22
|
+
["\\u00A0\\u2007\\u202F", "nbsp"],
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
const KIND_OF: readonly (readonly [RegExp, InvisibleKind])[] = CLASSES.map(([chars, kind]) => [new RegExp(`^[${chars}]$`, "u"), kind]);
|
|
26
|
+
|
|
27
|
+
/** 一字ずつ当てる。タグ文字と異体字の指定は BMP の外にもあるので u で読む。 */
|
|
28
|
+
const CANDIDATE = new RegExp(`[${CLASSES.map(([chars]) => chars).join("")}]`, "gu");
|
|
29
|
+
|
|
30
|
+
const kindOf = (char: string): InvisibleKind | undefined => KIND_OF.find(([pattern]) => pattern.test(char))?.[1];
|
|
31
|
+
|
|
32
|
+
/** 接合子(ZWJ・ZWNJ)で字の形を変える文字体系。アラビア文字やインドの文字では、見えない接合子が綴りの一部。 */
|
|
33
|
+
const JOINING_SCRIPT = /[\p{L}\p{M}]/u;
|
|
34
|
+
const NON_JOINING_SCRIPT = /[\p{Script=Latin}\p{Script=Greek}\p{Script=Cyrillic}\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u;
|
|
35
|
+
/** どの文字体系にも付くアクセント(U+0301 など)。ラテン文字の後ろの接合子を、接合子を使う文字体系のものと読まない。 */
|
|
36
|
+
const INHERITED = /\p{Script=Inherited}/u;
|
|
37
|
+
|
|
38
|
+
/** 右から左に書く文字。この字の隣の向きの印(LRM・RLM)は、英数字と混ぜて正しく並べるためのもの。 */
|
|
39
|
+
const RIGHT_TO_LEFT = /[\p{Script=Hebrew}\p{Script=Arabic}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}\p{Script=Samaritan}]/u;
|
|
40
|
+
|
|
41
|
+
/** 字の向きを強制する印(LRO・RLO)。右から左の文字の隣でも、見える順を入れ替えるのに使えるので、いつも指摘する。 */
|
|
42
|
+
const OVERRIDE = /[\u202D\u202E]/u;
|
|
43
|
+
|
|
44
|
+
/** 絵文字の部品。ZWJ でつないだ絵文字(家族・職業)と、肌の色や異体字の指定を挟んだもの。 */
|
|
45
|
+
const PICTOGRAPH = /[\p{Extended_Pictographic}\p{Emoji_Modifier}\uFE0F]/u;
|
|
46
|
+
|
|
47
|
+
/** 黒い旗の絵文字。後ろにタグ文字を並べて地域の旗(イングランドなど)を書く。地域の名は六字までで、旗は字の数で十四単位に収まる。 */
|
|
48
|
+
const BLACK_FLAG = String.fromCodePoint(0x1f3f4);
|
|
49
|
+
const FLAG_REACH = 14;
|
|
50
|
+
const TAG = /[\u{E0020}-\u{E007F}]/u;
|
|
51
|
+
|
|
52
|
+
const VARIATION_SELECTOR = /\p{Variation_Selector}/u;
|
|
53
|
+
|
|
54
|
+
/** 文書の形を作る制御文字(タブ・改行・改ページ)。 */
|
|
55
|
+
const LAYOUT_CONTROL = /[\t\n\r\f]/u;
|
|
56
|
+
|
|
57
|
+
/** Markdown の行の頭の印(見出し・箇条・番号・引用)。後ろの空白がノーブレークスペースだと、印として読まれない。 */
|
|
58
|
+
const BLOCK_MARKER = /^[ \t]*(?:#{1,6}|[-*+]|\d{1,9}[.)]|>)$/u;
|
|
59
|
+
const JAPANESE_MARK = /[、。「」『』()・]/u;
|
|
60
|
+
|
|
61
|
+
/** at の前の一字(サロゲートの対は一字に)。文書の頭なら空。 */
|
|
62
|
+
const charBefore = (source: string, at: number): string => {
|
|
63
|
+
if (at <= 0) return "";
|
|
64
|
+
const low = source.charCodeAt(at - 1);
|
|
65
|
+
const isLow = low >= 0xdc00 && low <= 0xdfff;
|
|
66
|
+
return isLow && at >= 2 ? source.slice(at - 2, at) : source.slice(at - 1, at);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/** at から始まる一字。文書の終わりなら空。 */
|
|
70
|
+
const charAt = (source: string, at: number): string => {
|
|
71
|
+
const code = source.codePointAt(at);
|
|
72
|
+
return code === undefined ? "" : String.fromCodePoint(code);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const isJoiningLetter = (char: string): boolean => JOINING_SCRIPT.test(char) && !NON_JOINING_SCRIPT.test(char) && !INHERITED.test(char);
|
|
76
|
+
|
|
77
|
+
const isJapaneseSide = (char: string): boolean => isJapanese(char) || JAPANESE_MARK.test(char);
|
|
78
|
+
|
|
79
|
+
const CANCEL_TAG = String.fromCodePoint(0xe007f);
|
|
80
|
+
|
|
81
|
+
/** タグ文字の並びをさかのぼった先が黒い旗で、並びが取り消しのタグ(U+E007F)で閉じていれば、地域の旗の中。 */
|
|
82
|
+
const isInFlag = (source: string, at: number): boolean => {
|
|
83
|
+
const before = [...source.slice(Math.max(0, at - FLAG_REACH), at)];
|
|
84
|
+
const after = [...source.slice(at, at + FLAG_REACH)];
|
|
85
|
+
const closing = after.findIndex((char) => !TAG.test(char) || char === CANCEL_TAG);
|
|
86
|
+
return before[before.findLastIndex((char) => !TAG.test(char))] === BLACK_FLAG && after[closing] === CANCEL_TAG;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/** 異体字の指定が付く字。空白や文書の頭の後ろの指定は、付く字が無い。 */
|
|
90
|
+
const SELECTOR_BASE = /\S/u;
|
|
91
|
+
|
|
92
|
+
/** 字が普通に使う異体字の指定は、字の後ろに一つ。二つ以上続く指定と、付く字の無い指定は、何かを隠した並び。 */
|
|
93
|
+
const isLoneSelector = (source: string, at: number, length: number): boolean => {
|
|
94
|
+
const before = charBefore(source, at);
|
|
95
|
+
return SELECTOR_BASE.test(before) && !VARIATION_SELECTOR.test(before) && !VARIATION_SELECTOR.test(charAt(source, at + length));
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/** 向きの分離の開き(LRI・RLI・FSI)と閉じ(PDI)。囲んだ中に右から左の文字があれば、混ぜて並べるための印。 */
|
|
99
|
+
const ISOLATE_OPENS: readonly string[] = ["\u2066", "\u2067", "\u2068"];
|
|
100
|
+
const ISOLATE_CLOSE = "\u2069";
|
|
101
|
+
const ISOLATE_REACH = 200;
|
|
102
|
+
|
|
103
|
+
/** 分離の印 char(at の位置)が囲む中身。組になる印が近くに無ければ undefined。 */
|
|
104
|
+
const isolatedText = (source: string, at: number, char: string): string | undefined => {
|
|
105
|
+
if (ISOLATE_OPENS.includes(char)) {
|
|
106
|
+
const inside = source.slice(at + 1, at + 1 + ISOLATE_REACH);
|
|
107
|
+
const end = inside.indexOf(ISOLATE_CLOSE);
|
|
108
|
+
return end === -1 ? undefined : inside.slice(0, end);
|
|
109
|
+
}
|
|
110
|
+
if (char !== ISOLATE_CLOSE) return undefined;
|
|
111
|
+
const inside = source.slice(Math.max(0, at - ISOLATE_REACH), at);
|
|
112
|
+
const start = Math.max(...ISOLATE_OPENS.map((open) => inside.lastIndexOf(open)));
|
|
113
|
+
return start === -1 ? undefined : inside.slice(start + 1);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const isolatesRightToLeft = (source: string, at: number, char: string): boolean => RIGHT_TO_LEFT.test(isolatedText(source, at, char) ?? "");
|
|
117
|
+
|
|
118
|
+
/** 文書の頭の BOM はファイルの印で、本文の字ではない。 */
|
|
119
|
+
const BYTE_ORDER_MARK = "\uFEFF";
|
|
120
|
+
|
|
121
|
+
const lineBefore = (source: string, at: number): string => source.slice(source.lastIndexOf("\n", at - 1) + 1, at);
|
|
122
|
+
|
|
123
|
+
/** 見えない字一つと、その前後の字。 */
|
|
124
|
+
type Place = { readonly source: string; readonly at: number; readonly char: string; readonly before: string; readonly after: string };
|
|
125
|
+
|
|
126
|
+
const ZERO_WIDTH_JOINER = "\u200D";
|
|
127
|
+
const ZERO_WIDTH_NON_JOINER = "\u200C";
|
|
128
|
+
|
|
129
|
+
const joinsLetters = ({ before, after }: Place): boolean => isJoiningLetter(before) || isJoiningLetter(after);
|
|
130
|
+
|
|
131
|
+
/** 種類ごとの、書き手が意味を持たせて置いた見えない字。そうでないものだけを指摘する。 */
|
|
132
|
+
const INTENDED: Readonly<Record<InvisibleKind, (place: Place) => boolean>> = {
|
|
133
|
+
"zero-width": (place) => {
|
|
134
|
+
if (place.char === BYTE_ORDER_MARK) return place.at === 0;
|
|
135
|
+
if (place.char === ZERO_WIDTH_JOINER) return (PICTOGRAPH.test(place.before) && PICTOGRAPH.test(place.after)) || joinsLetters(place);
|
|
136
|
+
return place.char === ZERO_WIDTH_NON_JOINER && joinsLetters(place);
|
|
137
|
+
},
|
|
138
|
+
"soft-hyphen": () => false,
|
|
139
|
+
direction: ({ source, at, char, before, after }) =>
|
|
140
|
+
!OVERRIDE.test(char) && (RIGHT_TO_LEFT.test(before) || RIGHT_TO_LEFT.test(after) || isolatesRightToLeft(source, at, char)),
|
|
141
|
+
control: ({ char }) => LAYOUT_CONTROL.test(char),
|
|
142
|
+
hidden: ({ source, at, char }) => (TAG.test(char) ? isInFlag(source, at) : isLoneSelector(source, at, char.length)),
|
|
143
|
+
nbsp: ({ source, at, before, after }) => !BLOCK_MARKER.test(lineBefore(source, at)) && !isJapaneseSide(before) && !isJapaneseSide(after),
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const isIntended = (source: string, at: number, char: string, kind: InvisibleKind): boolean =>
|
|
147
|
+
INTENDED[kind]({ source, at, char, before: charBefore(source, at), after: charAt(source, at + char.length) });
|
|
148
|
+
|
|
149
|
+
export type InvisibleRun = { readonly span: Span; readonly kind: InvisibleKind; readonly codes: readonly string[] };
|
|
150
|
+
|
|
151
|
+
export const codePointName = (char: string): string => `U+${(char.codePointAt(0) ?? 0).toString(16).toUpperCase().padStart(4, "0")}`;
|
|
152
|
+
|
|
153
|
+
const joinRuns = (runs: InvisibleRun[], next: InvisibleRun): InvisibleRun[] => {
|
|
154
|
+
const last = runs.at(-1);
|
|
155
|
+
if (last === undefined || last.span.end !== next.span.start || last.kind !== next.kind) return [...runs, next];
|
|
156
|
+
const codes = last.codes.includes(next.codes[0] ?? "") ? last.codes : [...last.codes, ...next.codes];
|
|
157
|
+
return [...runs.slice(0, -1), { span: { start: last.span.start, end: next.span.end }, kind: last.kind, codes }];
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
/** source の中の、見えない字の並び。隣り合う同じ種類の字は一つの並びにまとめる。 */
|
|
161
|
+
export const invisibleRuns = (source: string): InvisibleRun[] =>
|
|
162
|
+
[...source.matchAll(CANDIDATE)]
|
|
163
|
+
.flatMap((match): InvisibleRun[] => {
|
|
164
|
+
const kind = kindOf(match[0]);
|
|
165
|
+
if (kind === undefined || isIntended(source, match.index, match[0], kind)) return [];
|
|
166
|
+
return [{ span: { start: match.index, end: match.index + match[0].length }, kind, codes: [codePointName(match[0])] }];
|
|
167
|
+
})
|
|
168
|
+
.reduce<InvisibleRun[]>(joinRuns, []);
|
|
169
|
+
|
|
170
|
+
/** 見せる前後の字数。 */
|
|
171
|
+
const QUOTE_REACH = 20;
|
|
172
|
+
|
|
173
|
+
/** 見えない字を「⟨U+200B⟩」のように見える形にして、前後を引く。 */
|
|
174
|
+
export const visibleQuote = (source: string, span: Span): string =>
|
|
175
|
+
source
|
|
176
|
+
.slice(Math.max(0, span.start - QUOTE_REACH), span.end + QUOTE_REACH)
|
|
177
|
+
.replace(CANDIDATE, (char) => (LAYOUT_CONTROL.test(char) ? char : `⟨${codePointName(char)}⟩`))
|
|
178
|
+
.replace(/\s+/gu, " ")
|
|
179
|
+
.trim();
|
|
180
|
+
|
|
181
|
+
export const invisibleCharacter: Detector = (doc): Finding[] =>
|
|
182
|
+
invisibleRuns(doc.source).map((run) => ({
|
|
183
|
+
rule: "",
|
|
184
|
+
severity: "warning",
|
|
185
|
+
line: 0,
|
|
186
|
+
column: 0,
|
|
187
|
+
quote: visibleQuote(doc.source, run.span),
|
|
188
|
+
values: { code: run.codes.join(" "), count: [...doc.source.slice(run.span.start, run.span.end)].length, offset: run.span.start },
|
|
189
|
+
variant: run.kind,
|
|
190
|
+
}));
|