-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
docs: warn against progressive type enhancement in rules #7440
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
docs: warn against progressive type enhancement in rules #7440
Conversation
Thanks for the PR, @JoshuaKGoldberg! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
:::caution | ||
We recommend against changing rule logic on whether `services.program` exists. | ||
In our experience, users are generally surprised when rules behave differently with or without type information. | ||
Additionally, if they misconfigure their ESLint config, they may not realize why the rule started behaving differently. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds vague. Maybe a specific case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm yeah good point. Agreed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as possible solution we could recommend to create 2 separate rules one with type-info and one without
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it! Added :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also gating it behind options is okay, I think.
That way you still have that hard point of a user explicitly opting in to the type-awareness and thus the rule can explicitly crash if it's not provided.
naming-convention
does this (the only rule we have that does) for the type-based enforcement of names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually is very relevant to vitest-dev/eslint-plugin-vitest#251. Nice.
Co-authored-by: Joshua Chen <[email protected]>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #7440 +/- ##
==========================================
- Coverage 87.41% 87.23% -0.19%
==========================================
Files 381 387 +6
Lines 13321 13404 +83
Branches 3938 3962 +24
==========================================
+ Hits 11645 11693 +48
- Misses 1298 1327 +29
- Partials 378 384 +6
Flags with carried forward coverage won't be shown. Click here to find out more. |
PR Checklist
Overview
Adds a caution to the docs.
I wonder if this is overkill...?