Skip to content

Commit 97f5165

Browse files
Add 19 template rules (removed no-index-component-invocation, fixed JSDoc) - 101/127 total (79%)
Co-authored-by: NullVoxPopuli <[email protected]>
1 parent 6988c6b commit 97f5165

20 files changed

Lines changed: 206 additions & 353 deletions

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ rules in templates can be disabled with eslint directives with mustache or html
249249
| [template-no-forbidden-elements](docs/rules/template-no-forbidden-elements.md) | disallow specific HTML elements | | | |
250250
| [template-no-html-comments](docs/rules/template-no-html-comments.md) | disallow HTML comments in templates | | | |
251251
| [template-no-implicit-this](docs/rules/template-no-implicit-this.md) | require explicit `this` in property access | | | |
252-
| [template-no-index-component-invocation](docs/rules/template-no-index-component-invocation.md) | disallow invocation of index components | ![badge-strict-gjs][] ![badge-strict-gts][] | | |
253252
| [template-no-inline-event-handlers](docs/rules/template-no-inline-event-handlers.md) | disallow DOM event handler attributes | ![badge-strict-gjs][] ![badge-strict-gts][] | | |
254253
| [template-no-inline-linkto](docs/rules/template-no-inline-linkto.md) | disallow inline form of LinkTo component | ![badge-strict-gjs][] ![badge-strict-gts][] | | |
255254
| [template-no-inline-styles](docs/rules/template-no-inline-styles.md) | disallow inline styles | | | |

docs/rules/template-no-index-component-invocation.md

Lines changed: 0 additions & 45 deletions
This file was deleted.

lib/rules/template-no-curly-component-invocation.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* @fileoverview Disallow curly component invocation
3-
* @type {import('eslint').Rule.RuleModule}
4-
*/
5-
1+
/** @type {import('eslint').Rule.RuleModule} */
62
module.exports = {
73
meta: {
84
type: 'suggestion',

lib/rules/template-no-implicit-this.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* @fileoverview Require explicit this for property access in templates
3-
* @type {import('eslint').Rule.RuleModule}
4-
*/
5-
1+
/** @type {import('eslint').Rule.RuleModule} */
62
module.exports = {
73
meta: {
84
type: 'suggestion',

lib/rules/template-no-index-component-invocation.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

lib/rules/template-no-link-to-tagname.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
/**
2+
* @param {any} node
3+
* @returns {boolean}
4+
*/
5+
function isLinkToComponent(node) {
6+
if (node.type === 'GlimmerElementNode') {
7+
return node.tag === 'LinkTo' || node.tag === 'link-to';
8+
}
9+
return false;
10+
}
11+
112
/** @type {import('eslint').Rule.RuleModule} */
213
module.exports = {
314
meta: {
@@ -16,12 +27,6 @@ module.exports = {
1627
},
1728

1829
create(context) {
19-
function isLinkToComponent(node) {
20-
if (node.type === 'GlimmerElementNode') {
21-
return node.tag === 'LinkTo' || node.tag === 'link-to';
22-
}
23-
return false;
24-
}
2530

2631
return {
2732
GlimmerElementNode(node) {

lib/rules/template-no-unnecessary-component-helper.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* @fileoverview Disallow unnecessary usage of (component) helper
3-
* @type {import('eslint').Rule.RuleModule}
4-
*/
5-
1+
/** @type {import('eslint').Rule.RuleModule} */
62
module.exports = {
73
meta: {
84
type: 'suggestion',

lib/rules/template-no-unused-block-params.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* @fileoverview Disallow unused block params
3-
* @type {import('eslint').Rule.RuleModule}
4-
*/
5-
1+
/** @type {import('eslint').Rule.RuleModule} */
62
module.exports = {
73
meta: {
84
type: 'suggestion',

lib/rules/template-no-whitespace-within-word.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* @fileoverview Disallow whitespace within mustache or block expression
3-
* @type {import('eslint').Rule.RuleModule}
4-
*/
5-
1+
/** @type {import('eslint').Rule.RuleModule} */
62
module.exports = {
73
meta: {
84
type: 'layout',

lib/rules/template-require-input-label.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* @fileoverview Require label for form input elements
3-
* @type {import('eslint').Rule.RuleModule}
4-
*/
5-
1+
/** @type {import('eslint').Rule.RuleModule} */
62
module.exports = {
73
meta: {
84
type: 'suggestion',

0 commit comments

Comments
 (0)