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
Error: Cannot find module '@namespace/package'
Require stack:
- /Users/jonah/programming/xo-bug/tsconfig.json
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
at Function.resolve (node:internal/modules/cjs/helpers:108:19)
at recursiveBuildTsConfig (file:///Users/jonah/programming/xo-bug/node_modules/xo/lib/options-manager.js:649:27)
at handleTSConfig (file:///Users/jonah/programming/xo-bug/node_modules/xo/lib/options-manager.js:180:28)
at async mergeWithFileConfig (file:///Users/jonah/programming/xo-bug/node_modules/xo/lib/options-manager.js:139:13)
at async parseOptions (file:///Users/jonah/programming/xo-bug/node_modules/xo/lib/options-manager.js:586:51)
at async Promise.all (index 0)
at async getOptionGroups (file:///Users/jonah/programming/xo-bug/node_modules/xo/lib/options-manager.js:602:21)
at async Object.lintFiles (file:///Users/jonah/programming/xo-bug/node_modules/xo/index.js:78:17)
at async file:///Users/jonah/programming/xo-bug/node_modules/xo/cli.js:211:18
I think we've nearly got the tsconfig changes sorted out now, hate that it introduced so many regressions...
Unfortunately @tsconfig doesn't add a main field to the package.json which is why require.resolve can't find the config, but ultimately we should support whatever TS does as close as possible...
I don't think the check for startsWith('@') will fix this entirely, since it would be possible to install a tsconfig from npm that isn't prefixed with @ that also doesn't have the main field of package.json listed as the tsconfig.
I will make a PR for a different patch that will support this syntax and resolution logic to assume that tsconfig.json is always the name of the file it is looking for.
Bug description
When I run
xo
I get this error:This is my
tsconfig.json
:Bug reproduction
Here's a fully reproducible project:
xo-bug.zip
yarn
yarn test
Fix
I believe this is a bug introduced in #677.
The fix is probably replacing this:
xo/lib/options-manager.js
Lines 642 to 644 in c8ec522
with something like this:
The text was updated successfully, but these errors were encountered: