Replies: 1 comment
-
We have #3 for this reason: add a comment to add new rules :) You can close this discussion and add a new comment with exactly this content |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
In light of Biome's plan to support linter rules from other sources (as mentioned in issue #3 "Linter rules from other sources"), I propose including a noObjectAssign rule in the planned ESLint compatibility feature. This rule would discourage the use of Object.assign() in favor of object spread syntax, promoting more modern and readable code.
Motivation
Object.assign()
has been widely used for merging objects, but with the introduction of the object spread operator (...
) in ECMAScript 2018, we now have a more concise and readable alternative. Encouraging the use of object spread can lead to:Proposal
Add a new lint rule
noObjectAssign
with the following behavior:Object.assign()
as warnings or errors (configurable)Object.assign()
to object spread where possibleExample
Configuration
The rule could be configured in the Biome configuration file as follows:
Implementation
The implementation would involve:
Object.assign()
usagePotential Challenges
Object.assign()
is used with more than two argumentsObject.assign()
that can't be easily replaced with object spreadQuestions for Discussion
Object.assign()
?Beta Was this translation helpful? Give feedback.
All reactions