@cffnpwr/textlint-rule-sentence-per-line
v1.1.0
Published
1行に複数の文が含まれている状態を検出するtextlintルール
Readme
@cffnpwr/textlint-rule-sentence-per-line
A textlint rule that detects lines containing more than one sentence.
It enforces the style of "break the line after each sentence, and separate paragraphs with blank lines." The one-sentence-per-line format makes diffs sentence-scoped and easier to review.
<!-- NG -->
一文目です。二文目です。
<!-- OK -->
一文目です。
二文目です。Sentence boundaries are determined by
sentence-splitter. It does not split on "。" inside
quotation marks or parentheses, or on the period in abbreviations such as Node.js. A single
sentence wrapped across multiple lines at a comma or similar is not a violation.
Only paragraphs are inspected. Text inside list items is included, while headings, inline code, and code blocks are excluded.
When a line has two or more sentences, each sentence from the second onward is reported.
This rule supports autofixing with textlint --fix. Each fix inserts a line break at the sentence
boundary. Inside a list item, the continuation line is indented to match the item's own indentation,
so the fix does not fall back on
lazy continuation.
How to Install
npm
npm install --save-dev @cffnpwr/textlint-rule-sentence-per-lineor
npx jsr add -D @cffnpwr/textlint-rule-sentence-per-lineyarn
yarn add --dev @cffnpwr/textlint-rule-sentence-per-lineor
yarn dlx jsr add -D @cffnpwr/textlint-rule-sentence-per-linepnpm
pnpm add --save-dev @cffnpwr/textlint-rule-sentence-per-lineor
pnpm dlx jsr add -D @cffnpwr/textlint-rule-sentence-per-lineBun
bun add --dev @cffnpwr/textlint-rule-sentence-per-lineor
bunx jsr add -D @cffnpwr/textlint-rule-sentence-per-lineDeno
deno add --dev npm:@cffnpwr/textlint-rule-sentence-per-lineor
deno add --dev jsr:@cffnpwr/textlint-rule-sentence-per-lineHow to Use
Add it to .textlintrc.json.
{
"rules": {
"@cffnpwr/textlint-rule-sentence-per-line": true
}
}Options
interface Options {
skipBlockQuote?: boolean;
}| Option | Default | Description |
| --- | --- | --- |
| skipBlockQuote | true | Excludes content under quotes (BlockQuote) from inspection |
Specifying an unknown option key or an invalid value results in an error.
