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

Some typescript-eslint rules do not work with the plugin #22

Open
DiFuks opened this issue Dec 3, 2024 · 1 comment
Open

Some typescript-eslint rules do not work with the plugin #22

DiFuks opened this issue Dec 3, 2024 · 1 comment

Comments

@DiFuks
Copy link
Owner

DiFuks commented Dec 3, 2024

const alwaysStringVar = 'Some string';

alwaysStringVar?.toLowerCase();

ESLint: This rule requires the `strictNullChecks` compiler option to be turned on to function correctly.(@typescript-eslint/ no-unnecessary-condition)

@DiFuks
Copy link
Owner Author

DiFuks commented Dec 3, 2024

The issue lies here: typescript-eslint retrieves compiler options from the original program. In theory, this can be addressed by passing a custom program to the parser options (example). However, there’s still a problem—it's impossible to provide different compiler options for different files.

Even then, it only works correctly in the CLI. For proper functionality in an IDE, a languageService is required instead of a program. typescript-eslint has a configuration option that allows using TypeScript plugins in conjunction with languageService. However, I’m currently stuck because TypeScript throws errors about conflicting program instances when trying to modify a file in the IDE (example)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant