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
@nx/dependency-checks should not trigger for type-only imports #23096
Comments
Hi, This is not necessarily true. If you have a code that looks like this: import type { Foo } from '@mypkg/foo`
export type Baz = {
foo: Foo;
} Then your exported The rule at this level doesn't know the intention of how that |
The problem with suppressing it wholesale for a package is that it might fly under the radar if you're using the package as a proper runtime dep somewhere else in the future. Is there a way to tell the linter in the |
Current Behavior
If you import a library like so:
The ESLint rule
@nx/dependency-checks
will show an error if@mypkg/foo
isn't listed in eitherdependencies
orpeerDependencies
ofpackage.json
. That's fine, that's the purpose of the rule.However, in a type-only import situation such as this:
Today, this still trips up the rule… even if the package is listed in the
devDependencies
section ofpackage.json
.Expected Behavior
Type-only imports such as listed above are only needed at compile time. Therefore, having these packages referenced in the
devDependencies
sectionpackage.json
should suffice to satisfy the ESLint rule@nx/dependency-checks
GitHub Repo
No response
Steps to Reproduce
devDependencies
section ofpackage.json
import type { Foo } from '@mypkg/foo';
)npx nx lint {project-name}
)Nx Report
Failure Logs
No response
Package Manager Version
pnpm 8.15.1
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: