ESLint plugin for limiting sentences per line. 📐
eslint-plugin-sentences-per-line allows you to enforce that no line in your Markdown files contains more than one sentence.
This is useful because:
- Shorter lines result in simpler, easier-to-understand Git diffs
- Longer lines are harder to read in source code
- First sentence. Second sentence.
+ First sentence.
+ Second sentence.👉 This ESLint plugin assumes you're using
@eslint/markdown.
First install this package as a devDependency:
npm i -D eslint-plugin-sentences-per-lineThen add the following options to your ESLint configuration file:
import markdown from "@eslint/markdown";
import sentencesPerLine from "eslint-plugin-sentences-per-line";
export default [
// your other ESLint configurations
{
extends: [
markdown.configs.recommended,
// 👇 Apply this config to your *.md files
sentencesPerLine.configs.recommended,
],
files: ["**/*.md"],
},
];Sentences within Markdown table rows are left alone, as splitting a row across lines would break the table.
An array of custom abbreviations to ignore when determining sentence boundaries.
These will be added to the standard list of abbreviations below.
["eg.", "e.g.", "etc.", "ex.", "ie.", "i.e.", "vs."]
export default [
{
rules: {
"sentences-per-line/one": [
"error",
{ additionalAbbreviations: ["Mme."] },
],
},
},
];The BCP 47 locale tag describing the language your Markdown is written in.
Defaults to "en-US".
export default [
{
rules: {
"sentences-per-line/one": ["error", { locale: "el" }],
},
},
];💼 Configurations enabled in.
✅ Set in the recommended configuration.
🔧 Automatically fixable by the --fix CLI option.
| Name | Description | 💼 | 🔧 |
|---|---|---|---|
| one | Limits Markdown sentences to one per line. | ✅ | 🔧 |
This package is part of the sentences-per-line family of packages. You might also consider:
markdownlint-sentences-per-line: Markdownlint rule to enforce sentences per line in Markdown files.prettier-plugin-sentences-per-line: Prettier plugin to enforce sentences per line in Markdown files.