Skip to content

Commit

Permalink
Merge pull request #2211 from bmish/recommended-rules-v4
Browse files Browse the repository at this point in the history
  • Loading branch information
bmish committed Nov 23, 2021
2 parents 3895d1f + eaed378 commit e2de424
Show file tree
Hide file tree
Showing 19 changed files with 62 additions and 20 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,17 @@ Each rule has emojis denoting:
| [no-autofocus-attribute](./docs/rule/no-autofocus-attribute.md) | | | ⌨️ | |
| [no-bare-strings](./docs/rule/no-bare-strings.md) | | | | |
| [no-block-params-for-html-elements](./docs/rule/no-block-params-for-html-elements.md) || | | |
| [no-capital-arguments](./docs/rule/no-capital-arguments.md) | | | | |
| [no-class-bindings](./docs/rule/no-class-bindings.md) | | | | |
| [no-capital-arguments](./docs/rule/no-capital-arguments.md) | | | | |
| [no-class-bindings](./docs/rule/no-class-bindings.md) | | | | |
| [no-curly-component-invocation](./docs/rule/no-curly-component-invocation.md) || | | 🔧 |
| [no-debugger](./docs/rule/no-debugger.md) || | | |
| [no-down-event-binding](./docs/rule/no-down-event-binding.md) || | ⌨️ | |
| [no-duplicate-attributes](./docs/rule/no-duplicate-attributes.md) || | ⌨️ | |
| [no-duplicate-id](./docs/rule/no-duplicate-id.md) || | ⌨️ | |
| [no-duplicate-landmark-elements](./docs/rule/no-duplicate-landmark-elements.md) || | ⌨️ | |
| [no-dynamic-subexpression-invocations](./docs/rule/no-dynamic-subexpression-invocations.md) | | | | |
| [no-dynamic-subexpression-invocations](./docs/rule/no-dynamic-subexpression-invocations.md) | | | | |
| [no-element-event-actions](./docs/rule/no-element-event-actions.md) | | | | |
| [no-empty-headings](./docs/rule/no-empty-headings.md) | | | ⌨️ | |
| [no-empty-headings](./docs/rule/no-empty-headings.md) | | | ⌨️ | |
| [no-extra-mut-helper-argument](./docs/rule/no-extra-mut-helper-argument.md) || | | |
| [no-forbidden-elements](./docs/rule/no-forbidden-elements.md) || | | |
| [no-heading-inside-button](./docs/rule/no-heading-inside-button.md) || | ⌨️ | |
Expand All @@ -135,11 +135,11 @@ Each rule has emojis denoting:
| [no-invalid-meta](./docs/rule/no-invalid-meta.md) || | ⌨️ | |
| [no-invalid-role](./docs/rule/no-invalid-role.md) || | ⌨️ | |
| [no-link-to-positional-params](./docs/rule/no-link-to-positional-params.md) || | | |
| [no-link-to-tagname](./docs/rule/no-link-to-tagname.md) | | | | |
| [no-link-to-tagname](./docs/rule/no-link-to-tagname.md) | | | | |
| [no-log](./docs/rule/no-log.md) || | | |
| [no-model-argument-in-route-templates](./docs/rule/no-model-argument-in-route-templates.md) | | | | 🔧 |
| [no-model-argument-in-route-templates](./docs/rule/no-model-argument-in-route-templates.md) | | | | 🔧 |
| [no-multiple-empty-lines](./docs/rule/no-multiple-empty-lines.md) | | 💅 | | |
| [no-mut-helper](./docs/rule/no-mut-helper.md) | | | | |
| [no-mut-helper](./docs/rule/no-mut-helper.md) | | | | |
| [no-negated-condition](./docs/rule/no-negated-condition.md) || | | 🔧 |
| [no-nested-interactive](./docs/rule/no-nested-interactive.md) || | ⌨️ | |
| [no-nested-landmark](./docs/rule/no-nested-landmark.md) || | ⌨️ | |
Expand All @@ -155,7 +155,7 @@ Each rule has emojis denoting:
| [no-redundant-fn](./docs/rule/no-redundant-fn.md) || | | 🔧 |
| [no-redundant-landmark-role](./docs/rule/no-redundant-landmark-role.md) || | ⌨️ | 🔧 |
| [no-restricted-invocations](./docs/rule/no-restricted-invocations.md) | | | | |
| [no-route-action](./docs/rule/no-route-action.md) | | | | |
| [no-route-action](./docs/rule/no-route-action.md) | | | | |
| [no-shadowed-elements](./docs/rule/no-shadowed-elements.md) || | | |
| [no-this-in-template-only-components](./docs/rule/no-this-in-template-only-components.md) | | | | 🔧 |
| [no-trailing-spaces](./docs/rule/no-trailing-spaces.md) | | 💅 | | |
Expand All @@ -166,25 +166,25 @@ Each rule has emojis denoting:
| [no-unnecessary-component-helper](./docs/rule/no-unnecessary-component-helper.md) || | | |
| [no-unnecessary-concat](./docs/rule/no-unnecessary-concat.md) | | 💅 | | |
| [no-unused-block-params](./docs/rule/no-unused-block-params.md) || | | |
| [no-valueless-arguments](./docs/rule/no-valueless-arguments.md) | | | | |
| [no-whitespace-for-layout](./docs/rule/no-whitespace-for-layout.md) | | 💅 | ⌨️ | |
| [no-whitespace-within-word](./docs/rule/no-whitespace-within-word.md) | | 💅 | ⌨️ | |
| [no-with](./docs/rule/no-with.md) | | | | |
| [no-valueless-arguments](./docs/rule/no-valueless-arguments.md) | | | | |
| [no-whitespace-for-layout](./docs/rule/no-whitespace-for-layout.md) | | | ⌨️ | |
| [no-whitespace-within-word](./docs/rule/no-whitespace-within-word.md) | | | ⌨️ | |
| [no-with](./docs/rule/no-with.md) | | | | |
| [no-yield-only](./docs/rule/no-yield-only.md) || | | |
| [no-yield-to-default](./docs/rule/no-yield-to-default.md) | | | | |
| [no-yield-to-default](./docs/rule/no-yield-to-default.md) | | | | |
| [quotes](./docs/rule/quotes.md) | | 💅 | | |
| [require-button-type](./docs/rule/require-button-type.md) || | | 🔧 |
| [require-context-role](./docs/rule/require-context-role.md) | | | ⌨️ | |
| [require-context-role](./docs/rule/require-context-role.md) | | | ⌨️ | |
| [require-each-key](./docs/rule/require-each-key.md) | | | | |
| [require-form-method](./docs/rule/require-form-method.md) | | | | |
| [require-has-block-helper](./docs/rule/require-has-block-helper.md) || | | 🔧 |
| [require-iframe-title](./docs/rule/require-iframe-title.md) || | ⌨️ | |
| [require-input-label](./docs/rule/require-input-label.md) || | ⌨️ | |
| [require-lang-attribute](./docs/rule/require-lang-attribute.md) || | ⌨️ | |
| [require-presentational-children](./docs/rule/require-presentational-children.md) | | | ⌨️ | |
| [require-presentational-children](./docs/rule/require-presentational-children.md) | | | ⌨️ | |
| [require-splattributes](./docs/rule/require-splattributes.md) | | | | |
| [require-valid-alt-text](./docs/rule/require-valid-alt-text.md) || | ⌨️ | |
| [require-valid-named-block-naming-format](./docs/rule/require-valid-named-block-naming-format.md) | | | | |
| [require-valid-named-block-naming-format](./docs/rule/require-valid-named-block-naming-format.md) | | | | |
| [self-closing-void-elements](./docs/rule/self-closing-void-elements.md) | | 💅 | | |
| [simple-unless](./docs/rule/simple-unless.md) || | | |
| [splat-attributes-only](./docs/rule/splat-attributes-only.md) || | | |
Expand Down
2 changes: 2 additions & 0 deletions docs/rule/no-capital-arguments.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# no-capital-arguments

✅ The `extends: 'recommended'` property in a configuration file enables this rule.

Anything that does not start with a lowercase letter (such as @Foo, @0, @! etc) is reserved argument names. This is purely speculative and the goal is to carve out some space for future features. If we don't end up needing them, we can always relax the restrictions down the road.

'@arguments', '@args', '@block', '@else' - is reserved names, and also will be highlighted in this rule.
Expand Down
2 changes: 2 additions & 0 deletions docs/rule/no-class-bindings.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# no-class-bindings

✅ The `extends: 'recommended'` property in a configuration file enables this rule.

It is possible to pass `classBinding` and `classNameBindings` as arguments to a component when invoked with curly syntax.

```hbs
Expand Down
2 changes: 2 additions & 0 deletions docs/rule/no-dynamic-subexpression-invocations.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# no-dynamic-subexpression-invocations

✅ The `extends: 'recommended'` property in a configuration file enables this rule.

When using Ember versions prior to 3.25 the usage of dynamic invocations for
helpers and modifiers did not work. Unfortunately, some versions of Ember
silently ignored additional arguments (3.16) wherease others throw a very
Expand Down
2 changes: 2 additions & 0 deletions docs/rule/no-empty-headings.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# no-empty-headings

✅ The `extends: 'recommended'` property in a configuration file enables this rule.

Headings relay the structure of a webpage and provide a meaningful, hierarchical order of its content. If headings are empty or its text contents are inaccessible, this could confuse users or prevent them accessing sections of interest.

Disallow headings (h1, h2, etc.) with no accessible text content.
Expand Down
2 changes: 2 additions & 0 deletions docs/rule/no-link-to-tagname.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# no-link-to-tagname

✅ The `extends: 'recommended'` property in a configuration file enables this rule.

The builtin `LinkTo` component generates an `<a>` element. Since it is still
built on top of `Ember.Component` it is possible to assign a `tagName` from the
outside to change that `<a>` element into something else. This goes against
Expand Down
2 changes: 2 additions & 0 deletions docs/rule/no-model-argument-in-route-templates.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# no-model-argument-in-route-templates

✅ The `extends: 'recommended'` property in a configuration file enables this rule.

🔧 The `--fix` option on the command line can automatically fix some of the problems reported by this rule.

Usage of `{{@model}}` in route templates was introduced to simplify the mental
Expand Down
2 changes: 2 additions & 0 deletions docs/rule/no-mut-helper.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# no-mut-helper

✅ The `extends: 'recommended'` property in a configuration file enables this rule.

## Reasons to not use [the `mut` helper](https://api.emberjs.com/ember/release/classes/Ember.Templates.helpers/methods/each?anchor=mut)

1. General problems in the programming model:
Expand Down
2 changes: 2 additions & 0 deletions docs/rule/no-route-action.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# no-route-action

✅ The `extends: 'recommended'` property in a configuration file enables this rule.

This rule disallows the usage of `route-action`.

[ember-route-action-helper](https://github.com/DockYard/ember-route-action-helper) was a popular addon used to add actions to a route without creating a separate controller. Given the changes in Ember since ember-route-action-helper was a widely used pattern, controllers are now encouraged and we want to discourage the use of route-action.
Expand Down
2 changes: 2 additions & 0 deletions docs/rule/no-valueless-arguments.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# no-valueless-arguments

✅ The `extends: 'recommended'` property in a configuration file enables this rule.

Similar to HTML attributes, component arguments will default to an empty string when they are not explicitly assigned a value. This behavior isn't documented anywhere so depending on it isn't recommended and usually the result of a user-error. Since it _is_ valid syntax, accidental use of this behavior can be hard to detect and cause confusing bugs.

## Examples
Expand Down
2 changes: 1 addition & 1 deletion docs/rule/no-whitespace-for-layout.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# no-whitespace-for-layout

💅 The `extends: 'stylistic'` property in a configuration file enables this rule.
The `extends: 'recommended'` property in a configuration file enables this rule.

Formatting of text through the use of multiple whitespace is entirely visual, and therefore is incompatible with screen-reading assistive technology tools.

Expand Down
2 changes: 1 addition & 1 deletion docs/rule/no-whitespace-within-word.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# no-whitespace-within-word

💅 The `extends: 'stylistic'` property in a configuration file enables this rule.
The `extends: 'recommended'` property in a configuration file enables this rule.

In practice, the predominant issue raised by inline whitespace styling is that the resultant text 'formatting' is entirely visual in nature; the ability to discern the correct manner in which to read the text, and therefore, to correctly comprehend its meaning, is restricted to sighted users.

Expand Down
2 changes: 2 additions & 0 deletions docs/rule/no-with.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# no-with

✅ The `extends: 'recommended'` property in a configuration file enables this rule.

The use of `{{with}}` has been deprecated, you should replace it with either `{{let}}` or a combination of `{{let}}`, `{{if}}` and `{{else}}`.

## Examples
Expand Down
2 changes: 2 additions & 0 deletions docs/rule/no-yield-to-default.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# no-yield-to-default

✅ The `extends: 'recommended'` property in a configuration file enables this rule.

The `yield` keyword can be used for invoking blocks passed into a component. The `to` named argument specifies which of the blocks to yield too. Specifying `{{yield to="default"}}` is unnecessary, as that is the default behavior. Likewise, `{{has-block}}` and `{{has-block-params}}` also defaults to checking the "default" block.

This rule disallow yield to named blocks with the name "default".
Expand Down
2 changes: 2 additions & 0 deletions docs/rule/require-context-role.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# require-context-role

✅ The `extends: 'recommended'` property in a configuration file enables this rule.

## `<* role><* role /></*>`

The required context role defines the owning container where this role is allowed. If a role has a required context, authors MUST ensure that an element with the role is contained inside (or owned by) an element with the required context role. For example, an element with `role="listitem"` is only meaningful when contained inside (or owned by) an element with `role="list"`.
Expand Down
2 changes: 2 additions & 0 deletions docs/rule/require-presentational-children.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# require-presentational-children

✅ The `extends: 'recommended'` property in a configuration file enables this rule.

There are roles that require all children to be presentational. This rule checks if descendants of this element with this role type are presentational. By default, browsers are required to add `role="presentation"` to all descendants, but we should not rely on browsers to do this.

The roles that require all children to be presentational are:
Expand Down
2 changes: 2 additions & 0 deletions docs/rule/require-valid-named-block-naming-format.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# require-valid-named-block-naming-format

✅ The `extends: 'recommended'` property in a configuration file enables this rule.

Require named blocks to use a valid naming format (`camelCase` or `kebab-case`).

The default naming format used is `camelCase`.
Expand Down
16 changes: 16 additions & 0 deletions lib/config/recommended.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ module.exports = {
'no-aria-hidden-body': 'error',
'no-attrs-in-components': 'error',
'no-block-params-for-html-elements': 'error',
'no-capital-arguments': 'error',
'no-class-bindings': 'error',
'no-curly-component-invocation': 'error',
'no-debugger': 'error',
'no-down-event-binding': 'error',
'no-duplicate-attributes': 'error',
'no-duplicate-id': 'error',
'no-duplicate-landmark-elements': 'error',
'no-dynamic-subexpression-invocations': 'error',
'no-empty-headings': 'error',
'no-extra-mut-helper-argument': 'error',
'no-forbidden-elements': 'error',
'no-heading-inside-button': 'error',
Expand All @@ -36,7 +40,10 @@ module.exports = {
'no-invalid-meta': 'error',
'no-invalid-role': 'error',
'no-link-to-positional-params': 'error',
'no-link-to-tagname': 'error',
'no-log': 'error',
'no-model-argument-in-route-templates': 'error',
'no-mut-helper': 'error',
'no-negated-condition': 'error',
'no-nested-interactive': 'error',
'no-nested-landmark': 'error',
Expand All @@ -51,20 +58,29 @@ module.exports = {
'no-quoteless-attributes': 'error',
'no-redundant-fn': 'error',
'no-redundant-landmark-role': 'error',
'no-route-action': 'error',
'no-shadowed-elements': 'error',
'no-triple-curlies': 'error',
'no-unbalanced-curlies': 'error',
'no-unbound': 'error',
'no-unknown-arguments-for-builtin-components': 'error',
'no-unnecessary-component-helper': 'error',
'no-unused-block-params': 'error',
'no-valueless-arguments': 'error',
'no-whitespace-for-layout': 'error',
'no-whitespace-within-word': 'error',
'no-with': 'error',
'no-yield-only': 'error',
'no-yield-to-default': 'error',
'require-button-type': 'error',
'require-context-role': 'error',
'require-has-block-helper': 'error',
'require-iframe-title': 'error',
'require-input-label': 'error',
'require-lang-attribute': 'error',
'require-presentational-children': 'error',
'require-valid-alt-text': 'error',
'require-valid-named-block-naming-format': 'error',
'simple-unless': 'error',
'splat-attributes-only': 'error',
'style-concatenation': 'error',
Expand Down
2 changes: 0 additions & 2 deletions lib/config/stylistic.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ module.exports = {
'no-multiple-empty-lines': 'error',
'no-trailing-spaces': 'error',
'no-unnecessary-concat': 'error',
'no-whitespace-for-layout': 'error',
'no-whitespace-within-word': 'error',
quotes: ['error', 'double'],
'self-closing-void-elements': 'error',
},
Expand Down

0 comments on commit e2de424

Please sign in to comment.