-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
feat: introduce new deprecated types for rules #19238
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for docs-eslint canceled.
|
It doesn't seem that this is implemented? |
|
I updated the OP with the correct issue and corrected the messages in the rules. |
I think what we're looking for is something to autogenerate the comment at the top of this page:
Right now, these are hardcoded into the docs. |
Sorry for the delay, I somehow missed a notification for this comment. My understanding of the "Update ESLint's website generator to take into account the additional information" task mentioned in the original issue and the RFC was that we'll use the new metadata to autogenerate deprecation text on rule pages instead of hardcoding it in each rule's docs source .md file, just as @nzakas said in the comment above. |
Sorry for the delay. I added the deprecated rule notice and removed the manually added ones. |
@DMartens can you please resolve merge conflicts? |
Verify Files check is failing:
Looks like we should remove checking for deprecated info in rule docs source files. Lines 752 to 757 in 17f2aae
|
lib/eslint/eslint.js
Outdated
|
||
retv.push({ | ||
ruleId, | ||
replacedBy: usesNewFormat ? meta.deprecated.replacedBy?.map(replacement => `${replacement.plugin?.name !== void 0 ? `${replacement.plugin.name}/` : ""}${replacement.rule?.name ?? ""}`) ?? [] : meta.replacedBy || [], |
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 checked again the RFC and it's not indicated how normalizing rule names for usedDeprecatedRules
should work in the case of external rules. With this logic, the replacement rule names would look like "@stylistic/eslint-plugin-js/semi"
, but the standard notation for such a rule in a configuration object is "@stylistic/js/semi"
. Shall we use this format instead? Or something else? @eslint/eslint-tsc
The short form of the plugin prefix can be retrieved with naming.getShorthandName
like here: https://github.com/eslint/eslint/blob/e89a54a3090f3503daf5e36b02b0035c993e3fd1/lib/eslint/eslint.js#L499C25-L499C66
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 think we should use the name as it would likely appear in the config, so @stylistic/js/semi
would be my choice.
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'm also in favor of normalizing to @stylistic/js/semi
.
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.
Should the shorthand name also be used when displaying the replacement rules in the documentation?
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 don't have a strong preference, but I think it's fine to be more descriptive in the documentation. The current format "Replaced by semi
in @stylistic/eslint-plugin-js
" sounds good to me.
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.
LGTM, thanks! Leaving open for other reviews.
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Thanks for the helpful code review, all of these should be fixed now. |
* `name` (`string`)<br> | ||
The package name for `plugin` and the rule id for `rule`. | ||
* `url` (`string`)<br> | ||
An URL pointing to additional information, for example an announcement post or migration guide. |
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.
An URL pointing to additional information, for example an announcement post or migration guide. | |
An URL pointing to documentation for the plugin / rule.. |
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[x] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[x] Add something to the core
[ ] Other, please explain:
What changes did you make? (Give an overview)
This implements the additional deprecated metadata RFC and closes #18061.
The checklist from the RFC:
Internal Changes:
External Changes:
I also investigated the impact for third-party plugins.
Generally there are only a few deprecated rules and most are stylistic rules.
An overview for plugins with some deprecated rules:
jsx-*
shebang
imports-first
component-tags-order
,no-invalid-model-keys
,no-ref-object-destructure
,no-setup-props-destructure
,script-setup-uses-vars
,v-on-function-call
svelte/@typescript-eslint/no-unnecessary-condition
functional-parameters
Plugins without deprecated rules:
Is there anything you'd like reviewers to focus on?
Some notes for the changes:
DeprecateInfo
as it is part of the rule but its documentation has no type anywhere and the type documentation is required forusedDeprecatedRules
in NodeJS API Documentation. I chose to use a separate page with a short intro about the deprecated format and detailing the new format. This document could also detail future tools using the deprecated information.meta.deprecated
property for the ruleindent-legacy
is not updated as it is used for a test case inlegacy-eslint
andCLIEngine
which I assume to be frozen (but I still updated it for other frozen rules)eslint-stylistic
(e.g. rules replaced bypadding-line-between-statements
)