Current Behavior
Recently we switched from barrel files to using path wildcards (mainly because of vitest taking a long time to load everything in the barrel files) like so:
"paths": {
"@module-boundaries-bug/libA/*": ["libs/libA/src/lib/*"],
"@module-boundaries-bug/libB/*": ["libs/libB/src/lib/*"]
}
however before vscode would do a relative import of code in our libraries and the eslint enforce-module-boundaries rule would auto-fix this to the correct path import. But this doesn't happen anymore and I'm getting an error in the console (see failure logs)
It looks like this line is giving getRelativeImportPath the path including the wildcard, which crashes.
Expected Behavior
Ideally it would resolve the wildcard before giving the path to getRelativeImportPath so that the auto-fixer can still do it's job.
GitHub Repo
https://github.com/JesseZomer/module-boundaries-bug
Steps to Reproduce
- Open
libA.ts
- see Eslint output
Nx Report
nx report
NX Report complete - copy this into the issue template
Node : 22.16.0
OS : darwin-arm64
Native Target : aarch64-macos
npm : 10.9.2
nx (global) : 21.1.3
nx : 21.3.10
@nx/js : 21.3.10
@nx/jest : 21.3.10
@nx/eslint : 21.3.10
@nx/workspace : 21.3.10
@nx/angular : 21.3.10
@nx/devkit : 21.3.10
@nx/eslint-plugin : 21.3.10
@nx/module-federation : 21.3.10
@nx/rspack : 21.3.10
@nx/web : 21.3.10
@nx/webpack : 21.3.10
typescript : 5.8.3
---------------------------------------
Community plugins:
angular-eslint : 20.1.1
---------------------------------------
Cache Usage: 0.00 B / 92.64 GB
Failure Logs
Occurred while linting /Users/jesse/dev/module-boundaries-bug/libs/libA/src/lib/componentA/LibA.ts:3
Rule: "@nx/enforce-module-boundaries"
at readFileSync (node:fs:443:20)
at t.readFileSync (node:electron/js2c/node_init:2:10960)
at getRelativeImportPath (/Users/jesse/dev/module-boundaries-bug/node_modules/@nx/eslint-plugin/src/utils/ast-utils.js:103:47)
at Object.fix (/Users/jesse/dev/module-boundaries-bug/node_modules/@nx/eslint-plugin/src/rules/enforce-module-boundaries.js:200:98)
at normalizeFixes (/Users/jesse/dev/module-boundaries-bug/node_modules/eslint/lib/linter/file-report.js:297:25)
at FileReport.addRuleMessage (/Users/jesse/dev/module-boundaries-bug/node_modules/eslint/lib/linter/file-report.js:559:8)
at FileContext.report (/Users/jesse/dev/module-boundaries-bug/node_modules/eslint/lib/linter/linter.js:1112:28)
at run (/Users/jesse/dev/module-boundaries-bug/node_modules/@nx/eslint-plugin/src/rules/enforce-module-boundaries.js:182:25)
at ImportDeclaration (/Users/jesse/dev/module-boundaries-bug/node_modules/@nx/eslint-plugin/src/rules/enforce-module-boundaries.js:498:17)
at ruleErrorHandler (/Users/jesse/dev/module-boundaries-bug/node_modules/eslint/lib/linter/linter.js:1174:33)
Package Manager Version
No response
Operating System
Additional Information
No response
Current Behavior
Recently we switched from barrel files to using path wildcards (mainly because of vitest taking a long time to load everything in the barrel files) like so:
however before vscode would do a relative import of code in our libraries and the
eslint enforce-module-boundariesrule would auto-fix this to the correct path import. But this doesn't happen anymore and I'm getting an error in the console (see failure logs)It looks like this line is giving
getRelativeImportPaththe path including the wildcard, which crashes.Expected Behavior
Ideally it would resolve the wildcard before giving the path to
getRelativeImportPathso that the auto-fixer can still do it's job.GitHub Repo
https://github.com/JesseZomer/module-boundaries-bug
Steps to Reproduce
libA.tsNx Report
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
No response