Skip to content

Commit e178d9d

Browse files
committed
fix(template-anchor-has-content): fixable meta, clearer shadowing comment, is-native-element JSDoc sync (Copilot review)
- Add meta.fixable: null — the rule is not autofixable; be explicit so eslint-plugin/consistent-output / downstream tooling doesn't misclassify it. - Clarify test comment: 'detects the shadowing via scope bindings in the scope chain' (the implementation walks scope.variables up scope.upper, it does not use scope.references). - Byte-identical sync of lib/utils/is-native-element.js (+ test) to PR #50 canonical; drops the stale template-no-noninteractive-tabindex JSDoc reference (non-existent rule on master).
1 parent 4f0a737 commit e178d9d

4 files changed

Lines changed: 15 additions & 14 deletions

File tree

lib/rules/template-anchor-has-content.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ module.exports = {
157157
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/template-anchor-has-content.md',
158158
templateMode: 'both',
159159
},
160+
fixable: null,
160161
schema: [],
161162
messages: {
162163
anchorHasContent:

lib/utils/is-native-element.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,17 @@ const ELEMENT_TAGS = new Set([...htmlTags, ...svgTags, ...mathmlTagNames]);
2121
* MathML spec registries, reached via the `html-tags` / `svg-tags` /
2222
* `mathml-tag-names` packages). It is NOT the same as:
2323
*
24-
* - "native accessibility" / "widget-ness" — see `interactive-roles.js`
25-
* (aria-query widget taxonomy; an ARIA-tree-semantics question)
26-
* - "native interactive content" / "focus behavior" — see
27-
* `html-interactive-content.js` (HTML §3.2.5.2.7; an HTML-content-model
28-
* question about which tags can be nested inside what)
24+
* - "native accessibility" / "widget-ness" — an ARIA-tree-semantics
25+
* question (for example, whether something maps to a widget role)
26+
* - "native interactive content" / "focus behavior" — an HTML content-model
27+
* question about which elements are considered interactive in the spec
2928
* - "natively focusable" / sequential-focus — see HTML §6.6.3
3029
*
3130
* This util answers only: "is this tag a first-class built-in element of one
3231
* of the three markup-language standards, rather than a component invocation
33-
* or a shadowed local binding?" Callers compose it with the other utils
34-
* above when they need a more specific question (see e.g. `template-no-
35-
* noninteractive-tabindex`, which consults both this and
36-
* `html-interactive-content`).
32+
* or a shadowed local binding?" Callers should combine it with whatever
33+
* accessibility, interactivity, or focusability checks they need for more
34+
* specific questions.
3735
*
3836
* Returns false for:
3937
* - components (PascalCase, dotted, @-prefixed, this.-prefixed, ::-namespaced —

tests/lib/rules/template-anchor-has-content.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ ruleTester.run('template-anchor-has-content', rule, {
104104

105105
// Scope-shadowed lowercase `a` (local binding in GJS) — not the native
106106
// HTML anchor, so the rule does not validate it. `isNativeElement`
107-
// detects the shadowing via scope reference tracking.
107+
// detects the shadowing via scope bindings in the scope chain.
108108
{
109109
filename: 'test.gjs',
110110
code: `

tests/lib/utils/is-native-element-test.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
const { isNativeElement, ELEMENT_TAGS } = require('../../../lib/utils/is-native-element');
44

5-
// Tests exercise the list-lookup path only. Scope-based shadowing is covered
6-
// by the rule-level test suites (see tests/lib/rules/template-no-block-params-
7-
// for-html-elements.js and siblings) because it requires a real ESLint
8-
// SourceCode / scope manager that's only built up by the rule tester.
5+
// Tests cover both the list-lookup path (no sourceCode) and scope-shadowing
6+
// detection via lightweight sourceCode stubs. Rule-level suites exercise
7+
// shadowing against a real ESLint scope manager built by ember-eslint-parser
8+
// (see tests/lib/rules/template-no-block-params-for-html-elements.js and
9+
// siblings); these unit tests verify the shadowing branch in isolation with
10+
// a minimal stub of the `getScope`/`variables`/`upper` surface it touches.
911

1012
// Stub a minimal ESLint-shaped sourceCode object. The real one uses scope
1113
// managers produced by ember-eslint-parser; for unit-level coverage we mock

0 commit comments

Comments
 (0)