Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
node_modules/
dist/
lib/recommended-rules.js
CHANGELOG.md
README.md
pnpm-lock.yaml
.github/*
2 changes: 2 additions & 0 deletions docs/rules/_TEMPLATE_.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ TODO: suggest any fast/automated techniques for fixing violations in a large cod
## Configuration

<!-- begin auto-generated rule options list -->

TODO: exclude this section if the rule has no extra configuration.
TODO: ensure `meta.schema` contains descriptions, constraints, defaults, etc for all options.

<!-- end auto-generated rule options list -->

## Related Rules
Expand Down
10 changes: 5 additions & 5 deletions docs/rules/alias-model-in-controller.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ We can do this in two ways:
import { alias } from '@ember/object/computed';

export default Controller.extend({
nail: alias('model')
nail: alias('model'),
});
```

Expand All @@ -27,7 +27,7 @@ We can do this in two ways:
export default Route.extend({
setupController(controller, model) {
controller.set('nail', model);
}
},
});
```

Expand All @@ -39,12 +39,12 @@ import { reads } from '@ember/object/computed';

export default Controller.extend({
people: reads('model.people'),
pets: reads('model.pets')
pets: reads('model.pets'),
});
```

## Help Wanted

| Issue | Link |
| :-- | :-- |
| Issue | Link |
| :----------------------------------------- | :------------------------------------------------------------------ |
| ❌ Missing native JavaScript class support | [#560](https://github.com/ember-cli/eslint-plugin-ember/issues/560) |
16 changes: 8 additions & 8 deletions docs/rules/avoid-leaking-state-in-ember-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ export default Foo.extend({
actions: {
addItem(item) {
this.items.pushObject(item);
}
}
},
},
});
```

```js
import Mixin from '@ember/object/mixin';

export default Mixin.create({
items: []
items: [],
});
```

Expand All @@ -43,8 +43,8 @@ export default Foo.extend({
actions: {
addItem(item) {
this.items.pushObject(item);
}
}
},
},
});
```

Expand All @@ -71,9 +71,9 @@ module.exports = {
rules: {
'ember/avoid-leaking-state-in-ember-objects': [
'error',
['array', 'of', 'ignored', 'properties']
]
}
['array', 'of', 'ignored', 'properties'],
],
},
};
```

Expand Down
8 changes: 4 additions & 4 deletions docs/rules/avoid-using-needs-in-controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Examples of **incorrect** code for this rule:
```js
export default Controller.extend({
needs: ['comments'],
newComments: alias('controllers.comments.newest')
newComments: alias('controllers.comments.newest'),
});
```

Expand All @@ -24,12 +24,12 @@ import Controller, { inject as controller } from '@ember/controller';

export default Component.extend({
comments: controller(),
newComments: alias('comments.newest')
newComments: alias('comments.newest'),
});
```

## Help Wanted

| Issue | Link |
| :-- | :-- |
| Issue | Link |
| :----------------------------------------- | :------------------------------------------------------------------ |
| ❌ Missing native JavaScript class support | [#560](https://github.com/ember-cli/eslint-plugin-ember/issues/560) |
12 changes: 6 additions & 6 deletions docs/rules/closure-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export default Controller.extend({
actions: {
detonate() {
alert('Kabooom');
}
}
},
},
});
```

Expand All @@ -30,8 +30,8 @@ export default Component.extend({
actions: {
pushLever() {
this.sendAction('detonate');
}
}
},
},
});
```

Expand All @@ -47,8 +47,8 @@ export default Component.extend({
actions: {
pushLever() {
this.boom();
}
}
},
},
});
```

Expand Down
36 changes: 18 additions & 18 deletions docs/rules/computed-property-getters.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ This rule takes a single string option.

String option:

- `"always-with-setter"` (default) getters are *required* when computed property has a setter
- `"always"` getters are *required* in computed properties
- `"never"` getters are *never allowed* in computed properties
- `"always-with-setter"` (default) getters are _required_ when computed property has a setter
- `"always"` getters are _required_ in computed properties
- `"never"` getters are _never allowed_ in computed properties

## Examples

Expand All @@ -29,15 +29,15 @@ EmberObject.extend({
fullName: computed('firstName', 'lastName', {
get() {
// ...
}
})
},
}),
});

// GOOD
EmberObject.extend({
fullName: computed('firstName', 'lastName', function () {
// ...
})
}),
});

// GOOD
Expand All @@ -48,8 +48,8 @@ EmberObject.extend({
},
get() {
// ...
}
})
},
}),
});
```

Expand All @@ -63,15 +63,15 @@ EmberObject.extend({
fullName: computed('firstName', 'lastName', {
get() {
// ...
}
})
},
}),
});

// BAD
EmberObject.extend({
fullName: computed('firstName', 'lastName', function () {
// ...
})
}),
});
```

Expand All @@ -84,16 +84,16 @@ import EmberObject, { computed } from '@ember/object';
EmberObject.extend({
fullName: computed('firstName', 'lastName', function () {
// ...
})
}),
});

// BAD
EmberObject.extend({
fullName: computed('firstName', 'lastName', {
get() {
// ...
}
})
},
}),
});

// BAD
Expand All @@ -104,13 +104,13 @@ EmberObject.extend({
},
set() {
// ...
}
})
},
}),
});
```

## Help Wanted

| Issue | Link |
| :-- | :-- |
| Issue | Link |
| :----------------------------------------- | :------------------------------------------------------------------ |
| ❌ Missing native JavaScript class support | [#560](https://github.com/ember-cli/eslint-plugin-ember/issues/560) |
4 changes: 2 additions & 2 deletions docs/rules/named-functions-in-promises.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default Component.extend({
.then(() => this._reloadUser())
.then(() => this._notifyAboutSuccess())
.catch(() => this._notifyAboutFailure());
}
},
},
_reloadUser(user) {
return user.reload();
Expand All @@ -50,7 +50,7 @@ export default Component.extend({
},
_notifyAboutFailure() {
// ...
}
},
});
```

Expand Down
8 changes: 4 additions & 4 deletions docs/rules/no-actions-hash.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import Component from '@ember/component';

export default Component.extend({
actions: {
foo() {}
}
foo() {},
},
});
```

Expand All @@ -33,7 +33,7 @@ import Component from '@ember/component';

export class MyComponent extends Component {
actions = {
foo() {}
foo() {},
};
}
```
Expand All @@ -46,7 +46,7 @@ import Component from '@ember/component';
import { action } from '@ember/object';

export default Component.extend({
foo: action(function () {})
foo: action(function () {}),
});
```

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-arrow-function-computed-properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import EmberObject, { computed } from '@ember/object';
const Person = EmberObject.extend({
fullName: computed('firstName', 'lastName', () => {
return `${this.firstName} ${this.lastName}`;
})
}),
});
```

Expand All @@ -32,7 +32,7 @@ import EmberObject, { computed } from '@ember/object';
const Person = EmberObject.extend({
fullName: computed('firstName', 'lastName', function () {
return `${this.firstName} ${this.lastName}`;
})
}),
});
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Ember 3.13 added an assertion that fires when using assignment `this.x = 123` on an untracked property that is used in a tracking context such as a computed property.

> You attempted to update "propertyX" to "valueY",
but it is being tracked by a tracking context, such as a template, computed property, or observer.
> but it is being tracked by a tracking context, such as a template, computed property, or observer.
>
> In order to make sure the context updates properly, you must invalidate the property when updating it.
>
Expand Down Expand Up @@ -104,25 +104,25 @@ module.exports = {
argumentFormat: [
{
strings: {
count: 1
}
}
]
count: 1,
},
},
],
},
{
name: 't',
path: 'ember-intl',
argumentFormat: [
{
objects: {
index: 1
}
}
]
}
]
}
}
index: 1,
},
},
],
},
],
},
},
};
```

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-attrs-snapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default Component({
} else {
this.set('updated', false);
}
}
},
});
```

Expand All @@ -55,7 +55,7 @@ export default Component({
this._valueCache = this.value;
this.set('updated', true);
}
}
},
});
```

Expand Down
Loading
Loading