Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Enable access to the LanguageService for rules #4232

Closed
donaldpipowitch opened this issue Oct 18, 2018 · 6 comments
Closed

Enable access to the LanguageService for rules #4232

donaldpipowitch opened this issue Oct 18, 2018 · 6 comments

Comments

@donaldpipowitch
Copy link
Contributor

Feature request

Is your feature request that we implement a new rule?
No.

Is your feature request related to a problem? Please describe.
I'd like to access SuggestionDiagnostics in a rule. AFAIK there are only available via the LanguageService (and not the Program) and it looks like support for/access to the LanguageService was removed in tslint@^5. That way I could create a small wrapper around "unused variables" suggestion diagnostics, so I can still remove them via TSLint in a custom rule.

Describe the solution you'd like
It would be nice to get access to the LanguageService in custom rules.

Describe alternatives you've considered
Create my own lint framework which uses the LanguageService? 🤷‍♀️😂 I'd at least write a small standalone script which does everything I want, but TSLint would be a nicer place for this.

@JoshuaKGoldberg
Copy link
Contributor

Create my own lint framework

@ajafff did exactly that with https://github.com/fimbullinter/wotan 😊

@adidahiya
Copy link
Contributor

LanguageService access was removed in #2235 with the rationale of:

LanguageService is for editors; tslint should use the Program and TypeChecker API.

... but I think it would be nice to use TSLint's infrastructure to check & fix things with information only available through the LanguageService, as you suggest @donaldpipowitch. We should check with the TS team what the current stance is and what all the potential dangers are before proceeding.

@yss14
Copy link

yss14 commented Jan 16, 2019

Access to the TS LanguageService would be great, for example to get all references of a node. Or is there any other way to obtain all references?

@JoshuaKGoldberg JoshuaKGoldberg changed the title Enable access to the LanguageService for custom rules Enable access to the LanguageService for rules Jan 19, 2019
@JoshuaKGoldberg
Copy link
Contributor

Since it's not clear without reading other issues, recapping here: using a TS language service is necessary to re-enable the no-unused-variable rule. Its original implementation wreaked havoc when combined with many other TS/TSLint tools, including when used with VS Code.

@JoshuaKGoldberg
Copy link
Contributor

☠️ TSLint's time has come! ☠️

TSLint is no longer accepting most feature requests per #4534. See typescript-eslint.io for the new, shiny way to lint your TypeScript code with ESLint. ✨

It was a pleasure open sourcing with you all!

@JoshuaKGoldberg
Copy link
Contributor

🤖 Beep boop! 👉 TSLint is deprecated 👈 (#4534) and you should switch to typescript-eslint! 🤖

🔒 This issue is being locked to prevent further unnecessary discussions. Thank you! 👋

@palantir palantir locked and limited conversation to collaborators Mar 20, 2020
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

4 participants