Skip to content

Commit 788a258

Browse files
authored
style: format and fix linting issues (dotansimha#8850)
1 parent 6b1d852 commit 788a258

File tree

18 files changed

+28
-33
lines changed

18 files changed

+28
-33
lines changed

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const PROJECTS = false;
2-
const CI = Boolean(process.env.CI);
2+
const CI = !!process.env.CI;
33

44
module.exports =
55
!PROJECTS || CI

jest.project.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const { pathsToModuleNameMapper } = require('ts-jest');
55
const ROOT_DIR = __dirname;
66
const TSCONFIG = resolve(ROOT_DIR, 'tsconfig.json');
77
const tsconfig = require(TSCONFIG);
8-
const CI = Boolean(process.env.CI);
8+
const CI = !!process.env.CI;
99

1010
module.exports = ({ dirname, projectMode = true }) => {
1111
const pkg = require(resolve(dirname, 'package.json'));

packages/graphql-codegen-cli/src/codegen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ export async function executeCodegen(input: CodegenContext | Types.Config): Prom
196196
task: (ctx, task) => {
197197
const generateTasks: ListrTask<Ctx>[] = Object.keys(generates).map(filename => {
198198
const outputConfig = generates[filename];
199-
const hasPreset = Boolean(outputConfig.preset);
199+
const hasPreset = !!outputConfig.preset;
200200

201201
const title = `Generate to ${filename}`;
202202

packages/graphql-codegen-cli/src/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export function buildOptions() {
208208
if (typeof watch === 'string' || Array.isArray(watch)) {
209209
return watch;
210210
}
211-
return Boolean(watch);
211+
return !!watch;
212212
},
213213
},
214214
r: {
@@ -488,7 +488,7 @@ function addHashToDocumentFiles(documentFilesPromise: Promise<Types.DocumentFile
488488
}
489489

490490
export function shouldEmitLegacyCommonJSImports(config: Types.Config): boolean {
491-
const globalValue = config.emitLegacyCommonJSImports === undefined ? true : Boolean(config.emitLegacyCommonJSImports);
491+
const globalValue = config.emitLegacyCommonJSImports === undefined ? true : !!config.emitLegacyCommonJSImports;
492492
// const outputConfig = config.generates[outputPath];
493493

494494
// if (!outputConfig) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export async function generate(
144144
}
145145

146146
function shouldOverwrite(config: Types.Config, outputPath: string): boolean {
147-
const globalValue = config.overwrite === undefined ? true : Boolean(config.overwrite);
147+
const globalValue = config.overwrite === undefined ? true : !!config.overwrite;
148148
const outputConfig = config.generates[outputPath];
149149

150150
if (!outputConfig) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export class BaseDocumentsVisitor<
175175
namespacedImportName: getConfigValue(rawConfig.namespacedImportName, null),
176176
experimentalFragmentVariables: getConfigValue(rawConfig.experimentalFragmentVariables, false),
177177
addTypename: !rawConfig.skipTypename,
178-
globalNamespace: Boolean(rawConfig.globalNamespace),
178+
globalNamespace: !!rawConfig.globalNamespace,
179179
operationResultSuffix: getConfigValue(rawConfig.operationResultSuffix, ''),
180180
scalars: buildScalarsFromConfig(_schema, rawConfig, defaultScalars),
181181
...((additionalConfig || {}) as any),

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ export class BaseResolversVisitor<
717717
const isRootType = this._rootTypeNames.has(typeName);
718718
const isMapped = this.config.mappers[typeName];
719719
const isScalar = this.config.scalars[typeName];
720-
const hasDefaultMapper = Boolean(this.config.defaultMapper?.type);
720+
const hasDefaultMapper = !!this.config.defaultMapper?.type;
721721

722722
if (isRootType) {
723723
prev[typeName] = applyWrapper(this.config.rootValueType.type);
@@ -952,14 +952,10 @@ export class BaseResolversVisitor<
952952
}
953953

954954
protected isMapperImported(groupedMappers: GroupedMappers, identifier: string, source: string): boolean {
955-
const exists = !groupedMappers[source]
956-
? false
957-
: Boolean(groupedMappers[source].find(m => m.identifier === identifier));
958-
const existsFromEnums = Boolean(
959-
Object.keys(this.config.enumValues)
960-
.map(key => this.config.enumValues[key])
961-
.find(o => o.sourceFile === source && o.typeIdentifier === identifier)
962-
);
955+
const exists = !groupedMappers[source] ? false : !!groupedMappers[source].find(m => m.identifier === identifier);
956+
const existsFromEnums = !!Object.keys(this.config.enumValues)
957+
.map(key => this.config.enumValues[key])
958+
.find(o => o.sourceFile === source && o.typeIdentifier === identifier);
963959

964960
return exists || existsFromEnums;
965961
}
@@ -1177,7 +1173,7 @@ export class BaseResolversVisitor<
11771173

11781174
if (argsType !== null) {
11791175
const argsToForceRequire = original.arguments.filter(
1180-
arg => Boolean(arg.defaultValue) || arg.type.kind === 'NonNullType'
1176+
arg => !!arg.defaultValue || arg.type.kind === 'NonNullType'
11811177
);
11821178

11831179
if (argsToForceRequire.length > 0) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ export class BaseTypesVisitor<
963963
return null;
964964
})
965965
.reverse()
966-
.find(a => Boolean(a));
966+
.find(a => !!a);
967967

968968
return type || null;
969969
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,13 +381,13 @@ export class BaseVisitor<TRawConfig extends RawConfig = RawConfig, TPluginConfig
381381
externalFragments: rawConfig.externalFragments || [],
382382
fragmentImports: rawConfig.fragmentImports || [],
383383
addTypename: !rawConfig.skipTypename,
384-
nonOptionalTypename: Boolean(rawConfig.nonOptionalTypename),
385-
useTypeImports: Boolean(rawConfig.useTypeImports),
386-
dedupeFragments: Boolean(rawConfig.dedupeFragments),
387-
allowEnumStringTypes: Boolean(rawConfig.allowEnumStringTypes),
384+
nonOptionalTypename: !!rawConfig.nonOptionalTypename,
385+
useTypeImports: !!rawConfig.useTypeImports,
386+
dedupeFragments: !!rawConfig.dedupeFragments,
387+
allowEnumStringTypes: !!rawConfig.allowEnumStringTypes,
388388
inlineFragmentTypes: rawConfig.inlineFragmentTypes ?? 'inline',
389389
emitLegacyCommonJSImports:
390-
rawConfig.emitLegacyCommonJSImports === undefined ? true : Boolean(rawConfig.emitLegacyCommonJSImports),
390+
rawConfig.emitLegacyCommonJSImports === undefined ? true : !!rawConfig.emitLegacyCommonJSImports,
391391
...((additionalConfig || {}) as any),
392392
};
393393

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ export class ClientSideBaseVisitor<
265265
omitOperationSuffix: getConfigValue(rawConfig.omitOperationSuffix, false),
266266
gqlImport: rawConfig.gqlImport || null,
267267
documentNodeImport: rawConfig.documentNodeImport || null,
268-
noExport: Boolean(rawConfig.noExport),
268+
noExport: !!rawConfig.noExport,
269269
importOperationTypesFrom: getConfigValue(rawConfig.importOperationTypesFrom, null),
270270
operationResultSuffix: getConfigValue(rawConfig.operationResultSuffix, ''),
271271
documentVariablePrefix: getConfigValue(rawConfig.documentVariablePrefix, ''),

0 commit comments

Comments
 (0)