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 circular deps issue #496

Merged
merged 2 commits into from May 15, 2024
Merged

Fix circular deps issue #496

merged 2 commits into from May 15, 2024

Conversation

vladmoroz
Copy link
Contributor

@vladmoroz vladmoroz commented May 13, 2024

Fixes an issue caused by internal barrel files usage when the Next.js compiler would sometimes fail to compile a project that'd use Radix Themes.

Example for posterity:

image

Copy link

vercel bot commented May 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
themes-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 15, 2024 8:04am

Comment on lines +6 to +12
'import/order': [
'error',
{
'newlines-between': 'always',
groups: [['builtin', 'external'], ['parent', 'sibling', 'index'], 'type'],
},
],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This groups imports and provides a stable order, adds a newline before type imports

Comment on lines +13 to +19
'import/no-internal-modules': [
'error',
{
// Importing from barrel files may lead to circular dependencies within the package.
forbid: ['helpers/index.js', 'props/index.js'],
},
],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Barrel files caused the circular deps issue

Comment on lines +20 to +21
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
'import/newline-after-import': ['error', { count: 1 }],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • Enforce "import type { Foo }" instead of "import { type Foo }"
  • Just enforcing a newline after imports

"lib": ["DOM", "ESNext", "DOM.Iterable"],
"jsx": "react",
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "dist",
"strict": true,
"skipLibCheck": true,
"esModuleInterop": true
"esModuleInterop": true,
"verbatimModuleSyntax": true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Enforces the type keyword when importing a type

Comment on lines +3 to +4
"module": "ESNext",
"moduleResolution": "Node",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was needed to make verbatimModuleSyntax work as expected

@vladmoroz vladmoroz merged commit 8b49d54 into main May 15, 2024
2 checks passed
@vladmoroz vladmoroz deleted the vlad/fix-circular-deps-for-good branch May 15, 2024 08:04
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.

None yet

2 participants