File tree 2 files changed +9
-6
lines changed
eslint-plugin/tests/rules/indent
experimental-utils/src/ts-eslint
2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -621,6 +621,9 @@ type Foo = string | {
621
621
( acc , testCase ) => {
622
622
const indent = ' ' ;
623
623
624
+ const validCases = [ ...acc . valid ] ;
625
+ const invalidCases = [ ...acc . invalid ] ;
626
+
624
627
const codeCases = testCase . code . map ( code =>
625
628
[
626
629
'' , // newline to make test error messages nicer
@@ -631,7 +634,7 @@ type Foo = string | {
631
634
632
635
codeCases . forEach ( code => {
633
636
// valid test case is just the code
634
- acc . valid . push ( code ) ;
637
+ validCases . push ( code ) ;
635
638
636
639
const invalid = {
637
640
// test the fixer by removing all the spaces
@@ -663,11 +666,11 @@ type Foo = string | {
663
666
) ,
664
667
} ;
665
668
if ( invalid . errors . length > 0 ) {
666
- acc . invalid . push ( invalid ) ;
669
+ invalidCases . push ( invalid ) ;
667
670
}
668
671
} ) ;
669
672
670
- return acc ;
673
+ return { ... acc , valid : validCases , invalid : invalidCases } ;
671
674
} ,
672
675
{ valid : [ ] , invalid : [ ] } ,
673
676
) ;
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ interface InvalidTestCase<
64
64
/**
65
65
* Expected errors.
66
66
*/
67
- readonly errors : TestCaseError < TMessageIds > [ ] ;
67
+ readonly errors : readonly TestCaseError < TMessageIds > [ ] ;
68
68
/**
69
69
* The expected code after autofixes are applied. If set to `null`, the test runner will assert that no autofix is suggested.
70
70
*/
@@ -114,8 +114,8 @@ interface RunTests<
114
114
TOptions extends Readonly < unknown [ ] >
115
115
> {
116
116
// RuleTester.run also accepts strings for valid cases
117
- readonly valid : ( ValidTestCase < TOptions > | string ) [ ] ;
118
- readonly invalid : InvalidTestCase < TMessageIds , TOptions > [ ] ;
117
+ readonly valid : readonly ( ValidTestCase < TOptions > | string ) [ ] ;
118
+ readonly invalid : readonly InvalidTestCase < TMessageIds , TOptions > [ ] ;
119
119
}
120
120
interface RuleTesterConfig {
121
121
// should be require.resolve(parserPackageName)
You can’t perform that action at this time.
0 commit comments