vweevers / hallmark

Markdown Style Guide, with linter and automatic fixer.
GNU General Public License v3.0
34 stars 3 forks source link

TypeError related to git-contributors and lint-table-cell-padding #18

Closed vweevers closed 6 years ago

vweevers commented 6 years ago
CONTRIBUTORS.md
1:1  warning  TypeError: Cannot read property 'length' of undefined
    at visitor (D:\Projecten\GitHub\Level\level.js\node_modules\remark-lint-table-cell-padding\index.js:180:37)
    at one (D:\Projecten\GitHub\Level\level.js\node_modules\unist-util-visit\index.js:31:16)
    at all (D:\Projecten\GitHub\Level\level.js\node_modules\unist-util-visit\index.js:54:25)
    at one (D:\Projecten\GitHub\Level\level.js\node_modules\unist-util-visit\index.js:39:14)
    at visit (D:\Projecten\GitHub\Level\level.js\node_modules\unist-util-visit\index.js:22:3)
    at tableCellPadding (D:\Projecten\GitHub\Level\level.js\node_modules\remark-lint-table-cell-padding\index.js:176:3)
    at D:\Projecten\GitHub\Level\level.js\node_modules\wrapped\index.js:74:16
    at wrap (D:\Projecten\GitHub\Level\level.js\node_modules\wrapped\index.js:54:27)
    at transformer (D:\Projecten\GitHub\Level\level.js\node_modules\unified-lint-rule\index.js:34:7)
    at wrapped (D:\Projecten\GitHub\Level\level.js\node_modules\trough\index.js:93:19)    table-cell-padding  remark-lint
vweevers commented 6 years ago

remark-lint-table-cell-padding is expecting the MDAST table node to have an align property, but remark-contributors doesn't define this property.

vweevers commented 6 years ago

But in https://github.com/syntax-tree/mdast#table, align is defined as:

interface Table <: Parent {
  type: "table";
  align: [alignType];
}
enum alignType {
  "left" | "right" | "center" | null;
}

So it's optional, and remark-lint-table-cell-padding is at fault.

vweevers commented 6 years ago

I misread that. The align property is required, and must be an array. Only the alignType (per column) is optional.

vweevers commented 6 years ago

Fixed ad-hoc in https://github.com/vweevers/remark-git-contributors/commit/47eb07f5427b9738af83526cff5a95ab8ba8628c, pending https://github.com/hughsk/remark-contributors/pull/8.

vweevers commented 6 years ago

0.0.2