You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The follow error occurs when violating import is not empty:
> NX ENOENT: no such file or directory, open '/Users/jarod.burchill/GitHub/nx-lint-issue-example/libs/shared/src/lib/shared/index.ts'
Occurred while linting /Users/jarod.burchill/GitHub/nx-lint-issue-example/libs/shared/src/lib/test.tsx:1
Rule: "@nrwl/nx/enforce-module-boundaries"
Pass --verbose to see the stacktrace.
Works as expected when the violating import is empty though:
Linting "shared"...
/Users/jarod.burchill/GitHub/nx-lint-issue-example/libs/shared/src/lib/test.tsx
1:1 error Projects should use relative imports to import from other files within the same project. Use "./path/to/file" instead of import from "@nx-lint-issue-example/shared" @nrwl/nx/enforce-module-boundaries
✖ 1 problem (1 error, 0 warnings)
Lint errors found in the listed files.
Expected Behavior
The import being non-empty should not cause the linter to crash and give a ENOENT: no such file or directory error
> nx run shared:lint
Linting "shared"...
/Users/jarod.burchill/GitHub/nx-lint-issue-example/libs/shared/src/lib/test.tsx
1:1 error Projects should use relative imports to import from other files within the same project. Use "./path/to/file" instead of import from "@nx-lint-issue-example/shared" @nrwl/nx/enforce-module-boundaries
✖ 1 problem (1 error, 0 warnings)
Lint errors found in the listed files.
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Ran target lint for project shared (867ms)
✖ 1/1 failed
✔ 0/1 succeeded [0 read from cache]
Run linter with a non-empty import statement:
Change the import statement in test.tsx:
- import { } from "@nx-lint-issue-example/shared";+ import { Shared } from "@nx-lint-issue-example/shared";
npx nx lint shared
NOTE: the output is the following (unexpected, should give same @nrwl/nx/enforce-module-boundaries error as it did when the import statement was empty):
> nx run shared:lint
Linting "shared"...
> NX ENOENT: no such file or directory, open '/Users/jarod.burchill/GitHub/nx-lint-issue-example/libs/shared/src/lib/shared/index.ts'
Occurred while linting /Users/jarod.burchill/GitHub/nx-lint-issue-example/libs/shared/src/lib/test.tsx:1
Rule: "@nrwl/nx/enforce-module-boundaries"
Pass --verbose to see the stacktrace.
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Ran target lint for project shared (846ms)
✖ 1/1 failed
✔ 0/1 succeeded [0 read from cache]
> nx run shared:lint
Linting "shared"...
> NX ENOENT: no such file or directory, open '/Users/jarod.burchill/GitHub/nx-lint-issue-example/libs/shared/src/lib/shared/index.ts'
Occurred while linting /Users/jarod.burchill/GitHub/nx-lint-issue-example/libs/shared/src/lib/test.tsx:1
Rule: "@nrwl/nx/enforce-module-boundaries"
Pass --verbose to see the stacktrace.
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Ran target lint for project shared (846ms)
✖ 1/1 failed
✔ 0/1 succeeded [0 read from cache]
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Current Behavior
The follow error occurs when violating import is not empty:
Works as expected when the violating import is empty though:
Expected Behavior
The import being non-empty should not cause the linter to crash and give a
ENOENT: no such file or directory
errorGitHub Repo
https://github.com/jarodburchill/nx-lint-issue-example
Steps to Reproduce
Setup (can skip if using provided repo):
npx create-nx-workspace@15.8.0-beta.4 nx-lint-issue-example --preset=react-monorepo --appName=myapp --bundler=vite --style=css --nxCloud=false
cd nx-lint-issue-example
npx nx generate @nrwl/react:library shared --unitTestRunner=none --bundler=none
touch libs/shared/src/lib/test.tsx
test.tsx
:Run linter with an empty import statement:
npx nx lint shared
Run linter with a non-empty import statement:
test.tsx
:npx nx lint shared
@nrwl/nx/enforce-module-boundaries
error as it did when the import statement was empty):Nx Report
Failure Logs
Additional Information
No response
The text was updated successfully, but these errors were encountered: