File tree 1 file changed +4
-2
lines changed
packages/schematics/angular/utility
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 9
9
import { tags } from '@angular-devkit/core' ;
10
10
import * as ts from '../third_party/github.com/Microsoft/TypeScript/lib/typescript' ;
11
11
import { Change , InsertChange , NoopChange } from './change' ;
12
+ import { getEOL } from './eol' ;
12
13
13
14
/**
14
15
* Add Import `import { symbolName } from fileName` if the import doesn't exit
@@ -73,12 +74,13 @@ export function insertImport(
73
74
}
74
75
const open = isDefault ? '' : '{ ' ;
75
76
const close = isDefault ? '' : ' }' ;
77
+ const eol = getEOL ( rootNode . getText ( ) ) ;
76
78
// if there are no imports or 'use strict' statement, insert import at beginning of file
77
79
const insertAtBeginning = allImports . length === 0 && useStrict . length === 0 ;
78
- const separator = insertAtBeginning ? '' : ';\n' ;
80
+ const separator = insertAtBeginning ? '' : `; ${ eol } ` ;
79
81
const toInsert =
80
82
`${ separator } import ${ open } ${ importExpression } ${ close } ` +
81
- ` from '${ fileName } '${ insertAtBeginning ? ';\n' : '' } ` ;
83
+ ` from '${ fileName } '${ insertAtBeginning ? `; ${ eol } ` : '' } ` ;
82
84
83
85
return insertAfterLastOccurrence (
84
86
allImports ,
You can’t perform that action at this time.
0 commit comments