Skip to content

Commit 10ed898

Browse files
authored
chore: run prettier on code base (#3705)
1 parent 4d10869 commit 10ed898

File tree

9 files changed

+19
-34
lines changed

9 files changed

+19
-34
lines changed

.prettierrc

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"trailingComma": "es5",
33
"printWidth": 120,
44
"singleQuote": true,
5+
"arrowParens": "avoid",
56
"overrides": [
67
{
78
"files": "*.flow.js",

packages/graphql-codegen-cli/src/generate-and-save.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ import { debugLog } from './utils/debugging';
99
import { CodegenContext, ensureContext } from './config';
1010
import { createHash } from 'crypto';
1111

12-
const hash = (content: string): string =>
13-
createHash('sha1')
14-
.update(content)
15-
.digest('base64');
12+
const hash = (content: string): string => createHash('sha1').update(content).digest('base64');
1613

1714
export async function generate(
1815
input: CodegenContext | Types.Config,

packages/plugins/flow/flow/tests/validate-flow.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ const flow = require('./flow.js');
44
export function validateFlow(code: Types.PluginOutput) {
55
const errors = flow.checkContent('temp.flow.js', mergeOutputs([code]));
66

7-
const lint = errors.map(function(err) {
7+
const lint = errors.map(function (err) {
88
const messages = err.message;
99
const firstLoc = messages[0].loc;
1010
const message = messages
11-
.map(function(msg) {
11+
.map(function (msg) {
1212
return msg.descr;
1313
})
1414
.join('\n');

packages/plugins/java/apollo-android/src/operation-visitor.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1047,9 +1047,7 @@ ${indentMultiline(inner, 2)}
10471047
cls.addClassMethod(
10481048
'operationId',
10491049
`String`,
1050-
`return "${createHash('md5')
1051-
.update(printed)
1052-
.digest('hex')}";`,
1050+
`return "${createHash('md5').update(printed).digest('hex')}";`,
10531051
[],
10541052
[],
10551053
'public',

packages/plugins/other/visitor-plugin-common/src/base-resolvers-visitor.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -878,14 +878,16 @@ export type IDirectiveResolvers${contextType} = ${name}<ContextType>;`
878878
const subscriptionType = this._schema.getSubscriptionType();
879879
const isSubscriptionType = subscriptionType && subscriptionType.name === parentName;
880880
let argsType = hasArguments
881-
? `${this.convertName(parentName, {
882-
useTypesPrefix: true,
883-
}) +
881+
? `${
882+
this.convertName(parentName, {
883+
useTypesPrefix: true,
884+
}) +
884885
(this.config.addUnderscoreToArgsType ? '_' : '') +
885886
this.convertName(node.name, {
886887
useTypesPrefix: false,
887888
}) +
888-
'Args'}`
889+
'Args'
890+
}`
889891
: null;
890892

891893
if (argsType !== null) {

packages/plugins/other/visitor-plugin-common/src/client-side-base-visitor.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,7 @@ export class ClientSideBaseVisitor<
241241
const fragments = this._transformFragments(node);
242242

243243
const doc = this._prepareDocument(`
244-
${
245-
print(node)
246-
.split('\\')
247-
.join('\\\\') /* Re-escape escaped values in GraphQL syntax */
248-
}
244+
${print(node).split('\\').join('\\\\') /* Re-escape escaped values in GraphQL syntax */}
249245
${this._includeFragments(fragments)}`);
250246

251247
if (this.config.documentMode === DocumentMode.documentNode) {

packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,7 @@ export class SelectionSetToObject<Config extends ParsedDocumentsConfig = ParsedD
366366
name: this._processor.config.formatNamedField(field.name.value, selectedFieldType),
367367
type: realSelectedFieldType.name,
368368
selectionSet: this._processor.config.wrapTypeWithModifiers(
369-
selectionSet
370-
.transformSelectionSet()
371-
.split(`\n`)
372-
.join(`\n `),
369+
selectionSet.transformSelectionSet().split(`\n`).join(`\n `),
373370
selectedFieldType
374371
),
375372
});

packages/utils/config-md-generator/src/index.ts

+1-7
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,7 @@ function extractExamples(docComment: tsdoc.DocComment): Example[] {
135135
if (content.trim() !== '') {
136136
const splitted = content.split('\n');
137137
title = splitted[0].trim();
138-
description =
139-
splitted.length > 1
140-
? splitted
141-
.slice(1)
142-
.join('\n')
143-
.trim()
144-
: null;
138+
description = splitted.length > 1 ? splitted.slice(1).join('\n').trim() : null;
145139
}
146140
codeNodes = codeNodes.slice(1);
147141
}

packages/utils/graphql-codegen-testing/src/typescript.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -149,17 +149,17 @@ export function compileTs(
149149

150150
return host.getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
151151
},
152-
writeFile: function() {},
153-
useCaseSensitiveFileNames: function() {
152+
writeFile: function () {},
153+
useCaseSensitiveFileNames: function () {
154154
return false;
155155
},
156-
getCanonicalFileName: function(filename) {
156+
getCanonicalFileName: function (filename) {
157157
return filename;
158158
},
159-
getCurrentDirectory: function() {
159+
getCurrentDirectory: function () {
160160
return '';
161161
},
162-
getNewLine: function() {
162+
getNewLine: function () {
163163
return '\n';
164164
},
165165
});

0 commit comments

Comments
 (0)