zemdomu 1.3.5 → 1.3.7

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.
@@ -218,16 +218,29 @@ class ComponentAnalyzer {
218
218
  return a.column - b.column;
219
219
  });
220
220
  for (const heading of sortedHeadings) {
221
- if (lastHeadingLevel && heading.level > lastHeadingLevel + 1) {
222
- componentDef.issues.set('enforceHeadingOrder', [
223
- ...(componentDef.issues.get('enforceHeadingOrder') || []),
224
- {
225
- line: heading.line,
226
- column: heading.column,
227
- message: `Heading level skipped: <h${heading.level}> after <h${lastHeadingLevel}>`,
228
- rule: 'enforceHeadingOrder'
229
- }
230
- ]);
221
+ if (lastHeadingLevel) {
222
+ if (heading.level > lastHeadingLevel + 1) {
223
+ componentDef.issues.set('enforceHeadingOrder', [
224
+ ...(componentDef.issues.get('enforceHeadingOrder') || []),
225
+ {
226
+ line: heading.line,
227
+ column: heading.column,
228
+ message: `Heading level skipped: <h${heading.level}> after <h${lastHeadingLevel}>`,
229
+ rule: 'enforceHeadingOrder'
230
+ }
231
+ ]);
232
+ }
233
+ else if (heading.level === 1 && lastHeadingLevel !== 1) {
234
+ componentDef.issues.set('enforceHeadingOrder', [
235
+ ...(componentDef.issues.get('enforceHeadingOrder') || []),
236
+ {
237
+ line: heading.line,
238
+ column: heading.column,
239
+ message: `Heading level skipped: <h${heading.level}> after <h${lastHeadingLevel}>`,
240
+ rule: 'enforceHeadingOrder'
241
+ }
242
+ ]);
243
+ }
231
244
  }
232
245
  lastHeadingLevel = heading.level;
233
246
  }
@@ -376,7 +389,7 @@ class ComponentAnalyzer {
376
389
  * and checks for heading level issues
377
390
  */
378
391
  analyzeHeadingHierarchy(component, results, depth = 0) {
379
- var _a, _b, _c;
392
+ var _a, _b, _c, _d, _e, _f;
380
393
  if (this.maxDepth !== undefined && depth > this.maxDepth)
381
394
  return;
382
395
  if (this.processingComponentStack.has(component.filePath)) {
@@ -389,15 +402,26 @@ class ComponentAnalyzer {
389
402
  // Check for heading level issues
390
403
  let lastLevel = 0;
391
404
  for (const heading of allHeadings) {
392
- if (lastLevel > 0 && heading.heading.level > lastLevel + 1) {
393
- // We found a heading level skip
394
- results.push({
395
- filePath: ((_a = heading.usageLocation) === null || _a === void 0 ? void 0 : _a.filePath) || heading.heading.filePath,
396
- line: ((_b = heading.usageLocation) === null || _b === void 0 ? void 0 : _b.line) || heading.heading.line,
397
- column: ((_c = heading.usageLocation) === null || _c === void 0 ? void 0 : _c.column) || heading.heading.column,
398
- message: `Cross-component heading level skipped: <h${heading.heading.level}> after <h${lastLevel}>`,
399
- rule: 'enforceHeadingOrder'
400
- });
405
+ if (lastLevel > 0) {
406
+ if (heading.heading.level > lastLevel + 1) {
407
+ // We found a heading level skip
408
+ results.push({
409
+ filePath: ((_a = heading.usageLocation) === null || _a === void 0 ? void 0 : _a.filePath) || heading.heading.filePath,
410
+ line: ((_b = heading.usageLocation) === null || _b === void 0 ? void 0 : _b.line) || heading.heading.line,
411
+ column: ((_c = heading.usageLocation) === null || _c === void 0 ? void 0 : _c.column) || heading.heading.column,
412
+ message: `Cross-component heading level skipped: <h${heading.heading.level}> after <h${lastLevel}>`,
413
+ rule: 'enforceHeadingOrder'
414
+ });
415
+ }
416
+ else if (heading.heading.level === 1 && lastLevel !== 1) {
417
+ results.push({
418
+ filePath: ((_d = heading.usageLocation) === null || _d === void 0 ? void 0 : _d.filePath) || heading.heading.filePath,
419
+ line: ((_e = heading.usageLocation) === null || _e === void 0 ? void 0 : _e.line) || heading.heading.line,
420
+ column: ((_f = heading.usageLocation) === null || _f === void 0 ? void 0 : _f.column) || heading.heading.column,
421
+ message: `Cross-component heading level skipped: <h${heading.heading.level}> after <h${lastLevel}>`,
422
+ rule: 'enforceHeadingOrder'
423
+ });
424
+ }
401
425
  }
402
426
  lastLevel = heading.heading.level;
403
427
  }
@@ -42,10 +42,14 @@ const path_1 = __importDefault(require("path"));
42
42
  const ts = __importStar(require("typescript"));
43
43
  const linter_1 = require("./linter");
44
44
  const component_analyzer_1 = require("./component-analyzer");
45
+ const component_path_resolver_1 = require("./component-path-resolver");
45
46
  const collectLocalDeps_1 = require("./utils/collectLocalDeps");
46
47
  class ProjectLinter {
47
48
  constructor(options = {}) {
49
+ var _a;
48
50
  this.opts = options;
51
+ const rootDir = (_a = this.opts.rootDir) !== null && _a !== void 0 ? _a : process.cwd();
52
+ component_path_resolver_1.ComponentPathResolver.setRootDir(rootDir);
49
53
  this.analyzer = new component_analyzer_1.ComponentAnalyzer(this.opts, options.perf);
50
54
  }
51
55
  clear() {
@@ -1,2 +1,13 @@
1
- import { Rule } from '../linter';
1
+ import { Rule } from "../linter";
2
+ /**
3
+ * Enforce heading order with symmetric skip detection.
4
+ *
5
+ * Flags:
6
+ * - Upward skip: h2 -> h4 (new > last + 1)
7
+ * - Downward skip: h6 -> h4 (last > new + 1)
8
+ * - Reset to h1: any h1 after a non-h1 (e.g. h6 -> h1)
9
+ *
10
+ * First heading in a file never warns.
11
+ * Does not auto-reset on <section>/<article> yet; add if you want outline semantics.
12
+ */
2
13
  export default function enforceHeadingOrder(): Rule;
@@ -2,38 +2,82 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = enforceHeadingOrder;
4
4
  const utils_1 = require("./utils");
5
+ /**
6
+ * Enforce heading order with symmetric skip detection.
7
+ *
8
+ * Flags:
9
+ * - Upward skip: h2 -> h4 (new > last + 1)
10
+ * - Downward skip: h6 -> h4 (last > new + 1)
11
+ * - Reset to h1: any h1 after a non-h1 (e.g. h6 -> h1)
12
+ *
13
+ * First heading in a file never warns.
14
+ * Does not auto-reset on <section>/<article> yet; add if you want outline semantics.
15
+ */
5
16
  function enforceHeadingOrder() {
6
- let last = 0;
17
+ let last = 0; // 0 means “no heading seen yet”
7
18
  return {
8
- name: 'enforceHeadingOrder',
9
- init() { last = 0; },
19
+ name: "enforceHeadingOrder",
20
+ init() {
21
+ last = 0;
22
+ },
10
23
  enterHtml(node) {
11
- if (node.type === 'element' && /^h[1-6]$/.test(node.tagName)) {
12
- const lvl = parseInt(node.tagName.charAt(1), 10);
13
- if (last && lvl > last + 1) {
14
- const message = `Heading level skipped: <${node.tagName}> after <h${last}>`;
15
- last = lvl;
16
- return [{ line: 0, column: 0, message, rule: 'enforceHeadingOrder' }];
17
- }
18
- last = lvl;
19
- }
20
- return [];
24
+ if (!(node.type === "element" && /^h[1-6]$/.test(node.tagName)))
25
+ return [];
26
+ const lvl = parseInt(node.tagName[1], 10);
27
+ const msg = computeMessage(lvl, last, node.tagName);
28
+ last = lvl;
29
+ if (!msg)
30
+ return [];
31
+ // simpleHtmlParser nodes don’t carry source positions here; anchor at (0,0)
32
+ return [
33
+ {
34
+ line: 0,
35
+ column: 0,
36
+ message: msg,
37
+ rule: "enforceHeadingOrder",
38
+ },
39
+ ];
21
40
  },
22
41
  enterJsx(path) {
23
42
  var _a, _b, _c, _d;
24
43
  const tag = (0, utils_1.getTag)(path);
25
- if (/^h[1-6]$/.test(tag)) {
26
- const lvl = parseInt(tag.charAt(1), 10);
27
- if (last && lvl > last + 1) {
28
- const message = `Heading level skipped: <${tag}> after <h${last}>`;
29
- last = lvl;
30
- const line = ((_b = (_a = path.node.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _b !== void 0 ? _b : 1) - 1;
31
- const column = (_d = (_c = path.node.loc) === null || _c === void 0 ? void 0 : _c.start.column) !== null && _d !== void 0 ? _d : 0;
32
- return [{ line, column, message, rule: 'enforceHeadingOrder' }];
33
- }
34
- last = lvl;
35
- }
36
- return [];
44
+ if (!/^h[1-6]$/.test(tag))
45
+ return [];
46
+ const lvl = parseInt(tag[1], 10);
47
+ const msg = computeMessage(lvl, last, tag);
48
+ last = lvl;
49
+ if (!msg)
50
+ return [];
51
+ const line = ((_b = (_a = path.node.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _b !== void 0 ? _b : 1) - 1; // VS Code is 0-based
52
+ const column = (_d = (_c = path.node.loc) === null || _c === void 0 ? void 0 : _c.start.column) !== null && _d !== void 0 ? _d : 0;
53
+ return [
54
+ {
55
+ line,
56
+ column,
57
+ message: msg,
58
+ rule: "enforceHeadingOrder",
59
+ },
60
+ ];
37
61
  },
38
62
  };
39
63
  }
64
+ /**
65
+ * Return a human-readable message if the new level violates order, else null.
66
+ */
67
+ function computeMessage(newLvl, lastLvl, newTag) {
68
+ if (lastLvl === 0)
69
+ return null; // first heading seen
70
+ // Any h1 after a non-h1 is considered a reset-skip
71
+ if (newLvl === 1 && lastLvl !== 1) {
72
+ return `Heading level skipped: <${newTag}> after <h${lastLvl}>`;
73
+ }
74
+ // Upward skip (e.g. h2 -> h4)
75
+ if (newLvl > lastLvl + 1) {
76
+ return `Heading level skipped: <${newTag}> after <h${lastLvl}>`;
77
+ }
78
+ // Downward skip (e.g. h6 -> h4)
79
+ if (lastLvl > newLvl + 1) {
80
+ return `Heading level skipped: <${newTag}> after <h${lastLvl}>`;
81
+ }
82
+ return null;
83
+ }
@@ -218,16 +218,29 @@ class ComponentAnalyzer {
218
218
  return a.column - b.column;
219
219
  });
220
220
  for (const heading of sortedHeadings) {
221
- if (lastHeadingLevel && heading.level > lastHeadingLevel + 1) {
222
- componentDef.issues.set('enforceHeadingOrder', [
223
- ...(componentDef.issues.get('enforceHeadingOrder') || []),
224
- {
225
- line: heading.line,
226
- column: heading.column,
227
- message: `Heading level skipped: <h${heading.level}> after <h${lastHeadingLevel}>`,
228
- rule: 'enforceHeadingOrder'
229
- }
230
- ]);
221
+ if (lastHeadingLevel) {
222
+ if (heading.level > lastHeadingLevel + 1) {
223
+ componentDef.issues.set('enforceHeadingOrder', [
224
+ ...(componentDef.issues.get('enforceHeadingOrder') || []),
225
+ {
226
+ line: heading.line,
227
+ column: heading.column,
228
+ message: `Heading level skipped: <h${heading.level}> after <h${lastHeadingLevel}>`,
229
+ rule: 'enforceHeadingOrder'
230
+ }
231
+ ]);
232
+ }
233
+ else if (heading.level === 1 && lastHeadingLevel !== 1) {
234
+ componentDef.issues.set('enforceHeadingOrder', [
235
+ ...(componentDef.issues.get('enforceHeadingOrder') || []),
236
+ {
237
+ line: heading.line,
238
+ column: heading.column,
239
+ message: `Heading level skipped: <h${heading.level}> after <h${lastHeadingLevel}>`,
240
+ rule: 'enforceHeadingOrder'
241
+ }
242
+ ]);
243
+ }
231
244
  }
232
245
  lastHeadingLevel = heading.level;
233
246
  }
@@ -376,7 +389,7 @@ class ComponentAnalyzer {
376
389
  * and checks for heading level issues
377
390
  */
378
391
  analyzeHeadingHierarchy(component, results, depth = 0) {
379
- var _a, _b, _c;
392
+ var _a, _b, _c, _d, _e, _f;
380
393
  if (this.maxDepth !== undefined && depth > this.maxDepth)
381
394
  return;
382
395
  if (this.processingComponentStack.has(component.filePath)) {
@@ -389,15 +402,26 @@ class ComponentAnalyzer {
389
402
  // Check for heading level issues
390
403
  let lastLevel = 0;
391
404
  for (const heading of allHeadings) {
392
- if (lastLevel > 0 && heading.heading.level > lastLevel + 1) {
393
- // We found a heading level skip
394
- results.push({
395
- filePath: ((_a = heading.usageLocation) === null || _a === void 0 ? void 0 : _a.filePath) || heading.heading.filePath,
396
- line: ((_b = heading.usageLocation) === null || _b === void 0 ? void 0 : _b.line) || heading.heading.line,
397
- column: ((_c = heading.usageLocation) === null || _c === void 0 ? void 0 : _c.column) || heading.heading.column,
398
- message: `Cross-component heading level skipped: <h${heading.heading.level}> after <h${lastLevel}>`,
399
- rule: 'enforceHeadingOrder'
400
- });
405
+ if (lastLevel > 0) {
406
+ if (heading.heading.level > lastLevel + 1) {
407
+ // We found a heading level skip
408
+ results.push({
409
+ filePath: ((_a = heading.usageLocation) === null || _a === void 0 ? void 0 : _a.filePath) || heading.heading.filePath,
410
+ line: ((_b = heading.usageLocation) === null || _b === void 0 ? void 0 : _b.line) || heading.heading.line,
411
+ column: ((_c = heading.usageLocation) === null || _c === void 0 ? void 0 : _c.column) || heading.heading.column,
412
+ message: `Cross-component heading level skipped: <h${heading.heading.level}> after <h${lastLevel}>`,
413
+ rule: 'enforceHeadingOrder'
414
+ });
415
+ }
416
+ else if (heading.heading.level === 1 && lastLevel !== 1) {
417
+ results.push({
418
+ filePath: ((_d = heading.usageLocation) === null || _d === void 0 ? void 0 : _d.filePath) || heading.heading.filePath,
419
+ line: ((_e = heading.usageLocation) === null || _e === void 0 ? void 0 : _e.line) || heading.heading.line,
420
+ column: ((_f = heading.usageLocation) === null || _f === void 0 ? void 0 : _f.column) || heading.heading.column,
421
+ message: `Cross-component heading level skipped: <h${heading.heading.level}> after <h${lastLevel}>`,
422
+ rule: 'enforceHeadingOrder'
423
+ });
424
+ }
401
425
  }
402
426
  lastLevel = heading.heading.level;
403
427
  }
@@ -42,10 +42,14 @@ const path_1 = __importDefault(require("path"));
42
42
  const ts = __importStar(require("typescript"));
43
43
  const linter_1 = require("./linter");
44
44
  const component_analyzer_1 = require("./component-analyzer");
45
+ const component_path_resolver_1 = require("./component-path-resolver");
45
46
  const collectLocalDeps_1 = require("./utils/collectLocalDeps");
46
47
  class ProjectLinter {
47
48
  constructor(options = {}) {
49
+ var _a;
48
50
  this.opts = options;
51
+ const rootDir = (_a = this.opts.rootDir) !== null && _a !== void 0 ? _a : process.cwd();
52
+ component_path_resolver_1.ComponentPathResolver.setRootDir(rootDir);
49
53
  this.analyzer = new component_analyzer_1.ComponentAnalyzer(this.opts, options.perf);
50
54
  }
51
55
  clear() {
@@ -2,38 +2,82 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = enforceHeadingOrder;
4
4
  const utils_1 = require("./utils");
5
+ /**
6
+ * Enforce heading order with symmetric skip detection.
7
+ *
8
+ * Flags:
9
+ * - Upward skip: h2 -> h4 (new > last + 1)
10
+ * - Downward skip: h6 -> h4 (last > new + 1)
11
+ * - Reset to h1: any h1 after a non-h1 (e.g. h6 -> h1)
12
+ *
13
+ * First heading in a file never warns.
14
+ * Does not auto-reset on <section>/<article> yet; add if you want outline semantics.
15
+ */
5
16
  function enforceHeadingOrder() {
6
- let last = 0;
17
+ let last = 0; // 0 means “no heading seen yet”
7
18
  return {
8
- name: 'enforceHeadingOrder',
9
- init() { last = 0; },
19
+ name: "enforceHeadingOrder",
20
+ init() {
21
+ last = 0;
22
+ },
10
23
  enterHtml(node) {
11
- if (node.type === 'element' && /^h[1-6]$/.test(node.tagName)) {
12
- const lvl = parseInt(node.tagName.charAt(1), 10);
13
- if (last && lvl > last + 1) {
14
- const message = `Heading level skipped: <${node.tagName}> after <h${last}>`;
15
- last = lvl;
16
- return [{ line: 0, column: 0, message, rule: 'enforceHeadingOrder' }];
17
- }
18
- last = lvl;
19
- }
20
- return [];
24
+ if (!(node.type === "element" && /^h[1-6]$/.test(node.tagName)))
25
+ return [];
26
+ const lvl = parseInt(node.tagName[1], 10);
27
+ const msg = computeMessage(lvl, last, node.tagName);
28
+ last = lvl;
29
+ if (!msg)
30
+ return [];
31
+ // simpleHtmlParser nodes don’t carry source positions here; anchor at (0,0)
32
+ return [
33
+ {
34
+ line: 0,
35
+ column: 0,
36
+ message: msg,
37
+ rule: "enforceHeadingOrder",
38
+ },
39
+ ];
21
40
  },
22
41
  enterJsx(path) {
23
42
  var _a, _b, _c, _d;
24
43
  const tag = (0, utils_1.getTag)(path);
25
- if (/^h[1-6]$/.test(tag)) {
26
- const lvl = parseInt(tag.charAt(1), 10);
27
- if (last && lvl > last + 1) {
28
- const message = `Heading level skipped: <${tag}> after <h${last}>`;
29
- last = lvl;
30
- const line = ((_b = (_a = path.node.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _b !== void 0 ? _b : 1) - 1;
31
- const column = (_d = (_c = path.node.loc) === null || _c === void 0 ? void 0 : _c.start.column) !== null && _d !== void 0 ? _d : 0;
32
- return [{ line, column, message, rule: 'enforceHeadingOrder' }];
33
- }
34
- last = lvl;
35
- }
36
- return [];
44
+ if (!/^h[1-6]$/.test(tag))
45
+ return [];
46
+ const lvl = parseInt(tag[1], 10);
47
+ const msg = computeMessage(lvl, last, tag);
48
+ last = lvl;
49
+ if (!msg)
50
+ return [];
51
+ const line = ((_b = (_a = path.node.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _b !== void 0 ? _b : 1) - 1; // VS Code is 0-based
52
+ const column = (_d = (_c = path.node.loc) === null || _c === void 0 ? void 0 : _c.start.column) !== null && _d !== void 0 ? _d : 0;
53
+ return [
54
+ {
55
+ line,
56
+ column,
57
+ message: msg,
58
+ rule: "enforceHeadingOrder",
59
+ },
60
+ ];
37
61
  },
38
62
  };
39
63
  }
64
+ /**
65
+ * Return a human-readable message if the new level violates order, else null.
66
+ */
67
+ function computeMessage(newLvl, lastLvl, newTag) {
68
+ if (lastLvl === 0)
69
+ return null; // first heading seen
70
+ // Any h1 after a non-h1 is considered a reset-skip
71
+ if (newLvl === 1 && lastLvl !== 1) {
72
+ return `Heading level skipped: <${newTag}> after <h${lastLvl}>`;
73
+ }
74
+ // Upward skip (e.g. h2 -> h4)
75
+ if (newLvl > lastLvl + 1) {
76
+ return `Heading level skipped: <${newTag}> after <h${lastLvl}>`;
77
+ }
78
+ // Downward skip (e.g. h6 -> h4)
79
+ if (lastLvl > newLvl + 1) {
80
+ return `Heading level skipped: <${newTag}> after <h${lastLvl}>`;
81
+ }
82
+ return null;
83
+ }
@@ -1,7 +1,41 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.default = Button;
4
37
  const jsx_runtime_1 = require("react/jsx-runtime");
38
+ const React = __importStar(require("react"));
5
39
  function Button() {
6
40
  return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h1", { children: "Button" }), (0, jsx_runtime_1.jsx)("h5", { children: "Subsection" })] }));
7
41
  }
@@ -1,10 +1,44 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
39
  exports.default = Page;
7
40
  const jsx_runtime_1 = require("react/jsx-runtime");
41
+ const React = __importStar(require("react"));
8
42
  const Section_1 = __importDefault(require("@alias/Section"));
9
43
  function Page() {
10
44
  return ((0, jsx_runtime_1.jsxs)("main", { children: [(0, jsx_runtime_1.jsx)("h1", { children: "Hello" }), (0, jsx_runtime_1.jsx)(Section_1.default, {})] }));
@@ -1,10 +1,44 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
39
  exports.default = Section;
7
40
  const jsx_runtime_1 = require("react/jsx-runtime");
41
+ const React = __importStar(require("react"));
8
42
  const SubSection_1 = __importDefault(require("@alias/SubSection"));
9
43
  function Section() {
10
44
  return ((0, jsx_runtime_1.jsxs)("section", { children: [(0, jsx_runtime_1.jsx)("h2", { children: "Section Title" }), (0, jsx_runtime_1.jsx)(SubSection_1.default, {})] }));
@@ -1,10 +1,44 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
39
  exports.default = SubSection;
7
40
  const jsx_runtime_1 = require("react/jsx-runtime");
41
+ const React = __importStar(require("react"));
8
42
  const Button_1 = __importDefault(require("@alias/Button"));
9
43
  function SubSection() {
10
44
  return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { children: "SubSection" }), (0, jsx_runtime_1.jsx)(Button_1.default, {})] }));
@@ -41,5 +41,9 @@ describe("cross component heading order", () => {
41
41
  assert_1.default.ok(((_a = byRule["singleH1"]) !== null && _a !== void 0 ? _a : 0) >= 1, "Expected at least one singleH1");
42
42
  assert_1.default.ok(((_b = byRule["enforceHeadingOrder"]) !== null && _b !== void 0 ? _b : 0) >= 1, // set to >=2 if you expect more
43
43
  "Expected at least one enforceHeadingOrder");
44
+ const usageLocations = results
45
+ .filter((r) => r.rule === "enforceHeadingOrder" && "filePath" in r && r.filePath)
46
+ .map((r) => path_1.default.basename(r.filePath));
47
+ assert_1.default.ok(usageLocations.includes("SubSection.tsx"), "Expected heading order issue to surface on the component that renders the offending child");
44
48
  });
45
49
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zemdomu",
3
- "version": "1.3.5",
3
+ "version": "1.3.7",
4
4
  "description": "Semantic HTML linter for HTML, JSX, and TSX. Detects accessibility, SEO, and structure issues before deployment.",
5
5
  "main": "./out/index.js",
6
6
  "types": "./out/index.d.ts",