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!: drop support for function-style rules and rules missing schemas #16614

Closed
wants to merge 4 commits into from

Conversation

bmish
Copy link
Sponsor Member

@bmish bmish commented Dec 5, 2022

UPDATE: this PR was replaced by:

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] 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 RFC-85 (eslint/rfcs#85) for these two scenarios:

  • Drop support for deprecated function-style rules in favor of object style rules
  • Require rules with options to specify a schema

This is targeted to be merged as a breaking change in ESLint v9. It's a follow-up to @snitin315's work to add warnings in #16063.

Notable changes:

  • Rule tester now throws instead of warns for the two scenarios
  • Core no longer normalizes function-style rules into object-style rules
  • Core throws when attempting to create a function-style rule (and added a test case for this)
  • Retrieving a schema for a rule now defaults to the “no options” schema when no schema is specified
  • Updates documentation to mention the new requirements
  • I extracted HUNDREDS of updates to test cases that were using function-style rules in refactor: migrate off deprecated function-style rules in all tests #16618
  • Throw with no-op schema schema: {}
  • Implement, document, and test schema: false opt-out feature
  • Ensure all rule examples in docs that have options also have a schema

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

Should we delete docs/developer-guide/working-with-rules-deprecated.md. Perhaps we should delete most of the content and keep a barebones doc in place to avoid breaking links.

I'm a bit unsure about the below comment from an earlier PR. Should I duplicate the tests into FlatRuleTester? Should we still be relying on asserts in rule tester at all?

Should we also duplicate these changes in FlatRuleTester?

I think it isn't necessary since we are planning eslint/rfcs#85 for ESLint v9, and FlatRuleTester will not replace RuleTester before ESLint v9. When we implement eslint/rfcs#85 in linter/config, these deprecation warnings will become errors thrown by linter/config.

@bmish bmish added the breaking This change is backwards-incompatible label Dec 5, 2022
@eslint-github-bot
Copy link

Hi @bmish!, thanks for the Pull Request

The first commit message isn't properly formatted. We ask that you update the message to match this format, as we use it to generate changelogs and automate releases.

  • The length of the commit message must be less than or equal to 72

To Fix: You can fix this problem by running git commit --amend, editing your commit message, and then running git push -f to update this pull request.

Read more about contributing to ESLint here

@netlify
Copy link

netlify bot commented Dec 5, 2022

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit 1cd2266
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/63968eb50dffab000898f928

@eslint-github-bot
Copy link

Hi @bmish!, thanks for the Pull Request

The first commit message isn't properly formatted. We ask that you update the message to match this format, as we use it to generate changelogs and automate releases.

  • The length of the commit message must be less than or equal to 72

To Fix: You can fix this problem by running git commit --amend, editing your commit message, and then running git push -f to update this pull request.

Read more about contributing to ESLint here

@bmish bmish marked this pull request as ready for review December 12, 2022 02:23
@bmish bmish requested a review from a team as a code owner December 12, 2022 02:23
@nzakas nzakas marked this pull request as draft December 26, 2022 21:13
@nzakas
Copy link
Member

nzakas commented Dec 26, 2022

I think it may be a bit too early to be filing a breaking PR when we haven't even planned ESLint v9 yet.

Switching to a draft to avoid accidental merging, but I think it may be better to close this and hold on to the changes until we are actively planning for a major release.

});

it("should not log a deprecation warning when schema is an empty array", () => {
it("should not throw an error when schema is an empty array", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like these tests could be updated to remove the use of should.

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

How else would you write it? I do want it to read like an English sentence.

@bmish
Copy link
Sponsor Member Author

bmish commented Dec 29, 2022

@nzakas "draft" status works for me as I'd love to begin receiving and responding to feedback on this. I will likely have 4 breaking change RFCs to implement for ESLint v9, so I wanted to start preparing them now so they are lined up and ready to go whenever you decide to schedule the release. My concern is that each of these PRs could take several weeks of work, and if I wait until ESLint v9 is announced, I won't have time to complete them.

@github-actions
Copy link

Hi everyone, it looks like we lost track of this pull request. Please review and see what the next steps are. This pull request will auto-close in 7 days without an update.

@github-actions github-actions bot added the Stale label Feb 14, 2023
@Rec0iL99
Copy link
Member

@bmish wants this open for feedback. Don't close.

@Rec0iL99 Rec0iL99 removed the Stale label Feb 15, 2023
@github-actions
Copy link

Hi everyone, it looks like we lost track of this pull request. Please review and see what the next steps are. This pull request will auto-close in 7 days without an update.

@github-actions github-actions bot added the Stale label Feb 25, 2023
@github-actions
Copy link

github-actions bot commented Mar 5, 2023

This pull request was auto-closed due to inactivity. While we wish we could keep working on every request, we unfortunately don't have the bandwidth to continue here and need to focus on other things. You can resubmit this pull request if you would like to continue working on it.

@github-actions github-actions bot closed this Mar 5, 2023
@bmish bmish reopened this Mar 15, 2023
@github-actions github-actions bot removed the Stale label Mar 15, 2023
@nzakas
Copy link
Member

nzakas commented Mar 23, 2023

@bmish this PR seems very out of date and hasn't been updated in a while. What do you think about closing this for now? You can always pick up the work and submit a new PR later.

@github-actions
Copy link

github-actions bot commented Apr 2, 2023

Hi everyone, it looks like we lost track of this pull request. Please review and see what the next steps are. This pull request will auto-close in 7 days without an update.

@github-actions github-actions bot added the Stale label Apr 2, 2023
@nzakas
Copy link
Member

nzakas commented Apr 5, 2023

Okay, we are just going to close this. @bmish you can feel free to resubmit when it's time.

@nzakas nzakas closed this Apr 5, 2023
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Oct 3, 2023
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Oct 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion breaking This change is backwards-incompatible feature This change adds a new feature to ESLint Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants