Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
Run Prettier everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
fson committed Nov 8, 2018
1 parent 4bbfefe commit 1c5f7b0
Show file tree
Hide file tree
Showing 15 changed files with 91 additions and 57 deletions.
7 changes: 7 additions & 0 deletions .prettierignore
@@ -0,0 +1,7 @@
/packages/dev-tools/.next
/packages/dev-tools/build
/packages/expo-cli/build
/packages/json-file/build
/packages/schemer/build
/packages/xdl/flow-typed
/packages/xdl/build
3 changes: 2 additions & 1 deletion packages/dev-tools/common/state.js
Expand Up @@ -379,7 +379,8 @@ export const publishProject = async (options, props) => {
Successfully published to{' '}
<a target="_blank" href={url}>
{url}
</a>.
</a>
.
</span>
),
},
Expand Down
16 changes: 10 additions & 6 deletions packages/dev-tools/components/GlobalToasts.js
Expand Up @@ -104,12 +104,16 @@ export class Toast extends React.Component {
<div className={STYLES_TOAST} style={this.props.style}>
<header
className={`${STYLES_TOAST_TOP}
${this.props.name === 'notice' || this.props.name === 'info'
? STYLES_TOAST_TOP_NORMAL
: ''}
${this.props.name === 'warning' || this.props.name === 'error'
? STYLES_TOAST_TOP_WARNING
: ''}
${
this.props.name === 'notice' || this.props.name === 'info'
? STYLES_TOAST_TOP_NORMAL
: ''
}
${
this.props.name === 'warning' || this.props.name === 'error'
? STYLES_TOAST_TOP_WARNING
: ''
}
${this.props.name === 'success' ? STYLES_TOAST_TOP_SUCCESS : ''}
${this.props.name === 'alert' ? STYLES_TOAST_TOP_ALERT : ''}`}>
<span className={STYLES_TOAST_TOP_LEFT}>{this.props.name}</span>
Expand Down
Expand Up @@ -267,7 +267,8 @@ export default class ProjectManagerPublishingSection extends React.Component {
Once you publish your project, you will be able to view it at&nbsp;
<span className={STYLES_EMPHASIS}>
https://expo.io/@{this.props.user.username}/{this.state.config.slug}
</span>.
</span>
.
</p>
<div className={STYLES_ACTIONS}>
<PrimaryButtonWithStates
Expand Down
3 changes: 2 additions & 1 deletion packages/dev-tools/components/ProjectManagerSection.js
Expand Up @@ -142,7 +142,8 @@ class ProjectManagerSection extends React.Component {
<LoggerIcon
type={this.props.data.type}
style={{ marginRight: '8px', marginBottom: '2px' }}
/>&nbsp;
/>
&nbsp;
{this.props.data.name}
</ProjectManagerSectionHeader>
);
Expand Down
6 changes: 3 additions & 3 deletions packages/dev-tools/components/SmallButton.js
Expand Up @@ -45,9 +45,9 @@ export default class SmallButton extends React.Component {
return (
<span
onClick={this.props.onClick}
className={`${STYLES_SMALL_BUTTON} ${this.props.isActive
? STYLES_SMALL_BUTTON_ACTIVE
: STYLES_SMALL_BUTTON_DEFAULT}`}>
className={`${STYLES_SMALL_BUTTON} ${
this.props.isActive ? STYLES_SMALL_BUTTON_ACTIVE : STYLES_SMALL_BUTTON_DEFAULT
}`}>
{this.props.children}
</span>
);
Expand Down
6 changes: 3 additions & 3 deletions packages/dev-tools/components/SmallSquareButton.js
Expand Up @@ -34,9 +34,9 @@ export default class SmallButton extends React.Component {
return (
<span
onClick={this.props.onClick}
className={`${STYLES_SMALL_BUTTON} ${this.props.isActive
? STYLES_SMALL_BUTTON_ACTIVE
: STYLES_SMALL_BUTTON_DEFAULT}`}>
className={`${STYLES_SMALL_BUTTON} ${
this.props.isActive ? STYLES_SMALL_BUTTON_ACTIVE : STYLES_SMALL_BUTTON_DEFAULT
}`}>
{this.props.children}
</span>
);
Expand Down
8 changes: 6 additions & 2 deletions packages/expo-cli/src/commands/build/AndroidBuilder.js
Expand Up @@ -85,7 +85,9 @@ export default class AndroidBuilder extends BaseBuilder {

async collectAndValidateCredentials(options = {}) {
const publicUrl = options.publicUrl;
const { args: { username, remoteFullPackageName: experienceName } } = publicUrl
const {
args: { username, remoteFullPackageName: experienceName },
} = publicUrl
? await Exp.getThirdPartyInfoAsync(publicUrl)
: await Exp.getPublishInfoAsync(this.projectDir);

Expand Down Expand Up @@ -208,7 +210,9 @@ export default class AndroidBuilder extends BaseBuilder {

async validateProject(options) {
const publicUrl = options.publicUrl;
const { args: { sdkVersion } } = publicUrl
const {
args: { sdkVersion },
} = publicUrl
? await Exp.getThirdPartyInfoAsync(publicUrl)
: await Exp.getPublishInfoAsync(this.projectDir);
await this.checkIfSdkIsSupported(sdkVersion, 'android');
Expand Down
18 changes: 9 additions & 9 deletions packages/expo-cli/src/commands/build/BaseBuilder.js
Expand Up @@ -63,14 +63,12 @@ export default class BaseBuilder {
}
}

async checkStatus(
{
platform = 'all',
current = true,
publicUrl,
sdkVersion,
}: { platform: string, current: boolean, publicUrl?: string } = {}
): Promise<void> {
async checkStatus({
platform = 'all',
current = true,
publicUrl,
sdkVersion,
}: { platform: string, current: boolean, publicUrl?: string } = {}): Promise<void> {
await this._checkProjectConfig();

log('Checking if current build exists...\n');
Expand Down Expand Up @@ -187,7 +185,9 @@ ${job.id}
throw new BuildError('No releases found. Please create one using `exp publish` first.');
}
log(
`Using existing release on channel "${release.channel}":\n publicationId: ${release.publicationId}\n publishedTime: ${release.publishedTime}`
`Using existing release on channel "${release.channel}":\n publicationId: ${
release.publicationId
}\n publishedTime: ${release.publishedTime}`
);
return [release.publicationId];
}
Expand Down
8 changes: 6 additions & 2 deletions packages/expo-cli/src/commands/build/IOSBuilder.js
Expand Up @@ -433,7 +433,9 @@ See https://docs.expo.io/versions/latest/guides/building-standalone-apps.html`
if (this.options.revokeAppleProvisioningProfile) {
await new Promise(r => setTimeout(() => r(), 400));
log.warn(
`ATTENTION: Revoking your Apple Provisioning Profile for ${credsMetadata.bundleIdentifier} is permanent`
`ATTENTION: Revoking your Apple Provisioning Profile for ${
credsMetadata.bundleIdentifier
} is permanent`
);
const revokeAttempt = await authFuncs.revokeProvisioningProfile(
appleCredentials,
Expand Down Expand Up @@ -627,7 +629,9 @@ See https://docs.expo.io/versions/latest/guides/building-standalone-apps.html`
const creds = { ...credsStarter, ...credentialsCI };
this._areCredsMissing(creds);
await Credentials.updateCredentialsForPlatform('ios', creds, credsMetadata);
log.warn(`Encrypted ${Object.keys(OBLIGATORY_CREDS_KEYS).join(', ')} and saved to expo servers`);
log.warn(
`Encrypted ${Object.keys(OBLIGATORY_CREDS_KEYS).join(', ')} and saved to expo servers`
);
} else if (clientHasAllNeededCreds === false) {
const strategy = await prompt(runAsExpertQuestion);
const isEnterprise = this.options.appleEnterpriseAccount !== undefined;
Expand Down
31 changes: 17 additions & 14 deletions packages/expo-cli/src/commands/eject/Eject.js
Expand Up @@ -162,11 +162,10 @@ Ejecting is permanent! Please be careful with your selection.
// manually gets printed.
const babelRcJson = JSON.parse(projectBabelRc);
if (babelRcJson.presets && babelRcJson.presets.includes('babel-preset-expo')) {
babelRcJson.presets = babelRcJson.presets.map(
preset =>
preset === 'babel-preset-expo'
? 'babel-preset-react-native-stage-0/decorator-support'
: preset
babelRcJson.presets = babelRcJson.presets.map(preset =>
preset === 'babel-preset-expo'
? 'babel-preset-react-native-stage-0/decorator-support'
: preset
);
await fse.writeFile(projectBabelPath, JSON.stringify(babelRcJson, null, 2));
newDevDependencies.push('babel-preset-react-native-stage-0');
Expand Down Expand Up @@ -212,7 +211,11 @@ from \`babel-preset-expo\` to \`babel-preset-react-native-stage-0/decorator-supp
pkgJson.jest.preset = 'react-native';
} else {
log(
`${chalk.bold('Warning')}: it looks like you've changed the Jest preset from jest-expo to ${pkgJson.jest.preset}. We recommend you make sure this Jest preset is compatible with ejected apps.`
`${chalk.bold(
'Warning'
)}: it looks like you've changed the Jest preset from jest-expo to ${
pkgJson.jest.preset
}. We recommend you make sure this Jest preset is compatible with ejected apps.`
);
}
}
Expand Down Expand Up @@ -284,14 +287,14 @@ Please consider letting us know why you ejected in this survey:
async function filesUsingExpoSdk(projectRoot: string): Promise<Array<string>> {
const projectJsFiles = await findJavaScriptProjectFilesInRoot(projectRoot);

const jsFileContents = (await Promise.all(
projectJsFiles.map(f => fse.readFile(f))
)).map((buf, i) => {
return {
filename: projectJsFiles[i],
contents: buf.toString(),
};
});
const jsFileContents = (await Promise.all(projectJsFiles.map(f => fse.readFile(f)))).map(
(buf, i) => {
return {
filename: projectJsFiles[i],
contents: buf.toString(),
};
}
);

const filesUsingExpo = [];

Expand Down
12 changes: 9 additions & 3 deletions packages/expo-cli/src/commands/push-creds.js
Expand Up @@ -18,7 +18,9 @@ export default (program: any) => {

log('Reading project configuration...');

const { args: { remotePackageName } } = await Exp.getPublishInfoAsync(projectDir);
const {
args: { remotePackageName },
} = await Exp.getPublishInfoAsync(projectDir);

log('Logging in...');

Expand All @@ -38,7 +40,9 @@ export default (program: any) => {
.command('push:android:show [project-dir]')
.description('Print the value currently in use for FCM notifications for this project.')
.asyncActionProjectDir(async (projectDir, options) => {
const { args: { remotePackageName } } = await Exp.getPublishInfoAsync(projectDir);
const {
args: { remotePackageName },
} = await Exp.getPublishInfoAsync(projectDir);
let user = await User.getCurrentUserAsync();
let apiClient = ApiV2.clientForUser(user);

Expand All @@ -56,7 +60,9 @@ export default (program: any) => {
.description('Deletes a previously uploaded FCM credential.')
.asyncActionProjectDir(async (projectDir, options) => {
log('Reading project configuration...');
const { args: { remotePackageName } } = await Exp.getPublishInfoAsync(projectDir);
const {
args: { remotePackageName },
} = await Exp.getPublishInfoAsync(projectDir);

log('Logging in...');
let user = await User.getCurrentUserAsync();
Expand Down
18 changes: 9 additions & 9 deletions packages/expo-cli/src/commands/webhooks.js
Expand Up @@ -22,9 +22,9 @@ export default program => {
const options = _sanitizeOptions(_options);
const secret = options.secret ? options.secret : await _askForSecret();
const webhookData = { ...options, secret };
const { args: { remoteFullPackageName: experienceName } } = await Exp.getPublishInfoAsync(
projectDir
);
const {
args: { remoteFullPackageName: experienceName },
} = await Exp.getPublishInfoAsync(projectDir);
log(`Setting ${webhookData.event} webhook and secret for ${experienceName}`);
try {
await Webhooks.setWebhookAsync(experienceName, webhookData);
Expand All @@ -40,9 +40,9 @@ export default program => {
.command('webhooks:show [project-dir]')
.description(`Show webhooks for the project.`)
.asyncActionProjectDir(async (projectDir, options) => {
const { args: { remoteFullPackageName: experienceName } } = await Exp.getPublishInfoAsync(
projectDir
);
const {
args: { remoteFullPackageName: experienceName },
} = await Exp.getPublishInfoAsync(projectDir);

log(`Fetching webhooks for ${experienceName}`);

Expand Down Expand Up @@ -71,9 +71,9 @@ export default program => {
.description(`Clear a webhook associated with this project.`)
.asyncActionProjectDir(async (projectDir, options) => {
const event = _sanitizeEvent(options.event);
const { args: { remoteFullPackageName: experienceName } } = await Exp.getPublishInfoAsync(
projectDir
);
const {
args: { remoteFullPackageName: experienceName },
} = await Exp.getPublishInfoAsync(projectDir);

log(`Clearing webhooks for ${experienceName}`);

Expand Down
1 change: 0 additions & 1 deletion packages/schemer/__tests__/test.js
Expand Up @@ -70,7 +70,6 @@ describe('Manual Validation Individual Unit Tests', () => {
expect(e.errors.length).toBe(1);
}
});

});

describe('Individual Unit Tests', async () => {
Expand Down
8 changes: 6 additions & 2 deletions packages/schemer/src/index.js
Expand Up @@ -200,7 +200,9 @@ export default class Schemer {
new ValidationError({
errorCode: ErrorCodes.INVALID_CONTENT_TYPE,
fieldPath,
message: `field '${fieldPath}' should point to ${meta.contentTypeHuman} but the file at '${data}' has type ${type}`,
message: `field '${fieldPath}' should point to ${
meta.contentTypeHuman
} but the file at '${data}' has type ${type}`,
data,
meta,
})
Expand All @@ -212,7 +214,9 @@ export default class Schemer {
new ValidationError({
errorCode: ErrorCodes.INVALID_DIMENSIONS,
fieldPath,
message: `'${fieldPath}' should have dimensions ${dimensions.width}x${dimensions.height}, but the file at '${data}' has dimensions ${width}x${height}`,
message: `'${fieldPath}' should have dimensions ${dimensions.width}x${
dimensions.height
}, but the file at '${data}' has dimensions ${width}x${height}`,
data,
meta,
})
Expand Down

0 comments on commit 1c5f7b0

Please sign in to comment.