Skip to content
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: additional rule metadata for deprecations #124

Merged
merged 10 commits into from
Nov 12, 2024

Conversation

DMartens
Copy link
Contributor

Summary

This is a continuation of #116 by @bmish to specify additional properties for rule deprecations.
The main changes are:

  • move all properties under meta.deprecated and deprecate meta.replacedBy
  • "shorthands" for properties
  • additional properties: kind, deprecatedSince, availableUntil
  • more open questions

Related Issues

@nzakas nzakas added the Initial Commenting This RFC is in the initial feedback stage label Sep 13, 2024
Comment on lines 237 to 238
5. Which "extension points" (rules, processors, configurations, parsers, formatters) shold be supported?
6. Should the `rule` key be dependent on the "extension point" (e.g. `processor` for processors) or renamed (e.g. ``) so that it is the same property name for all?
Copy link
Member

Choose a reason for hiding this comment

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

I think the scope of this RFC is just rules deprecations. But if we are already anticipating that other extension points (processors, configurations, parsers, formatters) will have deprecation info, with the same shape, then a more generic name like replacement might have sense, so that it's the same property name for all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do not know of examples for other extension points being deprecated but especially with the introduction of language plugins, I can see some processors being deprecated (e.g. eslint-plugin-markdown).

designs/2024-deprecated-rule-metadata/README.md Outdated Show resolved Hide resolved
designs/2024-deprecated-rule-metadata/README.md Outdated Show resolved Hide resolved
designs/2024-deprecated-rule-metadata/README.md Outdated Show resolved Hide resolved
designs/2024-deprecated-rule-metadata/README.md Outdated Show resolved Hide resolved
designs/2024-deprecated-rule-metadata/README.md Outdated Show resolved Hide resolved
designs/2024-deprecated-rule-metadata/README.md Outdated Show resolved Hide resolved
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
- Ensure these properties are allowed on configurations, parsers and processors
- Add any additional information to these properties in core rules as desired (such as in <https://github.com/eslint/eslint/issues/18053>)
- Update ESLint's website generator to take into account the additional information for rule doc deprecation notices
- Update [LintResult.usedDeprecatedRules](https://github.com/eslint/eslint/blob/0f5df509a4bc00cff2c62b90fab184bdf0231322/lib/eslint/eslint.js#L197-L211)
Copy link
Member

Choose a reason for hiding this comment

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

Can you add more details about this change? Shall we keep the existing replacedBy: string[] property and/or add a new one with the DeprecatedInfo object?

Copy link
Member

Choose a reason for hiding this comment

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

I think that removing or changing the format of DeprecatedRuleInfo.replacedBy could break existing tools like custom formatters. Maybe it would be better to expose the RuleMeta.deprecated object as a new property of DeprecatedRuleInfo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should normalize the old and new format for replacedBy and provide the new data if available under a new property named info as this backwards-compatible.

Copy link
Member

Choose a reason for hiding this comment

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

I think we should normalize the old and new format for replacedBy and provide the new data if available under a new property named info as this backwards-compatible.

Sounds good to me.

- Ensure these properties are allowed on configurations, parsers and processors
- Add any additional information to these properties in core rules as desired (such as in <https://github.com/eslint/eslint/issues/18053>)
- Update ESLint's website generator to take into account the additional information for rule doc deprecation notices
- Update [LintResult.usedDeprecatedRules](https://github.com/eslint/eslint/blob/0f5df509a4bc00cff2c62b90fab184bdf0231322/lib/eslint/eslint.js#L197-L211)
Copy link
Member

Choose a reason for hiding this comment

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

I think that removing or changing the format of DeprecatedRuleInfo.replacedBy could break existing tools like custom formatters. Maybe it would be better to expose the RuleMeta.deprecated object as a new property of DeprecatedRuleInfo?

designs/2024-deprecated-rule-metadata/README.md Outdated Show resolved Hide resolved
@nzakas
Copy link
Member

nzakas commented Oct 24, 2024

@DMartens there's a bunch of feedback here. Are you still working on this?

@DMartens
Copy link
Contributor Author

Sorry for dropping the ball on this.
I have incorporated the following suggestions:

  • Rename introduced main type
  • Removed replacement kind
  • Make info property (message, url) root properties in DeprecatedInfo and ReplacedInfo
  • Remove syntax error in example
  • Add answer for FAQ question 2
  • Add note about version format
  • Reference internal ESLint types instead of DefinitelyTyped
  • Mention plugin developers can extend the types
  • Detailed the changes to usedDeprecatedRules

I am still committed to finishing this proposal.

Copy link
Member

@mdjermanovic mdjermanovic 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 few small suggestions, then LGTM.

designs/2024-deprecated-rule-metadata/README.md Outdated Show resolved Hide resolved
designs/2024-deprecated-rule-metadata/README.md Outdated Show resolved Hide resolved
Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks!

Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

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

LGTM. Moving to final commenting.

@nzakas nzakas added Final Commenting This RFC is in the final week of commenting and removed Initial Commenting This RFC is in the initial feedback stage labels Nov 4, 2024
Copy link
Member

@fasttime fasttime left a comment

Choose a reason for hiding this comment

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

LGTM.

@nzakas
Copy link
Member

nzakas commented Nov 12, 2024

Final commenting period has ended, so merging.

@DMartens feel free to open an implementation PR when ready.

@nzakas nzakas merged commit 8265809 into eslint:main Nov 12, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Final Commenting This RFC is in the final week of commenting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants