Closed warnellw closed 2 years ago
I have found a temporary solution: adding an explicit excludes: ["node_modules"]
(omitting the jest.config.ts
) to the tsconfig.spec.json
effectively overrides the excludes
inherited from the tsconfig.json
, allowing the jest.config.ts
to properly be included and the linting to pass. I am not an expert in Typescript configuration, but it does not appear that includes
takes precedence over excludes
(in fact, the opposite appears to be the case). It may be wise to migrate the Next.js Typescript configuration to a 3-file config pattern similar to Node apps in order to avoid the inheritance issue.
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
Current Behavior
Newer Nx projects that have run the
jest.config.js
->jest.config.ts
migration (or brand new workspaces) fail to lint Next.js applications due to a bug with how thejest.config.ts
isincluded
/excluded
in thetsconfig.*.json
files.Expected Behavior
A Next.js app should lint successfully just as it did prior to the conversion from
jest.config.js
->jest.config.ts
.Steps to Reproduce
setParserOptionsProject
flagnpx nx lint your-next-app
It appears the
jest.config.ts
isexcluded
intsconfig.json
, andincluded
in thetsconfig.spec.json
. However, the inclusion does not appear to be working properly (see error below).Failure Logs
Environment
Node : 14.17.6 OS : darwin x64 npm : 6.14.15
nx : 14.0.2 @nrwl/angular : Not Found @nrwl/cypress : 14.0.2 @nrwl/detox : Not Found @nrwl/devkit : 13.10.2 @nrwl/eslint-plugin-nx : 14.0.2 @nrwl/express : Not Found @nrwl/jest : 14.0.2 @nrwl/js : 14.0.2 @nrwl/linter : 14.0.2 @nrwl/nest : Not Found @nrwl/next : 14.0.2 @nrwl/node : Not Found @nrwl/nx-cloud : 13.3.1 @nrwl/nx-plugin : Not Found @nrwl/react : 14.0.2 @nrwl/react-native : Not Found @nrwl/schematics : Not Found @nrwl/storybook : 14.0.2 @nrwl/web : 14.0.2 @nrwl/workspace : 14.0.2 typescript : 4.6.3 rxjs : 6.6.7