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: introduce new deprecated types for rules #19238

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

DMartens
Copy link
Contributor

@DMartens DMartens commented Dec 11, 2024

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:

  • Mention the new schema in the custom rule documentation
  • Add any additional information to these properties in core rules as desired (such as in Docs: Mention Stylistic as the source of replacement rules for all the stylistic rules that got deprecated #18053)
  • Update ESLint's website generator to take into account the additional information for rule doc deprecation notices
  • Update LintResult.usedDeprecatedRules by normalizing the old and new format for the existing replacedBy property and adding a new property with the name info for rules using the new deprecated format
  • Update the types in eslint

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:

Plugins without deprecated rules:

Is there anything you'd like reviewers to focus on?

Some notes for the changes:

  • I did not know where the put the documentation for DeprecateInfo as it is part of the rule but its documentation has no type anywhere and the type documentation is required for usedDeprecatedRules 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 rule indent-legacy is not updated as it is used for a test case in legacy-eslint and CLIEngine which I assume to be frozen (but I still updated it for other frozen rules)
  • the replacements only mentions the latest replacement in eslint-stylistic (e.g. rules replaced by padding-line-between-statements)
  • implicit tests for rule.meta.deprecated were left untouched as objects are truthy (e.g. in rule.macro.html).
  • Did not update rule_meta.json and cannot find which file generates it but deploying the website works even though the replacement info is not autogenerated

@DMartens DMartens requested a review from a team as a code owner December 11, 2024 21:12
@eslint-github-bot eslint-github-bot bot added the feature This change adds a new feature to ESLint label Dec 11, 2024
@github-actions github-actions bot added rule Relates to ESLint's core rules cli Relates to ESLint's command-line interface core Relates to ESLint's core APIs and features labels Dec 11, 2024
Copy link

netlify bot commented Dec 11, 2024

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit cb8202e
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/6765de4466ad16000831a59a

@DMartens DMartens changed the title feat: introduce new deprecated types feat: introduce new deprecated types for rules Dec 11, 2024
@mdjermanovic mdjermanovic added the accepted There is consensus among the team that this change meets the criteria for inclusion label Dec 19, 2024
lib/rules/array-bracket-newline.js Outdated Show resolved Hide resolved
lib/rules/array-bracket-newline.js Outdated Show resolved Hide resolved
@mdjermanovic
Copy link
Member

  • Update ESLint's website generator to take into account the additional information for rule doc deprecation notices

It doesn't seem that this is implemented?

@mdjermanovic
Copy link
Member

This implements the additional deprecated metadata RFC and closes #18053.

I think this closes #18061 but not #18053.

@DMartens
Copy link
Contributor Author

I updated the OP with the correct issue and corrected the messages in the rules.
Regarding the ESLint website update:
As noted in the notes I did not need to update the website code to keep working (it looks the same as without the changes).
Which additional details should be shown on the rule pages?

@aladdin-add aladdin-add self-requested a review December 24, 2024 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion cli Relates to ESLint's command-line interface core Relates to ESLint's core APIs and features feature This change adds a new feature to ESLint rule Relates to ESLint's core rules
Projects
Status: Implementing
Development

Successfully merging this pull request may close these issues.

Change Request: Support additional rule metadata for deprecations
2 participants