diff options
Diffstat (limited to 'scripts/frontend/prettier.js')
-rw-r--r-- | scripts/frontend/prettier.js | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/scripts/frontend/prettier.js b/scripts/frontend/prettier.js index 863572bf64d..94506eed619 100644 --- a/scripts/frontend/prettier.js +++ b/scripts/frontend/prettier.js @@ -22,9 +22,7 @@ const availableExtensions = Object.keys(config.parsers); console.log(`Loading ${allFiles ? 'All' : 'Staged'} Files ...`); -const stagedFiles = allFiles - ? null - : getStagedFiles(availableExtensions.map(ext => `*.${ext}`)); +const stagedFiles = allFiles ? null : getStagedFiles(availableExtensions.map(ext => `*.${ext}`)); if (stagedFiles) { if (!stagedFiles.length || (stagedFiles.length === 1 && !stagedFiles[0])) { @@ -41,15 +39,10 @@ let files; if (allFiles) { const ignore = config.ignore; const patterns = config.patterns; - const globPattern = - patterns.length > 1 ? `{${patterns.join(',')}}` : `${patterns.join(',')}`; - files = glob - .sync(globPattern, { ignore }) - .filter(f => allFiles || stagedFiles.includes(f)); + const globPattern = patterns.length > 1 ? `{${patterns.join(',')}}` : `${patterns.join(',')}`; + files = glob.sync(globPattern, { ignore }).filter(f => allFiles || stagedFiles.includes(f)); } else { - files = stagedFiles.filter(f => - availableExtensions.includes(f.split('.').pop()), - ); + files = stagedFiles.filter(f => availableExtensions.includes(f.split('.').pop())); } if (!files.length) { @@ -81,7 +74,7 @@ prettier } else if (!prettier.check(input, options)) { if (!didWarn) { console.log( - '\n===============================\nGitLab uses Prettier to format all JavaScript code.\nPlease format each file listed below or run "yarn prettier-staged-save"\n===============================\n', + '\n===============================\nGitLab uses Prettier to format all JavaScript code.\nPlease format each file listed below or run "yarn prettier-staged-save"\n===============================\n' ); didWarn = true; } |