const formatFile = async (inputFilePath, outputFilePath) => { const fileContent = await readFile(inputFilePath); const prettierConfig = await prettier.resolveConfig(inputFilePath); const writtenFilePath = await writeFile( outputFilePath, prettier.format(fileContent, {...prettierConfig, filepath: inputFilePath}), ); return writtenFilePath; }
task.plugin('prettier', {}, function * (file, opts) { const out = format(file.data.toString(), opts); file.data = Buffer.from(out); });
files.forEach(file => { const { content, check, path } = file if (check) { print(chalk.grey(`INFO: lint ${path}`)) return } print(`INFO: lint ${path}`) const validContent = prettier.format(content, { filepath: path }) fs.writeFileSync(path, validContent, { flag: 'w' }) })
function cleanHtml(html) { return prettier.format(html, { parser: 'html' }); }
fn() { return payloads.map(({ payload, options }) => prettier.format(payload, options) ); }
const PackagedExternalFile = ({ obj, packagedArguments }) => { const { isTypescript } = packagedArguments; const dialect = isTypescript ? 'typescript' : 'javascript'; const wrappedObj = wrapSafely(obj); const code = { typescript: `export default ${wrappedObj}`, javascript: `module.exports = ${wrappedObj}`, }[dialect]; return prettier.format(code, { singleQuote: true, parser: 'babel', }); }
function cleanHtml(html) { return prettier.format(html, { parser: 'html' }); }
function cleanHtml(html) { return prettier.format(html, { parser: 'html' }); }
function cleanHtml(html) { return prettier.format(html, { parser: 'html' }); }
function cleanHtml(html) { return prettier.format(html, { parser: 'html' }); }
function cleanHtml(html) { return prettier.format(html, { parser: 'html' }); }
function cleanHtml(html) { return prettier.format(html, { parser: 'html' }); }
function cleanHtml(html) { return prettier.format(html, { parser: 'html' }); }
function cleanHtml(html) { return prettier.format(html, { parser: 'html' }); }
function cleanHtml(html) { return prettier.format(html, { parser: 'html' }); }