@@ -26,25 +26,25 @@ program
26
26
if ( ! globPattern ) {
27
27
throw new Error ( 'You must provide a file name or glob pattern to transform' ) ;
28
28
}
29
+ const prettierOptions : prettier . Options = {
30
+ arrowParens : program . arrowParens ,
31
+ bracketSpacing : ! program . noBracketSpacing ,
32
+ jsxBracketSameLine : ! ! program . jsxBracketSameLine ,
33
+ printWidth : parseInt ( program . printWidth , 10 ) ,
34
+ proseWrap : program . proseWrap ,
35
+ semi : ! program . noSemi ,
36
+ singleQuote : ! ! program . singleQuote ,
37
+ tabWidth : parseInt ( program . tabWidth , 10 ) ,
38
+ trailingComma : program . trailingComma ,
39
+ useTabs : ! ! program . useTabs ,
40
+ } ;
29
41
const files = glob . sync ( globPattern , { } ) ;
30
42
for ( const file of files ) {
31
43
const filePath = path . resolve ( file ) ;
32
44
const newPath = filePath . replace ( / \. j s x ? $ / , '.tsx' ) ;
33
45
34
46
try {
35
47
fs . renameSync ( filePath , newPath ) ;
36
- const prettierOptions : prettier . Options = {
37
- arrowParens : program . arrowParens ,
38
- bracketSpacing : ! program . noBracketSpacing ,
39
- jsxBracketSameLine : ! ! program . jsxBracketSameLine ,
40
- printWidth : parseInt ( program . printWidth , 10 ) ,
41
- proseWrap : program . proseWrap ,
42
- semi : ! program . noSemi ,
43
- singleQuote : ! ! program . singleQuote ,
44
- tabWidth : parseInt ( program . tabWidth , 10 ) ,
45
- trailingComma : program . trailingComma ,
46
- useTabs : ! ! program . useTabs ,
47
- } ;
48
48
const result = run ( newPath , prettierOptions ) ;
49
49
fs . writeFileSync ( newPath , result ) ;
50
50
} catch ( error ) {
0 commit comments