remark-lint-no-tabs

raw JSON →
4.0.1 verified Fri May 01 auth: no javascript

Remark-lint rule to warn when hard tabs are used in Markdown instead of spaces. Current stable version is 4.0.1. It is part of the remark-lint monorepo, which is actively maintained with frequent releases. This rule is specific to Markdown, where tabs can cause unexpected rendering due to the hardcoded tab size of 4, making it distinct from general linters. It works with unified and remark-stringify, which automatically uses spaces. No options needed.

error ERR_REQUIRE_ESM: require() of ES Module not supported
cause Using require() to load an ESM-only package.
fix
Change to import statement or use dynamic import: const remarkLintNoTabs = await import('remark-lint-no-tabs')
error Cannot find module 'remark-lint-no-tabs'
cause Package not installed or module path incorrect.
fix
Run npm install remark-lint-no-tabs in your project directory.
error TypeError: remarkLintNoTabs is not a function
cause Importing as named export instead of default export.
fix
Use: import remarkLintNoTabs from 'remark-lint-no-tabs'
breaking Package is ESM-only since v3. require() will throw ERR_REQUIRE_ESM.
fix Use import instead of require(). If using CommonJS, use dynamic import() or upgrade to Node.js 16+.
deprecated The previous version 2.x used a different API signature. The plugin no longer accepts options.
fix Remove any options passed to remarkLintNoTabs(). In v3+, the rule has no options.
gotcha This rule only checks for hard tab characters (U+0009). It does not check for leading spaces or mixed indentation.
fix Combine with other rules like remark-lint-no-mixed-spaces-and-tabs if needed.
breaking The package no longer exports a namespace. Default export is the plugin function.
fix Use default import: import remarkLintNoTabs from 'remark-lint-no-tabs'
npm install remark-lint-no-tabs
yarn add remark-lint-no-tabs
pnpm add remark-lint-no-tabs

Sets up a unified pipeline with remark, parses a Markdown file, lints for tabs, and reports any issues.

import remarkLint from 'remark-lint'
import remarkLintNoTabs from 'remark-lint-no-tabs'
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(remarkLintNoTabs)
  .use(remarkStringify)
  .process(file)

console.error(reporter(file))