-
-
Notifications
You must be signed in to change notification settings - Fork 44
feat(order
rule): add forceFix
option for potentially unsafe import sorting
#230
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
Maybe we can provide suggestions instead of fix in this case? |
In my project, we enforce a no side-effects rule, and auto-fixes are expected when saving in VSCode. I'd be fine with making this a suggestion, as long as it can be auto-applied on save. However, if suggestions can be auto-fixed, I worry that making it a suggestion might be too risky for some projects or users. |
These fixes are unsafe, so a manual action is better IMO. |
You can use
I agree that it should be manual by default. For reference, Perfectionist's version of this rule has a It would be useful to be able to opt into automating unsafe changes with the acknowledgement that there's a risk. |
@privatenumber Would you like to raise a PR for it? |
The
order
rule enforces a specific import order but refuses to auto-sort in case of potential side effects. However, there are many cases when imports have no side effects, making reordering safe.It would be useful to have a
forceFix
option to allow automatic sorting when side effects are not a concern.For precedent, TypeScript ESLint's
no-explicit-any
rule has a similar option:fixToUnknown
The text was updated successfully, but these errors were encountered: