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
package/src/config/load.ts
CHANGED
|
@@ -3,11 +3,14 @@ import { workingDir } from "./working-dir.ts";
|
|
|
3
3
|
import { isLevel } from "../levels.ts";
|
|
4
4
|
import { defaultModel } from "../backends/default-model.ts";
|
|
5
5
|
import { isBackend, type BackendName } from "../backends/types.ts";
|
|
6
|
-
import type { Level } from "../plugin.ts";
|
|
6
|
+
import type { Level, ScopeSelector } from "../plugin.ts";
|
|
7
|
+
import { preferOf, type PreferProblem } from "./prefer.ts";
|
|
7
8
|
import type { PathRule } from "./by-path.ts";
|
|
8
9
|
import type { Extensions } from "../extension/load.ts";
|
|
9
10
|
import type { StyleLimits } from "../style-parse.ts";
|
|
10
11
|
import type { GuideLayer } from "../genre-guide/layer.ts";
|
|
12
|
+
import { foldTerm } from "../term-form.ts";
|
|
13
|
+
import type { OptionLayer } from "../rule-options.ts";
|
|
11
14
|
|
|
12
15
|
export const CONFIG_FILE = "chaff.yaml";
|
|
13
16
|
|
|
@@ -30,19 +33,37 @@ export type Config = {
|
|
|
30
33
|
readonly jargon: readonly string[];
|
|
31
34
|
/** チームの表記。{ 使わない書き方: 使う書き方 }。「サーバー」ではなく「サーバ」、のように。 */
|
|
32
35
|
readonly prefer: Readonly<Record<string, string>>;
|
|
36
|
+
/** prefer's entries written in the object form with a scope: { avoid: the parts of the document the entry counts in }. */
|
|
37
|
+
readonly preferScopes?: Readonly<Record<string, ScopeSelector>>;
|
|
38
|
+
/** prefer's entries that could not be read (an object without use, a scope that cannot be read). Each stops the run. */
|
|
39
|
+
readonly unreadablePrefer?: readonly PreferProblem[];
|
|
33
40
|
/** この種類の文書に無いと困る見出し。チームが自分で決める。 */
|
|
34
41
|
readonly requiredSections: readonly string[];
|
|
35
42
|
/** チームの固有名詞(組織名・製品名)。1 つの名前として読み、漢字の連なりや繰り返しに数えない。 */
|
|
36
43
|
readonly names: readonly string[];
|
|
37
44
|
/** names に書かれていたが名前として読めなかった値。黙って捨てると、並べたつもりの名前が効いていないことに気づけない。 */
|
|
38
45
|
readonly unreadableNames: readonly string[];
|
|
46
|
+
/** The team's terms, each to be written exactly so (GitHub, not Github or GitHub). term-form reads them. */
|
|
47
|
+
readonly terms?: readonly string[];
|
|
48
|
+
/** terms as written that cannot be read as a term: not a list, an entry that is not text, or one that is only spaces and hyphens. */
|
|
49
|
+
readonly unreadableTerms?: readonly string[];
|
|
50
|
+
/** The team's groups of words that are each right but must not be mixed in one document ([顧客, お客様]). term-consistency reads them. */
|
|
51
|
+
readonly consistent?: readonly (readonly string[])[];
|
|
52
|
+
/** consistent as written that cannot be read as a group: not a list, or an entry that is not two or more different words. */
|
|
53
|
+
readonly unreadableConsistent?: readonly string[];
|
|
39
54
|
/** File-name globs (*.yaml) a directory walk checks besides Markdown. --include adds to them. */
|
|
40
55
|
readonly include?: readonly string[];
|
|
56
|
+
/** Globs a directory walk leaves out, matched from chaff.yaml's folder as by_path is. A file named on the command line is still checked. */
|
|
57
|
+
readonly exclude?: readonly string[];
|
|
41
58
|
/** パスごとの上書き。設定ファイルのある場所からの相対で照合する。 */
|
|
42
59
|
readonly byPath: readonly PathRule[];
|
|
43
60
|
/** by_path entries that could not be read (a map instead of a list, an entry without files), as written. */
|
|
44
61
|
readonly unreadableByPath?: readonly string[];
|
|
45
62
|
readonly baseDir: string;
|
|
63
|
+
/** Set only on the settings one file is checked with (by-path-rules.ts): for each rule a by_path entry set, which entry. */
|
|
64
|
+
readonly pathLevelsFrom?: Readonly<Record<string, string>>;
|
|
65
|
+
/** Set only on the settings one file is checked with: the matching by_path entries' options, strongest first. */
|
|
66
|
+
readonly pathOptionLayers?: readonly OptionLayer[];
|
|
46
67
|
/** Options set on rules that take them: { rule id: { option: value } }, as written. rule-options.ts checks them against the rules. */
|
|
47
68
|
readonly options?: Readonly<Record<string, unknown>>;
|
|
48
69
|
/** options as written when it is not a map. Dropping it silently would leave a team thinking its options apply. */
|
|
@@ -59,6 +80,8 @@ export type Config = {
|
|
|
59
80
|
readonly fixPlan?: unknown;
|
|
60
81
|
/** guide as written: the team's changes to the genre guides, or off (genre-guide/of-config.ts reads it). */
|
|
61
82
|
readonly guide?: unknown;
|
|
83
|
+
/** allow as written: text never to report, each entry with its reason (allow.ts reads and checks it). */
|
|
84
|
+
readonly allow?: unknown;
|
|
62
85
|
/** plugins as written: package names and paths. extension/plugin-load.ts reads and checks them. */
|
|
63
86
|
readonly plugins?: unknown;
|
|
64
87
|
/** The code chaff.yaml names, once loaded (extension/load.ts). Reading chaff.yaml does not load it. */
|
|
@@ -133,29 +156,38 @@ const globsOf = (value: unknown): string[] => {
|
|
|
133
156
|
return Array.isArray(value) ? value.map((entry) => String(entry)) : [];
|
|
134
157
|
};
|
|
135
158
|
|
|
159
|
+
const PATH_BLOCKS: readonly ("rules" | "options")[] = ["rules", "options"];
|
|
160
|
+
|
|
161
|
+
/** rules: or options: under a by_path entry that is written but is not a map: it changes nothing, so it is reported. */
|
|
162
|
+
const unreadableBlocksOf = (raw: Record<string, unknown>): { key: "rules" | "options"; value: string }[] =>
|
|
163
|
+
PATH_BLOCKS.flatMap((key) => {
|
|
164
|
+
const value = raw[key];
|
|
165
|
+
return value === undefined || value === null || isRecord(value) ? [] : [{ key, value: printed(value) }];
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
/** An entry's rules: and options:, read as the top-level ones are. Nothing is added for an entry that writes neither. */
|
|
169
|
+
const pathRuleSettingsOf = (raw: Record<string, unknown>): Pick<PathRule, "rules" | "limits" | "unreadableRules" | "options" | "unreadableBlocks"> => {
|
|
170
|
+
const written = (key: string): boolean => raw[key] !== undefined && raw[key] !== null;
|
|
171
|
+
const blocks = unreadableBlocksOf(raw);
|
|
172
|
+
const options = raw["options"];
|
|
173
|
+
return {
|
|
174
|
+
...(written("rules") ? { rules: rulesOf(raw["rules"]), limits: limitsOf(raw["rules"]), unreadableRules: unreadableOf(raw["rules"]) } : {}),
|
|
175
|
+
...(written("options") ? { options: isRecord(options) ? options : {} } : {}),
|
|
176
|
+
...(blocks.length === 0 ? {} : { unreadableBlocks: blocks }),
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
|
|
136
180
|
const toPathRule = (raw: unknown): PathRule | undefined => {
|
|
137
181
|
if (!isRecord(raw)) return undefined;
|
|
138
182
|
const files = raw["files"];
|
|
139
183
|
const globs = globsOf(files);
|
|
140
184
|
if (globs.length === 0) return undefined;
|
|
141
|
-
return { files: globs, genre: str(raw["genre"]), language: str(raw["language"]), profile: str(raw["profile"]) };
|
|
185
|
+
return { files: globs, genre: str(raw["genre"]), language: str(raw["language"]), profile: str(raw["profile"]), ...pathRuleSettingsOf(raw) };
|
|
142
186
|
};
|
|
143
187
|
|
|
144
188
|
/** 利用者が書く語の並び。空白だけのものは落とす。 */
|
|
145
189
|
const wordsOf = (raw: unknown): string[] => (Array.isArray(raw) ? raw.map((entry) => String(entry).trim()).filter((entry) => entry.length > 0) : []);
|
|
146
190
|
|
|
147
|
-
/** 両側とも空でない文字列の対だけを読む。同じ語どうし(「サーバ: サーバ」)は何も言えないので捨てる。 */
|
|
148
|
-
const preferOf = (raw: unknown): Record<string, string> =>
|
|
149
|
-
isRecord(raw)
|
|
150
|
-
? Object.fromEntries(
|
|
151
|
-
Object.entries(raw).flatMap(([avoid, use]): [string, string][] => {
|
|
152
|
-
const from = avoid.trim();
|
|
153
|
-
const to = typeof use === "string" ? use.trim() : "";
|
|
154
|
-
return from !== "" && to !== "" && from !== to ? [[from, to]] : [];
|
|
155
|
-
}),
|
|
156
|
-
)
|
|
157
|
-
: {};
|
|
158
|
-
|
|
159
191
|
const isNameEntry = (value: unknown): value is string | number => typeof value === "string" || typeof value === "number";
|
|
160
192
|
|
|
161
193
|
const printed = (value: unknown): string => JSON.stringify(value) ?? String(value);
|
|
@@ -171,6 +203,35 @@ const namesOf = (raw: unknown): { readonly names: string[]; readonly unreadable:
|
|
|
171
203
|
};
|
|
172
204
|
};
|
|
173
205
|
|
|
206
|
+
/** A term is text with something besides spaces and hyphens in it; a number (2025) reads as text, as under names. */
|
|
207
|
+
const termsOf = (raw: unknown): { readonly terms: string[]; readonly unreadable: string[] } => {
|
|
208
|
+
if (raw === undefined || raw === null) return { terms: [], unreadable: [] };
|
|
209
|
+
if (!Array.isArray(raw)) return { terms: [], unreadable: [printed(raw)] };
|
|
210
|
+
const entries: unknown[] = raw;
|
|
211
|
+
const isTerm = (entry: unknown): entry is string | number => isNameEntry(entry) && foldTerm(String(entry)) !== "";
|
|
212
|
+
return { terms: wordsOf(entries.filter(isTerm)), unreadable: entries.filter((entry) => !isTerm(entry)).map(printed) };
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
/** A group: a list of two or more different words (a number reads as text, as under names). */
|
|
216
|
+
const groupOf = (entry: unknown): string[] | undefined => {
|
|
217
|
+
if (!Array.isArray(entry)) return undefined;
|
|
218
|
+
const members: unknown[] = entry;
|
|
219
|
+
const words = wordsOf(members);
|
|
220
|
+
return members.every(isNameEntry) && words.length === members.length && new Set(words).size === words.length && words.length >= 2 ? words : undefined;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
/** consistent is a list of groups. A value that is not a list, and an entry that is not a group, are kept printed to be reported. */
|
|
224
|
+
const consistentOf = (raw: unknown): { readonly groups: string[][]; readonly unreadable: string[] } => {
|
|
225
|
+
if (raw === undefined || raw === null) return { groups: [], unreadable: [] };
|
|
226
|
+
if (!Array.isArray(raw)) return { groups: [], unreadable: [printed(raw)] };
|
|
227
|
+
const entries: unknown[] = raw;
|
|
228
|
+
const read = entries.map((entry) => ({ entry, group: groupOf(entry) }));
|
|
229
|
+
return {
|
|
230
|
+
groups: read.flatMap(({ group }) => (group === undefined ? [] : [group])),
|
|
231
|
+
unreadable: read.filter(({ group }) => group === undefined).map(({ entry }) => printed(entry)),
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
|
|
174
235
|
/** by_path は files を持つ項目の並び。並びでない値と、読めない項目は読めないものとして返す。黙って捨てると、書いた人は効いたつもりでいる。 */
|
|
175
236
|
export const byPathOf = (raw: unknown): { readonly rules: PathRule[]; readonly unreadable: string[] } => {
|
|
176
237
|
if (raw === undefined || raw === null) return { rules: [], unreadable: [] };
|
|
@@ -189,8 +250,11 @@ export const configOf = (raw: unknown, path: string): Config => {
|
|
|
189
250
|
const declared: unknown = raw["ai_backend"];
|
|
190
251
|
const backend: BackendName = isBackend(declared) ? declared : DEFAULT_BACKEND;
|
|
191
252
|
const names = namesOf(raw["names"]);
|
|
253
|
+
const terms = termsOf(raw["terms"]);
|
|
254
|
+
const consistent = consistentOf(raw["consistent"]);
|
|
192
255
|
const byPath = byPathOf(raw["by_path"]);
|
|
193
256
|
const options: unknown = raw["options"];
|
|
257
|
+
const prefer = preferOf(raw["prefer"]);
|
|
194
258
|
return {
|
|
195
259
|
genre: str(raw["genre"]),
|
|
196
260
|
profile: str(raw["profile"]),
|
|
@@ -204,11 +268,18 @@ export const configOf = (raw: unknown, path: string): Config => {
|
|
|
204
268
|
aiModel: str(raw["ai_model"]) ?? defaultModel(backend),
|
|
205
269
|
confidenceThreshold: typeof raw["confidence_threshold"] === "number" ? raw["confidence_threshold"] : 0.7,
|
|
206
270
|
jargon: wordsOf(raw["jargon"]),
|
|
207
|
-
prefer:
|
|
271
|
+
prefer: prefer.prefer,
|
|
272
|
+
preferScopes: prefer.scopes,
|
|
273
|
+
unreadablePrefer: prefer.problems,
|
|
208
274
|
requiredSections: wordsOf(raw["required_sections"]),
|
|
209
275
|
names: names.names,
|
|
210
276
|
unreadableNames: names.unreadable,
|
|
277
|
+
terms: terms.terms,
|
|
278
|
+
unreadableTerms: terms.unreadable,
|
|
279
|
+
consistent: consistent.groups,
|
|
280
|
+
unreadableConsistent: consistent.unreadable,
|
|
211
281
|
include: globsOf(raw["include"]),
|
|
282
|
+
exclude: globsOf(raw["exclude"]),
|
|
212
283
|
byPath: byPath.rules,
|
|
213
284
|
unreadableByPath: byPath.unreadable,
|
|
214
285
|
baseDir: dirname(path),
|
|
@@ -220,5 +291,6 @@ export const configOf = (raw: unknown, path: string): Config => {
|
|
|
220
291
|
fixPlan: raw["fix_plan"],
|
|
221
292
|
guide: raw["guide"],
|
|
222
293
|
plugins: raw["plugins"],
|
|
294
|
+
allow: raw["allow"],
|
|
223
295
|
};
|
|
224
296
|
};
|
|
@@ -2,6 +2,7 @@ import { CONFIG_FILE, type Config } from "./load.ts";
|
|
|
2
2
|
import type { RuleDefinition, RuleOption } from "../plugin.ts";
|
|
3
3
|
import { optionProblems, type OptionLayer, type OptionProblem } from "../rule-options.ts";
|
|
4
4
|
import { limitsFor, styleLevelSource, styleSource } from "./style.ts";
|
|
5
|
+
import { pathLevelsOf, type PathRuleLevel } from "./by-path-rules.ts";
|
|
5
6
|
import type { Texts, UiLanguage } from "../ui.ts";
|
|
6
7
|
|
|
7
8
|
/** Where chaff.yaml's options come from, for settleOptions: the file itself. */
|
|
@@ -10,19 +11,21 @@ export const configOptionLayer = (config: Pick<Config, "options">): OptionLayer
|
|
|
10
11
|
values: config.options ?? {},
|
|
11
12
|
});
|
|
12
13
|
|
|
13
|
-
/** Where a rule's settings come from, for explain: the option layers, the style when it set the level,
|
|
14
|
+
/** Where a rule's settings come from, for explain: the option layers, the style when it set the level, a number set for it, and the by_path entries that change it for some files. */
|
|
14
15
|
export const settingSourcesOf = (
|
|
15
|
-
config: Pick<Config, "options" | "applied" | "limits">,
|
|
16
|
+
config: Pick<Config, "options" | "applied" | "limits" | "byPath">,
|
|
16
17
|
ruleId: string,
|
|
17
18
|
language: string,
|
|
18
|
-
): { optionLayers: OptionLayer[]; levelFrom: string | undefined; limit: number | undefined } => ({
|
|
19
|
+
): { optionLayers: OptionLayer[]; levelFrom: string | undefined; limit: number | undefined; byPath: PathRuleLevel[] } => ({
|
|
19
20
|
optionLayers: optionLayersOf(config),
|
|
20
21
|
levelFrom: styleLevelSource(config, ruleId),
|
|
21
22
|
limit: limitsFor(config, language)[ruleId],
|
|
23
|
+
byPath: pathLevelsOf(config.byPath, ruleId),
|
|
22
24
|
});
|
|
23
25
|
|
|
24
|
-
/** Every place options come from, strongest first: chaff.yaml, then its style. */
|
|
25
|
-
export const optionLayersOf = (config: Pick<Config, "options" | "applied">): OptionLayer[] => [
|
|
26
|
+
/** Every place options come from, strongest first: the file's by_path entries, chaff.yaml, then its style. */
|
|
27
|
+
export const optionLayersOf = (config: Pick<Config, "options" | "applied" | "pathOptionLayers">): OptionLayer[] => [
|
|
28
|
+
...(config.pathOptionLayers ?? []),
|
|
26
29
|
configOptionLayer(config),
|
|
27
30
|
...(config.applied === undefined ? [] : [{ from: styleSource(config.applied.style), values: config.applied.options }]),
|
|
28
31
|
];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Config } from "./load.ts";
|
|
2
|
+
import type { Texts, UiLanguage } from "../ui.ts";
|
|
3
|
+
import type { PreferProblem } from "./prefer.ts";
|
|
4
|
+
import { scopeProblemSentence } from "../scope-problem-text.ts";
|
|
5
|
+
|
|
6
|
+
const TEXT: Texts<{ readonly at: (where: string, avoid: string) => string; readonly noUse: string }> = {
|
|
7
|
+
ja: {
|
|
8
|
+
at: (where, avoid) => `${where}: prefer の ${avoid}: `,
|
|
9
|
+
noUse: "使う書き方を use に書いてください(例: { use: 当社, scope: [~quote] })",
|
|
10
|
+
},
|
|
11
|
+
en: {
|
|
12
|
+
at: (where, avoid) => `${where}: prefer ${avoid}: `,
|
|
13
|
+
noUse: "write the spelling to use under use (for example { use: our company, scope: [~quote] })",
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const detailOf = (problem: PreferProblem, ui: UiLanguage): string =>
|
|
18
|
+
problem.kind === "no-use" ? TEXT[ui].noUse : scopeProblemSentence(problem.scope.kind, problem.scope.written, ui);
|
|
19
|
+
|
|
20
|
+
/** prefer's entries that cannot be used. Each stops the run: an entry that silently does not count looks like a clean document. */
|
|
21
|
+
export const preferProblems = (config: Pick<Config, "unreadablePrefer" | "path">, ui: UiLanguage): string[] =>
|
|
22
|
+
(config.unreadablePrefer ?? []).map((problem) => `chaff: ${TEXT[ui].at(config.path ?? "chaff.yaml", problem.avoid)}${detailOf(problem, ui)}`);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ScopeSelector } from "../plugin.ts";
|
|
2
|
+
import { scopeSelectorOf, type ScopeProblem } from "../text-scope.ts";
|
|
3
|
+
|
|
4
|
+
// prefer in chaff.yaml: { avoid: use }, and for an entry limited to some parts of the document the object form
|
|
5
|
+
// { avoid: { use, scope } }. Both forms may sit in one map. Pure: the YAML comes in parsed.
|
|
6
|
+
|
|
7
|
+
/** An entry that could not be read: an object form without use, or with a scope that cannot be read. */
|
|
8
|
+
export type PreferProblem =
|
|
9
|
+
{ readonly avoid: string; readonly kind: "no-use" } | { readonly avoid: string; readonly kind: "scope"; readonly scope: ScopeProblem };
|
|
10
|
+
|
|
11
|
+
type Prefer = {
|
|
12
|
+
/** { avoid: use } for every entry, either form. */
|
|
13
|
+
readonly prefer: Readonly<Record<string, string>>;
|
|
14
|
+
/** The scope of each entry written with one. */
|
|
15
|
+
readonly scopes: Readonly<Record<string, ScopeSelector>>;
|
|
16
|
+
readonly problems: readonly PreferProblem[];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type Entry = { readonly avoid: string; readonly use: string; readonly scope?: ScopeSelector } | { readonly problem: PreferProblem } | undefined;
|
|
20
|
+
|
|
21
|
+
const isRecord = (value: unknown): value is Record<string, unknown> => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22
|
+
|
|
23
|
+
const textOf = (value: unknown): string => (typeof value === "string" ? value.trim() : "");
|
|
24
|
+
|
|
25
|
+
/** The object form: use, and scope when written. */
|
|
26
|
+
const objectEntry = (avoid: string, written: Readonly<Record<string, unknown>>): Entry => {
|
|
27
|
+
const use = textOf(written["use"]);
|
|
28
|
+
if (use === "") return { problem: { avoid, kind: "no-use" } };
|
|
29
|
+
if (use === avoid) return undefined;
|
|
30
|
+
if (written["scope"] === undefined) return { avoid, use };
|
|
31
|
+
const read = scopeSelectorOf(written["scope"]);
|
|
32
|
+
return "selector" in read ? { avoid, use, scope: read.selector } : { problem: { avoid, kind: "scope", scope: read.problem } };
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** One entry. Both sides must be non-empty and differ (サーバ: サーバ says nothing); a value that is neither form is left out, as before. */
|
|
36
|
+
const entryOf = (written: string, value: unknown): Entry => {
|
|
37
|
+
const avoid = written.trim();
|
|
38
|
+
if (avoid === "") return undefined;
|
|
39
|
+
if (isRecord(value)) return objectEntry(avoid, value);
|
|
40
|
+
const use = textOf(value);
|
|
41
|
+
return use === "" || use === avoid ? undefined : { avoid, use };
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const preferOf = (raw: unknown): Prefer => {
|
|
45
|
+
const entries = isRecord(raw) ? Object.entries(raw).map(([avoid, value]) => entryOf(avoid, value)) : [];
|
|
46
|
+
const read = entries.flatMap((entry) => (entry === undefined || "problem" in entry ? [] : [entry]));
|
|
47
|
+
return {
|
|
48
|
+
prefer: Object.fromEntries(read.map((entry) => [entry.avoid, entry.use])),
|
|
49
|
+
scopes: Object.fromEntries(read.flatMap((entry) => (entry.scope === undefined ? [] : [[entry.avoid, entry.scope]]))),
|
|
50
|
+
problems: entries.flatMap((entry) => (entry !== undefined && "problem" in entry ? [entry.problem] : [])),
|
|
51
|
+
};
|
|
52
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Config } from "./load.ts";
|
|
2
|
+
import type { Texts, UiLanguage } from "../ui.ts";
|
|
3
|
+
import { foldTerm } from "../term-form.ts";
|
|
4
|
+
|
|
5
|
+
type TermTexts = {
|
|
6
|
+
readonly unreadable: (where: string, value: string) => string;
|
|
7
|
+
readonly clash: (where: string, first: string, second: string) => string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const TEXT: Texts<TermTexts> = {
|
|
11
|
+
ja: {
|
|
12
|
+
unreadable: (where, value) => `${where}: terms の ${value} は語として読めません。terms には決まった書き方の語を 1 行に 1 つずつ並べてください(- GitHub)`,
|
|
13
|
+
clash: (where, first, second) =>
|
|
14
|
+
`${where}: terms の「${first}」と「${second}」は字の大小・幅・ハイフン・空白だけが違います。どちらも正しい書き方として扱うので、互いを指摘しません。決まった書き方を 1 つにしてください`,
|
|
15
|
+
},
|
|
16
|
+
en: {
|
|
17
|
+
unreadable: (where, value) =>
|
|
18
|
+
`${where}: cannot read ${value} under terms as a term. Write terms as a list, one term per line, as it must be written (- GitHub)`,
|
|
19
|
+
clash: (where, first, second) =>
|
|
20
|
+
`${where}: "${first}" and "${second}" under terms differ only in case, width, hyphens or spaces. Both are taken as right, so neither is reported; keep the one the team writes`,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** Listed terms that fold to the same one, as the first written and each other spelling. */
|
|
25
|
+
const clashesOf = (terms: readonly string[]): { readonly first: string; readonly second: string }[] =>
|
|
26
|
+
terms.flatMap((term, at) => {
|
|
27
|
+
const first = terms.slice(0, at).find((earlier) => foldTerm(earlier) === foldTerm(term) && earlier !== term);
|
|
28
|
+
return first === undefined || terms.slice(0, at).includes(term) ? [] : [{ first, second: term }];
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
/** What under terms in chaff.yaml has no effect: values not read as terms, and terms that differ only in what term-form sets aside. */
|
|
32
|
+
export const termProblems = (config: Pick<Config, "terms" | "unreadableTerms" | "path">, ui: UiLanguage = "ja"): string[] => {
|
|
33
|
+
const where = config.path ?? "chaff.yaml";
|
|
34
|
+
return [
|
|
35
|
+
...(config.unreadableTerms ?? []).map((value) => TEXT[ui].unreadable(where, value)),
|
|
36
|
+
...clashesOf(config.terms ?? []).map(({ first, second }) => TEXT[ui].clash(where, first, second)),
|
|
37
|
+
];
|
|
38
|
+
};
|
package/src/config/warnings.ts
CHANGED
|
@@ -3,15 +3,22 @@ import type { RuleDefinition } from "../plugin.ts";
|
|
|
3
3
|
import type { UiLanguage } from "../ui.ts";
|
|
4
4
|
import { ruleProblems } from "./rule-problems.ts";
|
|
5
5
|
import { nameProblems } from "./name-problems.ts";
|
|
6
|
-
import {
|
|
6
|
+
import { termProblems } from "./term-problems.ts";
|
|
7
|
+
import { consistentProblems } from "./consistent-problems.ts";
|
|
8
|
+
import { byPathProblems, byPathRuleProblems } from "./by-path-problems.ts";
|
|
9
|
+
import { allowRuleWarnings } from "./allow-problems.ts";
|
|
7
10
|
import { configOptionProblems } from "./option-problems.ts";
|
|
8
11
|
import { configGuideProblems } from "../genre-guide/of-config.ts";
|
|
9
12
|
|
|
10
|
-
/** Everything in chaff.yaml that has no effect: unknown rules or levels, unreadable names or by_path entries, options that do not apply, guides that cannot be read. Said before the results. */
|
|
13
|
+
/** Everything in chaff.yaml that has no effect: unknown rules or levels, unreadable names, terms, consistent groups or by_path entries, rules under allow that chaff does not have, options that do not apply, guides that cannot be read. Said before the results. */
|
|
11
14
|
export const settingWarnings = (config: Config, rules: readonly RuleDefinition[], ui: UiLanguage): string[] => [
|
|
12
15
|
...ruleProblems(config, rules, ui),
|
|
13
16
|
...nameProblems(config, ui),
|
|
17
|
+
...termProblems(config, ui),
|
|
18
|
+
...consistentProblems(config, ui),
|
|
14
19
|
...byPathProblems(config, ui),
|
|
20
|
+
...byPathRuleProblems(config, rules, ui),
|
|
21
|
+
...allowRuleWarnings(config, rules, ui),
|
|
15
22
|
...configOptionProblems(config, rules, ui),
|
|
16
23
|
...configGuideProblems(config, ui),
|
|
17
24
|
];
|
package/src/cross-variants.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// One word written one way in some files of a run and another way in the others (サーバ / サーバー, e-mail / email).
|
|
2
2
|
// Pure: the words come in already read from each document, each with the key both spellings share.
|
|
3
|
-
import {
|
|
3
|
+
import { votesOutOfStep, type Vote } from "./cross-votes.ts";
|
|
4
4
|
|
|
5
5
|
/** One written word: the key both its spellings share, the spelling as written (in a form that compares), and where. */
|
|
6
6
|
export type KeyedWord = { readonly key: string; readonly form: string; readonly offset: number };
|
|
@@ -37,19 +37,16 @@ const votesOf = (usages: readonly Usage[]): Vote<string>[] =>
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
const oddAmong = (usages: readonly Usage[]): OddSpelling[] => {
|
|
40
|
-
const tally = tallyVotes(votesOf(usages), (left, right) => left === right);
|
|
41
|
-
const [example] = tally?.usual ?? [];
|
|
42
|
-
if (tally === undefined || example === undefined) return [];
|
|
43
40
|
const firstIn = new Map(usages.map((usage) => [usage.path, usage.first]));
|
|
44
|
-
return
|
|
41
|
+
return votesOutOfStep(votesOf(usages), (left, right) => left === right).flatMap(({ vote, against }) => {
|
|
45
42
|
const word = firstIn.get(vote.path);
|
|
46
|
-
return word === undefined ? [] : [{ path: vote.path, word, usual:
|
|
43
|
+
return word === undefined ? [] : [{ path: vote.path, word, usual: against[0].value, files: against.length, example: against[0].path }];
|
|
47
44
|
});
|
|
48
45
|
};
|
|
49
46
|
|
|
50
47
|
/**
|
|
51
48
|
* The files that write a word unlike the rest of the run. Each file that writes a word one way votes for that way; a file
|
|
52
49
|
* writing it both ways does not vote. When the votes split, every file outside the usual way is reported once per word,
|
|
53
|
-
* at the first place it writes it.
|
|
50
|
+
* at the first place it writes it; when two ways share the most files, the files of both.
|
|
54
51
|
*/
|
|
55
52
|
export const oddSpellings = (docs: readonly DocumentWords[]): OddSpelling[] => [...usagesByKey(docs).values()].flatMap(oddAmong);
|
package/src/cross-votes.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// How the rules that compare files decide which file is out of step: each file votes with the one value it writes for an
|
|
2
2
|
// item (a spelling, a price, a definition), and the files outside the value most files write are the ones reported.
|
|
3
|
-
// Pure. chaff takes no side on which value is right; the fewer side is where to look.
|
|
3
|
+
// Pure. chaff takes no side on which value is right; the fewer side is where to look, and with no fewer side, every side.
|
|
4
4
|
|
|
5
5
|
/** One file's value for one item. */
|
|
6
6
|
export type Vote<T> = { readonly path: string; readonly value: T };
|
|
@@ -8,10 +8,15 @@ export type Vote<T> = { readonly path: string; readonly value: T };
|
|
|
8
8
|
/** The votes for the value most files write, and the votes for any other value, in the run's order. */
|
|
9
9
|
export type Tally<T> = { readonly usual: readonly Vote<T>[]; readonly odd: readonly Vote<T>[]; readonly values: number };
|
|
10
10
|
|
|
11
|
+
type Votes<T> = readonly [Vote<T>, ...Vote<T>[]];
|
|
12
|
+
|
|
13
|
+
/** A vote to report, and the votes of the value it is compared with. */
|
|
14
|
+
export type OutOfStep<T> = { readonly vote: Vote<T>; readonly against: Votes<T> };
|
|
15
|
+
|
|
11
16
|
/** The votes grouped by value, each group in the order its first vote came. */
|
|
12
|
-
const groupsOf = <T>(votes: readonly Vote<T>[], same: (left: T, right: T) => boolean): Vote<T>[][] =>
|
|
13
|
-
votes.reduce<Vote<T>[][]>((groups, vote) => {
|
|
14
|
-
const home = groups.find((group) =>
|
|
17
|
+
const groupsOf = <T>(votes: readonly Vote<T>[], same: (left: T, right: T) => boolean): [Vote<T>, ...Vote<T>[]][] =>
|
|
18
|
+
votes.reduce<[Vote<T>, ...Vote<T>[]][]>((groups, vote) => {
|
|
19
|
+
const home = groups.find((group) => same(group[0].value, vote.value));
|
|
15
20
|
if (home === undefined) groups.push([vote]);
|
|
16
21
|
else home.push(vote);
|
|
17
22
|
return groups;
|
|
@@ -27,3 +32,29 @@ export const tallyVotes = <T>(votes: readonly Vote<T>[], same: (left: T, right:
|
|
|
27
32
|
if (usual === undefined) return undefined;
|
|
28
33
|
return { usual, odd: votes.filter((vote) => !usual.includes(vote)), values: groups.length };
|
|
29
34
|
};
|
|
35
|
+
|
|
36
|
+
/** The values most files write: one when a value leads, two or more when they share the most files. */
|
|
37
|
+
const leadersOf = <T>(groups: readonly Votes<T>[]): Votes<T>[] => {
|
|
38
|
+
const most = Math.max(...groups.map((group) => group.length));
|
|
39
|
+
return groups.filter((group) => group.length === most);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** What a value is compared with: the first leader, or for a leader, the leader after it (the last wraps to the first). */
|
|
43
|
+
const rivalOf = <T>(group: Votes<T>, leaders: readonly Votes<T>[]): Votes<T> | undefined => {
|
|
44
|
+
const at = leaders.indexOf(group);
|
|
45
|
+
return at === -1 ? leaders[0] : leaders[(at + 1) % leaders.length];
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The votes to report, value by value in the run's order. When one value leads, the votes of every other value, compared
|
|
50
|
+
* with it. When two or more values share the most files, none is the usual one and every vote is reported, a leader's
|
|
51
|
+
* compared with another leader: the order of the files in the run does not decide which side is pointed at.
|
|
52
|
+
*/
|
|
53
|
+
export const votesOutOfStep = <T>(votes: readonly Vote<T>[], same: (left: T, right: T) => boolean): OutOfStep<T>[] => {
|
|
54
|
+
const groups = groupsOf(votes, same);
|
|
55
|
+
const leaders = leadersOf(groups);
|
|
56
|
+
return groups.flatMap((group) => {
|
|
57
|
+
const rival = rivalOf(group, leaders);
|
|
58
|
+
return rival === undefined || rival === group ? [] : group.map((vote) => ({ vote, against: rival }));
|
|
59
|
+
});
|
|
60
|
+
};
|
package/src/custom/parse.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { CustomSpec, Localized, RuleDefinition, TokenCondition } from "../plugin.ts";
|
|
1
|
+
import type { CustomSpec, Localized, RuleDefinition, ScopeSelector, TokenCondition } from "../plugin.ts";
|
|
2
|
+
import type { ScopeProblem } from "../text-scope.ts";
|
|
3
|
+
import { scopedSpec, scopeOf } from "./scope-field.ts";
|
|
2
4
|
import { regexRefusal, type RegexRefusal } from "./regex-safety.ts";
|
|
3
5
|
import { posTags } from "./token-pattern.ts";
|
|
4
6
|
import { modulePathOf, type ModulePathRefusal } from "./module-path.ts";
|
|
@@ -33,6 +35,8 @@ export type CustomProblem =
|
|
|
33
35
|
| { readonly kind: "unknown-pos"; readonly at: string; readonly written: string }
|
|
34
36
|
| { readonly kind: "level-and-levels"; readonly at: string }
|
|
35
37
|
| { readonly kind: "bad-levels"; readonly at: string; readonly written: string }
|
|
38
|
+
| { readonly kind: "bad-scope"; readonly at: string; readonly written: string; readonly problem: ScopeProblem["kind"] }
|
|
39
|
+
| { readonly kind: "module-scope"; readonly at: string }
|
|
36
40
|
| (FieldProblem & { readonly at: string });
|
|
37
41
|
|
|
38
42
|
export type CustomRules = { readonly rules: readonly RuleDefinition[]; readonly problems: readonly CustomProblem[] };
|
|
@@ -313,6 +317,7 @@ type Checks = {
|
|
|
313
317
|
readonly texts: Checked<Texts>;
|
|
314
318
|
readonly languages: Checked<readonly string[] | undefined>;
|
|
315
319
|
readonly described: Checked<Described>;
|
|
320
|
+
readonly scope: Checked<ScopeSelector | undefined>;
|
|
316
321
|
};
|
|
317
322
|
|
|
318
323
|
/** The rule's parts once every check passed; undefined when one has no value. */
|
|
@@ -320,7 +325,14 @@ const partsOf = (checks: Checks, examples: Readonly<Record<string, Example>>): {
|
|
|
320
325
|
const { id, spec, needs, levels, texts, described } = checks;
|
|
321
326
|
if (id.value === undefined || spec.value === undefined || needs.value === undefined) return undefined;
|
|
322
327
|
if (levels.value === undefined || texts.value === undefined || described.value === undefined) return undefined;
|
|
323
|
-
const parts = {
|
|
328
|
+
const parts = {
|
|
329
|
+
spec: scopedSpec(spec.value, checks.scope.value),
|
|
330
|
+
needs: needs.value,
|
|
331
|
+
levels: levels.value,
|
|
332
|
+
texts: texts.value,
|
|
333
|
+
languages: checks.languages.value,
|
|
334
|
+
examples,
|
|
335
|
+
};
|
|
324
336
|
return { id: id.value, parts: { ...parts, described: described.value } };
|
|
325
337
|
};
|
|
326
338
|
|
|
@@ -337,11 +349,12 @@ const ruleOf = (raw: unknown, index: number, seen: ReadonlySet<string>, context:
|
|
|
337
349
|
texts: textsOf(raw, at),
|
|
338
350
|
languages: languagesOf(raw["languages"], at),
|
|
339
351
|
described: describedOf(raw, at, context.genres),
|
|
352
|
+
scope: scopeOf(raw["scope"], type.value ?? "", at),
|
|
340
353
|
};
|
|
341
354
|
const { texts, languages } = checks;
|
|
342
355
|
const examples = texts.value === undefined ? {} : examplesOf(texts.value, languages.value);
|
|
343
356
|
const unpaired: CustomProblem[] = texts.value !== undefined && Object.keys(examples).length === 0 ? [{ kind: "unpaired-example", at }] : [];
|
|
344
|
-
const ordered: Checked<unknown>[] = [id, type, checks.spec, checks.needs, checks.levels, texts, languages, checks.described];
|
|
357
|
+
const ordered: Checked<unknown>[] = [id, type, checks.spec, checks.needs, checks.levels, texts, languages, checks.described, checks.scope];
|
|
345
358
|
const problems = [...ordered.flatMap((checked) => checked.problems), ...unpaired];
|
|
346
359
|
const ready = problems.length > 0 ? undefined : partsOf(checks, examples);
|
|
347
360
|
return ready === undefined ? failed(...problems) : ok(definitionOf(ready.id, raw, ready.parts, context.useFor));
|
package/src/custom/problems.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { MAX_PATTERN_LENGTH, MAX_REPEATS, type RegexRefusal } from "./regex-safe
|
|
|
6
6
|
import { POS_WRITTEN_NAMES } from "./token-pattern.ts";
|
|
7
7
|
import type { ModulePathRefusal } from "./module-path.ts";
|
|
8
8
|
import { FIELD_KINDS, fieldProblemSentence, type FieldKind, type FieldProblem } from "../rule-fields.ts";
|
|
9
|
+
import { scopeProblemSentence } from "../scope-problem-text.ts";
|
|
9
10
|
|
|
10
11
|
/** Each problem's sentence, with {at}, {written}, {field}, {index}, {refusal} and {names} filled in from the problem. */
|
|
11
12
|
type Text = {
|
|
@@ -51,6 +52,8 @@ const TEXT: Texts<Text> = {
|
|
|
51
52
|
"level-and-levels": "{scope} の {at}: level と levels の両方があります。どちらか一つにしてください",
|
|
52
53
|
"bad-levels":
|
|
53
54
|
"{scope} の {at}: levels: {written} は読めません。strict・normal・relaxed に重さ(error / warning / info)を書き、normal は必ず書きます。チームのルールは箇所を出すので、数は書けません",
|
|
55
|
+
"bad-scope": "{scope} の {at}: {detail}",
|
|
56
|
+
"module-scope": "{scope} の {at}: type: module のルールには scope を書けません。読む所はモジュールが自分で選びます",
|
|
54
57
|
},
|
|
55
58
|
fieldAt: "{scope} の {at}: ",
|
|
56
59
|
},
|
|
@@ -88,12 +91,14 @@ const TEXT: Texts<Text> = {
|
|
|
88
91
|
"level-and-levels": "{scope} {at}: has both level and levels; keep one",
|
|
89
92
|
"bad-levels":
|
|
90
93
|
"{scope} {at}: cannot read levels: {written}. Give strict, normal and relaxed a severity (error / warning / info), normal always. A team's rule reports places, so a number has nothing to count",
|
|
94
|
+
"bad-scope": "{scope} {at}: {detail}",
|
|
95
|
+
"module-scope": "{scope} {at}: a type: module rule cannot have a scope; the module chooses what it reads",
|
|
91
96
|
},
|
|
92
97
|
fieldAt: "{scope} {at}: ",
|
|
93
98
|
},
|
|
94
99
|
};
|
|
95
100
|
|
|
96
|
-
const PLACEHOLDER = /\{(scope|at|written|field|index|refusal|names)\}/gu;
|
|
101
|
+
const PLACEHOLDER = /\{(scope|at|written|field|index|refusal|names|detail)\}/gu;
|
|
97
102
|
|
|
98
103
|
const refusalOf = (problem: CustomProblem, text: Text): string => {
|
|
99
104
|
if (problem.kind === "bad-pattern") return text.refusal[problem.refusal];
|
|
@@ -101,7 +106,7 @@ const refusalOf = (problem: CustomProblem, text: Text): string => {
|
|
|
101
106
|
};
|
|
102
107
|
|
|
103
108
|
/** The values a problem's sentence names. Each kind carries only some of them. */
|
|
104
|
-
const valuesOf = (problem: CustomProblem, text: Text, scope: string): Readonly<Record<string, string>> => ({
|
|
109
|
+
const valuesOf = (problem: CustomProblem, text: Text, scope: string, ui: UiLanguage): Readonly<Record<string, string>> => ({
|
|
105
110
|
scope,
|
|
106
111
|
at: "at" in problem ? problem.at : "",
|
|
107
112
|
written: "written" in problem ? problem.written : "",
|
|
@@ -109,13 +114,14 @@ const valuesOf = (problem: CustomProblem, text: Text, scope: string): Readonly<R
|
|
|
109
114
|
index: "index" in problem ? String(problem.index) : "",
|
|
110
115
|
refusal: refusalOf(problem, text),
|
|
111
116
|
names: POS_WRITTEN_NAMES.join(" / "),
|
|
117
|
+
detail: problem.kind === "bad-scope" ? scopeProblemSentence(problem.problem, problem.written, ui) : "",
|
|
112
118
|
});
|
|
113
119
|
|
|
114
120
|
const isFieldProblem = (problem: CustomProblem): problem is FieldProblem & { readonly at: string } => FIELD_KINDS.has(problem.kind);
|
|
115
121
|
|
|
116
122
|
/** One problem as a sentence. scope names the list the rule is in: custom_rules, or a plugin's rules. */
|
|
117
123
|
export const customProblemSentence = (problem: CustomProblem, ui: UiLanguage, scope = "custom_rules"): string => {
|
|
118
|
-
const values = valuesOf(problem, TEXT[ui], scope);
|
|
124
|
+
const values = valuesOf(problem, TEXT[ui], scope, ui);
|
|
119
125
|
const fill = (template: string): string => template.replace(PLACEHOLDER, (_whole, key: string) => values[key] ?? "");
|
|
120
126
|
return isFieldProblem(problem) ? `${fill(TEXT[ui].fieldAt)}${fieldProblemSentence(problem, ui)}` : fill(TEXT[ui].problems[problem.kind]);
|
|
121
127
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// scope: on a team rule: the parts of the document a words, pattern or tokens rule reads. Pure.
|
|
2
|
+
import type { CustomSpec, ScopeSelector } from "../plugin.ts";
|
|
3
|
+
import { scopeSelectorOf } from "../text-scope.ts";
|
|
4
|
+
import { failed, ok, type Checked } from "./checked.ts";
|
|
5
|
+
|
|
6
|
+
/** scope: the parts of the document the rule reads. A module reads the document itself, so a scope would silently do nothing. */
|
|
7
|
+
export const scopeOf = (raw: unknown, type: string, at: string): Checked<ScopeSelector | undefined> => {
|
|
8
|
+
if (raw === undefined) return ok(undefined);
|
|
9
|
+
if (type === "module") return failed({ kind: "module-scope", at });
|
|
10
|
+
const read = scopeSelectorOf(raw);
|
|
11
|
+
return "selector" in read ? ok(read.selector) : failed({ kind: "bad-scope", at, written: read.problem.written, problem: read.problem.kind });
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** The spec with the rule's scope. A module never has one: scopeOf refuses it. */
|
|
15
|
+
export const scopedSpec = (spec: CustomSpec, scope: ScopeSelector | undefined): CustomSpec =>
|
|
16
|
+
scope === undefined || spec.type === "module" ? spec : { ...spec, scope };
|