eslint icon indicating copy to clipboard operation
eslint copied to clipboard

feat: ability to test rule errors and invalid schemas

Open bmish opened this issue 3 years ago • 11 comments

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)

Implements this RFC:

  • https://github.com/eslint/rfcs/pull/103

Fixes #13434.

TODO:

  • [x] Wait for RFC approval
  • [x] Copy changes to flat-rule-tester.js
  • [x] Add rule tester tests
  • [x] More documentation
  • [ ] Add tests for fatal error when empty schema that's invalid, present schema that has one validation error, and present schema that has multiple validation errors (https://github.com/eslint/eslint/pull/17356)

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

bmish avatar Jan 25 '23 00:01 bmish

Deploy Preview for docs-eslint canceled.

Name Link
Latest commit 2b39ad336b6bd34ba6b1dab4b702f0ed68b1fa5c
Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/64bf1aa78cd5c20008cb3540

netlify[bot] avatar Jan 25 '23 00:01 netlify[bot]

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[bot] avatar Feb 12 '23 22:02 github-actions[bot]

WIP. The implementation proposal was approved recently. Don't close

Rec0iL99 avatar Feb 13 '23 05:02 Rec0iL99

This is ready for review.

bmish avatar May 22 '23 02:05 bmish

Marking as accepted, as this implements a merged RFC.

fasttime avatar Jun 16 '23 06:06 fasttime

@bmish can you circle back around to finish this up based on @mdjermanovic's feedback?

nzakas avatar Jul 14 '23 15:07 nzakas

@mdjermanovic this one is ready for you to look over again

nzakas avatar Jul 28 '23 15:07 nzakas

In #17475 we have changed the logic in RuleTester and FlatRuleTester to avoid creating empty suites for valid or invalid tests. In other words, describe will be only called if there are any its to call inside of it.

I was thinking that the same change should be applied to fatal tests: describe("fatal", ... should be only called if any fatal tests were specified.

fasttime avatar Aug 20 '23 20:08 fasttime

@bmish what's the status on this? Looks like it hasn't been updated in a while. Are you looking to get this into v9?

nzakas avatar Jan 17 '24 18:01 nzakas

@nzakas this isn't a breaking change so I don't think it needs to be included in the initial version of ESLint v9. Will aim to get it into a later version.

bmish avatar Jan 17 '24 18:01 bmish

Sounds good. I'll take it off my radar for now.

nzakas avatar Jan 17 '24 20:01 nzakas

@bmish what are your thoughts on this? There are a lot of conflicts now. Should we just close this?

nzakas avatar Jul 08 '24 19:07 nzakas

I'll close this for now since there are a number of issues to resolve still. Anyone else is welcome to take it over.

bmish avatar Jul 09 '24 15:07 bmish