11import * as ts from "typescript" ;
2- import formatter from "./formatter" ;
2+ import { format } from "./formatter" ;
33import { createDefaultFormatCodeSettings , parseJSON } from "./utils" ;
44
55export { parseJSON } ;
66
77import * as fs from "fs" ;
88import * as path from "path" ;
99
10- import base from "./provider/base" ;
11- import tsconfigjson from "./provider/tsconfigjson" ;
12- import editorconfig , { postProcess as editorconfigPostProcess } from "./provider/editorconfig" ;
13- import tslintjson , { postProcess as tslintPostProcess } from "./provider/tslintjson" ;
14- import vscodesettings from "./provider/vscodesettings" ;
10+ import * as base from "./provider/base" ;
11+ import * as tsconfigjson from "./provider/tsconfigjson" ;
12+ import * as editorconfig from "./provider/editorconfig" ;
13+ import * as tslintjson from "./provider/tslintjson" ;
14+ import * as vscodesettings from "./provider/vscodesettings" ;
1515
1616const packageJson = JSON . parse ( fs . readFileSync ( path . join ( __dirname , "../package.json" ) ) . toString ( ) ) ;
1717export const version = packageJson . version ;
@@ -144,21 +144,21 @@ export function processString(fileName: string, content: string, opts: Options):
144144
145145 let processor = new Processor ( ) ;
146146 if ( opts . tsfmt ) {
147- processor . addOptionModify ( base ) ;
147+ processor . addOptionModify ( base . makeFormatCodeOptions ) ;
148148 }
149149 if ( opts . tsconfig ) {
150- processor . addOptionModify ( tsconfigjson ) ;
150+ processor . addOptionModify ( tsconfigjson . makeFormatCodeOptions ) ;
151151 }
152152 if ( opts . editorconfig ) {
153- processor . addOptionModify ( editorconfig ) ;
154- processor . addPostProcess ( editorconfigPostProcess ) ;
153+ processor . addOptionModify ( editorconfig . makeFormatCodeOptions ) ;
154+ processor . addPostProcess ( editorconfig . postProcess ) ;
155155 }
156156 if ( opts . tslint ) {
157- processor . addOptionModify ( tslintjson ) ;
158- processor . addPostProcess ( tslintPostProcess ) ;
157+ processor . addOptionModify ( tslintjson . makeFormatCodeOptions ) ;
158+ processor . addPostProcess ( tslintjson . postProcess ) ;
159159 }
160160 if ( opts . vscode ) {
161- processor . addOptionModify ( vscodesettings ) ;
161+ processor . addOptionModify ( vscodesettings . makeFormatCodeOptions ) ;
162162 }
163163 processor . addPostProcess ( ( _fileName : string , formattedCode : string , _opts : Options , formatSettings : ts . FormatCodeSettings ) => {
164164 // replace newline code. maybe NewLineCharacter params affect to only "new" newline by language service.
@@ -169,7 +169,7 @@ export function processString(fileName: string, content: string, opts: Options):
169169 let formatSettings = createDefaultFormatCodeSettings ( ) ;
170170 return processor . processFormatCodeOptions ( fileName , opts , formatSettings )
171171 . then ( formatSettings => {
172- let formattedCode = formatter ( fileName , content , formatSettings ) ;
172+ let formattedCode = format ( fileName , content , formatSettings ) ;
173173
174174 // apply post process logic
175175 return processor . postProcess ( fileName , formattedCode , opts , formatSettings ) ;
0 commit comments