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: Added Import Order to Prettier Config #11

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anna-murphy
Copy link

Added import order prettier plugin ( https://github.com/trivago/prettier-plugin-sort-imports ). I think this should do nothing unless you override the default order in your prettier config a la the README.

Thoughts?

@anna-murphy anna-murphy added enhancement New feature or request question Further information is requested labels Oct 12, 2023
@anna-murphy anna-murphy self-assigned this Oct 12, 2023
@broarr
Copy link
Contributor

broarr commented Oct 13, 2023

Added import order prettier plugin ( https://github.com/trivago/prettier-plugin-sort-imports ). I think this should do nothing unless you override the default order in your prettier config a la the README.

Thoughts?

I think it moves third party stuff to the top and leaves the rest?

Default behavior: The plugin moves the third party imports to the top which are not part of the importOrder list.

Copy link
Contributor

@broarr broarr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we should have a default import order? We have one already in the eslint file, I think maybe the default should match eslint?

Are you hating the import order thing? I'm finding it kinda weird personally. When I include @alias imports in my code it treats them as third party, which is annoying

Can you add a bit to the readme about how this thing should be used?

Comment on lines +12 to +13
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.2.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +6 to +9
importOrder: [], // Override this for your repo. https://github.com/trivago/prettier-plugin-sort-imports
importOrderSeparation: true,
importOrderSortSpecifiers: true,
plugins: ["@trivago/prettier-plugin-sort-imports"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a little to the readme about how to override the import order?

Copy link
Contributor

@broarr broarr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anna-murphy - Wanted to bump this!

@RobertGemmaJr
Copy link
Member

FWIW we use eslint to enforce the import order in XMA portal?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants