summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2018-06-14 20:03:14 +0200
committerLukas Eipert <leipert@gitlab.com>2018-06-15 12:43:04 +0200
commite04dfff85805f9282b8edbb25e6f61c8dbee8366 (patch)
tree59cc370ccfb0a6f8172f1e645904cd60e3be2047
parent930baeb92af0dbd97931f8308dec6664819863dc (diff)
downloadgitlab-ce-44771-prettier-seems-to-ignore-the-overrides-2.tar.gz
Fixed the searching on the whole disk :-P44771-prettier-seems-to-ignore-the-overrides-2
-rw-r--r--scripts/frontend/prettier.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/frontend/prettier.js b/scripts/frontend/prettier.js
index 8304edcecec..6e4e36b9b2d 100644
--- a/scripts/frontend/prettier.js
+++ b/scripts/frontend/prettier.js
@@ -10,7 +10,7 @@ const mode = process.argv[2] || 'check';
const shouldSave = mode === 'save' || mode === 'save-all';
const allFiles = mode === 'check-all' || mode === 'save-all';
let dirPath = process.argv[3] || '';
-if (dirPath.charAt(dirPath.length-1) !== '/') dirPath += '/';
+if (dirPath && dirPath.charAt(dirPath.length - 1) !== '/') dirPath += '/';
const config = {
patterns: ['**/*.js', '**/*.vue', '**/*.scss'],
@@ -43,7 +43,8 @@ const availableExtensions = Object.keys(config.parsers);
console.log(`Loading ${allFiles ? 'All' : 'Selected'} Files ...`);
-const stagedFiles = allFiles || dirPath ? null : getStagedFiles(availableExtensions.map(ext => `*.${ext}`));
+const stagedFiles =
+ allFiles || dirPath ? null : getStagedFiles(availableExtensions.map(ext => `*.${ext}`));
if (stagedFiles) {
if (!stagedFiles.length || (stagedFiles.length === 1 && !stagedFiles[0])) {
@@ -64,7 +65,9 @@ if (allFiles) {
files = glob.sync(globPattern, { ignore }).filter(f => allFiles || stagedFiles.includes(f));
} else if (dirPath) {
const ignore = config.ignore;
- const patterns = config.patterns.map((item) => {return dirPath + item;});
+ const patterns = config.patterns.map(item => {
+ return dirPath + item;
+ });
const globPattern = patterns.length > 1 ? `{${patterns.join(',')}}` : `${patterns.join(',')}`;
files = glob.sync(globPattern, { ignore });
} else {