-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add option to ignore spread operator in sort-default-props #2178
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
Comments
I very much don’t agree that this would be good. A correct fixer will never move anything across a spread boundary, and while it’s fine to use linting rules to block language syntax, using linting rules to willfully break language syntax is not ok. |
@ljharb I'm not sure we understand each other. I was aking about an option to avoid having error in case like this
Cause the rule actually ask for
It's not a good thing if eslint ask for breaking my code and I have to add |
Gotcha, that makes sense. Thanks for clarifying. An option to only enforce sorting within spread boundaries seems like a good addition. |
To be clear with everyone Without the option
With the option
|
@ljharb I started to look into the code to implement the option. In test, we can see
Is expected to be a valid code. There is a check
So I think I found a bug. Cause this test case return an error.
|
@ljharb I found the fix and made the PR
|
With
foo = { bar: baz }
.And
So I think, an option to ignore spread operator in sort default props will be great.
Correct example
Incorrect example
Plus, it allow to develop a fixer (asked here) without breaking the code.
The text was updated successfully, but these errors were encountered: