Registry / testing / remark-lint-final-newline

remark-lint-final-newline

JSON →
library3.0.1jsnpmunverified

remark-lint rule to warn when a final newline character (\n) is missing at the end of a file. Part of the remark-lint ecosystem, this plugin enforces POSIX-style file endings. Current stable version is 3.0.1 (ESM-only, requires Node.js 16+). It is included in the `remark-preset-lint-recommended` preset. Unlike some linters that auto-fix, this rule only warns; auto-fixing can be done via `remark-stringify`. No configuration options.

npm install remark-lint-final-newline
INSTALL
IMPORT
SIG · REMARK-LINT-FINAL-
R
remark-lint-final-newline
testingjavascriptv3.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

remarkLintFinalNewline
import remarkLintFinalNewline from 'remark-lint-final-newline'
const remarkLintFinalNewline = require('remark-lint-final-newline')
Package is ESM-only since v3; CJS require() will fail.
default
import remarkLintFinalNewline from 'remark-lint-final-newline'
Package exports a single default function. No named exports.
remark-lint-final-newline
.use(remarkLintFinalNewline)
Used as a unified plugin. No options are accepted.

Set up unified pipeline with remark-parse, remark-lint, the rule, and remark-stringify to lint and optionally fix missing final newline.

import { unified } from 'unified'; import remarkParse from 'remark-parse'; import remarkStringify from 'remark-stringify'; import remarkLint from 'remark-lint'; import remarkLintFinalNewline from 'remark-lint-final-newline'; import { read } from 'to-vfile'; import { reporter } from 'vfile-reporter'; const file = await read('example.md'); await unified() .use(remarkParse) .use(remarkLint) .use(remarkLintFinalNewline) .use(remarkStringify) .process(file); console.error(reporter(file));
remark --version
Debug
Known issues
breakingv3 is ESM-only; requires Node.js 16+ and cannot be used with require().
fix
Switch to import syntax and ensure Node.js >=16.
affects: >=3.0.0
deprecatedThe package does not accept options; passing options may cause unexpected behavior in future versions.
fix
Do not pass any arguments to .use(remarkLintFinalNewline).
affects: >=3.0.0
gotchaThe rule only warns, it does not fix. Use remark-stringify to auto-add final newlines.
fix
Ensure remark-stringify is included in your unified pipeline.
affects: >=1.0.0
gotchaThe rule checks for a single newline at end of file; multiple newlines or missing newline are flagged.
fix
The rule expects exactly one \n at EOF. Use remark-stringify to normalize.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module
Using CJS require() with ESM-only package.
fix
Change to import remarkLintFinalNewline from 'remark-lint-final-newline'
Cannot find module 'remark-lint-final-newline'
Package not installed.
fix
npm install remark-lint-final-newline
TypeError: remarkLintFinalNewline is not a function
Incorrect import or using the wrong symbol.
fix
Use default import: import remarkLintFinalNewline from 'remark-lint-final-newline'
Upgrade
Version history
3.0.1latest on npm
Audit
Dependencies
unifiedrequiredUnified ecosystem core plugin interface
remark-lintrequiredParent lint framework
remark-parserequiredMarkdown parser for processing
remark-stringifyoptionalMarkdown serializer for fixing
Agent activity
4 hits · last 30 days
node
4
Resources
remark-lint-final-newline — npm install remark-lint-final-newline · libregistry