Webstorm is not finding a tsconfig.base.json from a test file
I'm working on the web3.js repo and I'm having problems getting a test file to recognize a tsconfig.base.json
file that is located at the root of the project.
The test file I'm getting this error on is packages/web3/test/integration/web3RPCProviders.test.ts
:
I think this has to do with the project structure and having multiple tsconfig
files in other folders. Can I get some help fixing this issue?
请先登录再写评论。
If the error only occurs when using ESLint integration in the IDE and doesn't occur when you run the linter in the terminal, it can be caused by the wrong working directory being used. With monorepos, the IDE can start multiple ESlint processes - by default, it starts a separate process for each
package.json
witheslint
dependency and processes everything below it, using the.eslintrc.*
configuration file nearest to the current file. Also, with Automatic configuration, the ESlint working folder is set to a folder where the nearest.eslintrc
oreslintignore
resides (as described in https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration)You can try changing the configuration to Manual and choosing the eslint package, configuration file and working directory explicitly to match the command you use when running the linter in terminal
@Elena Pogorelova Thank you for the help.
I'm still not sure how to fix the issue. I should've added the console outputs. In this test file I'm getting:
Error: File '../../tsconfig.base.json' not found.
Occurred while linting /Users/TheUser/Documents/web3.js/packages/web3/test/integration/web3RPCProviders.test.ts:18
Rule: "import/namespace"
In
.eslintrc.test.js
I'm getting:Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: .eslintrc.test.js.
The file must be included in at least one of the projects provided.
What command do you normally use to lint your project, in what directory do you run this command?
I run
npm run lint
from the root of the project.And what does the
lint
script look like?It runs
lerna run lint --stream --parallel
.I'm not sure how to set up the integration in your case. I've tried you app and get a different error in
packages/web3/test/integration/web3RPCProviders.test.ts
:Looks like the
tsconfig.json
is broken, it's not a valid JSON.