Skip to content

Enhancement(rule-tester): FlatRuleTester -> RuleTester #9017

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

Closed
4 tasks done
JoshuaKGoldberg opened this issue Apr 28, 2024 · 5 comments
Closed
4 tasks done

Enhancement(rule-tester): FlatRuleTester -> RuleTester #9017

JoshuaKGoldberg opened this issue Apr 28, 2024 · 5 comments
Assignees
Labels
breaking change This change will require a new major version to be released enhancement New feature or request locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. package: rule-tester Issues related to the @typescript-eslint/rule-tester package team assigned A member of the typescript-eslint team should work on this.
Milestone

Comments

@JoshuaKGoldberg
Copy link
Member

Before You File a Proposal Please Confirm You Have Done The Following...

Relevant Package

rule-tester

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Description

Splitting out of #8211 -> #8969: this issue tracks any updates we'll need corresponding to eslint/eslint#17922.

Additional Info

No response

@JoshuaKGoldberg JoshuaKGoldberg added enhancement New feature or request triage Waiting for team members to take a look package: rule-tester Issues related to the @typescript-eslint/rule-tester package labels Apr 28, 2024
@JoshuaKGoldberg JoshuaKGoldberg added this to the 8.0.0 milestone Apr 28, 2024
@JoshuaKGoldberg JoshuaKGoldberg changed the title Enhancement: FlatRuleTester -> RuleTester Enhancement(rule-tester): FlatRuleTester -> RuleTester Apr 28, 2024
@JoshuaKGoldberg JoshuaKGoldberg mentioned this issue Apr 28, 2024
42 tasks
@JoshuaKGoldberg JoshuaKGoldberg added accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for team members to take a look labels May 14, 2024
@favna
Copy link

favna commented May 28, 2024

Hi, I have a question about this issue. Is there any current way without the changes that will be made for this issue to test a flat config custom typescript-eslint rule? At the moment when using RuleTester from @typescript-eslint/rule-tester v7.11.0 I get the error:

FAIL  tests/rules/no-discard-result.test.ts [ tests/rules/no-discard-result.test.ts ]
Error: This method cannot be used with flat config. Add your entries directly into the config array.
 ❯ assertEslintrcConfig ../../node_modules/eslint/lib/linter/linter.js:1256:15
 ❯ Linter.defineRule ../../node_modules/eslint/lib/linter/linter.js:2164:9
 ❯ RuleTester.run ../../node_modules/@typescript-eslint/rule-tester/src/RuleTester.ts:400:18
 ❯ tests/rules/no-discard-result.test.ts:15:13
     13| 
     14| describe('ESLint plugin result', () => {
     15|  ruleTester.run('no-discard-result', noDiscardResult, {
       |             ^
     16|   valid: [
     17|    {

This is for https://github.com/sapphiredev/utilities/blob/feat/update-to-eslint-v9-flat-config/packages/eslint-plugin-result/tests/rules/no-discard-result.test.ts

@bradzacher
Copy link
Member

Nope! The way they designed the rule tester it is one or the other. Hence there is two rule tester classes. Our fork came from the legacy config version (before flat config existed) so it doesn't support flat config properties.

But regardless - the only difference is a few property names. The functionality is all the same.

@favna
Copy link

favna commented May 29, 2024

Turns out if I update to the v8 rc then my tests work again so I'll just patiently wait for the typescript-eslint team to finish their work. Looking forward to it, keep up the awesome work!

@azat-io
Copy link
Contributor

azat-io commented Jul 16, 2024

The same problem:

Error: This method cannot be used with flat config. Add your entries directly into the config array.

@JoshuaKGoldberg JoshuaKGoldberg self-assigned this Jul 21, 2024
@JoshuaKGoldberg JoshuaKGoldberg added team assigned A member of the typescript-eslint team should work on this. and removed accepting prs Go ahead, send a pull request that resolves this issue labels Jul 21, 2024
@JoshuaKGoldberg JoshuaKGoldberg added the breaking change This change will require a new major version to be released label Jul 22, 2024
Copy link

Closed by #9603.

@github-actions github-actions bot added the locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. label Aug 2, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking change This change will require a new major version to be released enhancement New feature or request locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. package: rule-tester Issues related to the @typescript-eslint/rule-tester package team assigned A member of the typescript-eslint team should work on this.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy