-
-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document reduceRight
alternative for no-array-reduce
#2457
Conversation
no-array-reduce
no-array-reduce
rules/no-array-reduce.js
Outdated
@@ -4,7 +4,7 @@ const {isNodeValueNotFunction, isArrayPrototypeProperty} = require('./utils/inde | |||
|
|||
const MESSAGE_ID = 'no-reduce'; | |||
const messages = { | |||
[MESSAGE_ID]: '`Array#{{method}}()` is not allowed', | |||
[MESSAGE_ID]: '`Array#{{method}}()` is not allowed. Prefer other types of loop for readability.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ll alter this message to specifically mention .toReversed() for reduceRight. #2428 isn’t out yet so it’s possible that they will use .reverse()
instead.
@@ -104,8 +106,7 @@ const create = context => { | |||
const methodNode = getMethodNode(callExpression); | |||
yield { | |||
node: methodNode, | |||
messageId: MESSAGE_ID, | |||
data: {method: methodNode.name}, | |||
messageId: methodNode.name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pattern seen in
messageId: method, |
no-array-reduce
reduceRight
alternative for no-array-reduce
no-array-reduce
#1063