-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[eslint-plugin] feat: split no-deprecated-components rule #5478
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fix lint with disable flagsPreviews: documentation | landing | table | demo |
fix timezone lint with disable flagsPreviews: documentation | landing | table | demo |
styu
reviewed
Aug 3, 2022
packages/eslint-plugin/src/rules/no-deprecated-components/no-deprecated-components.ts
Outdated
Show resolved
Hide resolved
address CR, DRY codePreviews: documentation | landing | table | demo |
fix more lintPreviews: documentation | landing | table | demo |
@styu this is ready for another round of review when you get the chance |
adidahiya
commented
Aug 4, 2022
* package instead. | ||
*/ | ||
|
||
/* eslint-disable deprecation/deprecation, @blueprintjs/no-deprecated-components */ |
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 realize it is redundant to have both of these rules on as "error" violations, but I'm keeping them both so we can dogfood our own lint rule.
styu
approved these changes
Aug 4, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR creates new ESLint rules which flag usage of deprecated components specific to each
@blueprintjs
package:@blueprintjs/no-deprecated-core-components
@blueprintjs/no-deprecated-datetime-components
@blueprintjs/no-deprecated-select-components
@blueprintjs/no-deprecated-timezone-components
Rationale (also in README): In migrations of large code bases, it may be useful to apply more granular rule configuration of "no-deprecated-components" to make incremental progress towards the newer APIs. This allows you, for example, to flag deprecated⚠️ warnings.
@blueprintjs/core
component usage as ❌ errors while allowing deprecated components from other packagesto pass as lint
Note that
@blueprintjs/no-deprecated-components
has not been removed, it is still available, and is enabled in the"@blueprintjs/recommended"
config (this config is not used in our internal monorepos, btw, just provided for convenience and seems to be an ESLint plugin convention). I refactored the implementation of this rule into a reusable function so that all 5 rules share the same implementation.Following up from #5477 (comment) and other conversations... the other idea I had of introducing a configuration object for
@blueprintjs/no-deprecated-components
to set "error"/"warn" levels for the different Blueprint packages turned out to be messy and less legible than the approach taken in this PR. It's better to let ESLint's infrastructure handle the "error"/"warn" option toggling, and splitting into separate rules also helps with legibility because we can search the codebase for// eslint-disable-next-line @blueprintjs/no-deprecated-core-components
lint flags.