Splitting 'expect' into targeted rules #69
Closed
JoshuaKGoldberg
started this conversation in
General
Replies: 2 comments 1 reply
-
How much of the win here would come from splitting the single |
Beta Was this translation helpful? Give feedback.
1 reply
-
Just following up: agreed with @danvk. Users are perfectly happy with the one Refactor PR here: #117 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
tl;dr
The
expect-type/expect
rule is quite large and contains multiple feature areas. I propose we deprecate (not delete, for now) it and create standalone rules for each of those feature areas.Context
I first joined as a maintainer of
eslint-plugin-expect-type
in August of 2021. I intentionally did not make any major changes for many months after that, to make sure I wasn't getting in the way of any existing community momentum. Back then this package supported:$ExpectError
$ExpectType
$ExpectTypeSnapshot
recommended
config containing the soleexpect
rule that supports those commentsIn the year and change since, the following features have been brought up:
^?
Twoslash assertions: implemented in Add twoslash support #47// @ts-(expect-error|ignore)
diagnostic code/text matching: Checking errors via@ts-expect-error
? #65The surface area of what this plugin is being asked to do is getting larger than just "expect type" assertions. Arguably, given
$ExpectError
, it always was.expect.ts
is currently at over 600 lines. It includes 8 separate message IDs, support for parsing both^?
and$
comments, and file snapshots.Proposal
I propose this package be split up into one rule per area of functionality, each set to
error
in therecommended
config:expect-type/equals
*:^?
,$ExpectType
, and$ExpectTypeSnapshot
expect-type/error
:@ts-(expect-error|ignore)
and$ExpectError
*I'm not confident on this name.
expect-type/to-be
?expect-type/is
? Would very much like to hear more alternatives 🤔...Deprecating
expect
Existing users ... expect that
expect
exists and works. While it may bemeta.replacedBy
other rules, it should stick around for a while. My timeline proposal would be roughly:I'd love to hear thoughts from the TypeScript community! What do you all think? Especially, but not limited to:
Beta Was this translation helpful? Give feedback.
All reactions