{"id":26286,"library":"remark-lint-table-cell-padding","title":"remark-lint-table-cell-padding","description":"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.","status":"active","version":"5.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/remarkjs/remark-lint#main","tags":["javascript","cell","lint","padding","remark","remark-lint","remark-lint-rule","rule","table","typescript"],"install":[{"cmd":"npm install remark-lint-table-cell-padding","lang":"bash","label":"npm"},{"cmd":"yarn add remark-lint-table-cell-padding","lang":"bash","label":"yarn"},{"cmd":"pnpm add remark-lint-table-cell-padding","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only; CommonJS require() throws an error.","wrong":"const remarkLintTableCellPadding = require('remark-lint-table-cell-padding')","symbol":"remarkLintTableCellPadding","correct":"import remarkLintTableCellPadding from 'remark-lint-table-cell-padding'"},{"note":"TypeScript type import for configuration object.","symbol":"Options","correct":"import type { Options } from 'remark-lint-table-cell-padding'"},{"note":"TypeScript type for 'compact' or 'padded' string literal.","symbol":"Style","correct":"import type { Style } from 'remark-lint-table-cell-padding'"}],"quickstart":{"code":"import { unified } from 'unified';\nimport remarkParse from 'remark-parse';\nimport remarkStringify from 'remark-stringify';\nimport remarkLint from 'remark-lint';\nimport remarkGfm from 'remark-gfm';\nimport remarkLintTableCellPadding from 'remark-lint-table-cell-padding';\nimport { reporter } from 'vfile-reporter';\n\nconst file = await unified()\n  .use(remarkParse)\n  .use(remarkGfm)\n  .use(remarkLint)\n  .use(remarkLintTableCellPadding, 'padded')\n  .use(remarkStringify)\n  .process('| a |\\n| - |');\n\nconsole.error(reporter(file));\n// Logs: 1:3-1:6 warning Cell padding Cell should be padded remark-lint-table-cell-padding","lang":"typescript","description":"Shows how to set up the lint rule with unified, enabling GFM tables and using 'padded' style."},"warnings":[{"fix":"Use import syntax or switch to dynamic import(). Ensure Node.js >=16.","message":"Package is ESM-only since version 5.0.0. Requires Node.js 16+ and cannot be required with CommonJS.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Add remark-gfm to your unified pipeline: .use(remarkGfm).","message":"The rule only works if remark-gfm is used to parse GFM tables. Without it, tables are not parsed and the rule does nothing.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Pass a function like stringLength: s => [...s].length or use string-width package.","message":"The 'stringLength' option must be provided when using non-standard characters (e.g., emoji, CJK) to correctly measure cell width.","severity":"gotcha","affected_versions":">=5.1.0"},{"fix":"Use { style: 'padded' } instead of just 'padded'.","message":"Passing a string like 'padded' directly as options is deprecated in favor of an object with style property.","severity":"deprecated","affected_versions":">=5.0.0"},{"fix":"Explicitly set style to 'padded' or 'compact' when known.","message":"The 'consistent' style uses the first cell's padding style. If the first cell is mis-padded, it may not warn correctly.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Change to import statement and ensure project is ESM or use dynamic import().","cause":"Package is ESM-only and cannot be required with CommonJS require().","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module ... not supported."},{"fix":"Install remark-gfm: npm install remark-gfm and add .use(remarkGfm) to pipeline.","cause":"Missing dependency remark-gfm required to parse GFM tables.","error":"Cannot find module 'remark-gfm'"},{"fix":"Add spaces: | a | instead of |a|.","cause":"Table cells do not have spaces around content when style is 'padded'.","error":"Warning: ... Cell padding Cell should be padded ..."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}