Skip to content

Commit 6d33aa0

Browse files
committed
lint:fix
1 parent 45d5dea commit 6d33aa0

8 files changed

Lines changed: 179 additions & 53 deletions

README.md

Lines changed: 154 additions & 34 deletions
Large diffs are not rendered by default.

lib/rules/template-link-rel-noopener.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@ module.exports = {
4040
context.report({
4141
node: targetAttr,
4242
messageId: 'missingRel',
43-
fix: !relAttr
44-
? (fixer) => {
43+
fix: relAttr
44+
? undefined
45+
: (fixer) => {
4546
const sourceCode = context.sourceCode;
4647
const openTag = sourceCode.getText(node).match(/^<a[^>]*/)[0];
4748
const insertPos = node.range[0] + openTag.length;
4849
return fixer.insertTextBeforeRange(
4950
[insertPos, insertPos],
5051
' rel="noopener noreferrer"'
5152
);
52-
}
53-
: undefined,
53+
},
5454
});
5555
}
5656
},

lib/rules/template-no-autofocus-attribute.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ module.exports = {
1515
noAutofocus:
1616
'Avoid using autofocus attribute. Autofocusing elements can cause usability issues for sighted and non-sighted users.',
1717
},
18+
originallyFrom: {
19+
rule: 'ember-template-lint/lib/rules/no-autofocus-attribute',
20+
docs: 'ember-template-lint/docs/rules/no-autofocus-attribute.md',
21+
tests: 'ember-template-lint/tests/lib/rules/no-autofocus-attribute.js',
22+
},
1823
},
1924

2025
create(context) {

lib/rules/template-no-dynamic-subexpression-invocations.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,24 @@ module.exports = {
3030

3131
function isLocal(name) {
3232
for (const scope of localScopes) {
33-
if (scope.has(name)) return true;
33+
if (scope.has(name)) {return true;}
3434
}
3535
return false;
3636
}
3737

3838
function isDynamicPath(path) {
39-
if (!path || path.type !== 'GlimmerPathExpression') return false;
40-
if (path.head?.type === 'AtHead') return true;
41-
if (path.head?.type === 'ThisHead') return true;
42-
if (path.original && path.original.includes('.')) return true;
43-
if (path.original && isLocal(path.original)) return true;
39+
if (!path || path.type !== 'GlimmerPathExpression') {return false;}
40+
if (path.head?.type === 'AtHead') {return true;}
41+
if (path.head?.type === 'ThisHead') {return true;}
42+
if (path.original && path.original.includes('.')) {return true;}
43+
if (path.original && isLocal(path.original)) {return true;}
4444
return false;
4545
}
4646

4747
function isInAttrPosition(node) {
4848
let p = node.parent;
4949
while (p) {
50-
if (p.type === 'GlimmerAttrNode') return true;
50+
if (p.type === 'GlimmerAttrNode') {return true;}
5151
if (p.type === 'GlimmerConcatStatement') {
5252
p = p.parent;
5353
continue;

lib/rules/template-no-nested-splattributes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ module.exports = {
4242
},
4343

4444
'GlimmerElementNode:exit'(node) {
45-
if (splattributesStack.length > 0 && splattributesStack[splattributesStack.length - 1] === node) {
45+
if (splattributesStack.length > 0 && splattributesStack.at(-1) === node) {
4646
splattributesStack.pop();
4747
}
4848
},

lib/rules/template-no-shadowed-elements.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ module.exports = {
142142

143143
function isLocal(name) {
144144
for (const scope of blockParamScope) {
145-
if (scope.has(name)) return true;
145+
if (scope.has(name)) {return true;}
146146
}
147147
return false;
148148
}
@@ -166,7 +166,7 @@ module.exports = {
166166
}
167167

168168
const tag = node.tag;
169-
if (!tag) return;
169+
if (!tag) {return;}
170170

171171
const firstChar = tag.charAt(0);
172172
const startsWithUpperCase =

lib/rules/template-require-aria-activedescendant-tabindex.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ module.exports = {
4040
}
4141

4242
function isCustomComponent(tag) {
43-
if (!tag) return false;
43+
if (!tag) {return false;}
4444
// PascalCase or dotted path → custom component
4545
return /^[A-Z]/.test(tag) || tag.includes('.');
4646
}

lib/rules/template-require-iframe-title.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ module.exports = {
4646
} else {
4747
// Check for duplicate titles
4848
const existingIdx = knownTitles.findIndex(([val]) => val === value);
49-
if (existingIdx !== -1) {
50-
context.report({ node, messageId: 'missingTitle' });
51-
} else {
49+
if (existingIdx === -1) {
5250
knownTitles.push([value, node]);
51+
} else {
52+
context.report({ node, messageId: 'missingTitle' });
5353
}
5454
}
5555
break;
@@ -73,8 +73,9 @@ module.exports = {
7373
}
7474
break;
7575
}
76-
default:
76+
default: {
7777
break;
78+
}
7879
}
7980
}
8081
},

0 commit comments

Comments
 (0)