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

Even prettier imports #162

Merged
merged 9 commits into from
Jan 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/stupid-birds-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@theguild/prettier-config': patch
---

Even prettier imports
14 changes: 7 additions & 7 deletions packages/prettier-config/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ module.exports = {
require('@trivago/prettier-plugin-sort-imports'),
],
importOrder: [
// Side effect imports.
'^\\u0000',
// TODO: Sort side effects on the top
// See more: https://github.com/trivago/prettier-plugin-sort-imports/issues/110
// Node.js builtins
`^(node:)?(${builtinModules
.filter(mod => !mod.startsWith('_') && !mod.includes('/'))
Expand All @@ -36,11 +36,11 @@ module.exports = {
// Anything not matched in other groups.
'<THIRD_PARTY_MODULES>',
// Things that start with `@` or digit or underscore.
'^(@|d|_)',
// Anything that starts with a dot and doesnt have an extension (relative imports).
'^\\.[^\\.]+$',
// Files with extensions.
'^.+\\.',
'^(@|\\d|_)',
// Anything that starts with a dot, or multiple dots, and doesnt have the "other files" extensions.
'^(?=\\.+)(.(?!\\.(graphql|css|png|svg|jpe?g|webp|avif|wasm|mp4|webm)))+$',
// Other files with extensions.
'^.+\\.(graphql|css|png|svg|jpe?g|webp|avif|wasm|mp4|webm)$',
],
importOrderSeparation: false, // import order groups wont be separated by a new line
importOrderSortSpecifiers: true, // sorts the import specifiers alphabetically
Expand Down