New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@typescript-eslint/parser error with TypeScript test files #637
Comments
Ah this is an edge case I missed when I was fixing our TS handling - but the fix is pretty simple. Until I have time to get a PR, an ok workaround is to create an parserOptions: {
project: './tsconfig.xo.json'
} Once I get the fix in - If you want an example of a project that already does this exact same thing, see: ow |
Appreciate the quick reply, @spence-s The workaround makes sense, but it's not working for me Here's a StackBlitz project with the workaround: https://stackblitz.com/edit/node-q5oxrl. XO continues to fail. I tried to replicate the error on https://github.com/sindresorhus/ow/tree/v0.28.1 ( ow@0.28.1 uses xo@0.38.2, so here's the same 'XO + TS with exclude' StackBlitz project but with xo@^0.38 instead of xo@latest: https://stackblitz.com/edit/node-atsn3f. XO works for this project. |
@ptrkcsk yep - xo 0.40+ has some major architectural changes. The reason it fails on your stack blitz is because of 2 reasons.
try this: {
"extends": "./tsconfig.json",
"exclude": []
} also - beware of a stale cache after changing a tsconfig file here. May be a problem with typescript-eslint that caching doesn't get busted properly for affected files when changing it. If you still get errors remove the cache: Hope this makes more sense to you now! This will be patched soon so you won't have to worry about this work around. edit: attempted to make a stack blitz here to make everything work https://stackblitz.com/edit/node-fgblkr |
There we go. I was mistakenly treating
I was aware of the cache. I had been running Appreciate your time on this one, @spence-s ! |
@spence-s thank you for sharing the workaround, we've been using it for a number of months now 👍 Is a fix still planning to be released soon? |
I'd like to use XO to lint and format my TypeScript tests in addition to my source code.
When I add a test file to my project, I get the following error from XO:
I think this is happening because my test files are excluded in TSConfig.
Here are some minimal reproductions in StackBlitz:
exclude
npm test
to see above errorexclude
npm test
to see no errorThe text was updated successfully, but these errors were encountered: