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

transformer: add style guide for import order #6637

Open
Dunqing opened this issue Oct 17, 2024 · 5 comments
Open

transformer: add style guide for import order #6637

Dunqing opened this issue Oct 17, 2024 · 5 comments
Assignees
Labels
A-transformer Area - Transformer / Transpiler C-docs Category - Documentation. Related to user-facing or internal documentation

Comments

@Dunqing
Copy link
Member

Dunqing commented Oct 17, 2024

As #6582 does, we can write the import order style guide here. This way can help contributors how write transformer plugins that conform to our style.

## Style guide for implementing transforms

@Dunqing Dunqing added A-transformer Area - Transformer / Transpiler C-docs Category - Documentation. Related to user-facing or internal documentation labels Oct 17, 2024
@overlookmotel
Copy link
Collaborator

Personally, I think it'd be ideal if we used this same import order convention in all crates, not just transformer.

So we'd need a universal "style guide". Where would that go? https://oxc.rs/docs/contribute/rules.html?

Or, even better, can we do it automatically with rustfmt/clippy/autofix action?

@Dunqing
Copy link
Member Author

Dunqing commented Oct 17, 2024

Or, even better, can we do it automatically with rustfmt/clippy/autofix action?

Yes, please! I can't remember this order.

@overlookmotel
Copy link
Collaborator

That was a question, not a statement! I don't know if any of these tools support doing that.

@overlookmotel
Copy link
Collaborator

Thanks @camc314. group_imports with StdExternalCrate option gives us some of what we want, and would be an improvement. But:

  1. It's unstable. Do we run rustfmt in nightly mode?
  2. It wouldn't enforce oxc_* crates being grouped together after external crates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-transformer Area - Transformer / Transpiler C-docs Category - Documentation. Related to user-facing or internal documentation
Projects
None yet
Development

No branches or pull requests

3 participants