@@ -57,6 +57,7 @@ describe('should pass lint without error in new projects', () => {
57
57
'with-vitest' ,
58
58
'type-checked' ,
59
59
'api-before-14.3' ,
60
+ 'custom-type-checked-rules-on-and-off' ,
60
61
] ) {
61
62
test ( projectName , async ( ) => {
62
63
const { stdout } = await runLintAgainst ( projectName )
@@ -83,6 +84,7 @@ describe('should report error on recommended rule violations in .vue files', ()
83
84
'with-vitest' ,
84
85
'type-checked' ,
85
86
'api-before-14.3' ,
87
+ 'custom-type-checked-rules-on-and-off' ,
86
88
] ) {
87
89
test ( `src/App.vue in ${ projectName } ` , async ( ) => {
88
90
const appVuePath = path . join (
@@ -210,3 +212,23 @@ test('(API before 14.3) should guide user to use camelCase names in "extends"',
210
212
expect ( failed ) . toBe ( true )
211
213
expect ( stderr ) . contain ( 'Please use "recommendedTypeChecked"' )
212
214
} )
215
+
216
+ test ( 'should allow users to turn on/off type-aware rules by just targeting `**/*.vue` files' , async ( ) => {
217
+ const appVuePath = path . join ( __dirname , '../examples/custom-type-checked-rules-on-and-off/src/App.vue' )
218
+ const { modify, restore } = setupFileMutations ( appVuePath )
219
+ modify ( ( oldContents ) => oldContents . replace ( '</script>' , `
220
+ // Should not cause lint error
221
+ export type UnionUnknown = unknown | 'foo';
222
+
223
+ const array: number[] = [];
224
+ // Should cause lint error
225
+ array.sort();
226
+ </script>` ) )
227
+
228
+ const { failed, stdout } = await runLintAgainst ( 'custom-type-checked-rules-on-and-off' )
229
+ restore ( )
230
+
231
+ expect ( failed ) . toBe ( true )
232
+ expect ( stdout ) . not . toContain ( 'no-redundant-type-constituents' )
233
+ expect ( stdout ) . toContain ( 'require-array-sort-compare' )
234
+ } )
0 commit comments