@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. Headings, inline code, and code blocks are excluded.
Text inside list items and quotes is also excluded by default, and can be included with the skipListItem and skipBlockQuote options.
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. When skipListItem is false, the continuation line inside a list item 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-line
or
npx jsr add -D @cffnpwr/textlint-rule-sentence-per-line
yarn
yarn add --dev @cffnpwr/textlint-rule-sentence-per-line
or
yarn dlx jsr add -D @cffnpwr/textlint-rule-sentence-per-line
pnpm
pnpm add --save-dev @cffnpwr/textlint-rule-sentence-per-line
or
pnpm dlx jsr add -D @cffnpwr/textlint-rule-sentence-per-line
Bun
bun add --dev @cffnpwr/textlint-rule-sentence-per-line
or
bunx jsr add -D @cffnpwr/textlint-rule-sentence-per-line
Deno
deno add --dev npm:@cffnpwr/textlint-rule-sentence-per-line
or
deno add --dev jsr:@cffnpwr/textlint-rule-sentence-per-line
How to Use
Add it to .textlintrc.json.
{
"rules": {
"@cffnpwr/textlint-rule-sentence-per-line": true
}
}
Options
interface Options {
skipBlockQuote?: boolean;
skipListItem?: boolean;
}
| Option | Default | Description |
|---|---|---|
skipBlockQuote | true | Excludes content under quotes (BlockQuote) from inspection |
skipListItem | true | Excludes content under list items (ListItem), including nested lists, from inspection |
Specifying an unknown option key or an invalid value results in an error.