File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
crates/oxc_linter/src/rules/typescript Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -255,7 +255,10 @@ impl Rule for NoRestrictedTypes {
255255 }
256256
257257 fn should_run ( & self , ctx : & ContextHost ) -> bool {
258- ctx. source_type ( ) . is_typescript ( )
258+ if !ctx. source_type ( ) . is_typescript ( ) || self . 0 . types . is_empty ( ) {
259+ return false ;
260+ }
261+ true
259262 }
260263}
261264
@@ -330,6 +333,7 @@ fn test() {
330333 ( "let e: namespace.Object;" , Some ( serde_json:: json!( [ { "types" : { "Object" : true } } ] ) ) ) ,
331334 ( "let value: _.NS.Banned;" , Some ( serde_json:: json!( [ { "types" : { "NS.Banned" : true } } ] ) ) ) ,
332335 ( "let value: NS.Banned._;" , Some ( serde_json:: json!( [ { "types" : { "NS.Banned" : true } } ] ) ) ) ,
336+ ( "let f: any = true" , Some ( serde_json:: json!( [ { "types" : { } } ] ) ) ) ,
333337 ] ;
334338
335339 let fail = vec ! [
You can’t perform that action at this time.
0 commit comments