chaffjs 0.49.0 → 0.51.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.ja.md +30 -3
- package/README.md +30 -2
- package/dist/allow.d.ts +49 -0
- package/dist/allow.d.ts.map +1 -0
- package/dist/allow.js +111 -0
- package/dist/allow.js.map +1 -0
- package/dist/announced-count.d.ts.map +1 -1
- package/dist/announced-count.js +18 -1
- package/dist/announced-count.js.map +1 -1
- package/dist/announced-list.d.ts.map +1 -1
- package/dist/announced-list.js +6 -1
- package/dist/announced-list.js.map +1 -1
- package/dist/check-source.d.ts +13 -3
- package/dist/check-source.d.ts.map +1 -1
- package/dist/check-source.js +23 -6
- package/dist/check-source.js.map +1 -1
- package/dist/cli-text.d.ts +7 -1
- package/dist/cli-text.d.ts.map +1 -1
- package/dist/cli-text.js +8 -2
- package/dist/cli-text.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +16 -13
- package/dist/cli.js.map +1 -1
- package/dist/commands/eval.js +1 -1
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/suppressions.d.ts +4 -1
- package/dist/commands/suppressions.d.ts.map +1 -1
- package/dist/commands/suppressions.js +2 -2
- package/dist/commands/suppressions.js.map +1 -1
- package/dist/commands/test.js +1 -1
- package/dist/commands/test.js.map +1 -1
- package/dist/composite-signals.d.ts +3 -1
- package/dist/composite-signals.d.ts.map +1 -1
- package/dist/composite-signals.js +7 -0
- package/dist/composite-signals.js.map +1 -1
- package/dist/compound-head.d.ts +5 -2
- package/dist/compound-head.d.ts.map +1 -1
- package/dist/compound-head.js +17 -8
- package/dist/compound-head.js.map +1 -1
- package/dist/config/allow-problems.d.ts +8 -0
- package/dist/config/allow-problems.d.ts.map +1 -0
- package/dist/config/allow-problems.js +61 -0
- package/dist/config/allow-problems.js.map +1 -0
- package/dist/config/by-path-problems.d.ts +3 -0
- package/dist/config/by-path-problems.d.ts.map +1 -1
- package/dist/config/by-path-problems.js +21 -2
- package/dist/config/by-path-problems.js.map +1 -1
- package/dist/config/by-path-rules.d.ts +34 -0
- package/dist/config/by-path-rules.d.ts.map +1 -0
- package/dist/config/by-path-rules.js +53 -0
- package/dist/config/by-path-rules.js.map +1 -0
- package/dist/config/by-path.d.ts +15 -0
- package/dist/config/by-path.d.ts.map +1 -1
- package/dist/config/by-path.js.map +1 -1
- package/dist/config/consistent-problems.d.ts +5 -0
- package/dist/config/consistent-problems.d.ts.map +1 -0
- package/dist/config/consistent-problems.js +24 -0
- package/dist/config/consistent-problems.js.map +1 -0
- package/dist/config/load.d.ts +23 -1
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +63 -10
- package/dist/config/load.js.map +1 -1
- package/dist/config/option-problems.d.ts +6 -4
- package/dist/config/option-problems.d.ts.map +1 -1
- package/dist/config/option-problems.js +5 -2
- package/dist/config/option-problems.js.map +1 -1
- package/dist/config/prefer-problems.d.ts +5 -0
- package/dist/config/prefer-problems.d.ts.map +1 -0
- package/dist/config/prefer-problems.js +15 -0
- package/dist/config/prefer-problems.js.map +1 -0
- package/dist/config/prefer.d.ts +21 -0
- package/dist/config/prefer.d.ts.map +1 -0
- package/dist/config/prefer.js +35 -0
- package/dist/config/prefer.js.map +1 -0
- package/dist/config/term-problems.d.ts +5 -0
- package/dist/config/term-problems.d.ts.map +1 -0
- package/dist/config/term-problems.js +25 -0
- package/dist/config/term-problems.js.map +1 -0
- package/dist/config/warnings.d.ts +1 -1
- package/dist/config/warnings.d.ts.map +1 -1
- package/dist/config/warnings.js +9 -2
- package/dist/config/warnings.js.map +1 -1
- package/dist/cross-variants.d.ts +1 -1
- package/dist/cross-variants.d.ts.map +1 -1
- package/dist/cross-variants.js +4 -8
- package/dist/cross-variants.js.map +1 -1
- package/dist/cross-votes.d.ts +13 -0
- package/dist/cross-votes.d.ts.map +1 -1
- package/dist/cross-votes.js +25 -2
- package/dist/cross-votes.js.map +1 -1
- package/dist/custom/parse.d.ts +9 -0
- package/dist/custom/parse.d.ts.map +1 -1
- package/dist/custom/parse.js +11 -2
- package/dist/custom/parse.js.map +1 -1
- package/dist/custom/problems.d.ts.map +1 -1
- package/dist/custom/problems.js +9 -3
- package/dist/custom/problems.js.map +1 -1
- package/dist/custom/scope-field.d.ts +7 -0
- package/dist/custom/scope-field.d.ts.map +1 -0
- package/dist/custom/scope-field.js +14 -0
- package/dist/custom/scope-field.js.map +1 -0
- package/dist/date-format.d.ts +5 -3
- package/dist/date-format.d.ts.map +1 -1
- package/dist/date-format.js +30 -5
- package/dist/date-format.js.map +1 -1
- package/dist/derived/elapsed.d.ts +4 -1
- package/dist/derived/elapsed.d.ts.map +1 -1
- package/dist/derived/elapsed.js +11 -1
- package/dist/derived/elapsed.js.map +1 -1
- package/dist/detectors/acronym-context.d.ts +3 -1
- package/dist/detectors/acronym-context.d.ts.map +1 -1
- package/dist/detectors/acronym-context.js +7 -1
- package/dist/detectors/acronym-context.js.map +1 -1
- package/dist/detectors/acronym-gloss.d.ts +20 -7
- package/dist/detectors/acronym-gloss.d.ts.map +1 -1
- package/dist/detectors/acronym-gloss.js +50 -13
- package/dist/detectors/acronym-gloss.js.map +1 -1
- package/dist/detectors/agentless-passive.d.ts.map +1 -1
- package/dist/detectors/agentless-passive.js +39 -4
- package/dist/detectors/agentless-passive.js.map +1 -1
- package/dist/detectors/agreement-slip.d.ts +2 -0
- package/dist/detectors/agreement-slip.d.ts.map +1 -1
- package/dist/detectors/agreement-slip.js +10 -3
- package/dist/detectors/agreement-slip.js.map +1 -1
- package/dist/detectors/amount-scale.js +2 -2
- package/dist/detectors/amount-scale.js.map +1 -1
- package/dist/detectors/bare-comparative.d.ts +4 -0
- package/dist/detectors/bare-comparative.d.ts.map +1 -1
- package/dist/detectors/bare-comparative.js +27 -3
- package/dist/detectors/bare-comparative.js.map +1 -1
- package/dist/detectors/blank-structure.d.ts +5 -1
- package/dist/detectors/blank-structure.d.ts.map +1 -1
- package/dist/detectors/blank-structure.js +13 -7
- package/dist/detectors/blank-structure.js.map +1 -1
- package/dist/detectors/bold-label.d.ts.map +1 -1
- package/dist/detectors/bold-label.js +12 -6
- package/dist/detectors/bold-label.js.map +1 -1
- package/dist/detectors/bracket-title-date.d.ts +6 -0
- package/dist/detectors/bracket-title-date.d.ts.map +1 -0
- package/dist/detectors/bracket-title-date.js +29 -0
- package/dist/detectors/bracket-title-date.js.map +1 -0
- package/dist/detectors/broken-link.d.ts.map +1 -1
- package/dist/detectors/broken-link.js +12 -1
- package/dist/detectors/broken-link.js.map +1 -1
- package/dist/detectors/capitalised-term.d.ts.map +1 -1
- package/dist/detectors/capitalised-term.js +24 -11
- package/dist/detectors/capitalised-term.js.map +1 -1
- package/dist/detectors/change-rate.d.ts.map +1 -1
- package/dist/detectors/change-rate.js +27 -4
- package/dist/detectors/change-rate.js.map +1 -1
- package/dist/detectors/char-shape.d.ts.map +1 -1
- package/dist/detectors/char-shape.js +12 -17
- package/dist/detectors/char-shape.js.map +1 -1
- package/dist/detectors/chat-citation.d.ts +2 -6
- package/dist/detectors/chat-citation.d.ts.map +1 -1
- package/dist/detectors/chat-citation.js +4 -2
- package/dist/detectors/chat-citation.js.map +1 -1
- package/dist/detectors/chat-mark-extent.d.ts +11 -0
- package/dist/detectors/chat-mark-extent.d.ts.map +1 -0
- package/dist/detectors/chat-mark-extent.js +53 -0
- package/dist/detectors/chat-mark-extent.js.map +1 -0
- package/dist/detectors/clause-shape.d.ts +4 -2
- package/dist/detectors/clause-shape.d.ts.map +1 -1
- package/dist/detectors/clause-shape.js +8 -4
- package/dist/detectors/clause-shape.js.map +1 -1
- package/dist/detectors/conjugated-entry.d.ts +2 -2
- package/dist/detectors/conjugated-entry.d.ts.map +1 -1
- package/dist/detectors/conjugated-entry.js +3 -5
- package/dist/detectors/conjugated-entry.js.map +1 -1
- package/dist/detectors/contraction-mix.d.ts.map +1 -1
- package/dist/detectors/contraction-mix.js +3 -2
- package/dist/detectors/contraction-mix.js.map +1 -1
- package/dist/detectors/contraction-set-apart.d.ts +7 -1
- package/dist/detectors/contraction-set-apart.d.ts.map +1 -1
- package/dist/detectors/contraction-set-apart.js +14 -1
- package/dist/detectors/contraction-set-apart.js.map +1 -1
- package/dist/detectors/contrast-frame.d.ts.map +1 -1
- package/dist/detectors/contrast-frame.js +34 -1
- package/dist/detectors/contrast-frame.js.map +1 -1
- package/dist/detectors/coordinate-adjective.d.ts +5 -3
- package/dist/detectors/coordinate-adjective.d.ts.map +1 -1
- package/dist/detectors/coordinate-adjective.js +49 -1
- package/dist/detectors/coordinate-adjective.js.map +1 -1
- package/dist/detectors/count-per-section.d.ts.map +1 -1
- package/dist/detectors/count-per-section.js +29 -23
- package/dist/detectors/count-per-section.js.map +1 -1
- package/dist/detectors/counter-edge.d.ts +11 -0
- package/dist/detectors/counter-edge.d.ts.map +1 -1
- package/dist/detectors/counter-edge.js +17 -0
- package/dist/detectors/counter-edge.js.map +1 -1
- package/dist/detectors/cross-variant.d.ts.map +1 -1
- package/dist/detectors/cross-variant.js +14 -2
- package/dist/detectors/cross-variant.js.map +1 -1
- package/dist/detectors/currency-notation.js +2 -2
- package/dist/detectors/currency-notation.js.map +1 -1
- package/dist/detectors/custom.d.ts.map +1 -1
- package/dist/detectors/custom.js +6 -4
- package/dist/detectors/custom.js.map +1 -1
- package/dist/detectors/date-format.js +1 -1
- package/dist/detectors/date-format.js.map +1 -1
- package/dist/detectors/date-repeated-day.d.ts +11 -0
- package/dist/detectors/date-repeated-day.d.ts.map +1 -0
- package/dist/detectors/date-repeated-day.js +15 -0
- package/dist/detectors/date-repeated-day.js.map +1 -0
- package/dist/detectors/date-year.d.ts.map +1 -1
- package/dist/detectors/date-year.js +8 -1
- package/dist/detectors/date-year.js.map +1 -1
- package/dist/detectors/defined-term-form.d.ts.map +1 -1
- package/dist/detectors/defined-term-form.js +21 -6
- package/dist/detectors/defined-term-form.js.map +1 -1
- package/dist/detectors/definition-use.d.ts.map +1 -1
- package/dist/detectors/definition-use.js +12 -2
- package/dist/detectors/definition-use.js.map +1 -1
- package/dist/detectors/derived-numbers.d.ts.map +1 -1
- package/dist/detectors/derived-numbers.js +1 -0
- package/dist/detectors/derived-numbers.js.map +1 -1
- package/dist/detectors/document-shape.d.ts +1 -1
- package/dist/detectors/document-shape.d.ts.map +1 -1
- package/dist/detectors/document-shape.js +4 -1
- package/dist/detectors/document-shape.js.map +1 -1
- package/dist/detectors/ellipsis.js +2 -2
- package/dist/detectors/ellipsis.js.map +1 -1
- package/dist/detectors/email-letter.d.ts +5 -1
- package/dist/detectors/email-letter.d.ts.map +1 -1
- package/dist/detectors/email-letter.js +5 -3
- package/dist/detectors/email-letter.js.map +1 -1
- package/dist/detectors/empty-section.d.ts +1 -0
- package/dist/detectors/empty-section.d.ts.map +1 -1
- package/dist/detectors/empty-section.js +10 -1
- package/dist/detectors/empty-section.js.map +1 -1
- package/dist/detectors/en-shape.d.ts.map +1 -1
- package/dist/detectors/en-shape.js +49 -9
- package/dist/detectors/en-shape.js.map +1 -1
- package/dist/detectors/enumeration-marker.d.ts +7 -0
- package/dist/detectors/enumeration-marker.d.ts.map +1 -0
- package/dist/detectors/enumeration-marker.js +8 -0
- package/dist/detectors/enumeration-marker.js.map +1 -0
- package/dist/detectors/event-title-item.d.ts +8 -0
- package/dist/detectors/event-title-item.d.ts.map +1 -0
- package/dist/detectors/event-title-item.js +45 -0
- package/dist/detectors/event-title-item.js.map +1 -0
- package/dist/detectors/example-baseline.d.ts +5 -0
- package/dist/detectors/example-baseline.d.ts.map +1 -1
- package/dist/detectors/example-baseline.js +15 -1
- package/dist/detectors/example-baseline.js.map +1 -1
- package/dist/detectors/filler-word.d.ts +11 -0
- package/dist/detectors/filler-word.d.ts.map +1 -0
- package/dist/detectors/filler-word.js +73 -0
- package/dist/detectors/filler-word.js.map +1 -0
- package/dist/detectors/fullwidth-alnum.d.ts.map +1 -1
- package/dist/detectors/fullwidth-alnum.js +19 -0
- package/dist/detectors/fullwidth-alnum.js.map +1 -1
- package/dist/detectors/gram-furniture.d.ts +1 -0
- package/dist/detectors/gram-furniture.d.ts.map +1 -1
- package/dist/detectors/gram-furniture.js +6 -0
- package/dist/detectors/gram-furniture.js.map +1 -1
- package/dist/detectors/gram-repetition.d.ts.map +1 -1
- package/dist/detectors/gram-repetition.js +8 -2
- package/dist/detectors/gram-repetition.js.map +1 -1
- package/dist/detectors/heading-case.d.ts +1 -0
- package/dist/detectors/heading-case.d.ts.map +1 -1
- package/dist/detectors/heading-case.js +16 -4
- package/dist/detectors/heading-case.js.map +1 -1
- package/dist/detectors/heading-marker-no-space.d.ts +3 -0
- package/dist/detectors/heading-marker-no-space.d.ts.map +1 -0
- package/dist/detectors/heading-marker-no-space.js +49 -0
- package/dist/detectors/heading-marker-no-space.js.map +1 -0
- package/dist/detectors/hyphen-name-suffix.d.ts.map +1 -1
- package/dist/detectors/hyphen-name-suffix.js +3 -2
- package/dist/detectors/hyphen-name-suffix.js.map +1 -1
- package/dist/detectors/inline-item-label.d.ts +6 -0
- package/dist/detectors/inline-item-label.d.ts.map +1 -0
- package/dist/detectors/inline-item-label.js +68 -0
- package/dist/detectors/inline-item-label.js.map +1 -0
- package/dist/detectors/kanji-name-edge.d.ts +5 -0
- package/dist/detectors/kanji-name-edge.d.ts.map +1 -1
- package/dist/detectors/kanji-name-edge.js +9 -0
- package/dist/detectors/kanji-name-edge.js.map +1 -1
- package/dist/detectors/known-correction.d.ts.map +1 -1
- package/dist/detectors/known-correction.js +13 -1
- package/dist/detectors/known-correction.js.map +1 -1
- package/dist/detectors/kutoten-consistency.d.ts.map +1 -1
- package/dist/detectors/kutoten-consistency.js +27 -6
- package/dist/detectors/kutoten-consistency.js.map +1 -1
- package/dist/detectors/lexicon-match.d.ts +2 -0
- package/dist/detectors/lexicon-match.d.ts.map +1 -1
- package/dist/detectors/lexicon-match.js +14 -3
- package/dist/detectors/lexicon-match.js.map +1 -1
- package/dist/detectors/lexicon.d.ts.map +1 -1
- package/dist/detectors/lexicon.js +8 -1
- package/dist/detectors/lexicon.js.map +1 -1
- package/dist/detectors/link-definition.d.ts +3 -0
- package/dist/detectors/link-definition.d.ts.map +1 -0
- package/dist/detectors/link-definition.js +78 -0
- package/dist/detectors/link-definition.js.map +1 -0
- package/dist/detectors/list-item-asides.d.ts +7 -0
- package/dist/detectors/list-item-asides.d.ts.map +1 -0
- package/dist/detectors/list-item-asides.js +25 -0
- package/dist/detectors/list-item-asides.js.map +1 -0
- package/dist/detectors/list-item-clause.d.ts +4 -0
- package/dist/detectors/list-item-clause.d.ts.map +1 -0
- package/dist/detectors/list-item-clause.js +8 -0
- package/dist/detectors/list-item-clause.js.map +1 -0
- package/dist/detectors/list-item.d.ts +2 -0
- package/dist/detectors/list-item.d.ts.map +1 -1
- package/dist/detectors/list-item.js +6 -0
- package/dist/detectors/list-item.js.map +1 -1
- package/dist/detectors/list-items.d.ts.map +1 -1
- package/dist/detectors/list-items.js +12 -3
- package/dist/detectors/list-items.js.map +1 -1
- package/dist/detectors/list-opening-conjunction.d.ts +7 -0
- package/dist/detectors/list-opening-conjunction.d.ts.map +1 -0
- package/dist/detectors/list-opening-conjunction.js +22 -0
- package/dist/detectors/list-opening-conjunction.js.map +1 -0
- package/dist/detectors/list-parallel.d.ts.map +1 -1
- package/dist/detectors/list-parallel.js +17 -16
- package/dist/detectors/list-parallel.js.map +1 -1
- package/dist/detectors/list-run.d.ts.map +1 -1
- package/dist/detectors/list-run.js +15 -3
- package/dist/detectors/list-run.js.map +1 -1
- package/dist/detectors/list-sentence.d.ts +2 -0
- package/dist/detectors/list-sentence.d.ts.map +1 -1
- package/dist/detectors/list-sentence.js.map +1 -1
- package/dist/detectors/list-verb-series.d.ts +6 -0
- package/dist/detectors/list-verb-series.d.ts.map +1 -0
- package/dist/detectors/list-verb-series.js +20 -0
- package/dist/detectors/list-verb-series.js.map +1 -0
- package/dist/detectors/mark-shape.d.ts +5 -2
- package/dist/detectors/mark-shape.d.ts.map +1 -1
- package/dist/detectors/mark-shape.js +40 -23
- package/dist/detectors/mark-shape.js.map +1 -1
- package/dist/detectors/markdown-slip.d.ts +5 -0
- package/dist/detectors/markdown-slip.d.ts.map +1 -1
- package/dist/detectors/markdown-slip.js +23 -0
- package/dist/detectors/markdown-slip.js.map +1 -1
- package/dist/detectors/marked-word.d.ts +10 -0
- package/dist/detectors/marked-word.d.ts.map +1 -0
- package/dist/detectors/marked-word.js +30 -0
- package/dist/detectors/marked-word.js.map +1 -0
- package/dist/detectors/middle-dot.d.ts +1 -1
- package/dist/detectors/middle-dot.d.ts.map +1 -1
- package/dist/detectors/middle-dot.js +21 -2
- package/dist/detectors/middle-dot.js.map +1 -1
- package/dist/detectors/missing-final-period.d.ts.map +1 -1
- package/dist/detectors/missing-final-period.js +17 -1
- package/dist/detectors/missing-final-period.js.map +1 -1
- package/dist/detectors/name-variant-two-things.d.ts +2 -1
- package/dist/detectors/name-variant-two-things.d.ts.map +1 -1
- package/dist/detectors/name-variant-two-things.js +30 -2
- package/dist/detectors/name-variant-two-things.js.map +1 -1
- package/dist/detectors/net-amount-mismatch.d.ts.map +1 -1
- package/dist/detectors/net-amount-mismatch.js +26 -4
- package/dist/detectors/net-amount-mismatch.js.map +1 -1
- package/dist/detectors/nominalization.d.ts.map +1 -1
- package/dist/detectors/nominalization.js +17 -5
- package/dist/detectors/nominalization.js.map +1 -1
- package/dist/detectors/number-style.d.ts +2 -0
- package/dist/detectors/number-style.d.ts.map +1 -1
- package/dist/detectors/number-style.js +5 -0
- package/dist/detectors/number-style.js.map +1 -1
- package/dist/detectors/ordinal-suffix.js +2 -2
- package/dist/detectors/ordinal-suffix.js.map +1 -1
- package/dist/detectors/ordinary-phrase.d.ts +5 -0
- package/dist/detectors/ordinary-phrase.d.ts.map +1 -1
- package/dist/detectors/ordinary-phrase.js +12 -0
- package/dist/detectors/ordinary-phrase.js.map +1 -1
- package/dist/detectors/organisation-run.d.ts +2 -0
- package/dist/detectors/organisation-run.d.ts.map +1 -1
- package/dist/detectors/organisation-run.js +7 -0
- package/dist/detectors/organisation-run.js.map +1 -1
- package/dist/detectors/orthographic-variant-kanji-word.d.ts +22 -0
- package/dist/detectors/orthographic-variant-kanji-word.d.ts.map +1 -0
- package/dist/detectors/orthographic-variant-kanji-word.js +27 -0
- package/dist/detectors/orthographic-variant-kanji-word.js.map +1 -0
- package/dist/detectors/orthographic-variant-open.d.ts.map +1 -1
- package/dist/detectors/orthographic-variant-open.js +2 -1
- package/dist/detectors/orthographic-variant-open.js.map +1 -1
- package/dist/detectors/orthographic-variant-text.d.ts +7 -0
- package/dist/detectors/orthographic-variant-text.d.ts.map +1 -0
- package/dist/detectors/orthographic-variant-text.js +14 -0
- package/dist/detectors/orthographic-variant-text.js.map +1 -0
- package/dist/detectors/orthographic-variant.d.ts.map +1 -1
- package/dist/detectors/orthographic-variant.js +46 -23
- package/dist/detectors/orthographic-variant.js.map +1 -1
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +24 -8
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/oxford-comma.d.ts.map +1 -1
- package/dist/detectors/oxford-comma.js +28 -3
- package/dist/detectors/oxford-comma.js.map +1 -1
- package/dist/detectors/paragraph-run.d.ts +1 -1
- package/dist/detectors/paragraph-run.d.ts.map +1 -1
- package/dist/detectors/paragraph-run.js +6 -4
- package/dist/detectors/paragraph-run.js.map +1 -1
- package/dist/detectors/phone-number-variant.d.ts.map +1 -1
- package/dist/detectors/phone-number-variant.js +2 -1
- package/dist/detectors/phone-number-variant.js.map +1 -1
- package/dist/detectors/phrase-context.d.ts +6 -0
- package/dist/detectors/phrase-context.d.ts.map +1 -0
- package/dist/detectors/phrase-context.js +12 -0
- package/dist/detectors/phrase-context.js.map +1 -0
- package/dist/detectors/phrase-match-all.d.ts +3 -0
- package/dist/detectors/phrase-match-all.d.ts.map +1 -0
- package/dist/detectors/phrase-match-all.js +47 -0
- package/dist/detectors/phrase-match-all.js.map +1 -0
- package/dist/detectors/phrase-match.d.ts +2 -1
- package/dist/detectors/phrase-match.d.ts.map +1 -1
- package/dist/detectors/phrase-match.js +25 -6
- package/dist/detectors/phrase-match.js.map +1 -1
- package/dist/detectors/placeholder-text.d.ts.map +1 -1
- package/dist/detectors/placeholder-text.js +22 -2
- package/dist/detectors/placeholder-text.js.map +1 -1
- package/dist/detectors/placeholder.d.ts +1 -0
- package/dist/detectors/placeholder.d.ts.map +1 -1
- package/dist/detectors/placeholder.js +8 -0
- package/dist/detectors/placeholder.js.map +1 -1
- package/dist/detectors/proper-noun-density.d.ts.map +1 -1
- package/dist/detectors/proper-noun-density.js +10 -6
- package/dist/detectors/proper-noun-density.js.map +1 -1
- package/dist/detectors/pseudo-heading.d.ts +9 -0
- package/dist/detectors/pseudo-heading.d.ts.map +1 -0
- package/dist/detectors/pseudo-heading.js +54 -0
- package/dist/detectors/pseudo-heading.js.map +1 -0
- package/dist/detectors/quote-around.d.ts +4 -1
- package/dist/detectors/quote-around.d.ts.map +1 -1
- package/dist/detectors/quote-around.js +28 -5
- package/dist/detectors/quote-around.js.map +1 -1
- package/dist/detectors/quoted-label.d.ts +8 -0
- package/dist/detectors/quoted-label.d.ts.map +1 -0
- package/dist/detectors/quoted-label.js +18 -0
- package/dist/detectors/quoted-label.js.map +1 -0
- package/dist/detectors/ra-nuki.d.ts +1 -7
- package/dist/detectors/ra-nuki.d.ts.map +1 -1
- package/dist/detectors/ra-nuki.js +2 -27
- package/dist/detectors/ra-nuki.js.map +1 -1
- package/dist/detectors/range-notation.js +2 -2
- package/dist/detectors/range-notation.js.map +1 -1
- package/dist/detectors/register-required.d.ts +27 -0
- package/dist/detectors/register-required.d.ts.map +1 -0
- package/dist/detectors/register-required.js +33 -0
- package/dist/detectors/register-required.js.map +1 -0
- package/dist/detectors/register-voice.d.ts +13 -1
- package/dist/detectors/register-voice.d.ts.map +1 -1
- package/dist/detectors/register-voice.js +27 -0
- package/dist/detectors/register-voice.js.map +1 -1
- package/dist/detectors/registry/enumeration-marker.d.ts +3 -0
- package/dist/detectors/registry/enumeration-marker.d.ts.map +1 -0
- package/dist/detectors/registry/enumeration-marker.js +3 -0
- package/dist/detectors/registry/enumeration-marker.js.map +1 -0
- package/dist/detectors/registry/filler-word.d.ts +3 -0
- package/dist/detectors/registry/filler-word.d.ts.map +1 -0
- package/dist/detectors/registry/filler-word.js +3 -0
- package/dist/detectors/registry/filler-word.js.map +1 -0
- package/dist/detectors/registry/heading-marker-no-space.d.ts +3 -0
- package/dist/detectors/registry/heading-marker-no-space.d.ts.map +1 -0
- package/dist/detectors/registry/heading-marker-no-space.js +3 -0
- package/dist/detectors/registry/heading-marker-no-space.js.map +1 -0
- package/dist/detectors/registry/link-definition-unused.d.ts +3 -0
- package/dist/detectors/registry/link-definition-unused.d.ts.map +1 -0
- package/dist/detectors/registry/link-definition-unused.js +3 -0
- package/dist/detectors/registry/link-definition-unused.js.map +1 -0
- package/dist/detectors/registry/phrase-match-all.d.ts +3 -0
- package/dist/detectors/registry/phrase-match-all.d.ts.map +1 -0
- package/dist/detectors/registry/phrase-match-all.js +3 -0
- package/dist/detectors/registry/phrase-match-all.js.map +1 -0
- package/dist/detectors/registry/pseudo-heading.d.ts +3 -0
- package/dist/detectors/registry/pseudo-heading.d.ts.map +1 -0
- package/dist/detectors/registry/pseudo-heading.js +3 -0
- package/dist/detectors/registry/pseudo-heading.js.map +1 -0
- package/dist/detectors/registry/reversed-link.d.ts +3 -0
- package/dist/detectors/registry/reversed-link.d.ts.map +1 -0
- package/dist/detectors/registry/reversed-link.js +3 -0
- package/dist/detectors/registry/reversed-link.js.map +1 -0
- package/dist/detectors/registry/sa-ire.d.ts +3 -0
- package/dist/detectors/registry/sa-ire.d.ts.map +1 -0
- package/dist/detectors/registry/sa-ire.js +3 -0
- package/dist/detectors/registry/sa-ire.js.map +1 -0
- package/dist/detectors/registry/table-absorbed-line.d.ts +3 -0
- package/dist/detectors/registry/table-absorbed-line.d.ts.map +1 -0
- package/dist/detectors/registry/table-absorbed-line.js +3 -0
- package/dist/detectors/registry/table-absorbed-line.js.map +1 -0
- package/dist/detectors/registry/term-consistency.d.ts +3 -0
- package/dist/detectors/registry/term-consistency.d.ts.map +1 -0
- package/dist/detectors/registry/term-consistency.js +3 -0
- package/dist/detectors/registry/term-consistency.js.map +1 -0
- package/dist/detectors/registry/term-form.d.ts +3 -0
- package/dist/detectors/registry/term-form.d.ts.map +1 -0
- package/dist/detectors/registry/term-form.js +3 -0
- package/dist/detectors/registry/term-form.js.map +1 -0
- package/dist/detectors/relative-pronoun-mix.d.ts +1 -1
- package/dist/detectors/relative-pronoun-mix.d.ts.map +1 -1
- package/dist/detectors/relative-pronoun-mix.js +14 -3
- package/dist/detectors/relative-pronoun-mix.js.map +1 -1
- package/dist/detectors/release-notes.d.ts +7 -0
- package/dist/detectors/release-notes.d.ts.map +1 -0
- package/dist/detectors/release-notes.js +12 -0
- package/dist/detectors/release-notes.js.map +1 -0
- package/dist/detectors/request-owner.d.ts +5 -1
- package/dist/detectors/request-owner.d.ts.map +1 -1
- package/dist/detectors/request-owner.js +53 -1
- package/dist/detectors/request-owner.js.map +1 -1
- package/dist/detectors/requirement-lists.d.ts.map +1 -1
- package/dist/detectors/requirement-lists.js +2 -0
- package/dist/detectors/requirement-lists.js.map +1 -1
- package/dist/detectors/reversed-link.d.ts +3 -0
- package/dist/detectors/reversed-link.d.ts.map +1 -0
- package/dist/detectors/reversed-link.js +31 -0
- package/dist/detectors/reversed-link.js.map +1 -0
- package/dist/detectors/sa-ire.d.ts +3 -0
- package/dist/detectors/sa-ire.d.ts.map +1 -0
- package/dist/detectors/sa-ire.js +5 -0
- package/dist/detectors/sa-ire.js.map +1 -0
- package/dist/detectors/sentence-counts.d.ts.map +1 -1
- package/dist/detectors/sentence-counts.js +24 -9
- package/dist/detectors/sentence-counts.js.map +1 -1
- package/dist/detectors/sentence-ending.d.ts.map +1 -1
- package/dist/detectors/sentence-ending.js +35 -11
- 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 +20 -3
- package/dist/detectors/sentence-length.js.map +1 -1
- package/dist/detectors/sentence-rhythm.d.ts.map +1 -1
- package/dist/detectors/sentence-rhythm.js +6 -2
- package/dist/detectors/sentence-rhythm.js.map +1 -1
- package/dist/detectors/signals.d.ts.map +1 -1
- package/dist/detectors/signals.js +8 -3
- package/dist/detectors/signals.js.map +1 -1
- package/dist/detectors/structure.d.ts +1 -0
- package/dist/detectors/structure.d.ts.map +1 -1
- package/dist/detectors/structure.js +5 -0
- package/dist/detectors/structure.js.map +1 -1
- package/dist/detectors/team.d.ts.map +1 -1
- package/dist/detectors/team.js +42 -9
- package/dist/detectors/team.js.map +1 -1
- package/dist/detectors/technical-docs.d.ts +8 -1
- package/dist/detectors/technical-docs.d.ts.map +1 -1
- package/dist/detectors/technical-docs.js +16 -3
- package/dist/detectors/technical-docs.js.map +1 -1
- package/dist/detectors/term-consistency.d.ts +4 -0
- package/dist/detectors/term-consistency.d.ts.map +1 -0
- package/dist/detectors/term-consistency.js +35 -0
- package/dist/detectors/term-consistency.js.map +1 -0
- package/dist/detectors/term-form.d.ts +4 -0
- package/dist/detectors/term-form.d.ts.map +1 -0
- package/dist/detectors/term-form.js +17 -0
- package/dist/detectors/term-form.js.map +1 -0
- package/dist/detectors/token-shape.d.ts.map +1 -1
- package/dist/detectors/token-shape.js +4 -1
- package/dist/detectors/token-shape.js.map +1 -1
- package/dist/detectors/unbalanced-bracket.d.ts +1 -1
- package/dist/detectors/unbalanced-bracket.d.ts.map +1 -1
- package/dist/detectors/unbalanced-bracket.js +4 -2
- package/dist/detectors/unbalanced-bracket.js.map +1 -1
- package/dist/detectors/unit-spacing.js +2 -2
- package/dist/detectors/unit-spacing.js.map +1 -1
- package/dist/detectors/unknown-word-context.d.ts +2 -0
- package/dist/detectors/unknown-word-context.d.ts.map +1 -1
- package/dist/detectors/unknown-word-context.js +3 -0
- package/dist/detectors/unknown-word-context.js.map +1 -1
- package/dist/detectors/unknown-word.d.ts.map +1 -1
- package/dist/detectors/unknown-word.js +7 -2
- package/dist/detectors/unknown-word.js.map +1 -1
- package/dist/detectors/vague-deadline.d.ts.map +1 -1
- package/dist/detectors/vague-deadline.js +2 -1
- package/dist/detectors/vague-deadline.js.map +1 -1
- package/dist/detectors/vague-density.d.ts.map +1 -1
- package/dist/detectors/vague-density.js +10 -2
- package/dist/detectors/vague-density.js.map +1 -1
- package/dist/detectors/version-mismatch.d.ts.map +1 -1
- package/dist/detectors/version-mismatch.js +5 -1
- package/dist/detectors/version-mismatch.js.map +1 -1
- package/dist/detectors/weasel-word.d.ts.map +1 -1
- package/dist/detectors/weasel-word.js +11 -2
- package/dist/detectors/weasel-word.js.map +1 -1
- package/dist/document-prose.d.ts +17 -0
- package/dist/document-prose.d.ts.map +1 -0
- package/dist/document-prose.js +35 -0
- package/dist/document-prose.js.map +1 -0
- package/dist/document-scope.d.ts +16 -0
- package/dist/document-scope.d.ts.map +1 -0
- package/dist/document-scope.js +51 -0
- package/dist/document-scope.js.map +1 -0
- package/dist/document.d.ts +10 -1
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +26 -37
- package/dist/document.js.map +1 -1
- package/dist/enumeration-marks.d.ts +23 -0
- package/dist/enumeration-marks.d.ts.map +1 -0
- package/dist/enumeration-marks.js +184 -0
- package/dist/enumeration-marks.js.map +1 -0
- package/dist/facts/cross-facts.d.ts +1 -1
- package/dist/facts/cross-facts.d.ts.map +1 -1
- package/dist/facts/cross-facts.js +8 -3
- package/dist/facts/cross-facts.js.map +1 -1
- package/dist/facts/labelled-facts.d.ts.map +1 -1
- package/dist/facts/labelled-facts.js +7 -4
- package/dist/facts/labelled-facts.js.map +1 -1
- package/dist/file-header.d.ts +2 -6
- package/dist/file-header.d.ts.map +1 -1
- package/dist/file-header.js +1 -1
- package/dist/file-header.js.map +1 -1
- package/dist/files.d.ts +18 -1
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +58 -8
- package/dist/files.js.map +1 -1
- package/dist/gitignore.d.ts +30 -0
- package/dist/gitignore.d.ts.map +1 -0
- package/dist/gitignore.js +68 -0
- package/dist/gitignore.js.map +1 -0
- package/dist/grade/stamp.d.ts.map +1 -1
- package/dist/grade/stamp.js +5 -0
- package/dist/grade/stamp.js.map +1 -1
- package/dist/latin-word-boundary.d.ts +5 -0
- package/dist/latin-word-boundary.d.ts.map +1 -1
- package/dist/latin-word-boundary.js +11 -0
- package/dist/latin-word-boundary.js.map +1 -1
- package/dist/levels.d.ts +14 -0
- package/dist/levels.d.ts.map +1 -1
- package/dist/levels.js +8 -3
- package/dist/levels.js.map +1 -1
- package/dist/markdown-node.d.ts +1 -0
- package/dist/markdown-node.d.ts.map +1 -1
- package/dist/markdown-node.js.map +1 -1
- package/dist/name-separator.d.ts.map +1 -1
- package/dist/name-separator.js +27 -5
- package/dist/name-separator.js.map +1 -1
- package/dist/news-dateline.d.ts +7 -0
- package/dist/news-dateline.d.ts.map +1 -0
- package/dist/news-dateline.js +24 -0
- package/dist/news-dateline.js.map +1 -0
- package/dist/phone-numbers.d.ts +5 -2
- package/dist/phone-numbers.d.ts.map +1 -1
- package/dist/phone-numbers.js +17 -3
- package/dist/phone-numbers.js.map +1 -1
- package/dist/plugin.d.ts +26 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/reasons.d.ts +4 -0
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +4 -0
- package/dist/reasons.js.map +1 -1
- package/dist/render/explain.d.ts +5 -0
- package/dist/render/explain.d.ts.map +1 -1
- package/dist/render/explain.js +57 -15
- package/dist/render/explain.js.map +1 -1
- package/dist/render/options.d.ts.map +1 -1
- package/dist/render/options.js +11 -6
- package/dist/render/options.js.map +1 -1
- package/dist/render/rules-json.d.ts.map +1 -1
- package/dist/render/rules-json.js +12 -2
- package/dist/render/rules-json.js.map +1 -1
- package/dist/render/summary.d.ts +5 -2
- package/dist/render/summary.d.ts.map +1 -1
- package/dist/render/summary.js +25 -4
- package/dist/render/summary.js.map +1 -1
- package/dist/render/suppressions.d.ts +6 -1
- package/dist/render/suppressions.d.ts.map +1 -1
- package/dist/render/suppressions.js +76 -3
- package/dist/render/suppressions.js.map +1 -1
- package/dist/render/text.d.ts.map +1 -1
- package/dist/render/text.js +14 -4
- package/dist/render/text.js.map +1 -1
- package/dist/rule-load.d.ts.map +1 -1
- package/dist/rule-load.js +2 -1
- package/dist/rule-load.js.map +1 -1
- package/dist/run-in-title.d.ts +4 -0
- package/dist/run-in-title.d.ts.map +1 -0
- package/dist/run-in-title.js +82 -0
- package/dist/run-in-title.js.map +1 -0
- package/dist/run.d.ts +5 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +40 -21
- package/dist/run.js.map +1 -1
- package/dist/scope-markers.d.ts +9 -0
- package/dist/scope-markers.d.ts.map +1 -0
- package/dist/scope-markers.js +19 -0
- package/dist/scope-markers.js.map +1 -0
- package/dist/scope-problem-text.d.ts +4 -0
- package/dist/scope-problem-text.d.ts.map +1 -0
- package/dist/scope-problem-text.js +17 -0
- package/dist/scope-problem-text.js.map +1 -0
- package/dist/scoped-sentences.d.ts +21 -0
- package/dist/scoped-sentences.d.ts.map +1 -0
- package/dist/scoped-sentences.js +21 -0
- package/dist/scoped-sentences.js.map +1 -0
- package/dist/setting-problems.d.ts.map +1 -1
- package/dist/setting-problems.js +4 -0
- package/dist/setting-problems.js.map +1 -1
- package/dist/spelling.js +4 -4
- package/dist/spelling.js.map +1 -1
- package/dist/stet-body.d.ts +13 -0
- package/dist/stet-body.d.ts.map +1 -0
- package/dist/stet-body.js +49 -0
- package/dist/stet-body.js.map +1 -0
- package/dist/stet.d.ts +30 -4
- package/dist/stet.d.ts.map +1 -1
- package/dist/stet.js +78 -28
- package/dist/stet.js.map +1 -1
- package/dist/structure/alert-lines.d.ts +4 -0
- package/dist/structure/alert-lines.d.ts.map +1 -0
- package/dist/structure/alert-lines.js +19 -0
- package/dist/structure/alert-lines.js.map +1 -0
- package/dist/structure/catch-all-row-blank.d.ts +9 -0
- package/dist/structure/catch-all-row-blank.d.ts.map +1 -0
- package/dist/structure/catch-all-row-blank.js +19 -0
- package/dist/structure/catch-all-row-blank.js.map +1 -0
- package/dist/structure/change-rate-tied.d.ts +22 -0
- package/dist/structure/change-rate-tied.d.ts.map +1 -0
- package/dist/structure/change-rate-tied.js +85 -0
- package/dist/structure/change-rate-tied.js.map +1 -0
- package/dist/structure/cross-definitions.d.ts +1 -1
- package/dist/structure/cross-definitions.d.ts.map +1 -1
- package/dist/structure/cross-definitions.js +3 -9
- package/dist/structure/cross-definitions.js.map +1 -1
- package/dist/structure/deadline-after-event.d.ts +1 -1
- package/dist/structure/deadline-after-event.d.ts.map +1 -1
- package/dist/structure/deadline-after-event.js +36 -9
- package/dist/structure/deadline-after-event.js.map +1 -1
- package/dist/structure/defining-names.d.ts +1 -1
- package/dist/structure/defining-names.d.ts.map +1 -1
- package/dist/structure/defining-names.js +12 -1
- package/dist/structure/defining-names.js.map +1 -1
- package/dist/structure/definition-use.d.ts +10 -1
- package/dist/structure/definition-use.d.ts.map +1 -1
- package/dist/structure/definition-use.js +4 -4
- package/dist/structure/definition-use.js.map +1 -1
- package/dist/structure/leg-times.d.ts.map +1 -1
- package/dist/structure/leg-times.js +10 -2
- package/dist/structure/leg-times.js.map +1 -1
- package/dist/structure/net-amount.d.ts +16 -0
- package/dist/structure/net-amount.d.ts.map +1 -1
- package/dist/structure/net-amount.js +28 -1
- package/dist/structure/net-amount.js.map +1 -1
- package/dist/structure/period-label-conflict.d.ts +2 -2
- package/dist/structure/period-label-conflict.d.ts.map +1 -1
- package/dist/structure/period-label-conflict.js +17 -3
- package/dist/structure/period-label-conflict.js.map +1 -1
- package/dist/structure/requirement-lists.d.ts +3 -0
- package/dist/structure/requirement-lists.d.ts.map +1 -1
- package/dist/structure/requirement-lists.js +8 -2
- package/dist/structure/requirement-lists.js.map +1 -1
- package/dist/structure/serial-range.d.ts.map +1 -1
- package/dist/structure/serial-range.js +14 -6
- package/dist/structure/serial-range.js.map +1 -1
- package/dist/structure/time-marks.d.ts +10 -0
- package/dist/structure/time-marks.d.ts.map +1 -1
- package/dist/structure/time-marks.js +21 -0
- package/dist/structure/time-marks.js.map +1 -1
- package/dist/structure/version-mismatch.d.ts +6 -1
- package/dist/structure/version-mismatch.d.ts.map +1 -1
- package/dist/structure/version-mismatch.js +28 -6
- package/dist/structure/version-mismatch.js.map +1 -1
- package/dist/structure/weekday.d.ts.map +1 -1
- package/dist/structure/weekday.js +14 -1
- package/dist/structure/weekday.js.map +1 -1
- package/dist/table-cells.d.ts +1 -1
- package/dist/table-cells.d.ts.map +1 -1
- package/dist/table-cells.js.map +1 -1
- package/dist/term-form.d.ts +15 -0
- package/dist/term-form.d.ts.map +1 -0
- package/dist/term-form.js +72 -0
- package/dist/term-form.js.map +1 -0
- package/dist/term-groups.d.ts +33 -0
- package/dist/term-groups.d.ts.map +1 -0
- package/dist/term-groups.js +46 -0
- package/dist/term-groups.js.map +1 -0
- package/dist/text-scope.d.ts +35 -0
- package/dist/text-scope.d.ts.map +1 -0
- package/dist/text-scope.js +55 -0
- package/dist/text-scope.js.map +1 -0
- package/dist/topic-clause.d.ts.map +1 -1
- package/dist/topic-clause.js +85 -16
- package/dist/topic-clause.js.map +1 -1
- package/dist/unclosed-code-quote.d.ts +7 -0
- package/dist/unclosed-code-quote.d.ts.map +1 -0
- package/dist/unclosed-code-quote.js +37 -0
- package/dist/unclosed-code-quote.js.map +1 -0
- package/package.json +4 -3
- package/rules/abstract-length.yaml +1 -1
- package/rules/adverb-overuse.yaml +3 -3
- package/rules/agentless-passive.yaml +3 -3
- package/rules/agreement-slip.yaml +5 -4
- package/rules/ai-generated-composite.yaml +3 -3
- package/rules/ai-structure.yaml +1 -1
- package/rules/all-caps-shouting.yaml +1 -1
- package/rules/announced-count-mismatch.yaml +2 -2
- package/rules/announcing-opener.yaml +1 -1
- package/rules/arrival-before-departure.yaml +1 -1
- package/rules/article-sound.yaml +1 -1
- package/rules/baito-keigo.yaml +1 -1
- package/rules/bold-density.yaml +3 -3
- package/rules/bold-emphasis.yaml +1 -1
- package/rules/bold-label-list.yaml +3 -3
- package/rules/bracket-width-consistency.yaml +3 -3
- package/rules/broken-link.yaml +2 -2
- package/rules/change-rate-mismatch.yaml +2 -2
- package/rules/chat-citation-residue.yaml +1 -1
- package/rules/citation-style-mix.yaml +1 -1
- package/rules/clause-chain.yaml +1 -1
- package/rules/cliche.yaml +4 -4
- package/rules/closing-cliche.yaml +1 -1
- package/rules/closing-exhortation.yaml +1 -1
- package/rules/code-fence-language-mix.yaml +2 -2
- package/rules/cold-open.yaml +1 -1
- package/rules/colloquial-opener.yaml +1 -1
- package/rules/comparative-without-baseline.yaml +2 -2
- package/rules/concrete-evidence-density.yaml +1 -1
- package/rules/contraction-consistency.yaml +4 -4
- package/rules/cross-doc-duplicate-definition.yaml +2 -2
- package/rules/cross-doc-fact-conflict.yaml +2 -2
- package/rules/cross-doc-term-variant.yaml +6 -6
- package/rules/cushion-phrase-density.yaml +1 -1
- package/rules/date-format-consistency.yaml +2 -2
- package/rules/date-weekday-mismatch.yaml +2 -2
- package/rules/date-without-year.yaml +2 -2
- package/rules/deadline-after-event.yaml +2 -2
- package/rules/defined-term-form.yaml +2 -2
- package/rules/demonstrative-opener-run.yaml +1 -1
- package/rules/double-keigo.yaml +1 -1
- package/rules/double-negative.yaml +11 -2
- package/rules/doubled-nado.yaml +1 -1
- package/rules/elapsed-years-mismatch.yaml +2 -2
- package/rules/email-stock-courtesy.yaml +1 -1
- package/rules/email-subject-length.yaml +1 -1
- package/rules/emoji-heading.yaml +1 -1
- package/rules/empty-intensifier.yaml +1 -1
- package/rules/empty-section.yaml +2 -2
- package/rules/empty-table-cell.yaml +2 -2
- package/rules/enumeration-marker-mix.yaml +102 -0
- package/rules/excessive-hedging.yaml +1 -1
- package/rules/exclamation-width-consistency.yaml +1 -1
- package/rules/expletive-construction.yaml +3 -3
- package/rules/figurative-density.yaml +3 -3
- package/rules/filler-word.yaml +74 -0
- package/rules/fullwidth-alnum-consistency.yaml +2 -2
- package/rules/heading-marker-no-space.yaml +79 -0
- package/rules/hiragana-fukushi.yaml +1 -1
- package/rules/homophone-slip.yaml +3 -3
- package/rules/honesty-marker.yaml +1 -1
- package/rules/humble-for-others.yaml +1 -1
- package/rules/hyphen-as-dash.yaml +3 -3
- package/rules/idiom-misuse.yaml +1 -1
- package/rules/internal-jargon.yaml +1 -1
- package/rules/kana-function-word.yaml +1 -1
- package/rules/katakana-long-vowel.yaml +1 -1
- package/rules/known-misspelling.yaml +2 -2
- package/rules/kutoten-consistency.yaml +7 -3
- package/rules/latin-abbreviation-form.yaml +1 -1
- package/rules/latin-spacing.yaml +5 -5
- package/rules/link-definition-unused.yaml +107 -0
- package/rules/list-item-form-mix.yaml +2 -2
- package/rules/max-kanji-continuous.yaml +5 -2
- package/rules/max-paragraph-length.yaml +1 -1
- package/rules/max-sentence-length.yaml +3 -3
- package/rules/max-ten.yaml +1 -1
- package/rules/misconversion.yaml +2 -2
- package/rules/missing-final-period.yaml +2 -2
- package/rules/name-variant.yaml +2 -2
- package/rules/net-amount-mismatch.yaml +5 -5
- package/rules/ngram-repetition.yaml +3 -3
- package/rules/no-doubled-joshi.yaml +2 -2
- package/rules/no-em-dash.yaml +3 -3
- package/rules/no-mixed-desumasu.yaml +63 -3
- package/rules/no-nakaguro-parallel.yaml +3 -3
- package/rules/nominalization.yaml +3 -3
- package/rules/nonstandard-word.yaml +2 -2
- package/rules/number-style-consistency.yaml +2 -2
- package/rules/numbered-generic-heading.yaml +1 -1
- package/rules/numbering-gap.yaml +2 -2
- package/rules/obligation-without-deadline.yaml +2 -2
- package/rules/one-sentence-paragraph-run.yaml +3 -3
- package/rules/orthographic-variant.yaml +2 -2
- package/rules/over-general-claim.yaml +1 -1
- package/rules/oxford-comma-consistency.yaml +4 -3
- package/rules/padded-intro.yaml +1 -1
- package/rules/period-label-conflict.yaml +2 -2
- package/rules/phone-number-variant.yaml +1 -1
- package/rules/preamble-length.yaml +3 -3
- package/rules/preferred-term.yaml +1 -1
- package/rules/proper-noun-density.yaml +1 -1
- package/rules/pseudo-heading.yaml +79 -0
- package/rules/q-fragment-answer.yaml +1 -1
- package/rules/quote-style-consistency.yaml +1 -1
- package/rules/quote-without-source.yaml +2 -2
- package/rules/redundant-expression.yaml +1 -1
- package/rules/repeated-conjunction.yaml +1 -1
- package/rules/repeated-sentence-ending.yaml +3 -3
- package/rules/repeated-sentence-head.yaml +5 -5
- package/rules/request-without-deadline.yaml +2 -2
- package/rules/required-listed-as-preferred.yaml +2 -2
- package/rules/required-sections.yaml +1 -1
- package/rules/reversed-link.yaml +78 -0
- package/rules/sa-ire.yaml +43 -0
- package/rules/sasete-itadaku.yaml +1 -1
- package/rules/sentence-initial-conjunction-run.yaml +1 -1
- package/rules/sentence-initial-so.yaml +1 -1
- package/rules/sentence-rhythm.yaml +2 -2
- package/rules/sentence-spacing-consistency.yaml +1 -1
- package/rules/serial-range-reversed.yaml +4 -4
- package/rules/shell-prompt-mix.yaml +3 -3
- package/rules/stock-transition.yaml +1 -1
- package/rules/stray-space.yaml +1 -1
- package/rules/table-absorbed-line.yaml +88 -0
- package/rules/taigen-dome-in-prose.yaml +1 -1
- package/rules/teki-overuse.yaml +3 -3
- package/rules/term-consistency.yaml +56 -0
- package/rules/term-form.yaml +56 -0
- package/rules/title-case-consistency.yaml +5 -5
- package/rules/title-length.yaml +3 -3
- package/rules/topic-predicate-distance.yaml +3 -3
- package/rules/translationese-density.yaml +1 -1
- package/rules/unbalanced-bracket.yaml +2 -2
- package/rules/uncomparable-graded.yaml +1 -1
- package/rules/undefined-acronym.yaml +5 -3
- package/rules/undefined-term.yaml +2 -2
- package/rules/unfilled-placeholder.yaml +4 -4
- package/rules/unknown-word.yaml +2 -2
- package/rules/unqualified-superlative.yaml +1 -1
- package/rules/use-before-definition.yaml +2 -2
- package/rules/vague-word-density.yaml +3 -3
- package/rules/version-mismatch.yaml +2 -2
- package/rules/weasel-word.yaml +4 -4
- package/rules/which-that-consistency.yaml +3 -3
- package/rules/wordy-phrase.yaml +1 -1
- package/skills/chaff/SKILL.md +51 -7
- package/src/allow.ts +146 -0
- package/src/announced-count.ts +22 -1
- package/src/announced-list.ts +7 -1
- package/src/check-source.ts +33 -9
- package/src/cli-text.ts +13 -4
- package/src/cli.ts +20 -17
- package/src/commands/eval.ts +1 -1
- package/src/commands/suppressions.ts +3 -3
- package/src/commands/test.ts +1 -1
- package/src/composite-signals.ts +10 -1
- package/src/compound-head.ts +17 -8
- package/src/config/allow-problems.ts +75 -0
- package/src/config/by-path-problems.ts +29 -3
- package/src/config/by-path-rules.ts +78 -0
- package/src/config/by-path.ts +9 -0
- package/src/config/consistent-problems.ts +36 -0
- package/src/config/load.ts +87 -15
- package/src/config/option-problems.ts +8 -5
- package/src/config/prefer-problems.ts +22 -0
- package/src/config/prefer.ts +52 -0
- package/src/config/term-problems.ts +38 -0
- package/src/config/warnings.ts +9 -2
- package/src/cross-variants.ts +4 -7
- package/src/cross-votes.ts +35 -4
- package/src/custom/parse.ts +16 -3
- package/src/custom/problems.ts +9 -3
- package/src/custom/scope-field.ts +16 -0
- package/src/date-format.ts +43 -8
- package/src/derived/elapsed.ts +17 -2
- package/src/detectors/acronym-context.ts +7 -1
- package/src/detectors/acronym-gloss.ts +59 -11
- package/src/detectors/agentless-passive.ts +49 -5
- package/src/detectors/agreement-slip.ts +11 -3
- package/src/detectors/amount-scale.ts +2 -2
- package/src/detectors/bare-comparative.ts +35 -3
- package/src/detectors/blank-structure.ts +18 -9
- package/src/detectors/bold-label.ts +7 -2
- package/src/detectors/bracket-title-date.ts +36 -0
- package/src/detectors/broken-link.ts +14 -1
- package/src/detectors/capitalised-term.ts +18 -4
- package/src/detectors/change-rate.ts +29 -4
- package/src/detectors/char-shape.ts +13 -17
- package/src/detectors/chat-citation.ts +4 -5
- package/src/detectors/chat-mark-extent.ts +63 -0
- package/src/detectors/clause-shape.ts +8 -4
- package/src/detectors/conjugated-entry.ts +3 -5
- package/src/detectors/contraction-mix.ts +8 -2
- package/src/detectors/contraction-set-apart.ts +22 -2
- package/src/detectors/contrast-frame.ts +37 -2
- package/src/detectors/coordinate-adjective.ts +54 -1
- package/src/detectors/count-per-section.ts +13 -8
- package/src/detectors/counter-edge.ts +20 -0
- package/src/detectors/cross-variant.ts +16 -2
- package/src/detectors/currency-notation.ts +2 -2
- package/src/detectors/custom.ts +6 -4
- package/src/detectors/date-format.ts +1 -1
- package/src/detectors/date-repeated-day.ts +20 -0
- package/src/detectors/date-year.ts +8 -1
- package/src/detectors/defined-term-form.ts +21 -7
- package/src/detectors/definition-use.ts +12 -9
- package/src/detectors/derived-numbers.ts +1 -0
- package/src/detectors/document-shape.ts +4 -1
- package/src/detectors/ellipsis.ts +2 -2
- package/src/detectors/email-letter.ts +7 -3
- package/src/detectors/empty-section.ts +10 -2
- package/src/detectors/en-shape.ts +57 -6
- package/src/detectors/enumeration-marker.ts +14 -0
- package/src/detectors/event-title-item.ts +57 -0
- package/src/detectors/example-baseline.ts +16 -1
- package/src/detectors/filler-word.ts +96 -0
- package/src/detectors/fullwidth-alnum.ts +24 -0
- package/src/detectors/gram-furniture.ts +8 -0
- package/src/detectors/gram-repetition.ts +8 -1
- package/src/detectors/heading-case.ts +18 -4
- package/src/detectors/heading-marker-no-space.ts +62 -0
- package/src/detectors/hyphen-name-suffix.ts +3 -2
- package/src/detectors/inline-item-label.ts +98 -0
- package/src/detectors/kanji-name-edge.ts +11 -0
- package/src/detectors/known-correction.ts +17 -1
- package/src/detectors/kutoten-consistency.ts +37 -6
- package/src/detectors/lexicon-match.ts +17 -3
- package/src/detectors/lexicon.ts +10 -4
- package/src/detectors/link-definition.ts +91 -0
- package/src/detectors/list-item-asides.ts +29 -0
- package/src/detectors/list-item-clause.ts +9 -0
- package/src/detectors/list-item.ts +7 -0
- package/src/detectors/list-items.ts +13 -2
- package/src/detectors/list-opening-conjunction.ts +22 -0
- package/src/detectors/list-parallel.ts +16 -17
- package/src/detectors/list-run.ts +16 -3
- package/src/detectors/list-sentence.ts +2 -0
- package/src/detectors/list-verb-series.ts +24 -0
- package/src/detectors/mark-shape.ts +51 -27
- package/src/detectors/markdown-slip.ts +25 -1
- package/src/detectors/marked-word.ts +40 -0
- package/src/detectors/middle-dot.ts +27 -2
- package/src/detectors/missing-final-period.ts +19 -1
- package/src/detectors/name-variant-two-things.ts +37 -2
- package/src/detectors/net-amount-mismatch.ts +41 -4
- package/src/detectors/nominalization.ts +22 -5
- package/src/detectors/number-style.ts +8 -0
- package/src/detectors/ordinal-suffix.ts +2 -2
- package/src/detectors/ordinary-phrase.ts +13 -0
- package/src/detectors/organisation-run.ts +9 -0
- package/src/detectors/orthographic-variant-kanji-word.ts +33 -0
- package/src/detectors/orthographic-variant-open.ts +2 -1
- package/src/detectors/orthographic-variant-text.ts +20 -0
- package/src/detectors/orthographic-variant.ts +61 -32
- package/src/detectors/orthography.ts +36 -10
- package/src/detectors/oxford-comma.ts +28 -2
- package/src/detectors/paragraph-run.ts +9 -12
- package/src/detectors/phone-number-variant.ts +2 -1
- package/src/detectors/phrase-context.ts +19 -0
- package/src/detectors/phrase-match-all.ts +57 -0
- package/src/detectors/phrase-match.ts +31 -6
- package/src/detectors/placeholder-text.ts +36 -3
- package/src/detectors/placeholder.ts +10 -0
- package/src/detectors/proper-noun-density.ts +14 -6
- package/src/detectors/pseudo-heading.ts +59 -0
- package/src/detectors/quote-around.ts +37 -6
- package/src/detectors/quoted-label.ts +22 -0
- package/src/detectors/ra-nuki.ts +3 -34
- package/src/detectors/range-notation.ts +2 -2
- package/src/detectors/register-required.ts +56 -0
- package/src/detectors/register-voice.ts +36 -1
- package/src/detectors/registry/enumeration-marker.ts +4 -0
- package/src/detectors/registry/filler-word.ts +4 -0
- package/src/detectors/registry/heading-marker-no-space.ts +4 -0
- package/src/detectors/registry/link-definition-unused.ts +4 -0
- package/src/detectors/registry/phrase-match-all.ts +4 -0
- package/src/detectors/registry/pseudo-heading.ts +4 -0
- package/src/detectors/registry/reversed-link.ts +4 -0
- package/src/detectors/registry/sa-ire.ts +4 -0
- package/src/detectors/registry/table-absorbed-line.ts +4 -0
- package/src/detectors/registry/term-consistency.ts +4 -0
- package/src/detectors/registry/term-form.ts +4 -0
- package/src/detectors/relative-pronoun-mix.ts +18 -3
- package/src/detectors/release-notes.ts +19 -0
- package/src/detectors/request-owner.ts +62 -2
- package/src/detectors/requirement-lists.ts +2 -0
- package/src/detectors/reversed-link.ts +39 -0
- package/src/detectors/sa-ire.ts +7 -0
- package/src/detectors/sentence-counts.ts +35 -13
- package/src/detectors/sentence-ending.ts +53 -12
- package/src/detectors/sentence-length.ts +28 -4
- package/src/detectors/sentence-rhythm.ts +6 -2
- package/src/detectors/signals.ts +12 -3
- package/src/detectors/structure.ts +4 -0
- package/src/detectors/team.ts +50 -12
- package/src/detectors/technical-docs.ts +27 -3
- package/src/detectors/term-consistency.ts +41 -0
- package/src/detectors/term-form.ts +17 -0
- package/src/detectors/token-shape.ts +4 -1
- package/src/detectors/unbalanced-bracket.ts +4 -2
- package/src/detectors/unit-spacing.ts +2 -2
- package/src/detectors/unknown-word-context.ts +6 -0
- package/src/detectors/unknown-word.ts +7 -1
- package/src/detectors/vague-deadline.ts +2 -1
- package/src/detectors/vague-density.ts +10 -2
- package/src/detectors/version-mismatch.ts +7 -1
- package/src/detectors/weasel-word.ts +13 -2
- package/src/document-prose.ts +43 -0
- package/src/document-scope.ts +66 -0
- package/src/document.ts +43 -50
- package/src/enumeration-marks.ts +233 -0
- package/src/facts/cross-facts.ts +10 -4
- package/src/facts/labelled-facts.ts +7 -4
- package/src/file-header.ts +3 -5
- package/src/files.ts +87 -8
- package/src/gitignore.ts +83 -0
- package/src/grade/stamp.ts +5 -0
- package/src/latin-word-boundary.ts +12 -0
- package/src/levels.ts +9 -3
- package/src/markdown-node.ts +1 -0
- package/src/name-separator.ts +29 -7
- package/src/news-dateline.ts +29 -0
- package/src/phone-numbers.ts +19 -3
- package/src/plugin.ts +23 -3
- package/src/reasons.ts +8 -0
- package/src/render/explain.ts +72 -17
- package/src/render/options.ts +12 -6
- package/src/render/rules-json.ts +16 -2
- package/src/render/summary.ts +33 -4
- package/src/render/suppressions.ts +101 -4
- package/src/render/text.ts +20 -7
- package/src/rule-load.ts +3 -2
- package/src/run-in-title.ts +91 -0
- package/src/run.ts +53 -16
- package/src/scope-markers.ts +25 -0
- package/src/scope-problem-text.ts +21 -0
- package/src/scoped-sentences.ts +41 -0
- package/src/setting-problems.ts +4 -0
- package/src/spelling.ts +4 -4
- package/src/stet-body.ts +74 -0
- package/src/stet.ts +113 -32
- package/src/structure/alert-lines.ts +19 -0
- package/src/structure/catch-all-row-blank.ts +22 -0
- package/src/structure/change-rate-tied.ts +113 -0
- package/src/structure/cross-definitions.ts +6 -9
- package/src/structure/deadline-after-event.ts +49 -10
- package/src/structure/defining-names.ts +14 -1
- package/src/structure/definition-use.ts +15 -5
- package/src/structure/leg-times.ts +16 -1
- package/src/structure/net-amount.ts +44 -5
- package/src/structure/period-label-conflict.ts +22 -7
- package/src/structure/requirement-lists.ts +14 -2
- package/src/structure/serial-range.ts +14 -6
- package/src/structure/time-marks.ts +25 -0
- package/src/structure/version-mismatch.ts +41 -8
- package/src/structure/weekday.ts +14 -1
- package/src/table-cells.ts +2 -2
- package/src/term-form.ts +99 -0
- package/src/term-groups.ts +68 -0
- package/src/text-scope.ts +79 -0
- package/src/topic-clause.ts +96 -17
- package/src/unclosed-code-quote.ts +42 -0
- package/dist/honorific-group.d.ts +0 -8
- package/dist/honorific-group.d.ts.map +0 -1
- package/dist/honorific-group.js +0 -15
- package/dist/honorific-group.js.map +0 -1
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
// The numbers written at the head of list items and numbered paragraphs (1. / (1) / ① / 一、 / i) / a.), and the runs they
|
|
2
|
+
// form: items at one indentation, one after another, with nothing but their own text between. Pure; reads lines only.
|
|
3
|
+
|
|
4
|
+
/** What a number is written with. Case counts: (a) and (A) are two forms. */
|
|
5
|
+
type NumeralKind = "arabic" | "kanji" | "circled" | "paren-sign" | "lower-letter" | "upper-letter" | "lower-roman" | "upper-roman";
|
|
6
|
+
|
|
7
|
+
/** What follows or encloses the number: 1. / 1) / (1) / 一、. A circled or parenthesised sign (①, ⑴) has none. */
|
|
8
|
+
type Delimiter = "dot" | "close" | "paren" | "comma" | "sign";
|
|
9
|
+
|
|
10
|
+
/** One numbered item: where its number starts, the number as written, its form and its place in the counting. */
|
|
11
|
+
export type EnumerationItem = {
|
|
12
|
+
readonly start: number;
|
|
13
|
+
readonly lineEnd: number;
|
|
14
|
+
readonly mark: string;
|
|
15
|
+
readonly form: string;
|
|
16
|
+
readonly value: number;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type Reading = { readonly kind: NumeralKind; readonly value: number };
|
|
20
|
+
|
|
21
|
+
const FULLWIDTH_OFFSET = 0xfee0;
|
|
22
|
+
const halfWidth = (text: string): string => text.replace(/[0-9A-Za-z]/gu, (char) => String.fromCharCode(char.charCodeAt(0) - FULLWIDTH_OFFSET));
|
|
23
|
+
|
|
24
|
+
const KANJI_DIGITS: Readonly<Record<string, number>> = { 一: 1, 二: 2, 三: 3, 四: 4, 五: 5, 六: 6, 七: 7, 八: 8, 九: 9 };
|
|
25
|
+
const KANJI_TEN = "十";
|
|
26
|
+
const TEN = 10;
|
|
27
|
+
|
|
28
|
+
/** 一 … 九十九. */
|
|
29
|
+
const kanjiValue = (text: string): number | undefined => {
|
|
30
|
+
const [tens = "", ones = ""] = text.includes(KANJI_TEN) ? text.split(KANJI_TEN) : ["", text];
|
|
31
|
+
const writtenTens = tens === "" ? 1 : KANJI_DIGITS[tens];
|
|
32
|
+
const tensValue = text.includes(KANJI_TEN) ? writtenTens : 0;
|
|
33
|
+
const onesValue = ones === "" ? 0 : KANJI_DIGITS[ones];
|
|
34
|
+
return tensValue === undefined || onesValue === undefined || tens.length > 1 || ones.length > 1 ? undefined : tensValue * TEN + onesValue;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const ROMAN_VALUES: Readonly<Record<string, number>> = { i: 1, v: 5, x: 10 };
|
|
38
|
+
const ROMAN = /^x{0,3}(?:ix|iv|v?i{0,3})$/u;
|
|
39
|
+
|
|
40
|
+
/** i … xxxix; undefined if the letters are not a Roman number. */
|
|
41
|
+
const romanValue = (text: string): number | undefined => {
|
|
42
|
+
const lower = text.toLowerCase();
|
|
43
|
+
if (lower === "" || !ROMAN.test(lower)) return undefined;
|
|
44
|
+
const values = [...lower].map((char) => ROMAN_VALUES[char] ?? 0);
|
|
45
|
+
return values.reduce((sum, value, at) => (value < (values[at + 1] ?? 0) ? sum - value : sum + value), 0);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const LETTER_BASE = "a".charCodeAt(0) - 1;
|
|
49
|
+
const letterValue = (char: string): number => char.toLowerCase().charCodeAt(0) - LETTER_BASE;
|
|
50
|
+
const isUpper = (text: string): boolean => text === text.toUpperCase();
|
|
51
|
+
|
|
52
|
+
/** A single i, v or x is a letter or a Roman number; the item before it decides. */
|
|
53
|
+
const AMBIGUOUS = /^[ivxIVX]$/u;
|
|
54
|
+
|
|
55
|
+
const CIRCLED_FIRST = 0x2460;
|
|
56
|
+
const CIRCLED_LAST = 0x2473;
|
|
57
|
+
const CIRCLED_LATER_FIRST = 0x3251;
|
|
58
|
+
const CIRCLED_LATER_LAST = 0x325f;
|
|
59
|
+
const CIRCLED_LATER_VALUE = 21;
|
|
60
|
+
const PAREN_SIGN_FIRST = 0x2474;
|
|
61
|
+
const PAREN_SIGN_LAST = 0x2487;
|
|
62
|
+
|
|
63
|
+
const signReading = (char: string): Reading | undefined => {
|
|
64
|
+
const code = char.codePointAt(0) ?? 0;
|
|
65
|
+
if (code >= CIRCLED_FIRST && code <= CIRCLED_LAST) return { kind: "circled", value: code - CIRCLED_FIRST + 1 };
|
|
66
|
+
if (code >= CIRCLED_LATER_FIRST && code <= CIRCLED_LATER_LAST) return { kind: "circled", value: code - CIRCLED_LATER_FIRST + CIRCLED_LATER_VALUE };
|
|
67
|
+
if (code >= PAREN_SIGN_FIRST && code <= PAREN_SIGN_LAST) return { kind: "paren-sign", value: code - PAREN_SIGN_FIRST + 1 };
|
|
68
|
+
return undefined;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** The readings of a number written with letters or digits, the likelier first. */
|
|
72
|
+
const readingsOf = (numeral: string): Reading[] => {
|
|
73
|
+
const sign = signReading(numeral);
|
|
74
|
+
if (sign !== undefined) return [sign];
|
|
75
|
+
const text = halfWidth(numeral);
|
|
76
|
+
if (/^\d+$/u.test(text)) return [{ kind: "arabic", value: Number(text) }];
|
|
77
|
+
const kanji = kanjiValue(text);
|
|
78
|
+
if (kanji !== undefined) return [{ kind: "kanji", value: kanji }];
|
|
79
|
+
const roman = romanValue(text);
|
|
80
|
+
const romanReading: Reading[] = roman === undefined ? [] : [{ kind: isUpper(text) ? "upper-roman" : "lower-roman", value: roman }];
|
|
81
|
+
const letterReading: Reading[] = /^[a-zA-Z]$/u.test(text) ? [{ kind: isUpper(text) ? "upper-letter" : "lower-letter", value: letterValue(text) }] : [];
|
|
82
|
+
return AMBIGUOUS.test(text) && text.toLowerCase() !== "i" ? [...letterReading, ...romanReading] : [...romanReading, ...letterReading];
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const NUMERAL = "[0-90-9]{1,3}|[一二三四五六七八九十]{1,3}|[a-zA-Za-zA-Z]|[ivxIVX]{2,6}";
|
|
86
|
+
const SIGN = "[\\u2460-\\u2487\\u3251-\\u325f]";
|
|
87
|
+
|
|
88
|
+
/** What may follow the number: a space, or a word or an opening quotation written straight after it. */
|
|
89
|
+
const TEXT_FOLLOWS = '(?=[\\s\\u3000]*[\\p{L}「『“"`((])';
|
|
90
|
+
|
|
91
|
+
/** The forms an item's number is written in, tried in order. Letters with a dot must be followed by a space (e.g. is not an item). */
|
|
92
|
+
const SHAPES: ReadonlyArray<{ readonly delimiter: Delimiter; readonly pattern: RegExp }> = [
|
|
93
|
+
{ delimiter: "paren", pattern: new RegExp(`^[((](${NUMERAL})[))]${TEXT_FOLLOWS}`, "u") },
|
|
94
|
+
{ delimiter: "close", pattern: new RegExp(`^(${NUMERAL})[))]${TEXT_FOLLOWS}`, "u") },
|
|
95
|
+
{ delimiter: "dot", pattern: new RegExp(`^([0-90-9]{1,3}|[一二三四五六七八九十]{1,3})[..](?![0-90-9])${TEXT_FOLLOWS}`, "u") },
|
|
96
|
+
{ delimiter: "dot", pattern: /^([a-zA-Z]|[ivxIVX]{2,6})\.(?=[ \t\u3000]+\p{L})/u },
|
|
97
|
+
{ delimiter: "comma", pattern: /^([0-90-9]{1,3}|[一二三四五六七八九十]{1,3})、(?=\p{L}|[「『])/u },
|
|
98
|
+
{ delimiter: "sign", pattern: new RegExp(`^(${SIGN})${TEXT_FOLLOWS}`, "u") },
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
/** A number at the head of a line with no other number before it: the mark as written, the number inside, and how it is delimited. */
|
|
102
|
+
type Head = { readonly mark: string; readonly numeral: string; readonly delimiter: Delimiter };
|
|
103
|
+
|
|
104
|
+
const headOf = (text: string): Head | undefined => {
|
|
105
|
+
const shape = SHAPES.map((candidate) => ({ candidate, match: candidate.pattern.exec(text) })).find(({ match }) => match !== null);
|
|
106
|
+
const numeral = shape?.match?.[1];
|
|
107
|
+
const mark = shape?.match?.[0];
|
|
108
|
+
return shape === undefined || numeral === undefined || mark === undefined ? undefined : { mark, numeral, delimiter: shape.candidate.delimiter };
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/** Lines that close every run: a heading, a rule, a table row, a quotation. */
|
|
112
|
+
const BREAK = /^(?:#{1,6}(?:\s|$)|[-*_](?:\s*[-*_]){2,}\s*$|\||>)/u;
|
|
113
|
+
|
|
114
|
+
const INDENT = /^[ \t\u3000]*/u;
|
|
115
|
+
const TAB_WIDTH = 4;
|
|
116
|
+
const widthOf = (indent: string): number => [...indent].reduce((width, char) => width + (char === "\t" ? TAB_WIDTH : 1), 0);
|
|
117
|
+
|
|
118
|
+
type Line = { readonly start: number; readonly text: string };
|
|
119
|
+
|
|
120
|
+
const linesOf = (text: string): Line[] => {
|
|
121
|
+
const lines: Line[] = [];
|
|
122
|
+
text.split("\n").forEach((line) => {
|
|
123
|
+
const previous = lines.at(-1);
|
|
124
|
+
lines.push({ start: previous === undefined ? 0 : previous.start + previous.text.length + 1, text: line });
|
|
125
|
+
});
|
|
126
|
+
return lines;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/** An item before the form is settled: a single i, v or x waits for the item before it. */
|
|
130
|
+
type Candidate = Omit<EnumerationItem, "form" | "value"> & { readonly delimiter: Delimiter; readonly readings: readonly Reading[] };
|
|
131
|
+
|
|
132
|
+
const formOf = (reading: Reading, delimiter: Delimiter): string =>
|
|
133
|
+
reading.kind === "circled" || reading.kind === "paren-sign" ? reading.kind : `${reading.kind}:${delimiter}`;
|
|
134
|
+
|
|
135
|
+
/** Settles each item's reading: the one that goes on from the item before it, else the one of the same kind, else the likelier. */
|
|
136
|
+
const settled = (candidates: readonly Candidate[]): EnumerationItem[] =>
|
|
137
|
+
candidates.reduce<EnumerationItem[]>((items, candidate) => {
|
|
138
|
+
const previous = items.at(-1);
|
|
139
|
+
const sameKind = (reading: Reading): boolean => previous !== undefined && formOf(reading, candidate.delimiter) === previous.form;
|
|
140
|
+
const reading =
|
|
141
|
+
candidate.readings.find((option) => sameKind(option) && option.value === (previous?.value ?? 0) + 1) ??
|
|
142
|
+
candidate.readings.find(sameKind) ??
|
|
143
|
+
candidate.readings[0];
|
|
144
|
+
if (reading === undefined) return items;
|
|
145
|
+
const { start, lineEnd, mark } = candidate;
|
|
146
|
+
return [...items, { start, lineEnd, mark, form: formOf(reading, candidate.delimiter), value: reading.value }];
|
|
147
|
+
}, []);
|
|
148
|
+
|
|
149
|
+
type OpenRun = { readonly indent: number; readonly items: Candidate[] };
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* The runs of numbered items in a text: items at one indentation, one after another. A line of text right under an item, or
|
|
153
|
+
* indented deeper than it, belongs to the item. A run ends at a heading, a rule, a table or a quotation, at a line less indented
|
|
154
|
+
* than its items, and at a new paragraph that starts at its indentation without a number.
|
|
155
|
+
*/
|
|
156
|
+
export const enumerationRuns = (text: string): EnumerationItem[][] => {
|
|
157
|
+
const closed: Candidate[][] = [];
|
|
158
|
+
const open: OpenRun[] = [];
|
|
159
|
+
const closeWhere = (keep: (run: OpenRun) => boolean): void => {
|
|
160
|
+
const kept = open.filter(keep);
|
|
161
|
+
closed.push(...open.filter((run) => !keep(run)).map((run) => run.items));
|
|
162
|
+
open.splice(0, open.length, ...kept);
|
|
163
|
+
};
|
|
164
|
+
const state = { afterBlank: false };
|
|
165
|
+
linesOf(text).forEach((line) => {
|
|
166
|
+
const afterBlank = state.afterBlank;
|
|
167
|
+
const indentText = INDENT.exec(line.text)?.[0] ?? "";
|
|
168
|
+
const body = line.text.slice(indentText.length);
|
|
169
|
+
state.afterBlank = body.trim() === "";
|
|
170
|
+
if (state.afterBlank) return;
|
|
171
|
+
if (BREAK.test(body)) {
|
|
172
|
+
closeWhere(() => false);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
const indent = widthOf(indentText);
|
|
176
|
+
const head = headOf(body);
|
|
177
|
+
if (head === undefined) {
|
|
178
|
+
closeWhere((run) => run.indent < indent || (run.indent === indent && !afterBlank));
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
closeWhere((run) => run.indent <= indent);
|
|
182
|
+
const run = open.find((candidate) => candidate.indent === indent) ?? { indent, items: [] };
|
|
183
|
+
if (!open.includes(run)) open.push(run);
|
|
184
|
+
const start = line.start + indentText.length;
|
|
185
|
+
run.items.push({ start, lineEnd: line.start + line.text.length, mark: head.mark.trim(), delimiter: head.delimiter, readings: readingsOf(head.numeral) });
|
|
186
|
+
});
|
|
187
|
+
closeWhere(() => false);
|
|
188
|
+
return closed.map(settled).filter((items) => items.length > 0);
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
/** An item written in another form than most items of its run, and the form it differs from. */
|
|
192
|
+
export type EnumerationMinority = { readonly item: EnumerationItem; readonly usual: EnumerationItem; readonly count: number };
|
|
193
|
+
|
|
194
|
+
/** Fewer items than this, and no form is the run's habit yet. */
|
|
195
|
+
const MIN_ITEMS = 3;
|
|
196
|
+
|
|
197
|
+
/** The form most items of a run use; undefined on a tie. */
|
|
198
|
+
const majorityOf = (items: readonly EnumerationItem[]): { readonly form: string; readonly count: number } | undefined => {
|
|
199
|
+
const counts = [...items.reduce((acc, item) => acc.set(item.form, (acc.get(item.form) ?? 0) + 1), new Map<string, number>())].toSorted(
|
|
200
|
+
([, left], [, right]) => right - left,
|
|
201
|
+
);
|
|
202
|
+
const [first, second] = counts;
|
|
203
|
+
return first === undefined || second?.[1] === first[1] ? undefined : { form: first[0], count: first[1] };
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
/** The run's usual form counts up without starting again; one that restarts (a) (b) … (a) (b) is the level below. */
|
|
207
|
+
const neverRestarts = (items: readonly EnumerationItem[], usual: string): boolean =>
|
|
208
|
+
items.filter((item) => item.form === usual).every((item, index, same) => index === 0 || item.value > (same[index - 1]?.value ?? 0));
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Whether the item at `at` counts on with the usual form's numbers: every item from the usual-form item before it to the one
|
|
212
|
+
* after it goes up by one (1. 2. 3) 4.). A sub-list written in its own form starts again at 1 (1. (1) (2) 2.), and is left.
|
|
213
|
+
* So is an item whose own form counted the number before it earlier in the run ((1) (a) (b) (2) (a) (b) (3)): that form is a
|
|
214
|
+
* level of its own.
|
|
215
|
+
*/
|
|
216
|
+
const countsOn = (items: readonly EnumerationItem[], at: number, usual: string): boolean => {
|
|
217
|
+
const before = items.findLastIndex((item, index) => index < at && item.form === usual);
|
|
218
|
+
const afterIndex = items.findIndex((item, index) => index > at && item.form === usual);
|
|
219
|
+
const from = before === -1 ? 0 : before;
|
|
220
|
+
const to = afterIndex === -1 ? items.length - 1 : afterIndex;
|
|
221
|
+
const stretch = items.slice(from, to + 1);
|
|
222
|
+
const own = items[at];
|
|
223
|
+
const ownCounter = items.slice(0, from).some((item) => item.form === own?.form && item.value === own.value - 1);
|
|
224
|
+
return !ownCounter && stretch.length > 1 && stretch.every((item, index) => index === 0 || item.value === (stretch[index - 1]?.value ?? 0) + 1);
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
/** The items of a run written in a minority form while counting on with the others. */
|
|
228
|
+
export const enumerationMinorities = (items: readonly EnumerationItem[]): EnumerationMinority[] => {
|
|
229
|
+
const majority = items.length < MIN_ITEMS ? undefined : majorityOf(items);
|
|
230
|
+
const usual = items.find((item) => item.form === majority?.form);
|
|
231
|
+
if (majority === undefined || usual === undefined || !neverRestarts(items, majority.form)) return [];
|
|
232
|
+
return items.flatMap((item, at) => (item.form !== majority.form && countsOn(items, at, majority.form) ? [{ item, usual, count: majority.count }] : []));
|
|
233
|
+
};
|
package/src/facts/cross-facts.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { tallyVotes, type Vote } from "../cross-votes.ts";
|
|
|
8
8
|
/** A file's labelled facts, by its path. */
|
|
9
9
|
export type FileFacts = { readonly path: string; readonly facts: readonly ScopedFact[] };
|
|
10
10
|
|
|
11
|
-
/** A file whose value for a label differs from the value most files give it: its first fact, and one file of the
|
|
11
|
+
/** A file whose value for a label differs from the value most files give it (or, on an even split, from the other value): its first fact, and one file of the other value. */
|
|
12
12
|
export type FactOutOfStep = { readonly path: string; readonly fact: ScopedFact; readonly usual: Vote<ScopedFact>; readonly files: number };
|
|
13
13
|
|
|
14
14
|
/** Two values the files can be said to agree or disagree on: comparable, and the same. */
|
|
@@ -37,11 +37,17 @@ const comparableGroups = (votes: readonly Vote<ScopedFact>[]): Vote<ScopedFact>[
|
|
|
37
37
|
/** Two values across the files, as with fact-conflict in one section: three or more is read as a list, and left alone. */
|
|
38
38
|
const MAX_VALUES = 2;
|
|
39
39
|
|
|
40
|
+
const against = (side: readonly Vote<ScopedFact>[], other: readonly Vote<ScopedFact>[]): FactOutOfStep[] => {
|
|
41
|
+
const [usual] = other;
|
|
42
|
+
return usual === undefined ? [] : side.map((vote) => ({ path: vote.path, fact: vote.value, usual, files: other.length }));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** The files of the fewer value. When as many files give one value as the other, neither is fewer, and both sides are reported. */
|
|
40
46
|
const outOfStep = (votes: readonly Vote<ScopedFact>[]): FactOutOfStep[] => {
|
|
41
47
|
const tally = tallyVotes(votes, sameFact);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return tally.odd.
|
|
48
|
+
if (tally === undefined || tally.values !== MAX_VALUES) return [];
|
|
49
|
+
const odd = against(tally.odd, tally.usual);
|
|
50
|
+
return tally.odd.length === tally.usual.length ? [...against(tally.usual, tally.odd), ...odd] : odd;
|
|
45
51
|
};
|
|
46
52
|
|
|
47
53
|
/** The files whose value for a label differs from the value most files of the run give it. */
|
|
@@ -125,16 +125,19 @@ const containsSeparator = (label: string, words: FactWords): boolean =>
|
|
|
125
125
|
|
|
126
126
|
const isShort = (text: string): boolean => text.length <= MAX_LABEL_LENGTH && wordsOf(text).length <= MAX_LABEL_WORDS;
|
|
127
127
|
|
|
128
|
-
/**
|
|
129
|
-
|
|
128
|
+
/**
|
|
129
|
+
* 名前の長さ。頭の冠詞(The registration deadline の The)は数えないので key で測る。条件の付いた名前(waiting period for
|
|
130
|
+
* cancellation cover)は、名前と条件がそれぞれ短いこと。
|
|
131
|
+
*/
|
|
132
|
+
const isShortLabel = (key: string, words: FactWords): boolean => {
|
|
130
133
|
const qualified = words.qualifiers === undefined ? undefined : qualifiedLabelOf(key, words.qualifiers);
|
|
131
|
-
return qualified === undefined ? isShort(
|
|
134
|
+
return qualified === undefined ? isShort(key) : isShort(qualified.head) && isShort(qualified.qualifier);
|
|
132
135
|
};
|
|
133
136
|
|
|
134
137
|
/** 名前として使える書き方か。短く、字を含み、区切りを含まず、指すだけの語(それ、it)でない。 */
|
|
135
138
|
const isLabel = (label: string, key: string, words: FactWords): boolean =>
|
|
136
139
|
label.length > 0 &&
|
|
137
|
-
isShortLabel(
|
|
140
|
+
isShortLabel(key, words) &&
|
|
138
141
|
LETTER.test(key) &&
|
|
139
142
|
!CODE_MARK.test(label) &&
|
|
140
143
|
!containsSeparator(label, words) &&
|
package/src/file-header.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CLI_TEXT, type GenreSource } from "./cli-text.ts";
|
|
1
|
+
import { CLI_TEXT, type GenreSource, type HeaderCounts } from "./cli-text.ts";
|
|
2
2
|
import { loadGenres } from "./genre-load.ts";
|
|
3
3
|
import type { GenreDefinition } from "./genre-parse.ts";
|
|
4
4
|
import { suggestGenre } from "./genre-suggest.ts";
|
|
@@ -11,8 +11,6 @@ type FileHeader = { readonly header: string; readonly notes: readonly string[] }
|
|
|
11
11
|
/** unread: a genre the front matter wrote that chaff does not know (already reported on stderr). */
|
|
12
12
|
type Placed = { readonly genre: string; readonly from: GenreSource; readonly unread?: string | undefined };
|
|
13
13
|
|
|
14
|
-
type Counts = { readonly shelved: number; readonly hushed: number };
|
|
15
|
-
|
|
16
14
|
/**
|
|
17
15
|
* The genre the file looks like, only when nothing set or guessed one: suggested on screen, never used for the run.
|
|
18
16
|
* A front matter genre chaff could not read is a genre the writer did set, so the note's "no genre was set" would be untrue.
|
|
@@ -21,9 +19,9 @@ const suggestionFor = (path: string, source: string, language: string, placed: P
|
|
|
21
19
|
placed.from === "default" && placed.unread === undefined ? suggestGenre({ path, source, language }, loadGenres(), loadProfiles()) : undefined;
|
|
22
20
|
|
|
23
21
|
/** In the file's language. The note names the genre the file was checked as. */
|
|
24
|
-
export const fileHeader = (path: string, source: string, language: string, placed: Placed, counts:
|
|
22
|
+
export const fileHeader = (path: string, source: string, language: string, placed: Placed, counts: HeaderCounts): FileHeader => {
|
|
25
23
|
const text = CLI_TEXT[uiLanguageOf(language)];
|
|
26
|
-
const first = text.header(path, placed.genre, text.languageName(language), text.genreSource[placed.from], counts
|
|
24
|
+
const first = text.header(path, placed.genre, text.languageName(language), text.genreSource[placed.from], counts);
|
|
27
25
|
const suggestion = suggestionFor(path, source, language, placed);
|
|
28
26
|
if (suggestion === undefined) return { header: first, notes: [] };
|
|
29
27
|
const name = suggestion.name[uiLanguageOf(language)] ?? suggestion.id;
|
package/src/files.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { globSync, statSync } from "node:fs";
|
|
1
|
+
import { globSync, readFileSync, statSync } from "node:fs";
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
3
|
import { join, matchesGlob, relative, sep } from "node:path";
|
|
4
|
+
import { matches } from "./config/by-path.ts";
|
|
5
|
+
import { ignoreLayers, isGitIgnored, projectRootOf, type IgnoreAt, type KindAt, type ProjectRoot, type ReadText } from "./gitignore.ts";
|
|
4
6
|
import { plainSource } from "./plain-source.ts";
|
|
5
7
|
|
|
6
8
|
/** 検査する文書を読む。言語・ジャンル・stet も文書モデルと同じ本文(BOM と CRLF / CR をそろえたもの)で読むため、ここでそろえる。 */
|
|
@@ -19,15 +21,72 @@ const isSkipped = (path: string): boolean => path.split(sep).some((part) => SKIP
|
|
|
19
21
|
/** include: file-name globs (*.yaml) a walk takes besides Markdown. A glob with a slash is matched below each folder walked. */
|
|
20
22
|
const isIncluded = (path: string, include: readonly string[]): boolean => include.some((pattern) => matchesGlob(path, join("**", pattern)));
|
|
21
23
|
|
|
24
|
+
/** One target given on the command line, and what it found. A file named itself is always checked; what a walk or a glob found may be left out. */
|
|
25
|
+
type Found = { readonly paths: readonly string[]; readonly named: boolean; readonly root: string };
|
|
26
|
+
|
|
27
|
+
const GLOB_MAGIC = /[*?[{]/u;
|
|
28
|
+
|
|
29
|
+
/** The folder a glob walks from: its segments up to the first with a wildcard. */
|
|
30
|
+
const globRoot = (pattern: string): string => {
|
|
31
|
+
const parts = pattern.split(/[\\/]/u);
|
|
32
|
+
const fixed = parts.slice(
|
|
33
|
+
0,
|
|
34
|
+
Math.max(
|
|
35
|
+
0,
|
|
36
|
+
parts.findIndex((part) => GLOB_MAGIC.test(part)),
|
|
37
|
+
),
|
|
38
|
+
);
|
|
39
|
+
return fixed.length === 0 ? "." : fixed.join(sep);
|
|
40
|
+
};
|
|
41
|
+
|
|
22
42
|
const expand =
|
|
23
43
|
(include: readonly string[]) =>
|
|
24
|
-
(target: string):
|
|
44
|
+
(target: string): Found => {
|
|
25
45
|
const stat = statSync(target, { throwIfNoEntry: false });
|
|
26
|
-
if (stat === undefined)
|
|
27
|
-
|
|
28
|
-
|
|
46
|
+
if (stat === undefined) {
|
|
47
|
+
return { paths: globSync(target).filter((path) => isMarkdown(path) || isIncluded(path, include)), named: false, root: globRoot(target) };
|
|
48
|
+
}
|
|
49
|
+
if (stat.isFile()) return { paths: [target], named: true, root: target };
|
|
50
|
+
const patterns = [join(target, "**", "*.{md,markdown,mdx}"), ...include.map((pattern) => join(target, "**", pattern))];
|
|
51
|
+
return { paths: patterns.flatMap((pattern) => globSync(pattern)), named: false, root: target };
|
|
29
52
|
};
|
|
30
53
|
|
|
54
|
+
/** What chaff.yaml leaves out of a walk: `exclude:` globs, matched from the folder chaff.yaml is in, as by_path is. */
|
|
55
|
+
export type Exclusion = { readonly exclude?: readonly string[] | undefined; readonly baseDir: string; readonly path?: string | undefined };
|
|
56
|
+
|
|
57
|
+
/** Why files a walk found were not checked: how many `exclude:` in chaff.yaml left out, and how many a .gitignore did. */
|
|
58
|
+
export type Excluded = { readonly config: number; readonly gitignore: number };
|
|
59
|
+
|
|
60
|
+
const kindAt: KindAt = (path) => {
|
|
61
|
+
const stat = statSync(path, { throwIfNoEntry: false });
|
|
62
|
+
if (stat === undefined) return undefined;
|
|
63
|
+
return stat.isDirectory() ? "folder" : "file";
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/** A folder without an ignore file, or with one that cannot be read, has no rules. */
|
|
67
|
+
const readText: ReadText = (path) => {
|
|
68
|
+
try {
|
|
69
|
+
return readFileSync(path, "utf8");
|
|
70
|
+
} catch {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/** Where a target's ignore files are read from: its repository's root, else chaff.yaml's folder, else the target itself. */
|
|
76
|
+
const projectOf = (found: Found, exclusion: Exclusion | undefined): ProjectRoot =>
|
|
77
|
+
projectRootOf(found.root, kindAt, exclusion?.path === undefined ? undefined : exclusion.baseDir);
|
|
78
|
+
|
|
79
|
+
type Project = { readonly root: string; readonly ignoreAt: IgnoreAt };
|
|
80
|
+
|
|
81
|
+
type Reason = keyof Excluded | undefined;
|
|
82
|
+
|
|
83
|
+
const reasonOf = (path: string, found: Found, exclusion: Exclusion | undefined, project: Project): Reason => {
|
|
84
|
+
if (found.named) return undefined;
|
|
85
|
+
if (exclusion?.exclude?.some((glob) => matches(glob, exclusion.baseDir, path)) === true) return "config";
|
|
86
|
+
const below = relative(project.root, path).split(sep).join("/");
|
|
87
|
+
return below.startsWith("..") || !isGitIgnored(below, project.ignoreAt) ? undefined : "gitignore";
|
|
88
|
+
};
|
|
89
|
+
|
|
31
90
|
/**
|
|
32
91
|
* 与えられたファイル・ディレクトリ・glob を、検査する Markdown の一覧にする。
|
|
33
92
|
* 0 件は成功にしない(§14)。glob が何にもマッチしないまま CI が緑になると、
|
|
@@ -39,7 +98,27 @@ const expand =
|
|
|
39
98
|
*/
|
|
40
99
|
const byPath = (left: string, right: string): number => left.localeCompare(right, "en");
|
|
41
100
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
101
|
+
/** The files to check, and how many a walk found but left out, by reason. */
|
|
102
|
+
export type Collected = { readonly paths: readonly string[]; readonly excluded: Excluded };
|
|
103
|
+
|
|
104
|
+
export const collectFiles = (targets: readonly string[], include: readonly string[] = [], exclusion?: Exclusion): Collected => {
|
|
105
|
+
const found = targets.map(expand(include));
|
|
106
|
+
const judged = found.flatMap((entry) => {
|
|
107
|
+
const root = projectOf(entry, exclusion);
|
|
108
|
+
const project: Project = { root: root.root, ignoreAt: ignoreLayers(root, readText) };
|
|
109
|
+
return entry.paths.filter((path) => !isSkipped(path)).map((path) => ({ path, reason: reasonOf(path, entry, exclusion, project) }));
|
|
110
|
+
});
|
|
111
|
+
const kept = new Set(judged.filter((entry) => entry.reason === undefined).map((entry) => entry.path));
|
|
112
|
+
const left = new Map(
|
|
113
|
+
judged.flatMap((entry): [string, keyof Excluded][] => (entry.reason === undefined || kept.has(entry.path) ? [] : [[entry.path, entry.reason]])),
|
|
114
|
+
);
|
|
115
|
+
const count = (reason: keyof Excluded): number => [...left.values()].filter((entry) => entry === reason).length;
|
|
116
|
+
return {
|
|
117
|
+
paths: [...kept].toSorted((one, other) => byPath(relative(".", one), relative(".", other))),
|
|
118
|
+
excluded: { config: count("config"), gitignore: count("gitignore") },
|
|
119
|
+
};
|
|
45
120
|
};
|
|
121
|
+
|
|
122
|
+
export const collectTargets = (targets: readonly string[], include: readonly string[] = [], exclusion?: Exclusion): string[] => [
|
|
123
|
+
...collectFiles(targets, include, exclusion).paths,
|
|
124
|
+
];
|
package/src/gitignore.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
2
|
+
import ignore, { type Ignore } from "ignore";
|
|
3
|
+
|
|
4
|
+
/** The rules of the .gitignore in one folder (relative to the project root, POSIX, "" for the root), or undefined when it has none. */
|
|
5
|
+
export type IgnoreAt = (folder: string) => Ignore | undefined;
|
|
6
|
+
|
|
7
|
+
/** Reads one .gitignore's text into the matcher git's own semantics need: negation, a trailing slash for folders only, anchoring. */
|
|
8
|
+
export const ignoreOf = (text: string): Ignore => ignore().add(text);
|
|
9
|
+
|
|
10
|
+
const folderChain = (parts: readonly string[]): string[] => parts.map((_part, index) => parts.slice(0, index).join("/"));
|
|
11
|
+
|
|
12
|
+
const below = (folder: string, path: string): string => (folder === "" ? path : path.slice(folder.length + 1));
|
|
13
|
+
|
|
14
|
+
/** What the .gitignore files from the root down to `path`'s folder say of it: a deeper file overrides a shallower one, as in git. */
|
|
15
|
+
const verdict = (path: string, isFolder: boolean, ignoreAt: IgnoreAt): boolean =>
|
|
16
|
+
folderChain(path.split("/")).reduce((ignored, folder) => {
|
|
17
|
+
const rules = ignoreAt(folder);
|
|
18
|
+
if (rules === undefined) return ignored;
|
|
19
|
+
const result = rules.test(`${below(folder, path)}${isFolder ? "/" : ""}`);
|
|
20
|
+
if (result.ignored) return true;
|
|
21
|
+
return result.unignored ? false : ignored;
|
|
22
|
+
}, false);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Pure: whether git would ignore the file at `path` (relative to the project root, POSIX). A file inside an ignored
|
|
26
|
+
* folder stays ignored whatever a later `!` says, as in git: git never looks inside a folder it ignores.
|
|
27
|
+
*/
|
|
28
|
+
export const isGitIgnored = (path: string, ignoreAt: IgnoreAt): boolean => {
|
|
29
|
+
const parts = path.split("/");
|
|
30
|
+
const folders = parts.slice(1).map((_part, index) => parts.slice(0, index + 1).join("/"));
|
|
31
|
+
return folders.some((folder) => verdict(folder, true, ignoreAt)) || verdict(path, false, ignoreAt);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** What is at a path: a folder, a file, or nothing. Injected, so the search for the project root stays pure. */
|
|
35
|
+
export type KindAt = (path: string) => "folder" | "file" | undefined;
|
|
36
|
+
|
|
37
|
+
/** The folder whose ignore files apply, and whether its `.git` is a folder (a worktree's `.git` is a file). */
|
|
38
|
+
export type ProjectRoot = { readonly root: string; readonly gitFolder: boolean };
|
|
39
|
+
|
|
40
|
+
const isWithin = (folder: string, path: string): boolean => {
|
|
41
|
+
const rel = relative(folder, path);
|
|
42
|
+
return !rel.startsWith("..") && !isAbsolute(rel);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const repositoryAbove = (start: string, kindAt: KindAt): ProjectRoot | undefined => {
|
|
46
|
+
const kind = kindAt(join(start, ".git"));
|
|
47
|
+
if (kind !== undefined) return { root: start, gitFolder: kind === "folder" };
|
|
48
|
+
const parent = dirname(start);
|
|
49
|
+
return parent === start ? undefined : repositoryAbove(parent, kindAt);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Pure: where ignore files are read from for a checked folder. The nearest folder at or above it holding `.git`, as git,
|
|
54
|
+
* ripgrep and most linters do; without one, chaff.yaml's folder when it holds the checked folder; else the checked folder.
|
|
55
|
+
*/
|
|
56
|
+
export const projectRootOf = (checked: string, kindAt: KindAt, configFolder: string | undefined): ProjectRoot => {
|
|
57
|
+
const start = resolve(checked);
|
|
58
|
+
const found = repositoryAbove(start, kindAt);
|
|
59
|
+
if (found !== undefined) return found;
|
|
60
|
+
if (configFolder !== undefined && isWithin(resolve(configFolder), start)) return { root: resolve(configFolder), gitFolder: false };
|
|
61
|
+
return { root: start, gitFolder: false };
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/** Reads a text file, or undefined when it is not there or cannot be read. Injected. */
|
|
65
|
+
export type ReadText = (path: string) => string | undefined;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Pure: each folder's ignore rules under the project root, read once per folder. At the root, `.git/info/exclude`
|
|
69
|
+
* comes first and the root `.gitignore` after it, so the `.gitignore` wins where they disagree, as in git.
|
|
70
|
+
*/
|
|
71
|
+
export const ignoreLayers = (project: ProjectRoot, readText: ReadText): IgnoreAt => {
|
|
72
|
+
const cache = new Map<string, Ignore | undefined>();
|
|
73
|
+
const read = (folder: string): Ignore | undefined => {
|
|
74
|
+
const own = readText(join(project.root, ...folder.split("/").filter((part) => part !== ""), ".gitignore"));
|
|
75
|
+
const exclude = folder === "" && project.gitFolder ? readText(join(project.root, ".git", "info", "exclude")) : undefined;
|
|
76
|
+
const texts = [exclude, own].filter((text): text is string => text !== undefined);
|
|
77
|
+
return texts.length === 0 ? undefined : ignoreOf(texts.join("\n"));
|
|
78
|
+
};
|
|
79
|
+
return (folder) => {
|
|
80
|
+
if (!cache.has(folder)) cache.set(folder, read(folder));
|
|
81
|
+
return cache.get(folder);
|
|
82
|
+
};
|
|
83
|
+
};
|
package/src/grade/stamp.ts
CHANGED
|
@@ -46,8 +46,13 @@ export const settingsOf = (settings: GradeSettings): Record<string, unknown> =>
|
|
|
46
46
|
styleApplied: config.applied ?? null,
|
|
47
47
|
jargon: config.jargon,
|
|
48
48
|
prefer: config.prefer,
|
|
49
|
+
...(Object.keys(config.preferScopes ?? {}).length === 0 ? {} : { preferScopes: config.preferScopes }),
|
|
49
50
|
requiredSections: config.requiredSections,
|
|
50
51
|
names: config.names,
|
|
52
|
+
// Only when listed, so a chaff.yaml without terms keeps the stamp it had.
|
|
53
|
+
...((config.terms ?? []).length === 0 ? {} : { terms: config.terms }),
|
|
54
|
+
// Only when listed, so a chaff.yaml without consistent keeps the stamp it had.
|
|
55
|
+
...((config.consistent ?? []).length === 0 ? {} : { consistent: config.consistent }),
|
|
51
56
|
byPath: config.byPath,
|
|
52
57
|
grade: gradeOf(settings),
|
|
53
58
|
};
|
|
@@ -62,3 +62,15 @@ export const isBoundSuffix = (text: string, boundary: Boundary, tokens: readonly
|
|
|
62
62
|
const suffix = tokens.find((token) => token.span.start === start);
|
|
63
63
|
return suffix !== undefined && suffixes.has(suffix.surface);
|
|
64
64
|
};
|
|
65
|
+
|
|
66
|
+
const SINGLE_LETTER = /^[A-Za-z]$/u;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 前後を空白一つで区切って一字だけ書いた英字(「(アイ) I を小文字の(エル) l に」の I と l)の前後の境目。見分けてほしい字そのものを
|
|
70
|
+
* 例に挙げるときは、ほかの字と離して書く。語の空け方の好みではない。片側だけ空けた一字(Rを)や二字以上の語は数える。
|
|
71
|
+
*/
|
|
72
|
+
export const isLoneLetter = (text: string, boundary: Boundary): boolean => {
|
|
73
|
+
if (boundary.kind !== "letter" || !boundary.spaced) return false;
|
|
74
|
+
const word = latinWordAt(text, boundary);
|
|
75
|
+
return SINGLE_LETTER.test(text.slice(word.start, word.end)) && text[word.start - 1] === " " && text[word.end] === " ";
|
|
76
|
+
};
|
package/src/levels.ts
CHANGED
|
@@ -18,11 +18,17 @@ export type Resolved = { readonly level: Level; readonly limit: number; readonly
|
|
|
18
18
|
* ジャンル別の閾値。"business/email" は "business" より細かいので先に当たる。
|
|
19
19
|
* 仕様書の一文と社内メールに同じ文長を課すと、どちらかが必ず間違う。spec §9。
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
/** The by_genre key whose numbers a genre takes, or undefined when it takes the rule's default levels. */
|
|
22
|
+
export const genreKeyFor = (rule: RuleDefinition, genre: string | undefined): string | undefined => {
|
|
23
|
+
if (genre === undefined) return undefined;
|
|
23
24
|
const parts = genre.split("/");
|
|
24
25
|
const keys = parts.map((_, index) => parts.slice(0, parts.length - index).join("/"));
|
|
25
|
-
return keys.
|
|
26
|
+
return keys.find((key) => rule.by_genre[key] !== undefined);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const tableFor = (rule: RuleDefinition, genre: string | undefined): LevelTable => {
|
|
30
|
+
const key = genreKeyFor(rule, genre);
|
|
31
|
+
return (key === undefined ? undefined : rule.by_genre[key]) ?? rule.levels;
|
|
26
32
|
};
|
|
27
33
|
|
|
28
34
|
export const resolve = (rule: RuleDefinition, level: Level, genre?: string): Resolved => {
|
package/src/markdown-node.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type MarkdownNode = {
|
|
|
8
8
|
readonly url?: string | undefined;
|
|
9
9
|
readonly value?: string | undefined;
|
|
10
10
|
readonly identifier?: string | undefined;
|
|
11
|
+
readonly label?: string | null | undefined;
|
|
11
12
|
readonly position?: { readonly start: Place; readonly end: Place } | undefined;
|
|
12
13
|
readonly children?: readonly MarkdownNode[] | undefined;
|
|
13
14
|
};
|
package/src/name-separator.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Boundary } from "./orthography.ts";
|
|
2
2
|
import type { Span, Token } from "./plugin.ts";
|
|
3
|
+
import { isPersonRun } from "./name-person.ts";
|
|
3
4
|
|
|
4
5
|
/** 名前を空白で並べた行(署名・連絡先・所属の行)に出る品詞。助詞・動詞・助動詞・連体詞が一つでもあれば、その行は文。 */
|
|
5
6
|
const NAME_LINE_POS = new Set(["NOUN", "PROPN", "NUM", "PUNCT", "SYM"]);
|
|
@@ -120,14 +121,22 @@ const isLabelledValue = (text: string, boundary: Boundary, tokens: readonly Toke
|
|
|
120
121
|
const pair = pairAround(text, enclosure, boundary.offset);
|
|
121
122
|
const label = { start: pair.start, end: boundary.offset };
|
|
122
123
|
const value = valueOf(text.slice(boundary.offset + 1, pair.end), text.slice(enclosure.end, line.end));
|
|
123
|
-
if (
|
|
124
|
+
if (value === undefined || !PAIR_VALUE.test(value)) return false;
|
|
124
125
|
if (SENTENCE_END.test(text.slice(enclosure.start, enclosure.end))) return false;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
return isPairLabel(text, label, tokensIn(tokens, label, base), base) && !tokensIn(tokens, enclosure, base).some((token) => CLAUSE_POS.has(token.pos));
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/** 項目名の語をつなぐ接続詞の品詞(社会福祉士または介護支援専門員、保健師及び看護師)。つないだ名前の一つずつが短い項目名。 */
|
|
130
|
+
const LABEL_JOINER_POS = "CCONJ";
|
|
131
|
+
|
|
132
|
+
/** 名詞だけの短い項目名か、接続詞でつないだ短い項目名の並び。接続詞は頭にも終わりにも置かない。 */
|
|
133
|
+
const isPairLabel = (text: string, label: Span, labelTokens: readonly Token[], base: number): boolean => {
|
|
134
|
+
const joiners = labelTokens.filter((token) => token.pos === LABEL_JOINER_POS);
|
|
135
|
+
if (labelTokens.length === 0 || labelTokens.some((token) => token.pos !== LABEL_JOINER_POS && !PAIR_LABEL_POS.has(token.pos))) return false;
|
|
136
|
+
const starts = [label.start, ...joiners.map((token) => token.span.end - base)];
|
|
137
|
+
const ends = [...joiners.map((token) => token.span.start - base), label.end];
|
|
138
|
+
const parts = starts.map((start, index) => text.slice(start, ends[index] ?? label.end));
|
|
139
|
+
return parts.every((part) => PAIR_LABEL.test(part));
|
|
131
140
|
};
|
|
132
141
|
|
|
133
142
|
/** 項目名とコロンの後ろに値の組を並べた行の、組と、数で始まる次の組のあいだの空白か。 */
|
|
@@ -152,6 +161,18 @@ export const isFieldSeparator = (text: string, boundary: Boundary, tokens: reado
|
|
|
152
161
|
return isColonFieldPart(text, boundary, tokens, base) || isLabelledValue(text, boundary, tokens, base);
|
|
153
162
|
};
|
|
154
163
|
|
|
164
|
+
/**
|
|
165
|
+
* 英字の肩書きと、行の終わりまでの人の名前のあいだの空白(代表取締役CEO 森川 遼、CTO 佐藤 健)。肩書きと名前の区切りで、
|
|
166
|
+
* 英字の後ろの空け方ではない。名前の後ろに語が続く行(CEO 森川さんに連絡します)は文の中の空白。
|
|
167
|
+
*/
|
|
168
|
+
const isTitleBeforeName = (text: string, boundary: Boundary, tokens: readonly Token[], base: number): boolean => {
|
|
169
|
+
if (!/[A-Za-z]/u.test(text.charAt(boundary.offset - 1))) return false;
|
|
170
|
+
const rest = tokensIn(tokens, { start: boundary.offset + 1, end: lineAround(text, boundary.offset).end }, base).filter(
|
|
171
|
+
(token) => token.surface.trim() !== "",
|
|
172
|
+
);
|
|
173
|
+
return rest.length > 0 && rest.every((token) => token.pos === "PROPN") && isPersonRun(rest, tokens, []);
|
|
174
|
+
};
|
|
175
|
+
|
|
155
176
|
/**
|
|
156
177
|
* 「株式会社あおば電子 経営企画部 IR担当」「東京本社 PR室」のように、名前だけを空白で並べた行で、空白の両側がどちらも組織の名前のときの空白。
|
|
157
178
|
* 名前と名前の区切りで、英字の前後の空け方ではない。文の中の空白(この IT システムは)や、組織の名前でない語のあいだ(生成AI 活用事例、Patch リリース)は区切りと読まない。
|
|
@@ -159,6 +180,7 @@ export const isFieldSeparator = (text: string, boundary: Boundary, tokens: reado
|
|
|
159
180
|
*/
|
|
160
181
|
export const isNameSeparator = (text: string, boundary: Boundary, tokens: readonly Token[] | undefined, base: number, words: OrganizationWords): boolean => {
|
|
161
182
|
if (tokens === undefined || boundary.kind !== "letter" || !boundary.spaced) return false;
|
|
183
|
+
if (isTitleBeforeName(text, boundary, tokens, base)) return true;
|
|
162
184
|
const before = { start: wordStart(text, boundary.offset), end: boundary.offset };
|
|
163
185
|
const after = { start: boundary.offset + 1, end: wordEnd(text, boundary.offset + 1) };
|
|
164
186
|
const line = lineAround(text, boundary.offset);
|