Skip to content

Commit 6641a1f

Browse files
committed
lint: hoist stubSourceCode helper; prettier-format html-interactive-content
1 parent 9211525 commit 6641a1f

2 files changed

Lines changed: 18 additions & 15 deletions

File tree

lib/utils/html-interactive-content.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ function hasAttribute(node, name) {
9494
const normalizedName = name.toLowerCase();
9595
return Boolean(
9696
node.attributes &&
97-
node.attributes.some(
98-
(a) => typeof a.name === 'string' && a.name.toLowerCase() === normalizedName,
99-
),
97+
node.attributes.some(
98+
(a) => typeof a.name === 'string' && a.name.toLowerCase() === normalizedName
99+
)
100100
);
101101
}
102102

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

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ const { isNativeElement, ELEMENT_TAGS } = require('../../../lib/utils/is-native-
77
// for-html-elements.js and siblings) because it requires a real ESLint
88
// SourceCode / scope manager that's only built up by the rule tester.
99

10+
// Stub a minimal ESLint-shaped sourceCode object. The real one uses scope
11+
// managers produced by ember-eslint-parser; for unit-level coverage we mock
12+
// just the surface `isNativeElement` touches: `getScope(parent)` returning
13+
// an object with `variables` (bindings) and `upper` (parent scope).
14+
function stubSourceCode(scopeByParent) {
15+
return {
16+
getScope(parent) {
17+
return scopeByParent.get(parent) || { variables: [], upper: null };
18+
},
19+
};
20+
}
21+
1022
describe('isNativeElement — list-only behavior (no sourceCode)', () => {
1123
it('returns true for lowercase HTML tag names', () => {
1224
expect(isNativeElement({ tag: 'div' })).toBe(true);
@@ -80,18 +92,9 @@ describe('isNativeElement — list-only behavior (no sourceCode)', () => {
8092
});
8193

8294
describe('isNativeElement — scope-shadowing (with sourceCode stubs)', () => {
83-
// Stub a minimal ESLint-shaped sourceCode object. The real one uses
84-
// scope managers produced by ember-eslint-parser; for unit-level coverage
85-
// we mock just the surface `isNativeElement` touches: `getScope(parent)`
86-
// returning an object with `variables` (bindings) and `upper` (parent
87-
// scope). Rule-level integration tests cover the real parser's shape.
88-
function stubSourceCode(scopeByParent) {
89-
return {
90-
getScope(parent) {
91-
return scopeByParent.get(parent) || { variables: [], upper: null };
92-
},
93-
};
94-
}
95+
// Rule-level integration tests (tests/lib/rules/...) cover the real
96+
// parser's shape; here we mock the minimal surface `isNativeElement`
97+
// touches via `stubSourceCode` above.
9598

9699
it('treats a tag as shadowed when its name matches an actual binding', () => {
97100
const parent = { type: 'Template' };

0 commit comments

Comments
 (0)