
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
remark-lint-file-extension
Advanced tools
remark-lint rule to warn when the file’s extension violates the given style
remark-lint
rule to warn for unexpected file extensions.
This package checks the file extension.
You can use this package to check that file extensions are consistent.
This plugin is included in the following presets:
Preset | Options |
---|---|
remark-preset-lint-markdown-style-guide | 'md' |
This package is ESM only. In Node.js (version 16+), install with npm:
npm install remark-lint-file-extension
In Deno with esm.sh
:
import remarkLintFileExtension from 'https://esm.sh/remark-lint-file-extension@3'
In browsers with esm.sh
:
<script type="module">
import remarkLintFileExtension from 'https://esm.sh/remark-lint-file-extension@3?bundle'
</script>
On the API:
import remarkLint from 'remark-lint'
import remarkLintFileExtension from 'remark-lint-file-extension'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'
import {read} from 'to-vfile'
import {unified} from 'unified'
import {reporter} from 'vfile-reporter'
const file = await read('example.md')
await unified()
.use(remarkParse)
.use(remarkLint)
.use(remarkLintFileExtension)
.use(remarkStringify)
.process(file)
console.error(reporter(file))
On the CLI:
remark --frail --use remark-lint --use remark-lint-file-extension .
On the CLI in a config file (here a package.json
):
…
"remarkConfig": {
"plugins": [
…
"remark-lint",
+ "remark-lint-file-extension",
…
]
}
…
This package exports no identifiers.
It exports the TypeScript types
Extensions
and
Options
.
The default export is
remarkLintFileExtension
.
unified().use(remarkLintFileExtension[, options])
Warn for unexpected extensions.
options
(Extensions
or Options
,
optional)
— configurationTransform (Transformer
from unified
).
Extensions
File extension(s) (TypeScript type).
type Extensions = Array<string> | string
Options
Configuration (TypeScript type).
allowExtensionless
(boolean
, default: true
)
— allow no file extension such as AUTHORS
or LICENSE
extensions
(Extensions
, default: ['mdx', 'md']
)
— allowed file extension(s)Use md
as it’s the most common.
Also use md
when your markdown contains common syntax extensions (such as
GFM, frontmatter, or math).
Do not use md
for MDX: use mdx
instead.
readme.md
No messages.
readme.mdx
No messages.
readme
No messages.
readme
When configured with { allowExtensionless: false }
.
1:1: Unexpected missing file extension, expected `mdx` or `md`
readme.mkd
1:1: Unexpected file extension `mkd`, expected `mdx` or `md`
readme.mkd
When configured with 'mkd'
.
No messages.
readme.css
When configured with [ 'markdown', 'md', 'mdown', 'mdwn', 'mdx', 'mkd', 'mkdn', 'mkdown', 'ron' ]
.
1:1: Unexpected file extension `css`, expected `markdown`, `md`, `mdown`, …
Projects maintained by the unified collective are compatible with maintained versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line,
remark-lint-file-extension@3
,
compatible with Node.js 16.
See contributing.md
in remarkjs/.github
for ways
to get started.
See support.md
for ways to get help.
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.
FAQs
remark-lint rule to warn when the file’s extension violates the given style
The npm package remark-lint-file-extension receives a total of 106,776 weekly downloads. As such, remark-lint-file-extension popularity was classified as popular.
We found that remark-lint-file-extension demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.