ember-cli / ember-cli/eslint-plugin-ember
Detect arbitrary function calls with potential side effects in `no-side-effects` rule
- Dominant language
- JavaScript
- Stars
- 263
- Forks
- 214
- Avg merge
- 30m
- Merged PRs (30d)
- 5
Description
Attempt to catch function calls in computed properties which are likely causing side effects.
```js
myProperty: computed(function() {
...
someFunctionCall(); // either useless or causes side effects
...
setLocalStorageItem('my-storage-key', 'true'); // causes side effects
...
return ...
});
```
Look for any statement within the computed property function that does not cause a mutation to a local binding. That’s easy for assignment but harder for e.g. `array.push`.
The existing rule [no-side-effects](https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/no-side-effects.md) only catches `this.set('property', ...)` right now.
Related: #329
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.