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

feat(order rule): add forceFix option for potentially unsafe import sorting #230

Open
privatenumber opened this issue Feb 10, 2025 · 3 comments

Comments

@privatenumber
Copy link

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

@JounQin
Copy link
Member

JounQin commented Mar 16, 2025

Maybe we can provide suggestions instead of fix in this case?

@privatenumber
Copy link
Author

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.

@JounQin
Copy link
Member

JounQin commented Mar 16, 2025

suggestions will not be applied automatically AFAIK?

These fixes are unsafe, so a manual action is better IMO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants