-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Allow setting tsconfig config directly in the parser #1613
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
Comments
I don't think that this is really possible without significant effort. When we call into the TS API, we have to provide a compiler host, which for us gets created via The significant effort would be us manually implementing a compiler host to work around this API limitation. |
Wouldn't this solve the problem? Or am I misunderstanding something? In XO, we have the config and TS file paths, just not the config file on disk. |
Do you have a raw json file content or parsed one (an instance of |
Raw |
XO makes its own calls into the ESLint api right? If yes, then this might be a good use case for a more generic solution like in #1442 I'm hesitant to accept tsconfig via |
Yes, it uses ESLint's programmatic interface ( |
Currently, we can specify
parserOptions.project
for a path to our tsconfig, but the parser handles the loading of tsconfig, so there's no way for us to provide a custom tsconfig (not on disk) directly to@typescript-eslint/parser
.My specific use-case is that we're adding built-in TypeScript support (xojs/xo#426) to XO. XO is a "zero-config" ESLint wrapper that ships with great defaults and lots of plugins. We want to add the ability to lint ambient
d.ts
files. However, JS packages with ad.ts
file don't usually have a tsconfig file, and I feel that TypeScript is too loose by default, so I would like to provide some sensible tsconfig defaults ford.ts
files in JS projects.It would be great if there was a way to set a default tsconfig object that is used if there's no tsconfig file in the project.
The text was updated successfully, but these errors were encountered: