Skip to content
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

test files create parser issue #15

Closed
EdJoPaTo opened this issue Aug 27, 2019 · 6 comments · Fixed by xojs/xo#426
Closed

test files create parser issue #15

EdJoPaTo opened this issue Aug 27, 2019 · 6 comments · Fixed by xojs/xo#426
Labels
help wanted Extra attention is needed

Comments

@EdJoPaTo
Copy link

As one example of many (one per file within test/):

test/math/probability.ts
✖    0:0    Parsing error: If "parserOptions.project" has been set for @typescript-eslint/parser, …/test/math/probability.ts must be included in at least one of the projects provided.
@sindresorhus
Copy link
Member

parserOptions.project has to be set for some of the rules to work. If we didn't set it here, you would have to set it yourself, and the result would be the same.

See typescript-eslint/typescript-eslint#890

@EdJoPaTo
Copy link
Author

As xo also includes rules for Ava I would assume it works out of the box with ava tests. Which is the purpose of xo: work with as little config as possible.

@fregante

This comment has been minimized.

@fregante
Copy link
Member

fregante commented Dec 1, 2019

The solution suggested in typescript-eslint/typescript-eslint#890 seems to work:

// tsconfig.xo.json
{
	"extends": "@sindresorhus/tsconfig",
	"files": [
		"index.ts",
		"index.test-d.ts"
	]
}
// package.json
{
  "xo": {
    "extensions": [
      "ts"
    ],
    "extends": "xo-typescript",
    "parserOptions": {
       "project": "./tsconfig.xo.json"
    }
  }
}

Edit: none of this config is needed anymore in XO 0.28.3! 🤩

@sindresorhus
Copy link
Member

sindresorhus commented Jan 12, 2020

@fregante This is not an XO issue. The problem is in TypeScript-ESLint. I'm happy to consider ways for XO to simplify this though.

@fregante
Copy link
Member

fregante commented Jan 12, 2020

Yeah this is an annoying requirements of ts-eslint.

I'm happy to consider ways XO to simplify this though.

XO could:

  • avoid linting TS files not included in tsconfig (not great)
  • detect the error and suggest the above solution, if possible
  • since xo is setting the project prop, perhaps it can also generate/extend one on the fly, but it's probably hard to accomplish.

I don't know of a better solution to the problem in the first place

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants