Skip to content

Commit 3a0613f

Browse files
committed
Extract rule: template-no-unknown-arguments-for-builtin-components
1 parent 300da43 commit 3a0613f

4 files changed

Lines changed: 813 additions & 7 deletions

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -412,13 +412,14 @@ rules in templates can be disabled with eslint directives with mustache or html
412412

413413
### Possible Errors
414414

415-
| Name                                     | Description | 💼 | 🔧 | 💡 |
416-
| :------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------- | :- | :- | :- |
417-
| [template-no-extra-mut-helper-argument](docs/rules/template-no-extra-mut-helper-argument.md) | disallow passing more than one argument to the mut helper | | | |
418-
| [template-no-jsx-attributes](docs/rules/template-no-jsx-attributes.md) | disallow JSX-style camelCase attributes | | 🔧 | |
419-
| [template-no-scope-outside-table-headings](docs/rules/template-no-scope-outside-table-headings.md) | disallow scope attribute outside th elements | | | |
420-
| [template-no-shadowed-elements](docs/rules/template-no-shadowed-elements.md) | disallow ambiguity with block param names shadowing HTML elements | | | |
421-
| [template-no-unbalanced-curlies](docs/rules/template-no-unbalanced-curlies.md) | disallow unbalanced mustache curlies | | | |
415+
| Name                                                 | Description | 💼 | 🔧 | 💡 |
416+
| :------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------- | :- | :- | :- |
417+
| [template-no-extra-mut-helper-argument](docs/rules/template-no-extra-mut-helper-argument.md) | disallow passing more than one argument to the mut helper | | | |
418+
| [template-no-jsx-attributes](docs/rules/template-no-jsx-attributes.md) | disallow JSX-style camelCase attributes | | 🔧 | |
419+
| [template-no-scope-outside-table-headings](docs/rules/template-no-scope-outside-table-headings.md) | disallow scope attribute outside th elements | | | |
420+
| [template-no-shadowed-elements](docs/rules/template-no-shadowed-elements.md) | disallow ambiguity with block param names shadowing HTML elements | | | |
421+
| [template-no-unbalanced-curlies](docs/rules/template-no-unbalanced-curlies.md) | disallow unbalanced mustache curlies | | | |
422+
| [template-no-unknown-arguments-for-builtin-components](docs/rules/template-no-unknown-arguments-for-builtin-components.md) | disallow unknown arguments for built-in components | | | |
422423

423424
### Routes
424425

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# ember/template-no-unknown-arguments-for-builtin-components
2+
3+
<!-- end auto-generated rule header -->
4+
5+
Disallow unknown arguments for built-in Ember components.
6+
7+
## Rule Details
8+
9+
This rule checks that only known arguments are used with built-in Ember components like `<Input>`, `<Textarea>`, and `<LinkTo>`.
10+
11+
## Examples
12+
13+
Examples of **incorrect** code for this rule:
14+
15+
```gjs
16+
<template>
17+
<Input @unknownArg="value" />
18+
</template>
19+
```
20+
21+
```gjs
22+
<template>
23+
<Textarea @invalidProp={{this.value}} />
24+
</template>
25+
```
26+
27+
Examples of **correct** code for this rule:
28+
29+
```gjs
30+
<template>
31+
<Input @type="text" @value={{this.value}} />
32+
</template>
33+
```
34+
35+
```gjs
36+
<template>
37+
<Textarea @value={{this.text}} rows="10" />
38+
</template>
39+
```
40+
41+
## Migration
42+
43+
- Check references section to get allowed arguments list.
44+
- If argument represents html attribute, remove `@` from name.
45+
46+
## Related Rules
47+
48+
- [no-link-to-tagname](template-no-link-to-tagname.md)
49+
- [no-input-tagname](template-no-input-tagname.md)
50+
- [builtin-component-arguments](template-builtin-component-arguments.md)
51+
52+
## References
53+
54+
- [Ember Built-in Components](https://api.emberjs.com/ember/release/classes/Ember.Templates.components)

0 commit comments

Comments
 (0)