remark-lint-no-hidden-table-cell

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

remark-lint rule to warn for superfluous table cells that are hidden because a row has more cells than the header row. Current stable version: 1.0.1. Part of the remark-lint monorepo maintained by unified collective. Released in 2024. Supports GFM tables via remark-gfm. ESM-only, ships TypeScript types. Unlike general table linting, this rule specifically catches rows with extra cells that are not rendered.

error Error [ERR_REQUIRE_ESM]: require() of ES Module ... not supported
cause Using CommonJS require() to import an ESM-only module.
fix
Switch to import statement or use dynamic import().
error Could not parse table: unrecognized table row structure
cause Missing remark-gfm plugin to parse GFM tables.
fix
Install remark-gfm and add .use(remarkGfm) to the pipeline.
error Cannot find module 'remark-lint'
cause remark-lint is not installed in the project.
fix
Run npm install remark-lint.
breaking ESM-only package: require() will throw ERR_REQUIRE_ESM.
fix Use import instead of require. Set type: 'module' in package.json.
breaking Requires Node.js 16+ as of version 1.
fix Upgrade Node.js to version 16 or later.
gotcha Does not work without remark-gfm for tables using GitHub Flavored Markdown.
fix Install remark-gfm and add .use(remarkGfm) before linting.
gotcha The plugin has no options; attempting to pass options will be silently ignored.
fix Do not pass any parameters. Use as .use(remarkLintNoHiddenTableCell).
npm install remark-lint-no-hidden-table-cell
yarn add remark-lint-no-hidden-table-cell
pnpm add remark-lint-no-hidden-table-cell

Sets up a unified pipeline to lint a markdown file for hidden table cells, using GFM support.

import remarkLint from 'remark-lint'
import remarkLintNoHiddenTableCell from 'remark-lint-no-hidden-table-cell'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'
import remarkGfm from 'remark-gfm'
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(remarkGfm)
  .use(remarkLint)
  .use(remarkLintNoHiddenTableCell)
  .use(remarkStringify)
  .process(file)

console.error(reporter(file))