summaryrefslogtreecommitdiff
path: root/scripts/frontend
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2018-03-23 11:52:54 -0500
committerMike Greiling <mike@pixelcog.com>2018-03-23 11:52:54 -0500
commit9238c5d5ca22d2fddc0c78a34dc063c8d3abb79e (patch)
tree7c5a778a16f85d855c899c582d27497e05478812 /scripts/frontend
parent5b6931b8e70dbd1c67233cb5f64a553e3ce7e465 (diff)
downloadgitlab-ce-9238c5d5ca22d2fddc0c78a34dc063c8d3abb79e.tar.gz
prettify all node scripts
Diffstat (limited to 'scripts/frontend')
-rw-r--r--scripts/frontend/frontend_script_utils.js7
-rw-r--r--scripts/frontend/prettier.js17
2 files changed, 6 insertions, 18 deletions
diff --git a/scripts/frontend/frontend_script_utils.js b/scripts/frontend/frontend_script_utils.js
index 2c06747255c..bbc1203262d 100644
--- a/scripts/frontend/frontend_script_utils.js
+++ b/scripts/frontend/frontend_script_utils.js
@@ -18,12 +18,7 @@ const execGitCmd = args =>
module.exports = {
getStagedFiles: fileExtensionFilter => {
- const gitOptions = [
- 'diff',
- '--name-only',
- '--cached',
- '--diff-filter=ACMRTUB',
- ];
+ const gitOptions = ['diff', '--name-only', '--cached', '--diff-filter=ACMRTUB'];
if (fileExtensionFilter) gitOptions.push(...fileExtensionFilter);
return execGitCmd(gitOptions);
},
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;
}