Skip to content
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

Merged
merged 5 commits into from
Sep 29, 2024
Merged

Conversation

fregante
Copy link
Collaborator

@fregante fregante changed the title Document reduceRight alternative forno-array-reduce Document reduceRight alternative for no-array-reduce Sep 29, 2024
fisker
fisker previously approved these changes Sep 29, 2024
@@ -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.',
Copy link
Collaborator Author

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.

@fregante fregante marked this pull request as draft September 29, 2024 08:13
@@ -104,8 +106,7 @@ const create = context => {
const methodNode = getMethodNode(callExpression);
yield {
node: methodNode,
messageId: MESSAGE_ID,
data: {method: methodNode.name},
messageId: methodNode.name,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pattern seen in

@fregante fregante marked this pull request as ready for review September 29, 2024 14:53
@fregante fregante merged commit 6a043c2 into main Sep 29, 2024
33 checks passed
@fregante fregante changed the title Document reduceRight alternative for no-array-reduce Document reduceRight alternative for no-array-reduce Sep 29, 2024
@fregante fregante deleted the reduce-right branch September 29, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants