chaffjs 0.17.0 → 0.18.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/dist/announced-count.d.ts +26 -0
- package/dist/announced-count.d.ts.map +1 -0
- package/dist/announced-count.js +104 -0
- package/dist/announced-count.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.map +1 -1
- package/dist/cli-text.js +8 -4
- package/dist/cli-text.js.map +1 -1
- package/dist/cli.js +33 -30
- package/dist/cli.js.map +1 -1
- package/dist/commands/compare.d.ts +8 -0
- package/dist/commands/compare.d.ts.map +1 -0
- package/dist/commands/compare.js +72 -0
- package/dist/commands/compare.js.map +1 -0
- package/dist/commands/eval.d.ts.map +1 -1
- package/dist/commands/eval.js +17 -9
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/feedback.d.ts +5 -2
- package/dist/commands/feedback.d.ts.map +1 -1
- package/dist/commands/feedback.js +11 -5
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +2 -4
- 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 +65 -0
- package/dist/compare/clock-time.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 +58 -0
- package/dist/compare/extract.js.map +1 -0
- package/dist/compare/fact-text.d.ts +23 -0
- package/dist/compare/fact-text.d.ts.map +1 -0
- package/dist/compare/fact-text.js +47 -0
- package/dist/compare/fact-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 +19 -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 +33 -0
- package/dist/compare/outcome.d.ts.map +1 -0
- package/dist/compare/outcome.js +40 -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 +44 -0
- package/dist/compare/proper-nouns.js.map +1 -0
- package/dist/compare/render.d.ts +9 -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 +24 -0
- package/dist/compare/text-atoms.d.ts.map +1 -0
- package/dist/compare/text-atoms.js +67 -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 +15 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +5 -0
- package/dist/config/load.js.map +1 -1
- package/dist/config/option-problems.d.ts +16 -0
- package/dist/config/option-problems.d.ts.map +1 -0
- package/dist/config/option-problems.js +58 -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 +16 -0
- package/dist/config/style.d.ts.map +1 -0
- package/dist/config/style.js +36 -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 +8 -0
- package/dist/custom/load.d.ts.map +1 -0
- package/dist/custom/load.js +11 -0
- package/dist/custom/load.js.map +1 -0
- package/dist/custom/parse.d.ts +70 -0
- package/dist/custom/parse.d.ts.map +1 -0
- package/dist/custom/parse.js +215 -0
- package/dist/custom/parse.js.map +1 -0
- package/dist/custom/problems.d.ts +5 -0
- package/dist/custom/problems.d.ts.map +1 -0
- package/dist/custom/problems.js +78 -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.d.ts.map +1 -1
- package/dist/detect.js +24 -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 +20 -0
- package/dist/detectors/ai-phrasing.d.ts.map +1 -0
- package/dist/detectors/ai-phrasing.js +112 -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/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 +4 -0
- package/dist/detectors/dangling-figure.d.ts.map +1 -0
- package/dist/detectors/dangling-figure.js +18 -0
- package/dist/detectors/dangling-figure.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 +33 -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/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/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/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 +34 -1
- package/dist/detectors/index.js.map +1 -1
- 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 +4 -0
- package/dist/detectors/lexicon-match.d.ts.map +1 -1
- package/dist/detectors/lexicon-match.js +7 -2
- package/dist/detectors/lexicon-match.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 +65 -0
- package/dist/detectors/list-sentence.d.ts.map +1 -0
- package/dist/detectors/list-sentence.js +105 -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 +57 -0
- package/dist/detectors/long-vowel.js.map +1 -0
- package/dist/detectors/markup-finding.d.ts +6 -0
- package/dist/detectors/markup-finding.d.ts.map +1 -0
- package/dist/detectors/markup-finding.js +19 -0
- package/dist/detectors/markup-finding.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/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +14 -10
- package/dist/detectors/orthography.js.map +1 -1
- 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 +135 -229
- package/dist/detectors/oxford-comma.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/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/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/structure-tree.d.ts +6 -0
- package/dist/detectors/structure-tree.d.ts.map +1 -1
- package/dist/detectors/structure-tree.js +37 -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 +3 -4
- package/dist/detectors/structure.js.map +1 -1
- 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 +19 -0
- package/dist/detectors/url-run-on.js.map +1 -0
- 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 +11 -4
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +90 -98
- 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/figure-references.d.ts +30 -0
- package/dist/figure-references.d.ts.map +1 -0
- package/dist/figure-references.js +76 -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/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/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/long-vowel.d.ts +35 -0
- package/dist/long-vowel.d.ts.map +1 -0
- package/dist/long-vowel.js +71 -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 +180 -0
- package/dist/markup.js.map +1 -0
- package/dist/mask.js +8 -5
- package/dist/mask.js.map +1 -1
- 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 +2 -0
- package/dist/orthography.d.ts.map +1 -1
- package/dist/orthography.js +9 -4
- package/dist/orthography.js.map +1 -1
- 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 +115 -0
- 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 +3 -0
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +6 -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/explain.d.ts +7 -1
- package/dist/render/explain.d.ts.map +1 -1
- package/dist/render/explain.js +36 -12
- 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 +102 -12
- 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/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 +54 -0
- package/dist/rule-guide.d.ts.map +1 -0
- package/dist/rule-guide.js +81 -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.d.ts +13 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +54 -10
- 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 +6 -1
- package/dist/setting-problems.js.map +1 -1
- 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/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 +21 -0
- package/dist/structure/date-range.d.ts.map +1 -0
- package/dist/structure/date-range.js +45 -0
- package/dist/structure/date-range.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/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 +17 -2
- 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 +19 -0
- package/dist/style-parse.d.ts.map +1 -0
- package/dist/style-parse.js +60 -0
- package/dist/style-parse.js.map +1 -0
- package/dist/subheading-line.d.ts +6 -0
- package/dist/subheading-line.d.ts.map +1 -0
- package/dist/subheading-line.js +57 -0
- package/dist/subheading-line.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 +26 -0
- package/package.json +5 -3
- package/reference-headings.yaml +17 -0
- package/rules/adverb-overuse.yaml +19 -0
- package/rules/agentless-passive.yaml +19 -0
- package/rules/agreement-slip.yaml +14 -1
- package/rules/ai-generated-composite.yaml +102 -0
- package/rules/ai-tell.yaml +23 -0
- package/rules/announced-count-mismatch.yaml +57 -0
- package/rules/announcing-opener.yaml +51 -0
- package/rules/assistant-residue.yaml +52 -0
- package/rules/bold-density.yaml +31 -0
- package/rules/broken-link.yaml +65 -0
- package/rules/closing-cliche.yaml +33 -0
- package/rules/colon-lead-in.yaml +59 -0
- package/rules/concrete-evidence-density.yaml +41 -0
- package/rules/contraction-consistency.yaml +18 -0
- package/rules/contrast-framing.yaml +57 -0
- package/rules/cushion-phrase-density.yaml +25 -0
- package/rules/dangling-figure-reference.yaml +61 -0
- package/rules/dangling-reference.yaml +53 -1
- package/rules/date-order.yaml +33 -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/doubled-punctuation.yaml +45 -0
- package/rules/doubled-word.yaml +17 -1
- package/rules/duplicate-definition.yaml +59 -1
- package/rules/emoji-density.yaml +25 -0
- package/rules/empty-conclusion.yaml +28 -0
- package/rules/empty-intensifier.yaml +19 -0
- package/rules/excessive-hedging.yaml +19 -0
- package/rules/expletive-construction.yaml +19 -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/katakana-long-vowel.yaml +98 -0
- package/rules/kutoten-consistency.yaml +53 -0
- package/rules/latin-spacing.yaml +23 -4
- package/rules/max-kanji-continuous.yaml +16 -0
- package/rules/max-paragraph-length.yaml +33 -0
- package/rules/max-sentence-length.yaml +32 -0
- package/rules/ngram-repetition.yaml +29 -2
- package/rules/no-doubled-joshi.yaml +16 -0
- package/rules/no-em-dash.yaml +25 -0
- package/rules/no-mixed-desumasu.yaml +27 -2
- package/rules/no-nakaguro-parallel.yaml +20 -0
- package/rules/numbering-gap.yaml +53 -1
- package/rules/oxford-comma-consistency.yaml +18 -0
- package/rules/padded-intro.yaml +19 -0
- package/rules/paragraph-length-variance.yaml +49 -0
- package/rules/percent-sum-mismatch.yaml +58 -0
- package/rules/preamble-length.yaml +56 -0
- package/rules/preferred-term.yaml +27 -0
- package/rules/proper-noun-density.yaml +26 -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/risk-disclosure.yaml +22 -0
- package/rules/rule-of-three.yaml +97 -0
- package/rules/sasete-itadaku.yaml +18 -0
- package/rules/section-length-uniformity.yaml +89 -0
- package/rules/sentence-initial-conjunction-run.yaml +18 -0
- package/rules/sentence-rhythm.yaml +25 -0
- package/rules/stock-transition.yaml +55 -0
- package/rules/stray-space.yaml +18 -0
- package/rules/taigen-dome-in-prose.yaml +19 -0
- package/rules/title-case-consistency.yaml +42 -0
- package/rules/total-mismatch.yaml +37 -1
- package/rules/unbalanced-bracket.yaml +56 -0
- package/rules/undefined-acronym.yaml +22 -0
- package/rules/unfilled-placeholder.yaml +50 -0
- package/rules/unqualified-superlative.yaml +19 -0
- package/rules/unsourced-number.yaml +16 -0
- package/rules/url-run-on.yaml +45 -0
- package/skills/chaff/SKILL.md +70 -0
- package/src/announced-count.ts +148 -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 +8 -4
- package/src/cli.ts +37 -37
- package/src/commands/compare.ts +80 -0
- package/src/commands/eval.ts +19 -8
- package/src/commands/feedback.ts +12 -6
- package/src/commands/test.ts +2 -4
- package/src/commands/tree.ts +41 -5
- package/src/compare/atom.ts +33 -0
- package/src/compare/clock-time.ts +86 -0
- package/src/compare/extract.ts +78 -0
- package/src/compare/fact-text.ts +68 -0
- package/src/compare/markup-atoms.ts +29 -0
- package/src/compare/match.ts +105 -0
- package/src/compare/outcome.ts +70 -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 +95 -0
- package/src/compare/text.ts +120 -0
- package/src/compare/tree-atoms.ts +80 -0
- package/src/compare/written-names.ts +26 -0
- package/src/config/load.ts +21 -0
- package/src/config/option-problems.ts +70 -0
- package/src/config/read.ts +8 -0
- package/src/config/rule-problems.ts +12 -2
- package/src/config/style.ts +42 -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 +15 -0
- package/src/custom/parse.ts +274 -0
- package/src/custom/problems.ts +89 -0
- package/src/custom/regex-safety.ts +118 -0
- package/src/custom/token-pattern.ts +84 -0
- package/src/detect.ts +28 -2
- package/src/detectors/acronym-context.ts +16 -4
- package/src/detectors/ai-phrasing.ts +137 -0
- package/src/detectors/announced-count.ts +25 -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 +22 -0
- package/src/detectors/doubled-punctuation.ts +49 -0
- package/src/detectors/doubled-word.ts +19 -4
- package/src/detectors/enumerated-runs.ts +13 -4
- 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/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 +43 -1
- package/src/detectors/kutoten-consistency.ts +96 -0
- package/src/detectors/lead-in.ts +3 -1
- package/src/detectors/lexicon-match.ts +9 -2
- 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 +157 -0
- package/src/detectors/list-view.ts +157 -0
- package/src/detectors/long-vowel.ts +66 -0
- package/src/detectors/markup-finding.ts +24 -0
- package/src/detectors/name-numeral.ts +4 -2
- package/src/detectors/orthography.ts +23 -17
- package/src/detectors/oxford-comma.ts +178 -283
- 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/register.ts +37 -10
- 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/structure-tree.ts +45 -1
- package/src/detectors/structure.ts +3 -4
- 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 +27 -0
- package/src/document-sections.ts +46 -0
- package/src/document.ts +106 -138
- package/src/email-parts.ts +269 -0
- package/src/eval.ts +14 -4
- package/src/figure-references.ts +112 -0
- package/src/files.ts +5 -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/levels.ts +14 -1
- package/src/line-paragraphs.ts +52 -9
- package/src/long-vowel.ts +99 -0
- package/src/markdown-node.ts +19 -0
- package/src/markdown-read.ts +44 -0
- package/src/markup.ts +210 -0
- package/src/mask.ts +8 -8
- package/src/number-name.ts +151 -24
- package/src/orthography.ts +10 -3
- package/src/page-furniture.ts +11 -2
- package/src/plain-source.ts +2 -1
- package/src/plugin.ts +101 -1
- package/src/profile/for-file.ts +3 -1
- package/src/quoted-span.ts +9 -3
- package/src/reasons.ts +9 -0
- package/src/reference-lists.ts +91 -0
- package/src/render/explain.ts +47 -13
- package/src/render/friendly.ts +20 -9
- package/src/render/options.ts +58 -0
- package/src/render/rules-json.ts +130 -14
- 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/text.ts +21 -7
- package/src/resolve-genre.ts +4 -1
- package/src/rule-genres.ts +25 -0
- package/src/rule-guide.ts +135 -0
- package/src/rule-load.ts +91 -34
- package/src/rule-options.ts +131 -0
- package/src/run.ts +74 -11
- package/src/sentence-shape.ts +4 -5
- package/src/setting-problems.ts +7 -1
- package/src/span-cut.ts +28 -0
- 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 +69 -0
- package/src/structure/known-mentions.ts +96 -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 +24 -4
- package/src/structure/wrapped-tail.ts +38 -13
- package/src/style-load.ts +28 -0
- package/src/style-parse.ts +77 -0
- package/src/subheading-line.ts +68 -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 +29 -0
- package/styles/jis-z8301-2011.yaml +25 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/compare/text.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAuB9C,MAAM,QAAQ,GAAuC;IACnD,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,OAAO;IAClB,QAAQ,EAAE,IAAI;CACf,CAAC;AAEF,MAAM,QAAQ,GAAuC;IACnD,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,GAAG,EAAE,MAAM;IACX,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,YAAY;IACnB,OAAO,EAAE,UAAU;IACnB,SAAS,EAAE,YAAY;IACvB,QAAQ,EAAE,WAAW;CACtB,CAAC;AAEF,MAAM,OAAO,GAAuC;IAClD,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,I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from "./atom.ts";
|
|
3
|
+
import { type SpanIndex } from "./spans.ts";
|
|
4
|
+
/** Facts the structure reader found, and where they are written, so no other reader reads the same digits again. */
|
|
5
|
+
export type TreeFacts = {
|
|
6
|
+
readonly atoms: readonly Atom[];
|
|
7
|
+
readonly taken: readonly Span[];
|
|
8
|
+
};
|
|
9
|
+
export type TreeInput = {
|
|
10
|
+
readonly tree: StructureNode;
|
|
11
|
+
readonly source: string;
|
|
12
|
+
/** Code and URLs: what the reader found there belongs to them. */
|
|
13
|
+
readonly blanked: SpanIndex;
|
|
14
|
+
/** Times of day: 3時30分 is one time, not the quantities 3 時 and 30 分. */
|
|
15
|
+
readonly times: SpanIndex;
|
|
16
|
+
readonly lineOf: (offset: number) => number;
|
|
17
|
+
};
|
|
18
|
+
/** Numbers with their unit, dates, references to articles and sections, and the numbered articles themselves. */
|
|
19
|
+
export declare const treeFacts: (input: TreeInput) => TreeFacts;
|
|
20
|
+
//# sourceMappingURL=tree-atoms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-atoms.d.ts","sourceRoot":"","sources":["../../src/compare/tree-atoms.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,IAAI,EAAY,MAAM,WAAW,CAAC;AAChD,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvE,oHAAoH;AACpH,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAA;CAAE,CAAC;AAE7F,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7C,CAAC;AA2DF,iHAAiH;AACjH,eAAO,MAAM,SAAS,GAAI,OAAO,SAAS,KAAG,SAG5C,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { preOrder } from "../tree-walk.js";
|
|
2
|
+
import { coversOffset, overlapsAny } from "./spans.js";
|
|
3
|
+
/** Numbered units that are the document's own structure. Items (a list's 1. 2. 3.) are left out: prose may replace a list. */
|
|
4
|
+
const NUMBERED = new Set(["chapter", "article"]);
|
|
5
|
+
const attr = (node, name) => String(node.attrs[name] ?? "");
|
|
6
|
+
/** The unit as one spelling: GB and GB, % and % are one unit. */
|
|
7
|
+
const unitKey = (unit) => unit.normalize("NFKC");
|
|
8
|
+
const quantityAtom = (node, text, line) => {
|
|
9
|
+
const value = attr(node, "value");
|
|
10
|
+
return { kind: "number", key: `${value} ${unitKey(attr(node, "unit"))}`, text, line, value };
|
|
11
|
+
};
|
|
12
|
+
/** The same section in another wording: Section 4.2 and § 4.2 point at one place; Article 4.2 does not. */
|
|
13
|
+
const referenceKey = (node) => {
|
|
14
|
+
const numbering = attr(node, "numbering") || attr(node, "unitWord");
|
|
15
|
+
const document = attr(node, "document");
|
|
16
|
+
return [numbering, attr(node, "target"), document === "" ? "" : `@${document}`].filter((part) => part !== "").join(" ");
|
|
17
|
+
};
|
|
18
|
+
const leafAtom = (node, kind, text, line) => {
|
|
19
|
+
if (kind === "number")
|
|
20
|
+
return quantityAtom(node, text, line);
|
|
21
|
+
return { kind, key: kind === "date" ? attr(node, "value") : referenceKey(node), text, line };
|
|
22
|
+
};
|
|
23
|
+
const LEAF_KINDS = { quantity: "number", date: "date", reference: "reference" };
|
|
24
|
+
/** The label's place on its line (第3条 after "## "), or none when the line does not spell it. */
|
|
25
|
+
const labelSpan = (node, source) => {
|
|
26
|
+
const label = attr(node, "label");
|
|
27
|
+
const lineEnd = source.indexOf("\n", node.span.start);
|
|
28
|
+
const at = source.indexOf(label, node.span.start);
|
|
29
|
+
return label === "" || at === -1 || (lineEnd !== -1 && at > lineEnd) ? [] : [{ start: at, end: at + label.length }];
|
|
30
|
+
};
|
|
31
|
+
const numberedFacts = (node, input) => {
|
|
32
|
+
const heading = attr(node, "heading");
|
|
33
|
+
const text = [attr(node, "label"), heading].filter((part) => part !== "").join(" ");
|
|
34
|
+
return { atoms: [{ kind: "heading", key: `${node.kind} ${node.address}`, text, line: node.line }], taken: labelSpan(node, input.source) };
|
|
35
|
+
};
|
|
36
|
+
const nodeFacts = (node, input) => {
|
|
37
|
+
if (NUMBERED.has(node.kind))
|
|
38
|
+
return numberedFacts(node, input);
|
|
39
|
+
const kind = LEAF_KINDS[node.kind];
|
|
40
|
+
if (kind === undefined || coversOffset(input.blanked, node.span.start))
|
|
41
|
+
return { atoms: [], taken: [] };
|
|
42
|
+
if (kind === "number" && overlapsAny(input.times, node.span))
|
|
43
|
+
return { atoms: [], taken: [] };
|
|
44
|
+
const span = withUnitAfter(node, input.source);
|
|
45
|
+
const text = input.source.slice(span.start, span.end);
|
|
46
|
+
return { atoms: [leafAtom(node, kind, text, input.lineOf(span.start))], taken: [span] };
|
|
47
|
+
};
|
|
48
|
+
/** A quantity's span may stop before the unit written right after it (25 of 25%); the fact is shown with its unit. */
|
|
49
|
+
const withUnitAfter = (node, source) => {
|
|
50
|
+
const unit = attr(node, "unit");
|
|
51
|
+
return unit !== "" && source.startsWith(unit, node.span.end) ? { start: node.span.start, end: node.span.end + unit.length } : node.span;
|
|
52
|
+
};
|
|
53
|
+
/** Numbers with their unit, dates, references to articles and sections, and the numbered articles themselves. */
|
|
54
|
+
export const treeFacts = (input) => {
|
|
55
|
+
const facts = preOrder(input.tree).map((node) => nodeFacts(node, input));
|
|
56
|
+
return { atoms: facts.flatMap((fact) => fact.atoms), ta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SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IACzE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;AACpG,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Atom } from "./atom.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The names among changes that the other document does not write as often as this one names them. The tagger reads
|
|
4
|
+
* a word as a name by its context (赤松 after から, Scammers before could), so a rewrite can change the tagging without
|
|
5
|
+
* changing the name; the spelling decides. otherText is the other document's prose spelled as name keys are.
|
|
6
|
+
*/
|
|
7
|
+
export declare const unwrittenNames: (changes: readonly Atom[], own: readonly Atom[], otherText: string) => Atom[];
|
|
8
|
+
//# sourceMappingURL=written-names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"written-names.d.ts","sourceRoot":"","sources":["../../src/compare/written-names.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAWtC;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,SAAS,SAAS,IAAI,EAAE,EAAE,KAAK,SAAS,IAAI,EAAE,EAAE,WAAW,MAAM,KAAG,IAAI,EAStG,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const occurrences = (text, needle) => {
|
|
2
|
+
let count = 0;
|
|
3
|
+
for (let at = text.indexOf(needle); at !== -1 && needle !== ""; at = text.indexOf(needle, at + needle.length))
|
|
4
|
+
count += 1;
|
|
5
|
+
return count;
|
|
6
|
+
};
|
|
7
|
+
const namesPerKey = (atoms) => atoms.reduce((counts, atom) => (atom.kind === "name" ? counts.set(atom.key, (counts.get(atom.key) ?? 0) + 1) : counts), new Map());
|
|
8
|
+
/**
|
|
9
|
+
* The names among changes that the other document does not write as often as this one names them. The tagger reads
|
|
10
|
+
* a word as a name by its context (赤松 after から, Scammers before could), so a rewrite can change the tagging without
|
|
11
|
+
* changing the name; the spelling decides. otherText is the other document's prose spelled as name keys are.
|
|
12
|
+
*/
|
|
13
|
+
export const unwrittenNames = (changes, own, otherText) => {
|
|
14
|
+
const named = namesPerKey(own);
|
|
15
|
+
const left = new Map();
|
|
16
|
+
return changes.filter((atom) => {
|
|
17
|
+
if (atom.kind !== "name")
|
|
18
|
+
return true;
|
|
19
|
+
const remaining = left.get(atom.key) ?? Math.max(0, (named.get(atom.key) ?? 0) - occurrences(otherText, atom.key));
|
|
20
|
+
left.set(atom.key, Math.max(0, remaining - 1));
|
|
21
|
+
return remaining > 0;
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=written-names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"written-names.js","sourceRoot":"","sources":["../../src/compare/written-names.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,MAAc,EAAU,EAAE;IAC3D,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,IAAI,MAAM,KAAK,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC;QAAE,KAAK,IAAI,CAAC,CAAC;IAC1H,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,KAAsB,EAAuB,EAAE,CAClE,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,GAAG,EAAkB,CAAC,CAAC;AAErJ;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAwB,EAAE,GAAoB,EAAE,SAAiB,EAAU,EAAE;IAC1G,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;IACvC,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QAC7B,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM;YAAE,OAAO,IAAI,CAAC;QACtC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACnH,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC;QAC/C,OAAO,SAAS,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/dist/config/load.d.ts
CHANGED
|
@@ -33,6 +33,21 @@ export type Config = {
|
|
|
33
33
|
/** パスごとの上書き。設定ファイルのある場所からの相対で照合する。 */
|
|
34
34
|
readonly byPath: readonly PathRule[];
|
|
35
35
|
readonly baseDir: string;
|
|
36
|
+
/** Options set on rules that take them: { rule id: { option: value } }, as written. rule-options.ts checks them against the rules. */
|
|
37
|
+
readonly options?: Readonly<Record<string, unknown>>;
|
|
38
|
+
/** options as written when it is not a map. Dropping it silently would leave a team thinking its options apply. */
|
|
39
|
+
readonly unreadableOptions?: string | undefined;
|
|
40
|
+
/** The house style chaff.yaml names (styles/*.yaml), as written. A value that is not a name is kept printed, to be reported. */
|
|
41
|
+
readonly style?: string | undefined;
|
|
42
|
+
/** The style once applied (config/style.ts): its id, the rules whose level it decided, and its options. */
|
|
43
|
+
readonly applied?: AppliedStyle | undefined;
|
|
44
|
+
/** custom_rules as written: the team's own rules. custom/parse.ts reads and checks them. */
|
|
45
|
+
readonly customRules?: unknown;
|
|
46
|
+
};
|
|
47
|
+
export type AppliedStyle = {
|
|
48
|
+
readonly style: string;
|
|
49
|
+
readonly levelsFrom: readonly string[];
|
|
50
|
+
readonly options: Readonly<Record<string, unknown>>;
|
|
36
51
|
};
|
|
37
52
|
export declare const EMPTY: Config;
|
|
38
53
|
/** 設定ファイルが無くても動く。あっても、既定から変えたものだけが書かれている。spec §18。 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../src/config/load.ts"],"names":[],"mappings":"AAKA,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,eAAO,MAAM,WAAW,eAAe,CAAC;AAExC,MAAM,MAAM,MAAM,GAAG;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,oDAAoD;IACpD,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,QAAQ,C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AAS,MAAM,EAAE,CAAC;IAC5C,sCAAsC;IACtC,QAAQ,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,sIAAsI;IACtI,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACrD,mHAAmH;IACnH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChD,gIAAgI;IAChI,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,2GAA2G;IAC3G,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IAC5C,4FAA4F;IAC5F,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACrD,CAAC;AAMF,eAAO,MAAM,KAAK,EAAE,MAmBnB,CAAC;AA2EF,sDAAsD;AACtD,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,KAAG,MA+BzC,CAAC"}
|
package/dist/config/load.js
CHANGED
|
@@ -95,6 +95,7 @@ export const loadConfig = (path) => {
|
|
|
95
95
|
const declared = raw["ai_backend"];
|
|
96
96
|
const backend = isBackend(declared) ? declared : DEFAULT_BACKEND;
|
|
97
97
|
const names = namesOf(raw["names"]);
|
|
98
|
+
const options = raw["options"];
|
|
98
99
|
return {
|
|
99
100
|
genre: str(raw["genre"]),
|
|
100
101
|
profile: str(raw["profile"]),
|
|
@@ -114,6 +115,10 @@ export const loadConfig = (path) => {
|
|
|
114
115
|
unreadableNames: names.unreadable,
|
|
115
116
|
byPath: byPathOf(raw["by_path"]),
|
|
116
117
|
baseDir: dirname(path),
|
|
118
|
+
options: isRecord(options) ? options : {},
|
|
119
|
+
unreadableOptions: options === undefined || options === null || isRecord(options) ? undefined : printed(options),
|
|
120
|
+
style: raw["style"] === undefined || raw["style"] === null ? undefined : (str(raw["style"]) ?? printed(raw["style"])),
|
|
121
|
+
customRules: raw["custom_rules"],
|
|
117
122
|
};
|
|
118
123
|
};
|
|
119
124
|
//# sourceMappingURL=load.js.map
|
package/dist/config/load.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/config/load.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAoB,MAAM,sBAAsB,CAAC;AAInE,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/config/load.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAoB,MAAM,sBAAsB,CAAC;AAInE,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC;AAgDxC,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AAO,CAAC,KAAK,SAAS,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QACrH,WAAW,EAAE,GAAG,CAAC,cAAc,CAAC;KACjC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Config } from "./load.ts";
|
|
2
|
+
import type { RuleDefinition } from "../plugin.ts";
|
|
3
|
+
import { type OptionLayer } from "../rule-options.ts";
|
|
4
|
+
import type { UiLanguage } from "../ui.ts";
|
|
5
|
+
/** Where chaff.yaml's options come from, for settleOptions: the file itself. */
|
|
6
|
+
export declare const configOptionLayer: (config: Pick<Config, "options">) => OptionLayer;
|
|
7
|
+
/** Where a rule's settings come from, for explain: the option layers, and the style when it set the level. */
|
|
8
|
+
export declare const settingSourcesOf: (config: Pick<Config, "options" | "applied">, ruleId: string) => {
|
|
9
|
+
optionLayers: OptionLayer[];
|
|
10
|
+
levelFrom: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
/** Every place options come from, strongest first: chaff.yaml, then its style. */
|
|
13
|
+
export declare const optionLayersOf: (config: Pick<Config, "options" | "applied">) => OptionLayer[];
|
|
14
|
+
/** chaff.yaml's options that change nothing. Said on every run, like an unknown rule under rules: silence would look like it applied. */
|
|
15
|
+
export declare const configOptionProblems: (config: Pick<Config, "options" | "unreadableOptions" | "path">, rules: readonly RuleDefinition[], ui: UiLanguage) => string[];
|
|
16
|
+
//# sourceMappingURL=option-problems.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"option-problems.d.ts","sourceRoot":"","sources":["../../src/config/option-problems.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAkB,KAAK,WAAW,EAAsB,MAAM,oBAAoB,CAAC;AAE1F,OAAO,KAAK,EAAS,UAAU,EAAE,MAAM,UAAU,CAAC;AAElD,gFAAgF;AAChF,eAAO,MAAM,iBAAiB,GAAI,QAAQ,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,KAAG,WAGlE,CAAC;AAEH,8GAA8G;AAC9G,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC,EAC3C,QAAQ,MAAM,KACb;IAAE,YAAY,EAAE,WAAW,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;CAG7D,CAAC;AAEH,kFAAkF;AAClF,eAAO,MAAM,cAAc,GAAI,QAAQ,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC,KAAG,WAAW,EAGvF,CAAC;AAkCF,yIAAyI;AACzI,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,mBAAmB,GAAG,MAAM,CAAC,EAC9D,OAAO,SAAS,cAAc,EAAE,EAChC,IAAI,UAAU,KACb,MAAM,EAKR,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { CONFIG_FILE } from "./load.js";
|
|
2
|
+
import { optionProblems } from "../rule-options.js";
|
|
3
|
+
import { styleLevelSource, styleSource } from "./style.js";
|
|
4
|
+
/** Where chaff.yaml's options come from, for settleOptions: the file itself. */
|
|
5
|
+
export const configOptionLayer = (config) => ({
|
|
6
|
+
from: CONFIG_FILE,
|
|
7
|
+
values: config.options ?? {},
|
|
8
|
+
});
|
|
9
|
+
/** Where a rule's settings come from, for explain: the option layers, and the style when it set the level. */
|
|
10
|
+
export const settingSourcesOf = (config, ruleId) => ({
|
|
11
|
+
optionLayers: optionLayersOf(config),
|
|
12
|
+
levelFrom: styleLevelSource(config, ruleId),
|
|
13
|
+
});
|
|
14
|
+
/** Every place options come from, strongest first: chaff.yaml, then its style. */
|
|
15
|
+
export const optionLayersOf = (config) => [
|
|
16
|
+
configOptionLayer(config),
|
|
17
|
+
...(config.applied === undefined ? [] : [{ from: styleSource(config.applied.style), values: config.applied.options }]),
|
|
18
|
+
];
|
|
19
|
+
const TEXT = {
|
|
20
|
+
ja: {
|
|
21
|
+
notAMap: (where, value) => `${where}: options の ${value} は読めません。ルールの名前の下に、オプションの名前と値を並べてください`,
|
|
22
|
+
problem: (where, problem) => {
|
|
23
|
+
if (problem.kind === "unknown-rule")
|
|
24
|
+
return `${where}: options の ${problem.rule} というルールはありません(npx chaff rules --json で一覧が出ます)`;
|
|
25
|
+
if (problem.kind === "no-options")
|
|
26
|
+
return `${where}: ${problem.rule} にはオプションがありません。options に書いても何も変わりません`;
|
|
27
|
+
if (problem.kind === "not-a-map")
|
|
28
|
+
return `${where}: options の ${problem.rule} の下には、オプションの名前と値を並べてください`;
|
|
29
|
+
if (problem.kind === "unknown-option")
|
|
30
|
+
return `${where}: ${problem.rule} に ${problem.option} というオプションはありません(使えるのは ${problem.known.join(" / ")})`;
|
|
31
|
+
return `${where}: ${problem.rule} の ${problem.option} の値 ${problem.value} は読めません(${problem.expected})。既定のまま動きます`;
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
en: {
|
|
35
|
+
notAMap: (where, value) => `${where}: cannot read ${value} under options. Under each rule's name, list option names and values`,
|
|
36
|
+
problem: (where, problem) => {
|
|
37
|
+
if (problem.kind === "unknown-rule")
|
|
38
|
+
return `${where}: there is no rule named ${problem.rule} under options (npx chaff rules --json lists them)`;
|
|
39
|
+
if (problem.kind === "no-options")
|
|
40
|
+
return `${where}: ${problem.rule} takes no options, so writing some changes nothing`;
|
|
41
|
+
if (problem.kind === "not-a-map")
|
|
42
|
+
return `${where}: under options, ${problem.rule} needs option names and values`;
|
|
43
|
+
if (problem.kind === "unknown-option")
|
|
44
|
+
return `${where}: ${problem.rule} has no option ${problem.option} (it takes ${problem.known.join(" / ")})`;
|
|
45
|
+
return `${where}: cannot read ${problem.value} as ${problem.rule}'s ${problem.option} (${problem.expected}); it stays at its default`;
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
const optionsByRule = (rules) => Object.fromEntries(rules.map((rule) => [rule.id, rule.options ?? {}]));
|
|
50
|
+
/** chaff.yaml's options that change nothing. Said on every run, like an unknown rule under rules: silence would look like it applied. */
|
|
51
|
+
export const configOptionProblems = (config, rules, ui) => {
|
|
52
|
+
const text = TEXT[ui];
|
|
53
|
+
const where = config.path ?? "chaff.yaml";
|
|
54
|
+
if (config.unreadableOptions !== undefined)
|
|
55
|
+
return [text.notAMap(where, config.unreadableOptions)];
|
|
56
|
+
return optionProblems(configOptionLayer(config), optionsByRule(rules)).map((problem) => text.problem(where, problem));
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=option-problems.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"option-problems.js","sourceRoot":"","sources":["../../src/config/option-problems.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,WAAW,CAAC;AAErD,OAAO,EAAE,cAAc,EAAwC,MAAM,oBAAoB,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG3D,gFAAgF;AAChF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAA+B,EAAe,EAAE,CAAC,CAAC;IAClF,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE,MAAM,CAAC,OAAO,IAAI,EAAE;CAC7B,CAAC,CAAC;AAEH,8GAA8G;AAC9G,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,MAA2C,EAC3C,MAAc,EACkD,EAAE,CAAC,CAAC;IACpE,YAAY,EAAE,cAAc,CAAC,MAAM,CAAC;IACpC,SAAS,EAAE,gBAAgB,CAAC,M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AAC,CAAC;IACtB,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,IAAI,YAAY,CAAC;IAC1C,IAAI,MAAM,CAAC,iBAAiB,KAAK,SAAS;QAAE,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACnG,OAAO,cAAc,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AACxH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/config/read.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkC,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAIxE,wFAAwF;AACxF,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,KAAG,MAAoH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { CONFIG_FILE, EMPTY, loadConfig } from "./load.js";
|
|
4
|
+
import { withStyle } from "./style.js";
|
|
5
|
+
import { loadStyles } from "../style-load.js";
|
|
6
|
+
/** The chaff.yaml in dir with its style applied, or the defaults when there is none. */
|
|
7
|
+
export const readConfigIn = (dir) => (existsSync(join(dir, CONFIG_FILE)) ? withStyle(loadConfig(join(dir, CONFIG_FILE)), loadStyles()) : EMPTY);
|
|
8
|
+
//# sourceMappingURL=read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/config/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAe,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,wFAAwF;AACxF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAW,EAAU,EAAE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { Config } from "./load.ts";
|
|
2
|
+
import type { RuleDefinition } from "../plugin.ts";
|
|
2
3
|
import type { UiLanguage } from "../ui.ts";
|
|
3
4
|
/**
|
|
4
5
|
* chaff.yaml の rules のうち、効いていないもの。知らない rule 名と、読めない値。
|
|
5
6
|
* どちらも黙って捨てると、書いた人は設定したつもりで何も変わっていない。打ち間違いがいちばん多い。
|
|
6
7
|
*/
|
|
7
|
-
export declare const ruleProblems: (config: Pick<Config, "rules" | "limits" | "unreadableRules" | "path">, known: readonly
|
|
8
|
-
readonly id: string;
|
|
9
|
-
readonly layer: string;
|
|
10
|
-
}[], ui?: UiLanguage) => string[];
|
|
8
|
+
export declare const ruleProblems: (config: Pick<Config, "rules" | "limits" | "unreadableRules" | "path">, known: readonly Pick<RuleDefinition, "id" | "layer" | "level_sets">[], ui?: UiLanguage) => string[];
|
|
11
9
|
//# sourceMappingURL=rule-problems.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-problems.d.ts","sourceRoot":"","sources":["../../src/config/rule-problems.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAS,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"rule-problems.d.ts","sourceRoot":"","sources":["../../src/config/rule-problems.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAS,UAAU,EAAE,MAAM,UAAU,CAAC;AAyBlD;;;GAGG;AACH,eAAO,MAAM,YAAY,GACvB,QAAQ,IAAI,CAAC,MAAM,EAAE,OAAO,GAAG,QAAQ,GAAG,iBAAiB,GAAG,MAAM,CAAC,EACrE,OAAO,SAAS,IAAI,CAAC,cAAc,EAAE,IAAI,GAAG,OAAO,GAAG,YAAY,CAAC,EAAE,EACrE,KAAI,UAAiB,KACpB,MAAM,EAiBR,CAAC"}
|
|
@@ -3,11 +3,13 @@ const TEXT = {
|
|
|
3
3
|
unknown: (where, id) => `${where}: ${id} というルールはありません(npx chaff rules --json で一覧が出ます)`,
|
|
4
4
|
unreadable: (where, id, value) => `${where}: ${id} の値 ${value} は読めません(strict / normal / relaxed / off か、正の数)`,
|
|
5
5
|
numberOnSemantic: (where, id) => `${where}: ${id} は意味を読む検査なので数値の上限はありません。normal として動きます(strict / normal / relaxed / off で書いてください)`,
|
|
6
|
+
numberOnSeverity: (where, id) => `${where}: ${id} には数の上限がありません。normal として動きます(段階は指摘の重さを変えます。relaxed で一段軽く、off で止まります)`,
|
|
6
7
|
},
|
|
7
8
|
en: {
|
|
8
9
|
unknown: (where, id) => `${where}: there is no rule named ${id} (npx chaff rules --json lists them)`,
|
|
9
10
|
unreadable: (where, id, value) => `${where}: cannot read ${value} as the level of ${id} (strict / normal / relaxed / off, or a positive number)`,
|
|
10
11
|
numberOnSemantic: (where, id) => `${where}: ${id} reads meaning and has no numeric limit; it runs as normal (write strict / normal / relaxed / off)`,
|
|
12
|
+
numberOnSeverity: (where, id) => `${where}: ${id} has no numeric limit; it runs as normal (its levels set how a finding is marked: relaxed lowers it a step, off stops it)`,
|
|
11
13
|
},
|
|
12
14
|
};
|
|
13
15
|
/**
|
|
@@ -26,6 +28,10 @@ export const ruleProblems = (config, known, ui = "ja") => {
|
|
|
26
28
|
const numberOnSemantic = Object.keys(config.limits)
|
|
27
29
|
.filter((id) => semantic.has(id))
|
|
28
30
|
.map((id) => text.numberOnSemantic(where, id));
|
|
29
|
-
|
|
31
|
+
const nothingToCount = new Set(known.filter((rule) => rule.layer !== "L4" && rule.level_sets === "severity").map((rule) => rule.id));
|
|
32
|
+
const numberOnSeverity = Object.keys(config.limits)
|
|
33
|
+
.filter((id) => nothingToCount.has(id))
|
|
34
|
+
.map((id) => text.numberOnSeverity(where, id));
|
|
35
|
+
return [...unknown, ...unreadable, ...numberOnSemantic, ...numberOnSeverity];
|
|
30
36
|
};
|
|
31
37
|
//# sourceMappingURL=rule-problems.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-problems.js","sourceRoot":"","sources":["../../src/config/rule-problems.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rule-problems.js","sourceRoot":"","sources":["../../src/config/rule-problems.ts"],"names":[],"mappings":"AAIA,MAAM,IAAI,GAKL;IACH,EAAE,EAAE;QACF,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,KAAK,EAAE,+CAA+C;QACtF,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,KAAK,EAAE,OAAO,KAAK,gDAAgD;QAC7G,gBAAgB,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAC9B,GAAG,KAAK,KAAK,EAAE,kFAAkF;QACnG,gBAAgB,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAC9B,GAAG,KAAK,KAAK,EAAE,sEAAsE;KACxF;IACD,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AChD,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;SACtC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;IACjD,OAAO,CAAC,GAAG,OAAO,EAAE,GAAG,UAAU,EAAE,GAAG,gBAAgB,EAAE,GAAG,gBAAgB,CAAC,CAAC;AAC/E,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Config } from "./load.ts";
|
|
2
|
+
import type { StyleDefinition } from "../style-parse.ts";
|
|
3
|
+
import type { UiLanguage } from "../ui.ts";
|
|
4
|
+
/** How a style is named where a setting's source is shown (rules --json, explain). */
|
|
5
|
+
export declare const styleSource: (id: string) => string;
|
|
6
|
+
/** Where a rule's level came from when the style set it; undefined when chaff.yaml, the genre or the default did. */
|
|
7
|
+
export declare const styleLevelSource: (config: Pick<Config, "applied">, ruleId: string) => string | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* chaff.yaml with its style applied. A style's levels sit under chaff.yaml's own rules and over the genre's preset, since
|
|
10
|
+
* they join rules (which run.ts already puts over the preset). Its options become a layer under chaff.yaml's options.
|
|
11
|
+
* Without a style, or with one chaff does not have (settingProblems stops the run on that), the config is unchanged.
|
|
12
|
+
*/
|
|
13
|
+
export declare const withStyle: (config: Config, styles: readonly StyleDefinition[]) => Config;
|
|
14
|
+
/** A style chaff does not have. It stops the run, like an unknown genre: running without it would check less than was asked. */
|
|
15
|
+
export declare const styleProblems: (config: Pick<Config, "style" | "path">, styles: readonly StyleDefinition[], ui: UiLanguage) => string[];
|
|
16
|
+
//# sourceMappingURL=style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/config/style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAS,UAAU,EAAE,MAAM,UAAU,CAAC;AAElD,sFAAsF;AACtF,eAAO,MAAM,WAAW,GAAI,IAAI,MAAM,KAAG,MAAwB,CAAC;AAElE,qHAAqH;AACrH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,QAAQ,MAAM,KAAG,MAAM,GAAG,SACU,CAAC;AAEvG;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,QAAQ,MAAM,EAAE,QAAQ,SAAS,eAAe,EAAE,KAAG,MAS9E,CAAC;AAWF,gIAAgI;AAChI,eAAO,MAAM,aAAa,GAAI,QAAQ,IAAI,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,EAAE,QAAQ,SAAS,eAAe,EAAE,EAAE,IAAI,UAAU,KAAG,MAAM,EAIhI,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** How a style is named where a setting's source is shown (rules --json, explain). */
|
|
2
|
+
export const styleSource = (id) => `style: ${id}`;
|
|
3
|
+
/** Where a rule's level came from when the style set it; undefined when chaff.yaml, the genre or the default did. */
|
|
4
|
+
export const styleLevelSource = (config, ruleId) => config.applied?.levelsFrom.includes(ruleId) === true ? styleSource(config.applied.style) : undefined;
|
|
5
|
+
/**
|
|
6
|
+
* chaff.yaml with its style applied. A style's levels sit under chaff.yaml's own rules and over the genre's preset, since
|
|
7
|
+
* they join rules (which run.ts already puts over the preset). Its options become a layer under chaff.yaml's options.
|
|
8
|
+
* Without a style, or with one chaff does not have (settingProblems stops the run on that), the config is unchanged.
|
|
9
|
+
*/
|
|
10
|
+
export const withStyle = (config, styles) => {
|
|
11
|
+
const style = styles.find((entry) => entry.id === config.style);
|
|
12
|
+
if (style === undefined)
|
|
13
|
+
return config;
|
|
14
|
+
const fromStyle = Object.keys(style.rules).filter((id) => config.rules[id] === undefined && config.limits[id] === undefined);
|
|
15
|
+
return {
|
|
16
|
+
...config,
|
|
17
|
+
rules: { ...style.rules, ...config.rules },
|
|
18
|
+
applied: { style: style.id, levelsFrom: fromStyle, options: style.options },
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
const TEXT = {
|
|
22
|
+
ja: {
|
|
23
|
+
unknown: (where, style, known) => `${where}: style: ${style} というスタイルはありません。使えるのは ${known} です`,
|
|
24
|
+
},
|
|
25
|
+
en: {
|
|
26
|
+
unknown: (where, style, known) => `${where}: there is no style named ${style}. The styles are ${known}`,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
/** A style chaff does not have. It stops the run, like an unknown genre: running without it would check less than was asked. */
|
|
30
|
+
export const styleProblems = (config, styles, ui) => {
|
|
31
|
+
const written = config.style;
|
|
32
|
+
if (written === undefined || styles.some((style) => style.id === written))
|
|
33
|
+
return [];
|
|
34
|
+
return [`chaff: ${TEXT[ui].unknown(config.path ?? "chaff.yaml", written, styles.map((style) => style.id).join(", "))}`];
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../src/config/style.ts"],"names":[],"mappings":"AAIA,sFAAsF;AACtF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAU,EAAU,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC;AAElE,qHAAqH;AACrH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAA+B,EAAE,MAAc,EAAsB,EAAE,CACtG,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAEvG;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,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M,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,CAAC;IACrF,OAAO,CAAC,UAAU,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;AAC1H,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Config } from "./load.ts";
|
|
2
|
+
import type { RuleDefinition } from "../plugin.ts";
|
|
3
|
+
import type { UiLanguage } from "../ui.ts";
|
|
4
|
+
/** Everything in chaff.yaml that has no effect: unknown rules or levels, unreadable names, options that do not apply. Said before the results. */
|
|
5
|
+
export declare const settingWarnings: (config: Config, rules: readonly RuleDefinition[], ui: UiLanguage) => string[];
|
|
6
|
+
//# sourceMappingURL=warnings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warnings.d.ts","sourceRoot":"","sources":["../../src/config/warnings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAK3C,kJAAkJ;AAClJ,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,EAAE,OAAO,SAAS,cAAc,EAAE,EAAE,IAAI,UAAU,KAAG,MAAM,EAIxG,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ruleProblems } from "./rule-problems.js";
|
|
2
|
+
import { nameProblems } from "./name-problems.js";
|
|
3
|
+
import { configOptionProblems } from "./option-problems.js";
|
|
4
|
+
/** Everything in chaff.yaml that has no effect: unknown rules or levels, unreadable names, options that do not apply. Said before the results. */
|
|
5
|
+
export const settingWarnings = (config, rules, ui) => [
|
|
6
|
+
...ruleProblems(config, rules, ui),
|
|
7
|
+
...nameProblems(config, ui),
|
|
8
|
+
...configOptionProblems(config, rules, ui),
|
|
9
|
+
];
|
|
10
|
+
//# sourceMappingURL=warnings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warnings.js","sourceRoot":"","sources":["../../src/config/warnings.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,kJAAkJ;AAClJ,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAc,EAAE,KAAgC,EAAE,EAAc,EAAY,EAAE,CAAC;IAC7G,GAAG,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;IAClC,GAAG,YAAY,CAAC,MAAM,EAAE,EAAE,CAAC;IAC3B,GAAG,oBAAoB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;CAC3C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/config/write.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/config/write.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAsC1D,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAe/E;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,EAAE,MAAM,cAAc,EAAE,OAAO,KAAK,EAAE,KAAK,MAAM,GAAG,SAAS,EAAE,UAAU,MAAM,EAAE,KAAK,MAAM,KAAG,aA4BrI,CAAC"}
|
package/dist/config/write.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { Scalar, YAMLMap, isMap, isScalar, parseDocument } from "yaml";
|
|
3
|
-
import { definedLevels } from "../levels.js";
|
|
4
|
-
import {
|
|
3
|
+
import { definedLevels, severityAt } from "../levels.js";
|
|
4
|
+
import { SEVERITY_NAME, withArticle } from "../render/severity-name.js";
|
|
5
|
+
import { readableText } from "../render/text.js";
|
|
5
6
|
import { uiLanguageOf } from "../ui.js";
|
|
6
7
|
const TEXT = {
|
|
7
8
|
ja: {
|
|
@@ -15,6 +16,7 @@ rules:
|
|
|
15
16
|
noSuchLevel: (id, level) => `${id} に ${level} はありません。normal と同じ設定です。\n設定は変更しませんでした。`,
|
|
16
17
|
hasReason: (id, previous) => `${id} には既に理由が書かれています:\n ${previous}\n値を変えるときは --why で新しい理由を書いてください。`,
|
|
17
18
|
done: (id, level, path) => `${id} を ${level} にしました(${path})`,
|
|
19
|
+
severityMoved: (from, to) => `このルールに数の上限はありません。指摘は消えず、${from} ではなく ${to} として出ます。`,
|
|
18
20
|
},
|
|
19
21
|
en: {
|
|
20
22
|
template: `# chaff.yaml — this team's writing rules
|
|
@@ -27,6 +29,7 @@ rules:
|
|
|
27
29
|
noSuchLevel: (id, level) => `${id} has no ${level} level; it is the same as normal.\nThe settings were not changed.`,
|
|
28
30
|
hasReason: (id, previous) => `${id} already has a reason:\n ${previous}\nTo change the level, give a new reason with --why.`,
|
|
29
31
|
done: (id, level, path) => `Set ${id} to ${level} (${path})`,
|
|
32
|
+
severityMoved: (from, to) => `This rule has no numeric limit: its findings still show, as ${withArticle(to)} instead of ${withArticle(from)}.`,
|
|
30
33
|
},
|
|
31
34
|
};
|
|
32
35
|
const today = () => new Date().toISOString().slice(0, 10);
|
|
@@ -36,7 +39,7 @@ const reasonOf = (value) => {
|
|
|
36
39
|
const text = value.comment.trim();
|
|
37
40
|
return text.length === 0 ? undefined : text;
|
|
38
41
|
};
|
|
39
|
-
const ruleComment = (rule, language) => ` ${
|
|
42
|
+
const ruleComment = (rule, language) => ` ${readableText(rule, rule.name, language)}\n ${readableText(rule, rule.why, language)}`;
|
|
40
43
|
const load = (path, language) => parseDocument(existsSync(path) ? readFileSync(path, "utf8") : TEXT[uiLanguageOf(language)].template);
|
|
41
44
|
/**
|
|
42
45
|
* 設定を機械的に書き換えるが、**既存のコメントを壊さない**。
|
|
@@ -75,6 +78,16 @@ export const applyLevel = (path, rule, level, why, language, who) => {
|
|
|
75
78
|
existing.value = value;
|
|
76
79
|
}
|
|
77
80
|
writeFileSync(path, String(doc), "utf8");
|
|
78
|
-
return { ok: true, message: text.done(rule.id, level, path) };
|
|
81
|
+
return { ok: true, message: [text.done(rule.id, level, path), ...severityNote(rule, level, language)].join("\n") };
|
|
82
|
+
};
|
|
83
|
+
/** relax on a rule with nothing to count keeps its findings and lowers them; say so, or the change looks like it did nothing. */
|
|
84
|
+
const severityNote = (rule, level, language) => {
|
|
85
|
+
if (level === "off")
|
|
86
|
+
return [];
|
|
87
|
+
const [from, to] = [severityAt(rule, "normal"), severityAt(rule, level)];
|
|
88
|
+
if (from === to)
|
|
89
|
+
return [];
|
|
90
|
+
const ui = uiLanguageOf(language);
|
|
91
|
+
return [TEXT[ui].severityMoved(SEVERITY_NAME[ui][from], SEVERITY_NAME[ui][to])];
|
|
79
92
|
};
|
|
80
93
|
//# sourceMappingURL=write.js.map
|
package/dist/config/write.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/config/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO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