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

fix(style): imports grouping, trivial #830

Merged
merged 1 commit into from Nov 22, 2022
Merged

Conversation

dreglad
Copy link
Contributor

@dreglad dreglad commented Nov 22, 2022

This is a trivial style fix. Third party library imports are grouped apart from local imports throughout the project, I guess this file shouldn't be an exception.

βœ… Checklist

I assume this change is too trivial to require anything from the checklist other than following the commit convention

  • I have followed every step in the contributing guide (updated 2022-10-06).
  • The PR title follows the convention we established conventional-commit
  • Not required I performed a functional test on my final commit.

Changelog

[Not required]


Screenshots

[Not required]

πŸ’―

Separate groups of third party and local imports
@changeset-bot
Copy link

changeset-bot bot commented Nov 22, 2022

⚠️ No Changeset found

Latest commit: 40e89e4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Nov 22, 2022

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

1 Ignored Deployment
Name Status Preview Updated
create-t3-app ⬜️ Ignored (Inspect) Nov 22, 2022 at 0:15AM (UTC)

@github-actions github-actions bot added πŸ“Œ area: cli Relates to the CLI πŸ“Œ area: t3-app Relates to the generated T3 App labels Nov 22, 2022
Copy link
Member

@c-ehrlich c-ehrlich left a comment

Choose a reason for hiding this comment

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

Looks good. I think this file just hadn't been worked in since this style of importing was implemented

@c-ehrlich c-ehrlich merged commit 59309f9 into t3-oss:next Nov 22, 2022
@dreglad
Copy link
Contributor Author

dreglad commented Nov 22, 2022

An additional thought on the topic

What about having imports sorted/grouped by the linter?

Something like prettier-plugin-sort-imports would do the job with minimal boilerplate.

I wouldn't disagree if some consider that grouping imports by default may be too opinionated, but I don't think anyone could reasonably argue against enforcing import order by default.. Much like prettier-plugin-tailwindcss already does for Tailwind classes

@bai
Copy link
Contributor

bai commented Nov 22, 2022

prettier-plugin-tailwindcss and @trivago/prettier-plugin-sort-imports are not working together nicely, e.g. Cal.com does this sort of hacking: https://github.com/calcom/cal.com/blob/main/packages/config/merged-prettier-plugin.js

There's now Organize Imports in VS Code β€” wonder if it's something that could be unsed instead of prettier plugin hackery?

@wyattades
Copy link

Hey all, I know there's a lot of solutions/packages out there for "sortings imports", but I think one in particular is the best fit for the prettier + typescript philosophies: https://github.com/simonhaenisch/prettier-plugin-organize-imports

From there docs:

A plugin that makes Prettier organize your imports (i. e. sorts, combines and removes unused ones) using the organizeImports feature of the TypeScript language service API. This is the same as using the "Organize Imports" action in VS Code.

In other words, developers should not have to care about how imports are grouped. The plugin itself doesn't even know. Just let the typescript compiler decide.


Also, prettier-plugin-tailwindcss@0.2.0 supposedly fixes compatibility with the other prettier plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
πŸ“Œ area: cli Relates to the CLI πŸ“Œ area: t3-app Relates to the generated T3 App
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants