diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-24 00:10:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-24 00:10:24 +0300 |
commit | 5838993b5f3e2d861d9dd7c82dfeea71506b9fc2 (patch) | |
tree | caab6621fb79f06a355f802dc885982f746b544d /scripts/frontend | |
parent | b8d021cb606ac86f41a0ef9dacd133a9677f8414 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts/frontend')
-rw-r--r-- | scripts/frontend/block_dependencies.js | 4 | ||||
-rwxr-xr-x | scripts/frontend/check_page_bundle_mixins_css_for_sideeffects.js | 2 | ||||
-rw-r--r-- | scripts/frontend/extract_gettext_all.js | 2 | ||||
-rwxr-xr-x | scripts/frontend/file_test_coverage.js | 16 | ||||
-rw-r--r-- | scripts/frontend/frontend_script_utils.js | 4 | ||||
-rw-r--r-- | scripts/frontend/merge_coverage_frontend.js | 8 | ||||
-rw-r--r-- | scripts/frontend/prettier.js | 10 | ||||
-rw-r--r-- | scripts/frontend/stylelint/stylelint-utility-map.js | 2 | ||||
-rw-r--r-- | scripts/frontend/stylelint/stylelint-utils.js | 2 |
9 files changed, 25 insertions, 25 deletions
diff --git a/scripts/frontend/block_dependencies.js b/scripts/frontend/block_dependencies.js index c9257c9f72b..a1ff8d5ee36 100644 --- a/scripts/frontend/block_dependencies.js +++ b/scripts/frontend/block_dependencies.js @@ -5,13 +5,13 @@ const dependencies = packageJson.dependencies; const devDependencies = packageJson.devDependencies; const blockedDependenciesNames = Object.keys(blockedDependencies); const blockedDependenciesFound = blockedDependenciesNames.filter( - blockedDependency => dependencies[blockedDependency] || devDependencies[blockedDependency], + (blockedDependency) => dependencies[blockedDependency] || devDependencies[blockedDependency], ); if (blockedDependenciesFound.length) { console.log('The following package.json dependencies are not allowed:'); - blockedDependenciesFound.forEach(blockedDependency => { + blockedDependenciesFound.forEach((blockedDependency) => { const infoLink = blockedDependencies[blockedDependency]; console.log(`- ${blockedDependency}: See ${infoLink} for more information.`); diff --git a/scripts/frontend/check_page_bundle_mixins_css_for_sideeffects.js b/scripts/frontend/check_page_bundle_mixins_css_for_sideeffects.js index a2bb9f56d84..34e939e3ceb 100755 --- a/scripts/frontend/check_page_bundle_mixins_css_for_sideeffects.js +++ b/scripts/frontend/check_page_bundle_mixins_css_for_sideeffects.js @@ -27,7 +27,7 @@ const file = fs.readFileSync(paths[0], 'utf-8'); const parsed = pjs.parse(file); -if (parsed.nodes.every(node => ['comment', 'atrule'].includes(node.type))) { +if (parsed.nodes.every((node) => ['comment', 'atrule'].includes(node.type))) { console.log('The file does not introduce any side effects, we are all good.'); process.exit(0); } diff --git a/scripts/frontend/extract_gettext_all.js b/scripts/frontend/extract_gettext_all.js index 725522a3540..c34c9a0233d 100644 --- a/scripts/frontend/extract_gettext_all.js +++ b/scripts/frontend/extract_gettext_all.js @@ -45,7 +45,7 @@ function printJson() { text += `\u0000${message.textPlural}`; } - message.references.forEach(reference => { + message.references.forEach((reference) => { const filename = reference.replace(/:\d+$/, ''); if (!Array.isArray(result[filename])) { diff --git a/scripts/frontend/file_test_coverage.js b/scripts/frontend/file_test_coverage.js index 7d1eb45d4bc..ec6ec4a1e9d 100755 --- a/scripts/frontend/file_test_coverage.js +++ b/scripts/frontend/file_test_coverage.js @@ -17,11 +17,11 @@ const sourceDirectories = ['app/assets/javascripts']; const testDirectories = ['spec/javascripts', 'spec/frontend']; if (fs.existsSync('ee')) { - sourceDirectories.forEach(dir => { + sourceDirectories.forEach((dir) => { sourceDirectories.push(`ee/${dir}`); }); - testDirectories.forEach(dir => { + testDirectories.forEach((dir) => { testDirectories.push(`ee/${dir}`); }); } @@ -29,10 +29,10 @@ if (fs.existsSync('ee')) { let numSourceFiles = 0; let numTestFiles = 0; -const isVerbose = process.argv.some(arg => arg === '-v'); +const isVerbose = process.argv.some((arg) => arg === '-v'); -const countSourceFiles = path => - forEachFileIn(path, fileName => { +const countSourceFiles = (path) => + forEachFileIn(path, (fileName) => { if (fileName.endsWith('.vue') || fileName.endsWith('.js')) { if (isVerbose) { console.log(`source file: ${fileName}`); @@ -42,8 +42,8 @@ const countSourceFiles = path => } }); -const countTestFiles = path => - forEachFileIn(path, fileName => { +const countTestFiles = (path) => + forEachFileIn(path, (fileName) => { if (fileName.endsWith('_spec.js')) { if (isVerbose) { console.log(`test file: ${fileName}`); @@ -63,7 +63,7 @@ function forEachFileIn(dirPath, callback) { return; } - files.forEach(fileName => { + files.forEach((fileName) => { const absolutePath = path.join(dirPath, fileName); const stats = fs.statSync(absolutePath); if (stats.isFile()) { diff --git a/scripts/frontend/frontend_script_utils.js b/scripts/frontend/frontend_script_utils.js index 5614737d278..43016dce6a4 100644 --- a/scripts/frontend/frontend_script_utils.js +++ b/scripts/frontend/frontend_script_utils.js @@ -9,10 +9,10 @@ const exec = (command, args) => { return execFileSync(command, args, options); }; -const execGitCmd = args => exec('git', args).trim().toString().split('\n').filter(Boolean); +const execGitCmd = (args) => exec('git', args).trim().toString().split('\n').filter(Boolean); module.exports = { - getStagedFiles: fileExtensionFilter => { + getStagedFiles: (fileExtensionFilter) => { const gitOptions = ['diff', '--name-only', '--cached', '--diff-filter=ACMRTUB']; if (fileExtensionFilter) gitOptions.push(...fileExtensionFilter); return execGitCmd(gitOptions); diff --git a/scripts/frontend/merge_coverage_frontend.js b/scripts/frontend/merge_coverage_frontend.js index 99034176b29..0c45a38b9b5 100644 --- a/scripts/frontend/merge_coverage_frontend.js +++ b/scripts/frontend/merge_coverage_frontend.js @@ -11,7 +11,7 @@ const reportFiles = sync(`${coverageDir}/*/coverage-final.json`); // Normalize coverage report generated by jest that has additional "data" key // https://github.com/facebook/jest/issues/2418#issuecomment-423806659 -const normalizeReport = report => { +const normalizeReport = (report) => { const normalizedReport = Object.assign({}, report); Object.entries(normalizedReport).forEach(([k, v]) => { if (v.data) normalizedReport[k] = v.data; @@ -20,12 +20,12 @@ const normalizeReport = report => { }; reportFiles - .map(reportFile => require(reportFile)) + .map((reportFile) => require(reportFile)) .map(normalizeReport) - .forEach(report => coverageMap.merge(report)); + .forEach((report) => coverageMap.merge(report)); const context = createContext({ coverageMap: coverageMap, dir: 'coverage-frontend' }); -['json', 'lcov', 'text-summary', 'clover', 'cobertura'].forEach(reporter => { +['json', 'lcov', 'text-summary', 'clover', 'cobertura'].forEach((reporter) => { create(reporter, {}).execute(context); }); diff --git a/scripts/frontend/prettier.js b/scripts/frontend/prettier.js index b55822505c3..8e9ecc2ba85 100644 --- a/scripts/frontend/prettier.js +++ b/scripts/frontend/prettier.js @@ -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); }); diff --git a/scripts/frontend/stylelint/stylelint-utility-map.js b/scripts/frontend/stylelint/stylelint-utility-map.js index cc555fb6d2a..bf8ee362740 100644 --- a/scripts/frontend/stylelint/stylelint-utility-map.js +++ b/scripts/frontend/stylelint/stylelint-utility-map.js @@ -32,7 +32,7 @@ sass.render( // This suppresses a postcss warning from: undefined, }) - .then(result => { + .then((result) => { const selectorGroups = {}; utils.createPropertiesHashmap(result.root, result, null, null, selectorGroups, true); diff --git a/scripts/frontend/stylelint/stylelint-utils.js b/scripts/frontend/stylelint/stylelint-utils.js index 09b75bb1d63..e7452b0cdb2 100644 --- a/scripts/frontend/stylelint/stylelint-utils.js +++ b/scripts/frontend/stylelint/stylelint-utils.js @@ -9,7 +9,7 @@ module.exports.createPropertiesHashmap = ( selectorGroups, addSelectors, ) => { - ruleRoot.walkRules(rule => { + ruleRoot.walkRules((rule) => { const selector = rule.selector.replace(/(?:\r\n|\r|\n)/g, ' '); if ( |