eslint-config-xo-typescript icon indicating copy to clipboard operation
eslint-config-xo-typescript copied to clipboard

`tsconfig.json` is being cached between runs and not purged on change

Open fregante opened this issue 6 years ago • 3 comments

Repro.zip

➡️ Run:

npm i
npm test

❌ You get:

> xo

  a.ts:1:7
  ✖  1:7  a is assigned a value but never used.                                                                                                                                                                    @typescript-eslint/no-unused-vars

  b.ts:undefined:undefined
  ✖  0:0  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: b.ts.
The file must be included in at least one of the projects provided.  

  2 errors

Ok, I guess, tsconfig.json is:

{
	"include": [
		"a.ts"
	]
}

➡️ Change it to include the missing file:

{
	"include": [
		"a.ts",
		"b.ts"
	]
}

➡️ Run:

npm test

Same result as above. It's still complaining that b.ts isn't included but it's included. Crazy.

➡️ Run:

trash node_modules # or # rm -rf node_modules
npm i
npm test

It works.

I also included .eslintrc with which you can verify that eslint isn't doing this. Replace test in package.json with eslint *.ts

fregante avatar Dec 01 '19 18:12 fregante

This is probably caused by xo's caching, which is really just ESLint's caching. I guess TypeScript-ESLint doesn't correctly update the cache or something.

sindresorhus avatar Dec 01 '19 18:12 sindresorhus

Have same issue. I use xo and eslint both in one project. xo for cli and eslint for WebStorm. node_modules removal helps. @fregante thank you for the workaround.

dobromyslov avatar Feb 21 '20 03:02 dobromyslov

Cache is handled by ESLint itself, not TypeScript-ESLint, and ESLint does not understand tsconfig.json should invalidate cache.

JounQin avatar Jun 25 '22 03:06 JounQin