Registry / testing / remark-lint-table-cell-padding

remark-lint-table-cell-padding

JSON →
library5.1.1jsnpmunverified

remark-lint rule to warn when GFM table cells are padded inconsistently. Version 5.1.1, part of the remark-lint ecosystem, maintained by the remark organization. It checks whether cells have compact (no spaces around content) or padded (at least one space) style. Supports 'consistent' mode to detect first style, and custom stringLength function for wide characters. ESM-only, requires Node 16+, and needs remark-gfm for GFM table parsing.

npm install remark-lint-table-cell-padding
INSTALL
IMPORT
SIG · REMARK-LINT-TABLE-
R
remark-lint-table-cell-padding
testingjavascriptv5.1.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.

remarkLintTableCellPadding
import remarkLintTableCellPadding from 'remark-lint-table-cell-padding'
const remarkLintTableCellPadding = require('remark-lint-table-cell-padding')
Package is ESM-only; CommonJS require() throws an error.
Options
import type { Options } from 'remark-lint-table-cell-padding'
TypeScript type import for configuration object.
Style
import type { Style } from 'remark-lint-table-cell-padding'
TypeScript type for 'compact' or 'padded' string literal.

Shows how to set up the lint rule with unified, enabling GFM tables and using 'padded' style.

import { unified } from 'unified'; import remarkParse from 'remark-parse'; import remarkStringify from 'remark-stringify'; import remarkLint from 'remark-lint'; import remarkGfm from 'remark-gfm'; import remarkLintTableCellPadding from 'remark-lint-table-cell-padding'; import { reporter } from 'vfile-reporter'; const file = await unified() .use(remarkParse) .use(remarkGfm) .use(remarkLint) .use(remarkLintTableCellPadding, 'padded') .use(remarkStringify) .process('| a |\n| - |'); console.error(reporter(file)); // Logs: 1:3-1:6 warning Cell padding Cell should be padded remark-lint-table-cell-padding
Debug
Known issues
breakingPackage is ESM-only since version 5.0.0. Requires Node.js 16+ and cannot be required with CommonJS.
fix
Use import syntax or switch to dynamic import(). Ensure Node.js >=16.
affects: >=5.0.0
gotchaThe rule only works if remark-gfm is used to parse GFM tables. Without it, tables are not parsed and the rule does nothing.
fix
Add remark-gfm to your unified pipeline: .use(remarkGfm).
affects: >=1.0.0
gotchaThe 'stringLength' option must be provided when using non-standard characters (e.g., emoji, CJK) to correctly measure cell width.
fix
Pass a function like stringLength: s => [...s].length or use string-width package.
affects: >=5.1.0
deprecatedPassing a string like 'padded' directly as options is deprecated in favor of an object with style property.
fix
Use { style: 'padded' } instead of just 'padded'.
affects: >=5.0.0
gotchaThe 'consistent' style uses the first cell's padding style. If the first cell is mis-padded, it may not warn correctly.
fix
Explicitly set style to 'padded' or 'compact' when known.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module ... not supported.
Package is ESM-only and cannot be required with CommonJS require().
fix
Change to import statement and ensure project is ESM or use dynamic import().
Cannot find module 'remark-gfm'
Missing dependency remark-gfm required to parse GFM tables.
fix
Install remark-gfm: npm install remark-gfm and add .use(remarkGfm) to pipeline.
Warning: ... Cell padding Cell should be padded ...
Table cells do not have spaces around content when style is 'padded'.
fix
Add spaces: | a | instead of |a|.
Upgrade
Version history
5.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
remark-lint-table-cell-padding — npm install remark-lint-table-cell-padding · libregistry