Enhancement(rule-tester): FlatRuleTester -> RuleTester
JoshuaKGoldberg opened this issue · comments
Before You File a Proposal Please Confirm You Have Done The Following...
- I have searched for related issues and found none that match my proposal.
- I have searched the current rule list and found no rules that match my proposal.
- I have read the FAQ and my problem is not listed.
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
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| {
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.
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!