Make babel-standalone an ESModule and enable flow (#9025)
* Make babel-standalone an ESModule and enable flow * autogenerate plugin list * Make config an array
This commit is contained in:
11
scripts/utils/formatCode.js
Normal file
11
scripts/utils/formatCode.js
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
const prettier = require("prettier");
|
||||
|
||||
module.exports = function formatCode(code, filename) {
|
||||
filename = filename || __filename;
|
||||
const prettierConfig = prettier.resolveConfig.sync(filename);
|
||||
prettierConfig.filepath = filename;
|
||||
prettierConfig.parser = "babel";
|
||||
|
||||
return prettier.format(code, prettierConfig);
|
||||
};
|
||||
Reference in New Issue
Block a user