-
Notifications
You must be signed in to change notification settings - Fork 39
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
Bug(sort-imports): Misleading Missed spacing
errors
#322
Comments
I think that's normal behavior. Don't you think so? |
@azat-io It is misleading in my opinion because it tells the user to make fixes that in the end will be erased when the imports will eventually be sorted. I think that each error reported (and as such fix) should bring the code closer to the expected state. In the example above, I believe that there is no need to throw a import d2 from "d"
import a1 from "./a" That's how I see it, but it's nitpicking, I understand if you see it differently! @OlivierZal, what do you think? |
I understand both points of view. My way of using eslint (preference for autofix) would make me vote for @hugop95's proposal. However I think it's good to warn the users about the errors he actually has, and not about what these errors could be after a potential fix. I say potential because maybe some developers don't enable autofix, so they could fix manually based on (all) the error messages. In the example given in the previous comment, maybe one's fix wouldn't be the one proposed, but another one based on the missing space warnings: // comment separator
import a1 from "a"
import a2 from "./a"
// comment separator
import b1 from "b"
import b2 from "./b"
// comment separator
import c1 from "c"
import c2 from "./c"
// comment separator
import d1 from "d"
import d2 from "./d" Then displaying all the warning messages could have some interest, so the user could fix accordingly as wanted. Again, it's not my way to proceed, so maybe my example is too fictive to be relevant. |
Describe the bug
Not a breaking bug but can be a minor inconvenience:
Missed spacing
errors may be reported way more than what the sorted result would require. See code belowCode example
Configuration:
Code:
The sorted result is:
but the following
Missed spacing
are reported (order-errors are not shown here):ESLint version
8.57.0
ESLint Plugin Perfectionist version
3.8.0
Additional comments
No response
Validations
The text was updated successfully, but these errors were encountered: