Skip to content

Commit 91084fe

Browse files
author
Miles Johnson
committed
internal: Run Prettier on codebase.
1 parent 49237a7 commit 91084fe

File tree

13 files changed

+37
-37
lines changed

13 files changed

+37
-37
lines changed

packages/config-danger/src/adr.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ export function checkForADR(docsPath: string, options: CheckAdrOptions = {}) {
1515
}
1616

1717
const { changeThreshold = 200, docsUrl = '', exclusions = [] } = options;
18-
const hasDocsFiles = touchedFiles.some(file => file.includes(docsPath));
18+
const hasDocsFiles = touchedFiles.some((file) => file.includes(docsPath));
1919
const docsExclusions = [...exclusions, 'package-lock.json', 'yarn.lock', TEST_EXT, SNAP_EXT];
20-
const modifiedExclusions = danger.git.modified_files.filter(file =>
21-
docsExclusions.some(ex => !!file.match(ex)),
20+
const modifiedExclusions = danger.git.modified_files.filter((file) =>
21+
docsExclusions.some((ex) => !!file.match(ex)),
2222
);
2323

24-
Promise.all(modifiedExclusions.map(countChangesInFile)).then(vals => {
24+
Promise.all(modifiedExclusions.map(countChangesInFile)).then((vals) => {
2525
const totalChangeCount = danger.github.pr.additions + danger.github.pr.deletions;
2626
const exclusionChangeCount = vals.reduce((acc, val) => acc + val, 0);
2727
const changeCount = totalChangeCount - exclusionChangeCount;

packages/config-danger/src/code.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from './helpers';
1313
import { CommonOptions } from './types';
1414

15-
const changedSrcFiles = updatedFiles.filter(file => IS_SRC.test(file) && SRC_EXT.test(file));
15+
const changedSrcFiles = updatedFiles.filter((file) => IS_SRC.test(file) && SRC_EXT.test(file));
1616

1717
export type TestOptions = {
1818
ignorePattern?: RegExp;
@@ -21,7 +21,7 @@ export type TestOptions = {
2121

2222
// Check for invalid NPM/Yarn installs by verifying the lock files.
2323
export function checkForInvalidLocks() {
24-
const fileNames = touchedFiles.map(file => path.basename(file));
24+
const fileNames = touchedFiles.map((file) => path.basename(file));
2525

2626
if (fileNames.includes('package-lock.json') && !fileNames.includes('package.json')) {
2727
fail('Your PR contains changes to package-lock.json, but not package.json.');
@@ -38,9 +38,9 @@ export function checkForAnyTests({ root, ...options }: TestOptions = {}) {
3838
return;
3939
}
4040

41-
const hasTestFiles = touchedFiles.some(file => !!file.match(TEST_EXT));
41+
const hasTestFiles = touchedFiles.some((file) => !!file.match(TEST_EXT));
4242
const srcFiles = root
43-
? changedSrcFiles.filter(srcFile => srcFile.startsWith(root))
43+
? changedSrcFiles.filter((srcFile) => srcFile.startsWith(root))
4444
: changedSrcFiles;
4545

4646
if (srcFiles.length > 0 && !hasTestFiles) {
@@ -62,10 +62,10 @@ export function checkSourceFilesHaveTests({ ignorePattern, root, ...options }: T
6262

6363
const missingTestFiles: string[] = [];
6464
const srcFiles = root
65-
? changedSrcFiles.filter(srcFile => srcFile.startsWith(root))
65+
? changedSrcFiles.filter((srcFile) => srcFile.startsWith(root))
6666
: changedSrcFiles;
6767

68-
srcFiles.forEach(srcFile => {
68+
srcFiles.forEach((srcFile) => {
6969
if ((ignorePattern && srcFile.match(ignorePattern)) || srcFile.match(GLOBAL_IGNORE)) {
7070
return;
7171
}
@@ -84,7 +84,7 @@ export function checkSourceFilesHaveTests({ ignorePattern, root, ...options }: T
8484

8585
const regex = new RegExp(testFile);
8686

87-
updatedFiles.forEach(file => {
87+
updatedFiles.forEach((file) => {
8888
if (file.match(regex)) {
8989
missingTestFiles.push(`- ${srcFile.split(IS_SRC)[1]}`);
9090
}
@@ -138,7 +138,7 @@ export function disableComponentSnapshots(options: SnapshotOptions = {}) {
138138
// Disable new JavaScript files from being created.
139139
export function disableNewJavaScript() {
140140
const hasJS = danger.git.created_files.some(
141-
file => (IS_SRC.test(file) || IS_TEST.test(file)) && JS_EXT.test(file),
141+
(file) => (IS_SRC.test(file) || IS_TEST.test(file)) && JS_EXT.test(file),
142142
);
143143

144144
if (hasJS) {

packages/config-danger/src/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ export function isRevert(): boolean {
2828
}
2929

3030
export async function countChangesInFile(file: string): Promise<number> {
31-
return new Promise(resolve => {
32-
danger.git.diffForFile(file).then(d => {
31+
return new Promise((resolve) => {
32+
danger.git.diffForFile(file).then((d) => {
3333
const added = (d?.added && d.added.split('\n').length) || 0;
3434
const removed = (d?.removed && d.removed.split('\n').length) || 0;
3535

packages/config-jest/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ export interface JestOptions {
1717
workspaces?: string[];
1818
}
1919

20-
const exts = EXTS.map(ext => ext.slice(1));
21-
const extsWithoutJSON = exts.filter(ext => ext !== 'json');
20+
const exts = EXTS.map((ext) => ext.slice(1));
21+
const extsWithoutJSON = exts.filter((ext) => ext !== 'json');
2222

2323
function fromHere(filePath: string): string {
2424
return `<rootDir>/${new Path(process.cwd()).relativeTo(
@@ -46,7 +46,7 @@ export function getConfig({
4646
const setupFilesAfterEnv = [fromHere('bootstrap/consumer.js')];
4747

4848
if (workspaces.length > 0) {
49-
workspaces.forEach(wsPath => {
49+
workspaces.forEach((wsPath) => {
5050
roots.push(new Path('<rootDir>', wsPath.replace('/*', '')).path());
5151
});
5252
} else {
@@ -66,7 +66,7 @@ export function getConfig({
6666
bail: false,
6767
collectCoverageFrom: [createCoveragePattern(srcFolder), createCoveragePattern(testFolder)],
6868
coverageDirectory: './coverage',
69-
coveragePathIgnorePatterns: IGNORE_PATHS.filter(ignore => !ignore.startsWith('*')),
69+
coveragePathIgnorePatterns: IGNORE_PATHS.filter((ignore) => !ignore.startsWith('*')),
7070
coverageReporters: ['lcov', 'json-summary', 'html'],
7171
coverageThreshold: {
7272
global: {

packages/config-webpack/src/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export function getESMAliases(): AliasMap {
4747
onlyDirectories: true,
4848
onlyFiles: false,
4949
})
50-
.forEach(modulePath => {
50+
.forEach((modulePath) => {
5151
const packageName = modulePath.split('/node_modules/')[1];
5252
const esLessName = packageName.replace(/-es$/, '');
5353
const esPath = new Path(modulePath, 'es');
@@ -57,7 +57,7 @@ export function getESMAliases(): AliasMap {
5757
// optimal/lib -> optimal/esm
5858
if (esPath.exists() || esmPath.exists()) {
5959
const aliasPath = esPath.exists() ? `${packageName}/es` : `${packageName}/esm`;
60-
const aliased = buildTargets.some(targetFolder => {
60+
const aliased = buildTargets.some((targetFolder) => {
6161
if (new Path(modulePath, targetFolder).exists()) {
6262
aliases[`${packageName}/${targetFolder}`] = aliasPath;
6363

packages/nimbus-common/src/git.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import execa from 'execa';
22

33
export function getLastTag(): Promise<string> {
4-
return execa('git', ['describe', '--tags', '--abbrev=0', '@^']).then(response =>
4+
return execa('git', ['describe', '--tags', '--abbrev=0', '@^']).then((response) =>
55
response.stdout.trim(),
66
);
77
}
88

99
export function getCommitsSince(since: string): Promise<string[]> {
10-
return execa('git', ['log', '--oneline', `${since}..@`]).then(response =>
10+
return execa('git', ['log', '--oneline', `${since}..@`]).then((response) =>
1111
response.stdout.trim().split('\n'),
1212
);
1313
}

packages/nimbus/hooks/checkNodeVersion.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const { getPackage } = require('@airbnb/nimbus-common');
66

77
// Only run if the engines block is defined
88
if (getPackage().engines) {
9-
execa('check-node-version', ['--package'], { preferLocal: true }).catch(error => {
9+
execa('check-node-version', ['--package'], { preferLocal: true }).catch((error) => {
1010
console.error();
1111
console.error(chalk.red(error.stderr.trim()));
1212
console.error();

packages/nimbus/hooks/detectModuleChanges.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ execa('git', ['diff-tree', '-r', '--name-only', remoteHead, branchHead])
3131
);
3232
}
3333
})
34-
.catch(error => {
34+
.catch((error) => {
3535
console.log('\n ', chalk.red(`🛑 Failed to detect module changes: ${error.message}`), ' \n');
3636
});

packages/nimbus/src/bins/eject.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async function copyAndInstallDepsFromModule(
3030
) {
3131
const pkg = require(`${moduleName}/package.json`);
3232
const deps = Object.keys(pkg.dependencies).filter(
33-
dep => !dep.includes('@beemo') && !dep.includes('@airbnb/nimbus'),
33+
(dep) => !dep.includes('@beemo') && !dep.includes('@airbnb/nimbus'),
3434
);
3535

3636
await installDeps(deps, isYarn, isMonorepo);
@@ -63,7 +63,7 @@ function migrateDotfiles() {
6363
const dotPath = Path.resolve('.gitignore').path();
6464
let data = fs.readFileSync(dotPath, 'utf8');
6565

66-
toRemove.forEach(value => {
66+
toRemove.forEach((value) => {
6767
data = data.replace(new RegExp(`${escapeRegExp(value)}\n?`, 'g'), '');
6868
});
6969

@@ -87,7 +87,7 @@ function migratePackageScripts(nimbus: NimbusPackage['nimbus']) {
8787
delete scripts.release;
8888
}
8989

90-
Object.keys(scripts).forEach(key => {
90+
Object.keys(scripts).forEach((key) => {
9191
const value = scripts[key];
9292
const esm = value.includes('--esm');
9393

@@ -119,7 +119,7 @@ function migrateEslint() {
119119
const { extends: extendPaths, ...rootConfig } = require(configPath);
120120
let config: { extends: string[]; parserOptions?: object } = { extends: [] };
121121

122-
(extendPaths as string[]).forEach(extendPath => {
122+
(extendPaths as string[]).forEach((extendPath) => {
123123
if (extendPath.startsWith('.')) {
124124
config = {
125125
...config,
@@ -236,7 +236,7 @@ export async function eject() {
236236

237237
pkg.set(
238238
'nimbus.drivers',
239-
(pkg.get('nimbus.drivers') as string[]).filter(d => d !== driver),
239+
(pkg.get('nimbus.drivers') as string[]).filter((d) => d !== driver),
240240
);
241241
pkg.save();
242242
}

packages/nimbus/src/bins/setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export async function setup() {
183183
console.log(`${chalk.cyan('[3/6]')} Installing dependencies`);
184184

185185
await installDeps(
186-
['@airbnb/nimbus', ...response.drivers.map(driver => `@airbnb/config-${driver}`)],
186+
['@airbnb/nimbus', ...response.drivers.map((driver) => `@airbnb/config-${driver}`)],
187187
response.yarn,
188188
response.type === 'monolib',
189189
);

0 commit comments

Comments
 (0)