File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,18 @@ class Walker extends Lint.RuleWalker {
16
16
return super . visitImportDeclaration ( node ) ;
17
17
}
18
18
19
- const importClause = node . importClause . getText ( ) ;
19
+ const importClauseText = node . importClause . getText ( ) ;
20
+
21
+ if ( importClauseText . startsWith ( '{' ) && importClauseText . endsWith ( '}' ) && (
22
+ importClauseText . includes ( '{ ' ) || importClauseText . includes ( ' }' ) ) ) {
23
+
24
+ const fix = new Lint . Replacement (
25
+ node . importClause . getStart ( ) , node . importClause . getWidth ( ) ,
26
+ importClauseText . replace ( / { \s + / , '{' ) . replace ( / \s + } / , '}' )
27
+ ) ;
20
28
21
- if ( importClause . startsWith ( '{' ) && importClause . endsWith ( '}' ) && (
22
- importClause . includes ( '{ ' ) || importClause . includes ( ' }' ) ) ) {
23
29
this . addFailureAtNode ( node . importClause , 'Import clauses should not have spaces after the ' +
24
- 'opening brace or before the closing one.' ) ;
30
+ 'opening brace or before the closing one.' , fix ) ;
25
31
}
26
32
27
33
super . visitImportDeclaration ( node ) ;
You can’t perform that action at this time.
0 commit comments