prefer-spread doesn't report Reflect.apply calls.
See original GitHub issueTell us about your environment
- ESLint Version: 3.8.1
- Node Version: v6.9.0
- npm Version: 3.10.8
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
rules:
prefer-spread: 2
What did you do?
From the example:
foo.apply(null, args);
One of my coworkers has decided to refactor this sort of syntax using Reflect
instead of spread params.
Reflect.apply(foo, null, args);
What did you expect to happen?
I would expect prefer-spread
to not accept this syntax either, enforcing my coworkers to use the spread syntax. At least I think it should be possible to enforce this using a setting.
What actually happened? Please include the actual, raw output from ESLint.
Eslint didn’t report anything.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:10 (10 by maintainers)
Top Results From Across the Web
prefer-spread - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Reflect.apply() - JavaScript - MDN Web Docs
apply () method to call a function with a given this value and arguments provided as an array (or an array-like object). Function.prototype.apply.call(Math.floor ......
Read more >javascript - Use of .apply() with 'new' operator. Is this possible?
I'm going to accept this one as my preferred solution, since it doesn't require modification of the original constructor (I didn't specify that...
Read more >eslint-plugin-unicorn/prefer-reflect-apply.md at main - GitHub
Prefer Reflect.apply() over Function#apply(). This rule is enabled in the ✓ recommended config. This rule is automatically fixable by the --fix CLI ...
Read more >What Is a Bid-Ask Spread, and How Does It Work in Trading?
A bid-ask spread is the amount by which the ask price exceeds the bid price for an asset in the market.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Our standard operating procedure is to keep rules as small as possible. The argument that “it won’t hurt to have it in the rule” only leads to large rules that are hard to maintain. Since in this case it looks like there is another way to accomplish the same thing, it seems like not updating the rule for this specific case is the best case forward.
Closing this issue as it looks like a sufficient workaround was suggested and it doesn’t look like there’s enough support to pursue an enhancement of the rule.