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

chore(prettier): add @trivago/prettier-plugin-sort-imports #19281

Closed
wants to merge 1 commit into from

Conversation

rexledesma
Copy link
Contributor

@rexledesma rexledesma commented Jan 18, 2024

Summary & Motivation

Follow https://github.com/trivago/prettier-plugin-sort-imports and enable sorting of *.tsx, *.ts, *.js imports by default.

We remove the existing sort-order rules from eslint, to defer formatting to prettier. For prettier config, we add importOrder and put @dagster-io imports and relative imports into their own group. Feel free to suggest other groups if needed.

Alternatively, we could have set this in eslint. Originally, I followed https://medium.com/weekly-webtips/how-to-sort-imports-like-a-pro-in-typescript-4ee8afd7258a to do just this. However, organizing code imports is more of a formatting concern, so I went back to prettier.

How I Tested These Changes

yarn format, added bk step to enforce prettier

Copy link
Contributor Author

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

Copy link

github-actions bot commented Jan 18, 2024

Deploy preview for dagit-core-storybook ready!

✅ Preview
https://dagit-core-storybook-8c4hn8pog-elementl.vercel.app
https://rl-add-eslint-sort-imports.core-storybook.dagster-docs.io

Built with commit df8a9db.
This pull request is being automatically deployed with vercel-action

@rexledesma rexledesma force-pushed the rl/add-eslint-sort-imports branch from ed6a2b6 to 8454c30 Compare January 18, 2024 17:09
@rexledesma rexledesma changed the title chore(eslint): add sort-imports rule chore(prettier): add @trivago/prettier-plugin-sort-imports Jan 18, 2024
Copy link

github-actions bot commented Jan 18, 2024

Deploy preview for dagit-storybook ready!

✅ Preview
https://dagit-storybook-alxc2lalb-elementl.vercel.app
https://rl-add-eslint-sort-imports.components-storybook.dagster-docs.io

Built with commit df8a9db.
This pull request is being automatically deployed with vercel-action

@rexledesma rexledesma marked this pull request as ready for review January 18, 2024 17:18
@rexledesma rexledesma force-pushed the rl/add-eslint-sort-imports branch 2 times, most recently from 62f12d7 to 4a0695f Compare January 18, 2024 17:37
@rexledesma rexledesma force-pushed the rl/add-eslint-sort-imports branch from 4a0695f to df8a9db Compare January 18, 2024 18:16
@rexledesma rexledesma closed this Jan 18, 2024
@rexledesma rexledesma deleted the rl/add-eslint-sort-imports branch February 21, 2024 01:40
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

Successfully merging this pull request may close these issues.

1 participant