Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

Support for typed TSLint rules #276

Closed
JoshuaKGoldberg opened this issue Jan 8, 2019 · 6 comments
Closed

Support for typed TSLint rules #276

JoshuaKGoldberg opened this issue Jan 8, 2019 · 6 comments

Comments

@JoshuaKGoldberg
Copy link

TSLint has some rules that use typed checked rules are able to tap into the full type intelligence from TypeScript, so they can leverage the full type system in their linting.

(some higher value rules that aren't really possible without type information here...)


Although versions of some typed rules are available in ESLint & its plugins, they fall apart when interacting with objects whose types can't be inferred statically using just the file: for example, if linting code that imports objects from another file/module.

The recent TypeScript Jan-Jun 2019 Roadmap reminded me of a tweeted suggestion to file this here. Is this the right place? Would ESLint core need structural improvements to support full-program type checking?

@armano2
Copy link
Contributor

armano2 commented Jan 8, 2019

@JoshuaKGoldberg we started working on rules like this :)
#250 #269 but we are kind block by parser eslint/typescript-eslint-parser#568 witch is blocked by eslint/typescript-eslint-parser#592

@JoshuaKGoldberg
Copy link
Author

Ooh! Looking through that PR:

context.parserServices.program.getTypeChecker();

TIL that's available, great! Do you have docs on this? I can't find any in this repo.

@j-f1
Copy link
Collaborator

j-f1 commented Jan 8, 2019

There’s a PR open in typescript-eslint-parser to add a way for rules to get type information: eslint/typescript-eslint-parser#568. Once that’s merged, we’d appreciate help creating rules that use this type info!

@JoshuaKGoldberg
Copy link
Author

I'll close this issue in favor of making two dedicated ones: docs and rule parity. Thanks! 😍

@j-f1
Copy link
Collaborator

j-f1 commented Jan 8, 2019

We don’t have docs here as far as I know, but getTypeChecker() returns an instance of TS’s TypeChecker class provided directly by TS.

@j-f1
Copy link
Collaborator

j-f1 commented Jan 8, 2019

I’m wondering if we should move all the TS+ESLint stuff to an @eslint-typescript org so changes can be released more quickly.

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

No branches or pull requests

3 participants