How to use the check function from prettier
Find comprehensive JavaScript prettier.check code examples handpicked from public code repositorys.
GitHub: lenolee16/mock
29 30 31 32 33 34 35 36 37 38
const input = fs.readFileSync(file, 'utf8'); const withParserOptions = { ...options, parser: fileInfo.inferredParser, }; const isPrettier = prettier.check(input, withParserOptions); if (!isPrettier) { console.log( `\x1b[31m ${file} is no prettier, please use npm run prettier and git add !\x1b[0m` );
1
2
0
prettier.format is the most popular function in prettier (372 examples)