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

chore(js_analyze): bolster noAccumulatingSpread against false positives #330

Merged

Conversation

Vivalldi
Copy link
Contributor

Summary

While it's not currently possible to check if a method is a known prototype belonging to an array we can add additional guards to prevent custom .reduce declarations from being caught.

  • The callback functions should have 2, 3, or 4 args (acc, value, index?, array?)
  • The method can have 1 or 2 parameters (callbackFn, initialValue?)

Discord discussion

Test Plan

  • Added additional cases to valid code

@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Sep 18, 2023
@Vivalldi Vivalldi force-pushed the vivalldi/no-accumulating-spread-guards branch from 8b10a6a to 85f8bf4 Compare September 19, 2023 19:06
@Vivalldi Vivalldi force-pushed the vivalldi/no-accumulating-spread-guards branch from 85f8bf4 to 30c2e59 Compare September 22, 2023 14:10
@Vivalldi
Copy link
Contributor Author

@ematipico, branch should be ready. Thanks for the recommendations. Checked the tests and the failing ones are the same as the ones in main.

@Conaclos Conaclos merged commit ea7295c into biomejs:main Sep 22, 2023
@Vivalldi Vivalldi deleted the vivalldi/no-accumulating-spread-guards branch September 22, 2023 14:50
@Conaclos Conaclos added the A-Changelog Area: changelog label Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-Linter Area: linter L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants