Skip to content

Latest commit

 

History

History
50 lines (33 loc) · 1.56 KB

no-this-in-template-only-components.md

File metadata and controls

50 lines (33 loc) · 1.56 KB

no-this-in-template-only-components

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

There is no this context in template-only components.

Examples

This rule forbids this if the template has no corresponding component.js:

<h1>Hello {{this.name}}!</h1>

This rule allows this if the template has a corresponding component.js:

import Component from '@ember/component';

export default Component.extend({
  name: 'Derek'
});
<h1>Hello {{this.name}}!</h1>

The --fix option will convert to named arguments:

<h1>Hello {{@name}}!</h1>

Configuration

  • boolean -- true for enabled / false for disabled
  • object -- An object with the following keys:
    • validComponentExtensions -- An array of component class extensions. Defaults to [ '.js', '.ts' ]

Migration

References