77// Run via:
88// node --experimental-strip-types --no-warnings packages/core/test/cache-typeaware.test.ts
99
10- import * as ts from 'typescript' ;
1110import type { Config , RuleContext } from '@tsslint/types' ;
11+ import * as ts from 'typescript' ;
1212import type { FileLintCache } from '../index.js' ;
1313
1414const core = require ( '../index.js' ) as typeof import ( '../index.js' ) ;
@@ -63,12 +63,12 @@ function makeCache(): FileLintCache {
6363 syntactic : ( ( rctx : RuleContext ) => {
6464 syntacticRan ++ ;
6565 rctx . report ( 'plain' , 0 , 1 ) ;
66- } ) as any ,
66+ } ) ,
6767 'type-aware' : ( ( rctx : RuleContext ) => {
6868 typeAwareRan ++ ;
6969 void rctx . program ; // probe trigger
7070 rctx . report ( 'typed' , 0 , 1 ) ;
71- } ) as any ,
71+ } ) ,
7272 } ,
7373 } ;
7474 const linter = core . createLinter ( ctx , '/' , config , ( ) => [ ] ) ;
@@ -96,8 +96,8 @@ function makeCache(): FileLintCache {
9696 rules : {
9797 'report-then-touch' : ( ( rctx : RuleContext ) => {
9898 rctx . report ( 'first' , 0 , 1 ) ; // populates cache[1] via report()
99- void rctx . program ; // sets touchedProgram
100- } ) as any ,
99+ void rctx . program ; // sets touchedProgram
100+ } ) ,
101101 } ,
102102 } ;
103103 const linter = core . createLinter ( ctx , '/' , config , ( ) => [ ] ) ;
@@ -126,7 +126,7 @@ function makeCache(): FileLintCache {
126126 void rctx . program ;
127127 }
128128 rctx . report ( 'hi' , 0 , 1 ) ;
129- } ) as any ,
129+ } ) ,
130130 } ,
131131 } ;
132132 const linter = core . createLinter ( ctx , '/' , config , ( ) => [ ] ) ;
@@ -144,7 +144,9 @@ function makeCache(): FileLintCache {
144144 check (
145145 '/b.ts cache entry NOT written (sticky)' ,
146146 ! cacheB [ 1 ] [ 'sometimes-typed' ] ,
147- `expected cacheB empty due to sticky type-aware classification, got ${ JSON . stringify ( cacheB [ 1 ] [ 'sometimes-typed' ] ) } ` ,
147+ `expected cacheB empty due to sticky type-aware classification, got ${
148+ JSON . stringify ( cacheB [ 1 ] [ 'sometimes-typed' ] )
149+ } `,
148150 ) ;
149151}
150152
@@ -158,7 +160,7 @@ function makeCache(): FileLintCache {
158160 ran ++ ;
159161 void rctx . program ;
160162 rctx . report ( 'typed' , 0 , 1 ) ;
161- } ) as any ,
163+ } ) ,
162164 } ,
163165 } ;
164166 const linter = core . createLinter ( ctx , '/' , config , ( ) => [ ] ) ;
@@ -176,7 +178,7 @@ function makeCache(): FileLintCache {
176178 start : 0 ,
177179 length : 1 ,
178180 source : 'tsslint' ,
179- } as ts . DiagnosticWithLocation ] ] ,
181+ } ] ] ,
180182 } ,
181183 { } ,
182184 ] ;
@@ -200,7 +202,7 @@ function makeCache(): FileLintCache {
200202 start : 0 ,
201203 length : 1 ,
202204 source : 'tsslint' ,
203- } as ts . DiagnosticWithLocation ] ] ,
205+ } ] ] ,
204206 } ,
205207 { } ,
206208 ] ;
@@ -211,7 +213,7 @@ function makeCache(): FileLintCache {
211213 ran2 ++ ;
212214 void rctx . program ;
213215 rctx . report ( 'typed' , 0 , 1 ) ;
214- } ) as any ,
216+ } ) ,
215217 } ,
216218 } ;
217219 const linter3 = core . createLinter ( ctx2 , '/' , config2 , ( ) => [ ] ) ;
0 commit comments