podlite 0.0.78 → 0.0.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.podlite +12 -0
  2. package/esm/cli.js +22 -8
  3. package/esm/cli.js.map +1 -1
  4. package/esm/lint/config.d.ts +6 -0
  5. package/esm/lint/config.js +55 -0
  6. package/esm/lint/config.js.map +1 -0
  7. package/esm/lint/engine.js +3 -1
  8. package/esm/lint/engine.js.map +1 -1
  9. package/esm/lint/formatters/text.d.ts +1 -0
  10. package/esm/lint/formatters/text.js +3 -1
  11. package/esm/lint/formatters/text.js.map +1 -1
  12. package/esm/lint/grammar/scan.js +8 -1
  13. package/esm/lint/grammar/scan.js.map +1 -1
  14. package/esm/lint/index.js +32 -15
  15. package/esm/lint/index.js.map +1 -1
  16. package/esm/lint/mute.d.ts +17 -0
  17. package/esm/lint/mute.js +75 -0
  18. package/esm/lint/mute.js.map +1 -0
  19. package/esm/lint/rules/attr-value-dropped.js +3 -2
  20. package/esm/lint/rules/attr-value-dropped.js.map +1 -1
  21. package/esm/lint/rules/index.js +2 -0
  22. package/esm/lint/rules/index.js.map +1 -1
  23. package/esm/lint/rules/table-column-width.d.ts +4 -0
  24. package/esm/lint/rules/table-column-width.js +106 -0
  25. package/esm/lint/rules/table-column-width.js.map +1 -0
  26. package/esm/lint/rules/table-shape.d.ts +3 -0
  27. package/esm/lint/rules/table-shape.js +15 -0
  28. package/esm/lint/rules/table-shape.js.map +1 -0
  29. package/esm/lint/types.d.ts +4 -1
  30. package/esm/version.d.ts +1 -1
  31. package/esm/version.js +1 -1
  32. package/lib/cli.js +22 -8
  33. package/lib/cli.js.map +1 -1
  34. package/lib/lint/config.d.ts +6 -0
  35. package/lib/lint/config.js +95 -0
  36. package/lib/lint/config.js.map +1 -0
  37. package/lib/lint/engine.js +3 -1
  38. package/lib/lint/engine.js.map +1 -1
  39. package/lib/lint/formatters/text.d.ts +1 -0
  40. package/lib/lint/formatters/text.js +3 -1
  41. package/lib/lint/formatters/text.js.map +1 -1
  42. package/lib/lint/grammar/scan.js +8 -1
  43. package/lib/lint/grammar/scan.js.map +1 -1
  44. package/lib/lint/index.js +32 -15
  45. package/lib/lint/index.js.map +1 -1
  46. package/lib/lint/mute.d.ts +17 -0
  47. package/lib/lint/mute.js +80 -0
  48. package/lib/lint/mute.js.map +1 -0
  49. package/lib/lint/rules/attr-value-dropped.js +3 -2
  50. package/lib/lint/rules/attr-value-dropped.js.map +1 -1
  51. package/lib/lint/rules/index.js +2 -0
  52. package/lib/lint/rules/index.js.map +1 -1
  53. package/lib/lint/rules/table-column-width.d.ts +4 -0
  54. package/lib/lint/rules/table-column-width.js +110 -0
  55. package/lib/lint/rules/table-column-width.js.map +1 -0
  56. package/lib/lint/rules/table-shape.d.ts +3 -0
  57. package/lib/lint/rules/table-shape.js +18 -0
  58. package/lib/lint/rules/table-shape.js.map +1 -0
  59. package/lib/lint/types.d.ts +4 -1
  60. package/lib/version.d.ts +1 -1
  61. package/lib/version.js +1 -1
  62. package/package.json +7 -7
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LINT_IGNORE_RULE_ID = void 0;
4
+ exports.collectMutes = collectMutes;
5
+ exports.applyMutes = applyMutes;
6
+ const schema_1 = require("@podlite/schema");
7
+ exports.LINT_IGNORE_RULE_ID = 'lint-ignore';
8
+ const ATTR = 'lint-ignore';
9
+ const valuesOf = (config) => {
10
+ if (!Array.isArray(config))
11
+ return null;
12
+ const item = config.find(c => c && typeof c === 'object' && c.name === ATTR);
13
+ if (!item)
14
+ return null;
15
+ const value = item.value;
16
+ if (Array.isArray(value))
17
+ return value.map(String);
18
+ if (typeof value === 'string')
19
+ return value.split(/\s+/).filter(Boolean);
20
+ return [];
21
+ };
22
+ const covers = (mute, violation) => {
23
+ const at = violation.location?.start.offset;
24
+ if (at === undefined)
25
+ return false;
26
+ return at >= mute.location.start.offset && at <= mute.location.end.offset;
27
+ };
28
+ function collectMutes(ast) {
29
+ const nodes = (0, schema_1.getFromTree)(ast, () => true);
30
+ const mutes = [];
31
+ const empty = [];
32
+ for (const node of nodes) {
33
+ if (!node || !node.location)
34
+ continue;
35
+ const rules = valuesOf(node.config);
36
+ if (rules === null)
37
+ continue;
38
+ if (rules.length === 0) {
39
+ empty.push(node.location);
40
+ continue;
41
+ }
42
+ mutes.push({ rules, location: node.location, used: new Set() });
43
+ }
44
+ return { mutes, empty };
45
+ }
46
+ // A mute names the rules it silences: a bare attribute would cover everything,
47
+ // and a mute that never fires is a leftover the author cannot see otherwise.
48
+ function applyMutes(violations, ast) {
49
+ const { mutes, empty } = collectMutes(ast);
50
+ if (mutes.length === 0 && empty.length === 0)
51
+ return { kept: violations, silenced: 0 };
52
+ const kept = violations.filter(violation => {
53
+ const mute = mutes.find(m => m.rules.includes(violation.rule) && covers(m, violation));
54
+ if (!mute)
55
+ return true;
56
+ mute.used.add(violation.rule);
57
+ return false;
58
+ });
59
+ for (const location of empty) {
60
+ kept.push({
61
+ rule: exports.LINT_IGNORE_RULE_ID,
62
+ severity: 'warning',
63
+ message: `:${ATTR} names no rule; write the rule slugs it should silence`,
64
+ location,
65
+ });
66
+ }
67
+ for (const mute of mutes) {
68
+ const idle = mute.rules.filter(rule => !mute.used.has(rule));
69
+ if (idle.length === 0)
70
+ continue;
71
+ kept.push({
72
+ rule: exports.LINT_IGNORE_RULE_ID,
73
+ severity: 'warning',
74
+ message: `:${ATTR}<${idle.join(' ')}> silenced nothing here`,
75
+ location: mute.location,
76
+ });
77
+ }
78
+ return { kept, silenced: violations.length - kept.filter(v => v.rule !== exports.LINT_IGNORE_RULE_ID).length };
79
+ }
80
+ //# sourceMappingURL=mute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mute.js","sourceRoot":"","sources":["../../src/lint/mute.ts"],"names":[],"mappings":";;;AA2BA,oCAeC;AAID,gCA8BC;AA5ED,4CAA6C;AAIhC,QAA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CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;QAC7B,OAAO,KAAK,CAAA;IACd,CAAC,CAAC,CAAA;IAEF,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE,CAAC;QAC7B,IAAI,CAAC,IAAI,CAAC;YACR,IAAI,EAAE,2BAAmB;YACzB,QAAQ,EAAE,SAAS;YACnB,OAAO,EAAE,IAAI,IAAI,wDAAwD;YACzE,QAAQ;SACT,CAAC,CAAA;IACJ,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;QAC5D,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,SAAQ;QAC/B,IAAI,CAAC,IAAI,CAAC;YACR,IAAI,EAAE,2BAAmB;YACzB,QAAQ,EAAE,SAAS;YACnB,OAAO,EAAE,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,yBAAyB;YAC5D,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,2BAAmB,CAAC,CAAC,MAAM,EAAE,CAAA;AACxG,CAAC"}
@@ -5,9 +5,10 @@ exports.ATTR_VALUE_DROPPED_RULE_ID = 'attr-value-dropped';
5
5
  exports.attrValueDroppedRule = {
6
6
  id: exports.ATTR_VALUE_DROPPED_RULE_ID,
7
7
  severity: 'warning',
8
- // a directive the parser could not read is the business of syntax-valid
8
+ // a directive the parser could not read is the business of syntax-valid,
9
+ // a table that was reshaped is the business of table-shape
9
10
  check: (ast, _ctx) => (ast.diagnostics || [])
10
- .filter(d => d.code !== 'directive-unreadable')
11
+ .filter(d => d.code === 'value-unreadable')
11
12
  .map(d => ({
12
13
  rule: exports.ATTR_VALUE_DROPPED_RULE_ID,
13
14
  severity: d.severity,
@@ -1 +1 @@
1
- {"version":3,"file":"attr-value-dropped.js","sourceRoot":"","sources":["../../../src/lint/rules/attr-value-dropped.ts"],"names":[],"mappings":";;;AAGa,QAAA,0BAA0B,GAAG,oBAAoB,CAAA;AAEjD,QAAA,oBAAoB,GAAS;IACxC,EAAE,EAAE,kCAA0B;IAC9B,QAAQ,EAAE,SAAS;IACnB,wEAAwE;IACxE,KAAK,EAAE,CAAC,GAAoB,EAAE,IAAiB,EAAe,EAAE,CAC9D,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,sBAAsB,CAAC;SAC9C,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACT,IAAI,EAAE,kCAA0B;QAChC,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,QAAQ,EAAE,CAAC,CAAC,QAAQ;KACrB,CAAC,CAAC;CACR,CAAA"}
1
+ {"version":3,"file":"attr-value-dropped.js","sourceRoot":"","sources":["../../../src/lint/rules/attr-value-dropped.ts"],"names":[],"mappings":";;;AAGa,QAAA,0BAA0B,GAAG,oBAAoB,CAAA;AAEjD,QAAA,oBAAoB,GAAS;IACxC,EAAE,EAAE,kCAA0B;IAC9B,QAAQ,EAAE,SAAS;IACnB,yEAAyE;IACzE,2DAA2D;IAC3D,KAAK,EAAE,CAAC,GAAoB,EAAE,IAAiB,EAAe,EAAE,CAC9D,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,kBAAkB,CAAC;SAC1C,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACT,IAAI,EAAE,kCAA0B;QAChC,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,QAAQ,EAAE,CAAC,CAAC,QAAQ;KACrB,CAAC,CAAC;CACR,CAAA"}
@@ -7,6 +7,7 @@ const id_unique_1 = require("./id-unique");
7
7
  const media_absolute_file_1 = require("./media-absolute-file");
8
8
  const link_target_resolves_1 = require("./link-target-resolves");
9
9
  const attr_value_dropped_1 = require("./attr-value-dropped");
10
+ const table_shape_1 = require("./table-shape");
10
11
  exports.DEFAULT_RULES = [
11
12
  syntax_valid_1.syntaxValidRule,
12
13
  heading_hierarchy_1.headingHierarchyRule,
@@ -14,5 +15,6 @@ exports.DEFAULT_RULES = [
14
15
  media_absolute_file_1.mediaAbsoluteFileRule,
15
16
  link_target_resolves_1.linkTargetResolvesRule,
16
17
  attr_value_dropped_1.attrValueDroppedRule,
18
+ table_shape_1.tableShapeRule,
17
19
  ];
18
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lint/rules/index.ts"],"names":[],"mappings":";;;AACA,iDAAgD;AAChD,2DAA0D;AAC1D,2CAA0C;AAC1C,+DAA6D;AAC7D,iEAA+D;AAC/D,6DAA2D;AAE9C,QAAA,aAAa,GAAW;IACnC,8BAAe;IACf,wCAAoB;IACpB,wBAAY;IACZ,2CAAqB;IACrB,6CAAsB;IACtB,yCAAoB;CACrB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lint/rules/index.ts"],"names":[],"mappings":";;;AACA,iDAAgD;AAChD,2DAA0D;AAC1D,2CAA0C;AAC1C,+DAA6D;AAC7D,iEAA+D;AAC/D,6DAA2D;AAC3D,+CAA8C;AAEjC,QAAA,aAAa,GAAW;IACnC,8BAAe;IACf,wCAAoB;IACpB,wBAAY;IACZ,2CAAqB;IACrB,6CAAsB;IACtB,yCAAoB;IACpB,4BAAc;CACf,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { Violation, SourceRule } from '../types';
2
+ export declare const TABLE_COLUMN_WIDTH_RULE_ID = "table-column-width";
3
+ export declare const tableColumnWidthRule: SourceRule;
4
+ export declare function scanTableColumns(content: string): Violation[];
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tableColumnWidthRule = exports.TABLE_COLUMN_WIDTH_RULE_ID = void 0;
4
+ exports.scanTableColumns = scanTableColumns;
5
+ const schema_1 = require("@podlite/schema");
6
+ exports.TABLE_COLUMN_WIDTH_RULE_ID = 'table-column-width';
7
+ exports.tableColumnWidthRule = {
8
+ id: exports.TABLE_COLUMN_WIDTH_RULE_ID,
9
+ severity: 'warning',
10
+ };
11
+ const SEPARATOR_LINE = /^[\s=+|_-]*[|+][\s=+|_-]*$/;
12
+ const hasBar = (line) => line.includes('|') || line.includes('+');
13
+ // A table with visible bars is cut by the column positions its separator line
14
+ // sets, not by the bars in the row itself. A cell that reaches the boundary
15
+ // pushes the column open for the whole table, so every row loses its last
16
+ // column at once — and the document still parses, silently.
17
+ const boundaries = (separator) => {
18
+ const out = [];
19
+ for (let i = 0; i < separator.length; i++) {
20
+ if (separator[i] === '|' || separator[i] === '+')
21
+ out.push(i);
22
+ }
23
+ return out;
24
+ };
25
+ const isEdge = (char) => char === '|' || char === '+' || char === ' ';
26
+ const collides = (line, boundary) => {
27
+ if (boundary >= line.length)
28
+ return false;
29
+ // content standing on the boundary, or pressed against it with no space left
30
+ if (!isEdge(line[boundary]))
31
+ return true;
32
+ return boundary > 0 && !isEdge(line[boundary - 1]);
33
+ };
34
+ const checkTable = (lines) => {
35
+ const separator = lines.find(l => SEPARATOR_LINE.test(l.text) && hasBar(l.text));
36
+ if (!separator)
37
+ return [];
38
+ const columns = boundaries(separator.text);
39
+ if (columns.length === 0)
40
+ return [];
41
+ const violations = [];
42
+ for (const row of lines) {
43
+ if (row === separator || row.text.trim() === '')
44
+ continue;
45
+ if (SEPARATOR_LINE.test(row.text))
46
+ continue;
47
+ const hit = columns.find(b => collides(row.text, b));
48
+ if (hit === undefined)
49
+ continue;
50
+ violations.push({
51
+ rule: exports.TABLE_COLUMN_WIDTH_RULE_ID,
52
+ severity: 'warning',
53
+ message: `cell reaches the column boundary at column ${hit + 1}; leave a space before the bar or the table loses a column`,
54
+ location: {
55
+ start: { line: row.line, column: hit + 1, offset: 0 },
56
+ end: { line: row.line, column: hit + 1, offset: 0 },
57
+ },
58
+ });
59
+ }
60
+ return violations;
61
+ };
62
+ function scanTableColumns(content) {
63
+ const lines = content.split(/\r?\n/);
64
+ // a table keeps its content verbatim too, and it is the one being read here
65
+ const verbatim = new Set(schema_1.VERBATIM_BLOCKS.filter(name => name !== 'table'));
66
+ const openBlocks = [];
67
+ const violations = [];
68
+ let table = null;
69
+ const closeTable = () => {
70
+ if (table)
71
+ violations.push(...checkTable(table));
72
+ table = null;
73
+ };
74
+ for (let i = 0; i < lines.length; i++) {
75
+ const text = lines[i];
76
+ const begin = text.match(/^\s*=begin\s+([\w-]+)/);
77
+ const end = text.match(/^\s*=end\s+([\w-]+)/);
78
+ const abbreviated = text.match(/^\s*=(?:for\s+)?table\b/);
79
+ if (end) {
80
+ if (end[1] === 'table')
81
+ closeTable();
82
+ openBlocks.pop();
83
+ continue;
84
+ }
85
+ if (begin) {
86
+ closeTable();
87
+ openBlocks.push(begin[1]);
88
+ if (begin[1] === 'table' && !openBlocks.some(b => verbatim.has(b)))
89
+ table = [];
90
+ continue;
91
+ }
92
+ if (openBlocks.some(b => verbatim.has(b)))
93
+ continue;
94
+ if (abbreviated) {
95
+ closeTable();
96
+ table = [];
97
+ continue;
98
+ }
99
+ // an abbreviated table ends at the first blank line
100
+ if (table && text.trim() === '' && !openBlocks.includes('table')) {
101
+ closeTable();
102
+ continue;
103
+ }
104
+ if (table)
105
+ table.push({ text, line: i + 1 });
106
+ }
107
+ closeTable();
108
+ return violations;
109
+ }
110
+ //# sourceMappingURL=table-column-width.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-column-width.js","sourceRoot":"","sources":["../../../src/lint/rules/table-column-width.ts"],"names":[],"mappings":";;;AA+DA,4CA6CC;AA5GD,4CAAiD;AAGpC,QAAA,0BAA0B,GAAG,oBAAoB,CAAA;AAEjD,QAAA,oBAAoB,GAAe;IAC9C,EAAE,EAAE,kCAA0B;IAC9B,QAAQ,EAAE,SAAS;CACpB,CAAA;AAED,MAAM,cAAc,GAAG,4BAA4B,CAAA;AACnD,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AAEzE,8EAA8E;AAC9E,4EAA4E;AAC5E,0EAA0E;AAC1E,4DAA4D;AAC5D,MAAM,UAAU,GAAG,CAAC,SAAiB,EAAY,EAAE;IACjD,MAAM,GAAG,GAAa,EAAE,CAAA;IACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,GAAG;YAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC/D,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG,CAAA;AAE7E,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,QAAgB,EAAW,EAAE;IAC3D,IAAI,QAAQ,IAAI,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IACzC,6EAA6E;I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CAAC,CAAC,KAAK,OAAO;gBAAE,UAAU,EAAE,CAAA;YACpC,UAAU,CAAC,GAAG,EAAE,CAAA;YAChB,SAAQ;QACV,CAAC;QACD,IAAI,KAAK,EAAE,CAAC;YACV,UAAU,EAAE,CAAA;YACZ,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;YACzB,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBAAE,KAAK,GAAG,EAAE,CAAA;YAC9E,SAAQ;QACV,CAAC;QACD,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAAE,SAAQ;QACnD,IAAI,WAAW,EAAE,CAAC;YAChB,UAAU,EAAE,CAAA;YACZ,KAAK,GAAG,EAAE,CAAA;YACV,SAAQ;QACV,CAAC;QACD,oDAAoD;QACpD,IAAI,KAAK,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACjE,UAAU,EAAE,CAAA;YACZ,SAAQ;QACV,CAAC;QACD,IAAI,KAAK;YAAE,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAC9C,CAAC;IACD,UAAU,EAAE,CAAA;IACZ,OAAO,UAAU,CAAA;AACnB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Rule } from '../types';
2
+ export declare const TABLE_SHAPE_RULE_ID = "table-shape";
3
+ export declare const tableShapeRule: Rule;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tableShapeRule = exports.TABLE_SHAPE_RULE_ID = void 0;
4
+ exports.TABLE_SHAPE_RULE_ID = 'table-shape';
5
+ const TABLE_CODES = ['table-row-cells', 'table-cell-outside-row', 'table-mixed-separators', 'table-source-unreadable'];
6
+ exports.tableShapeRule = {
7
+ id: exports.TABLE_SHAPE_RULE_ID,
8
+ severity: 'warning',
9
+ check: (ast, _ctx) => (ast.diagnostics || [])
10
+ .filter(d => TABLE_CODES.includes(d.code))
11
+ .map(d => ({
12
+ rule: exports.TABLE_SHAPE_RULE_ID,
13
+ severity: d.severity,
14
+ message: d.message,
15
+ location: d.location,
16
+ })),
17
+ };
18
+ //# sourceMappingURL=table-shape.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-shape.js","sourceRoot":"","sources":["../../../src/lint/rules/table-shape.ts"],"names":[],"mappings":";;;AAGa,QAAA,mBAAmB,GAAG,aAAa,CAAA;AAEhD,MAAM,WAAW,GAAG,CAAC,iBAAiB,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,yBAAyB,CAAC,CAAA;AAEzG,QAAA,cAAc,GAAS;IAClC,EAAE,EAAE,2BAAmB;IACvB,QAAQ,EAAE,SAAS;IACnB,KAAK,EAAE,CAAC,GAAoB,EAAE,IAAiB,EAAe,EAAE,CAC9D,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;SACzC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACT,IAAI,EAAE,2BAAmB;QACzB,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,QAAQ,EAAE,CAAC,CAAC,QAAQ;KACrB,CAAC,CAAC;CACR,CAAA"}
@@ -1,7 +1,10 @@
1
1
  import type { Location, PodliteDocument } from '@podlite/schema';
2
2
  export type Severity = 'error' | 'warning' | 'info';
3
3
  export type FileType = 'md' | 'podlite';
4
- export type LintConfig = Record<string, never>;
4
+ export type RuleSetting = 'off' | Severity;
5
+ export type LintConfig = {
6
+ rules?: Record<string, RuleSetting>;
7
+ };
5
8
  export type LintContext = {
6
9
  filePath: string;
7
10
  fileType: FileType;
package/lib/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "0.0.78";
1
+ export declare const version = "0.0.79";
package/lib/version.js CHANGED
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // generated by scripts/inject-version.mjs — do not edit by hand
5
- exports.version = '0.0.78';
5
+ exports.version = '0.0.79';
6
6
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podlite",
3
- "version": "0.0.78",
3
+ "version": "0.0.79",
4
4
  "description": "Podlite markup language parser — Markdown-compatible, with native support for diagrams, formulas, and custom blocks",
5
5
  "homepage": "https://podlite.org",
6
6
  "repository": {
@@ -74,12 +74,12 @@
74
74
  "url": "https://github.com/podlite/podlite/issues"
75
75
  },
76
76
  "dependencies": {
77
- "@podlite/diagram": "^0.0.69",
78
- "@podlite/formula": "0.0.47",
79
- "@podlite/image": "^0.0.64",
80
- "@podlite/markdown": "0.0.58",
81
- "@podlite/schema": "^0.0.65",
82
- "@podlite/toc": "0.0.58",
77
+ "@podlite/diagram": "^0.0.70",
78
+ "@podlite/formula": "0.0.48",
79
+ "@podlite/image": "^0.0.65",
80
+ "@podlite/markdown": "0.0.59",
81
+ "@podlite/schema": "^0.0.66",
82
+ "@podlite/toc": "0.0.59",
83
83
  "nanoid": "3.1.30"
84
84
  },
85
85
  "devDependencies": {