Skip to content

Commit c0df35f

Browse files
authored
Merge branch 'master' into night_fix/template-no-obsolete-elements
2 parents 6189818 + fd67dd9 commit c0df35f

122 files changed

Lines changed: 3673 additions & 1080 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ rules in templates can be disabled with eslint directives with mustache or html
249249
| [template-no-model-argument-in-route-templates](docs/rules/template-no-model-argument-in-route-templates.md) | disallow @model argument in route templates | | 🔧 | |
250250
| [template-no-multiple-empty-lines](docs/rules/template-no-multiple-empty-lines.md) | disallow multiple consecutive empty lines in templates | | 🔧 | |
251251
| [template-no-mut-helper](docs/rules/template-no-mut-helper.md) | disallow usage of (mut) helper | | | |
252-
| [template-no-negated-comparison](docs/rules/template-no-negated-comparison.md) | disallow negated comparisons in templates | | | |
252+
| [template-no-negated-condition](docs/rules/template-no-negated-condition.md) | disallow negated conditions in if/unless | | 🔧 | |
253253
| [template-no-nested-splattributes](docs/rules/template-no-nested-splattributes.md) | disallow nested ...attributes usage | | | |
254254
| [template-no-obscure-array-access](docs/rules/template-no-obscure-array-access.md) | disallow obscure array access patterns like `[email protected]` | | 🔧 | |
255255
| [template-no-obsolete-elements](docs/rules/template-no-obsolete-elements.md) | disallow obsolete HTML elements | | | |
@@ -283,7 +283,7 @@ rules in templates can be disabled with eslint directives with mustache or html
283283
| [template-require-valid-named-block-naming-format](docs/rules/template-require-valid-named-block-naming-format.md) | require valid named block naming format | | 🔧 | |
284284
| [template-self-closing-void-elements](docs/rules/template-self-closing-void-elements.md) | require self-closing on void elements | | 🔧 | |
285285
| [template-simple-modifiers](docs/rules/template-simple-modifiers.md) | require simple modifier syntax | | | |
286-
| [template-simple-unless](docs/rules/template-simple-unless.md) | require simple conditions in unless blocks | | | |
286+
| [template-simple-unless](docs/rules/template-simple-unless.md) | require simple conditions in unless blocks | | 🔧 | |
287287
| [template-sort-invocations](docs/rules/template-sort-invocations.md) | require sorted attributes and modifiers | | 🔧 | |
288288
| [template-splat-attributes-only](docs/rules/template-splat-attributes-only.md) | disallow ...spread other than ...attributes | | | |
289289
| [template-style-concatenation](docs/rules/template-style-concatenation.md) | disallow string concatenation in inline styles | | | |
@@ -418,7 +418,7 @@ rules in templates can be disabled with eslint directives with mustache or html
418418
| [template-no-scope-outside-table-headings](docs/rules/template-no-scope-outside-table-headings.md) | disallow scope attribute outside th elements | | | |
419419
| [template-no-shadowed-elements](docs/rules/template-no-shadowed-elements.md) | disallow ambiguity with block param names shadowing HTML elements | | | |
420420
| [template-no-unbalanced-curlies](docs/rules/template-no-unbalanced-curlies.md) | disallow unbalanced mustache curlies | | | |
421-
| [template-no-unknown-arguments-for-builtin-components](docs/rules/template-no-unknown-arguments-for-builtin-components.md) | disallow unknown arguments for built-in components | | | |
421+
| [template-no-unknown-arguments-for-builtin-components](docs/rules/template-no-unknown-arguments-for-builtin-components.md) | disallow unknown arguments for built-in components | | 🔧 | |
422422

423423
### Routes
424424

docs/rules/template-no-action.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,25 @@ Examples of **correct** code for this rule:
4242
</template>
4343
```
4444

45+
```gjs
46+
import action from './my-action-helper';
47+
<template>
48+
{{action this.handleClick}}
49+
</template>
50+
```
51+
52+
```gjs
53+
<template>
54+
{{#each items as |action|}}
55+
<button {{action this.handleClick}}>x</button>
56+
{{/each}}
57+
</template>
58+
```
59+
60+
## Strict-mode behavior
61+
62+
`action` is an ambient strict-mode keyword in Ember (registered in `STRICT_MODE_KEYWORDS`), so `{{action this.x}}` works in `.gjs`/`.gts` templates without an explicit import. The rule still flags those uses to discourage the deprecated keyword — but skips reports when `action` resolves to a JS-scope binding (an import or local declaration) or a template block param.
63+
4564
## Migration
4665

4766
- Replace `(action "methodName")` with method references or `(fn this.methodName)`

docs/rules/template-no-dynamic-subexpression-invocations.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ This rule disallows invoking helpers dynamically using `this` or `@` properties.
2626
</template>
2727
```
2828

29-
```gjs
30-
<template>
31-
{{this.formatter this.data}}
32-
</template>
33-
```
34-
3529
### Correct ✅
3630

3731
```gjs
@@ -52,6 +46,13 @@ This rule disallows invoking helpers dynamically using `this` or `@` properties.
5246
</template>
5347
```
5448

49+
```gjs
50+
{{! Body-position dynamic helpers are allowed }}
51+
<template>
52+
{{this.formatter this.data}}
53+
</template>
54+
```
55+
5556
## Related Rules
5657

5758
- [template-no-implicit-this](./template-no-implicit-this.md)

docs/rules/template-no-inline-linkto.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,19 @@ Examples of **correct** code for this rule:
6262
</template>
6363
```
6464

65+
```gjs
66+
// User-authored `<LinkTo>` (not from `@ember/routing`) is not flagged in
67+
// strict mode, even when childless.
68+
import LinkTo from './my-link-to-component';
69+
<template>
70+
<LinkTo />
71+
</template>
72+
```
73+
74+
## Strict-mode behavior
75+
76+
In `.gjs`/`.gts` strict mode, `<LinkTo>` only refers to Ember's router link when explicitly imported from `@ember/routing` (this also covers renamed imports such as `import { LinkTo as Link } from '@ember/routing'`). Without that import, `<LinkTo>` is treated as a user-authored component and the rule does not fire. The curly `{{link-to ...}}` form is unreachable in strict mode (`link-to` cannot be a JS identifier) and the autofix is skipped there.
77+
6578
## References
6679

6780
- [eslint-plugin-ember template-no-inline-link-to](https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/template-no-inline-link-to.md)

docs/rules/template-no-mut-helper.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# ember/template-no-mut-helper
22

3-
> **HBS Only**: This rule applies to classic `.hbs` template files only (loose mode). It is not relevant for `gjs`/`gts` files (strict mode), where these patterns cannot occur.
4-
53
<!-- end auto-generated rule header -->
64

75
Disallow usage of the `(mut)` helper.

docs/rules/template-no-negated-comparison.md

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# ember/template-no-negated-condition
2+
3+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
4+
5+
<!-- end auto-generated rule header -->
6+
7+
Disallow negated conditions in `{{#if}}` blocks. Use `{{#unless}}` instead or rewrite the condition.
8+
9+
## Rule Details
10+
11+
This rule discourages the use of `{{#if (not condition)}}` in favor of `{{#unless condition}}` for better readability.
12+
13+
## Examples
14+
15+
Examples of **incorrect** code for this rule:
16+
17+
```gjs
18+
<template>
19+
{{#if (not isValid)}}
20+
Invalid
21+
{{/if}}
22+
</template>
23+
```
24+
25+
Examples of **correct** code for this rule:
26+
27+
```gjs
28+
<template>
29+
{{#unless isValid}}
30+
Invalid
31+
{{/unless}}
32+
</template>
33+
34+
<template>
35+
{{#if isValid}}
36+
Valid
37+
{{/if}}
38+
</template>
39+
```
40+
41+
## Options
42+
43+
| Name | Type | Default | Description |
44+
| ----------------- | --------- | ------- | ----------------------------------------------------------------------------------------------------------------------- |
45+
| `simplifyHelpers` | `boolean` | `true` | When `true`, also reports negated comparison helpers (e.g. `(not (eq ...))`) and suggests using `(not-eq ...)` instead. |
46+
47+
## Related Rules
48+
49+
- [simple-unless](template-simple-unless.md)
50+
51+
## References
52+
53+
- [no-negated-condition](https://eslint.org/docs/rules/no-negated-condition) from eslint

docs/rules/template-no-unbound.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# ember/template-no-unbound
22

3-
> **HBS Only**: This rule applies to classic `.hbs` template files only (loose mode). It is not relevant for `gjs`/`gts` files (strict mode), where these patterns cannot occur.
4-
53
<!-- end auto-generated rule header -->
64

75
`{{unbound}}` is a legacy hold over from the days in which Ember's template engine was less performant. Its use today

docs/rules/template-no-unknown-arguments-for-builtin-components.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# ember/template-no-unknown-arguments-for-builtin-components
22

3+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
4+
35
<!-- end auto-generated rule header -->
46

57
The builtin components `LinkTo`, `Input`, `Textarea` has list of allowed arguments, and some argument names may be mistyped, this rule trying to highlight possible typos, checking for unknown arguments, also, some components has conflicted and required arguments, rule addressing this behavior.

docs/rules/template-simple-unless.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# ember/template-simple-unless
22

3+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
4+
35
<!-- end auto-generated rule header -->
46

57
Require simple conditions in `{{#unless}}` blocks. Complex expressions should use `{{#if}}` with negation instead.

0 commit comments

Comments
 (0)