Skip to content

Commit ba63d48

Browse files
Merge pull request #2570 from NullVoxPopuli/nvp/template-lint-extract-rule-template-no-restricted-invocations
Extract rule: template-no-restricted-invocations
2 parents b430b92 + 114c6ff commit ba63d48

4 files changed

Lines changed: 1065 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ rules in templates can be disabled with eslint directives with mustache or html
261261
| [template-no-page-title-component](docs/rules/template-no-page-title-component.md) | disallow usage of ember-page-title component | | | |
262262
| [template-no-positional-data-test-selectors](docs/rules/template-no-positional-data-test-selectors.md) | disallow positional data-test-* params in curly invocations | | | |
263263
| [template-no-potential-path-strings](docs/rules/template-no-potential-path-strings.md) | disallow potential path strings in attribute values | | | |
264+
| [template-no-restricted-invocations](docs/rules/template-no-restricted-invocations.md) | disallow certain components, helpers or modifiers from being used | | | |
264265
| [template-no-splattributes-with-class](docs/rules/template-no-splattributes-with-class.md) | disallow splattributes with class attribute | | | |
265266
| [template-no-this-in-template-only-components](docs/rules/template-no-this-in-template-only-components.md) | disallow this in template-only components (gjs/gts) | | 🔧 | |
266267
| [template-no-trailing-spaces](docs/rules/template-no-trailing-spaces.md) | disallow trailing whitespace at the end of lines in templates | | 🔧 | |
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# ember/template-no-restricted-invocations
2+
3+
<!-- end auto-generated rule header -->
4+
5+
Disallow certain components, helpers or modifiers from being used.
6+
7+
Use cases include:
8+
9+
- You bring in some addon like ember-composable-helpers, but your team deems one or many of the helpers not suitable and wants to guard against their usage
10+
- You want to discourage use of a deprecated component
11+
12+
## Examples
13+
14+
Given a config of:
15+
16+
```json
17+
["foo-bar"]
18+
```
19+
20+
This rule **forbids** the following:
21+
22+
```hbs
23+
{{foo-bar}}
24+
```
25+
26+
```hbs
27+
{{#foo-bar}}{{/foo-bar}}
28+
```
29+
30+
```hbs
31+
<FooBar />
32+
```
33+
34+
## Configuration
35+
36+
One of these:
37+
38+
- string[] - helpers or components to disallow (using kebab-case names like `nested-scope/component-name`)
39+
- object[] - with the following keys:
40+
- `names` - string[] - helpers or components to disallow (using kebab-case names like `nested-scope/component-name`)
41+
- `message` - string - custom error message to report for violations (typically a deprecation notice / explanation of why not to use it and a recommended replacement)
42+
43+
## Related Rules
44+
45+
- [ember/no-restricted-service-injections](https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/no-restricted-service-injections.md)
46+
47+
## References
48+
49+
- [ember-cli-deprecation-workflow](https://github.com/mixonic/ember-cli-deprecation-workflow)

0 commit comments

Comments
 (0)