summaryrefslogtreecommitdiff
path: root/scripts/frontend/prettier.js
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/frontend/prettier.js')
-rw-r--r--scripts/frontend/prettier.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/scripts/frontend/prettier.js b/scripts/frontend/prettier.js
index 7772f80c233..f721e46f36b 100644
--- a/scripts/frontend/prettier.js
+++ b/scripts/frontend/prettier.js
@@ -7,11 +7,11 @@ const matchExtensions = ['js', 'vue', 'graphql'];
// This will improve glob performance by excluding certain directories.
// The .prettierignore file will also be respected, but after the glob has executed.
-const globIgnore = ['**/node_modules/**', 'vendor/**', 'public/**'];
+const globIgnore = ['**/node_modules/**', 'vendor/**', 'public/**', 'fixtures/**'];
const readFileAsync = (file, options) =>
new Promise((resolve, reject) => {
- fs.readFile(file, options, function(err, data) {
+ fs.readFile(file, options, function (err, data) {
if (err) reject(err);
else resolve(data);
});
@@ -19,7 +19,7 @@ const readFileAsync = (file, options) =>
const writeFileAsync = (file, data, options) =>
new Promise((resolve, reject) => {
- fs.writeFile(file, data, options, function(err) {
+ fs.writeFile(file, data, options, function (err) {
if (err) reject(err);
else resolve();
});
@@ -35,7 +35,7 @@ console.log(
`Loading all ${allFiles ? '' : 'staged '}files ${globDir ? `within ${globDir} ` : ''}...`,
);
-const globPatterns = matchExtensions.map(ext => `${globDir}**/*.${ext}`);
+const globPatterns = matchExtensions.map((ext) => `${globDir}**/*.${ext}`);
const matchedFiles = allFiles
? glob.sync(`{${globPatterns.join(',')}}`, { ignore: globIgnore })
: getStagedFiles(globPatterns);
@@ -62,7 +62,7 @@ Please format each file listed below or run "${fixCommand}"
`;
const checkFileWithOptions = (filePath, options) =>
- readFileAsync(filePath, 'utf8').then(input => {
+ readFileAsync(filePath, 'utf8').then((input) => {
if (shouldSave) {
const output = prettier.format(input, options);
if (input === output) {
@@ -92,7 +92,7 @@ const checkFileWithOptions = (filePath, options) =>
}
});
-const checkFileWithPrettierConfig = filePath =>
+const checkFileWithPrettierConfig = (filePath) =>
prettier
.getFileInfo(filePath, { ignorePath: '.prettierignore' })
.then(({ ignored, inferredParser }) => {
@@ -100,7 +100,7 @@ const checkFileWithPrettierConfig = filePath =>
ignoredCount += 1;
return;
}
- return prettier.resolveConfig(filePath).then(fileOptions => {
+ return prettier.resolveConfig(filePath).then((fileOptions) => {
const options = { ...fileOptions, parser: inferredParser };
return checkFileWithOptions(filePath, options);
});
@@ -115,7 +115,7 @@ Promise.all(matchedFiles.map(checkFileWithPrettierConfig))
if (didWarn) process.exit(1);
})
- .catch(e => {
+ .catch((e) => {
console.log(`\nAn error occurred while processing files with prettier: ${e.message}\n`);
process.exit(1);
});