File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change
1
+ import ts from 'typescript' ;
2
+ import * as Lint from 'tslint' ;
3
+
4
+ /** Lint rule that doesn't allow usages of type-only imports/exports. */
5
+ export class Rule extends Lint . Rules . AbstractRule {
6
+ apply ( sourceFile : ts . SourceFile ) {
7
+ return this . applyWithFunction ( sourceFile , walker ) ;
8
+ }
9
+ }
10
+
11
+ function walker ( context : Lint . WalkContext ) : void {
12
+ ( function visitNode ( node : ts . Node ) {
13
+ if ( ts . isTypeOnlyImportOrExportDeclaration ( node ) ) {
14
+ context . addFailureAtNode ( node , 'Type-only symbols are not allowed.' ) ;
15
+ }
16
+
17
+ ts . forEachChild ( node , visitNode ) ;
18
+ } ) ( context . sourceFile ) ;
19
+ }
Original file line number Diff line number Diff line change 75
75
// Custom Rules
76
76
"ts-loader" : true ,
77
77
"no-exposed-todo" : true ,
78
+ "no-type-only-import-export" : true ,
78
79
"no-private-getters" : [true , " ^_" ],
79
80
"no-undecorated-base-class-di" : true ,
80
81
"no-undecorated-class-with-angular-features" : true ,
You can’t perform that action at this time.
0 commit comments