8000 Add ExpectType to eslint-plugin by jakebailey · Pull Request #843 · microsoft/DefinitelyTyped-tools · GitHub
[go: up one dir, main page]

Skip to content

Add ExpectType to eslint-plugin #843

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

Merged
merged 29 commits into from
Dec 8, 2023
Merged

Conversation

jakebailey
Copy link
Member
@jakebailey jakebailey commented Nov 22, 2023

This moves the expect rule from tslint to eslint. By default in the editor, it will run ExpectType on the builtin version of TypeScript. But when run via dtslint, it will run all TS versions (and also convert diagnostics into lint errors).

This leaves npm-naming as the only remaining tslint rule.

TODO:

  • Multiple versions
  • Only run one version in editor, run all otherwise
  • Don't return compiler errors in editor
  • Delete old rule
  • Delete tslint???
  • Perf test now that I am running all TS versions, or go back to the hacky way
  • Never call diagnostics from the editor-based setup

@jakebailey jakebailey marked this pull request as ready for review December 6, 2023 18:03
Copy link
Member
@sandersn sandersn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of small comments/questions.

@jakebailey
8000
Copy link
Member Author
jakebailey commented Dec 6, 2023

I just remembered that this message appears with this PR:

Tried to lint /home/jabaile/work/DefinitelyTyped/types/add2home/index.d.ts but found no valid, enabled rules for this file type and file path in the resolved configuration.
Tried to lint /home/jabaile/work/DefinitelyTyped/types/add2home/add2home-tests.ts but found no valid, enabled rules for this file type and file path in the resolved configuration.

This happens often, some 1400 times the last time I ran the entire thing.

@jakebailey
Copy link
Member Author

Oh, that's tslint giving that message, not eslint.

Copy link
Member
@andrewbranch andrewbranch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary to address here, but does it really make sense to keep ExpectRule responsible for reporting program diagnostics?

@jakebailey
Copy link
Member Author
jakebailey commented Dec 7, 2023

Not necessary to address here, but does it really make sense to keep ExpectRule responsible for reporting program diagnostics?

It's the expect rule that loops over every TS version, so it's the only one that can report these errors. I have disabled that reporting when in the editor though (since tsserver is there), but if we want to do it outside of the plugin we're going to have to move the looping logic over to dtslint and then duplicate the programs too (or, do some sort of program sharing).

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

Successfully merging this pull request may close these issues.

3 participants
0