File tree 2 files changed +15
-0
lines changed 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -251,6 +251,19 @@ async function generatePrettierConfig(options: Options): Promise<void> {
251
251
return generateConfigFile ( options , './.prettierrc.js' , style ) ;
252
252
}
253
253
254
+ async function generateEditorConfig ( options : Options ) : Promise < void > {
255
+ const config = `root = true
256
+
257
+ [*]
258
+ indent_style = space
259
+ indent_size = 2
260
+ end_of_line = lf
261
+ charset = utf-8
262
+ insert_final_newline = true
263
+ ` ;
264
+ return generateConfigFile ( options , './.editorconfig' , config ) ;
265
+ }
266
+
254
267
export async function installDefaultTemplate (
255
268
options : Options
256
269
) : Promise < boolean > {
@@ -320,6 +333,7 @@ export async function init(options: Options): Promise<boolean> {
320
333
await generateESLintConfig ( options ) ;
321
334
await generateESLintIgnore ( options ) ;
322
335
await generatePrettierConfig ( options ) ;
336
+ await generateEditorConfig ( options ) ;
323
337
await installDefaultTemplate ( options ) ;
324
338
325
339
// Run `npm install` after initial setup so `npm run lint` works right away.
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ describe('🚰 kitchen sink', () => {
61
61
fs . accessSync ( path . join ( kitchenPath , '.eslintrc.json' ) ) ;
62
62
fs . accessSync ( path . join ( kitchenPath , '.eslintignore' ) ) ;
63
63
fs . accessSync ( path . join ( kitchenPath , '.prettierrc.js' ) ) ;
64
+ fs . accessSync ( path . join ( kitchenPath , '.editorconfig' ) ) ;
64
65
65
66
// Compilation shouldn't have happened. Hence no `build` directory.
66
67
const dirContents = fs . readdirSync ( kitchenPath ) ;
You can’t perform that action at this time.
0 commit comments