diff --git a/.eslintrc.js b/.eslintrc.js index 6d3b2e93cf5..721e327dbe6 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -247,6 +247,11 @@ module.exports = { 'promise/no-multiple-resolved': 'error', 'sonarjs/no-redundant-jump': 'error', 'unicorn/prefer-logical-operator-over-ternary': 'error', + 'logical-assignment-operators': [ + 'error', + 'always', + { enforceForIfStatements: true }, + ], 'unicorn/prefer-export-from': ['error', { ignoreUsedVariables: true }], 'unicorn/throw-new-error': 'error', 'unicorn/prefer-includes': 'error', diff --git a/examples/monaco-graphql-webpack/src/index.ts b/examples/monaco-graphql-webpack/src/index.ts index 0bb2c80e4e5..1ce00ce3025 100644 --- a/examples/monaco-graphql-webpack/src/index.ts +++ b/examples/monaco-graphql-webpack/src/index.ts @@ -23,15 +23,13 @@ async function render() { return; } - if (!monacoGraphQLAPI) { - monacoGraphQLAPI = initializeMode({ - formattingOptions: { - prettierConfig: { - printWidth: 120, - }, + monacoGraphQLAPI ||= initializeMode({ + formattingOptions: { + prettierConfig: { + printWidth: 120, }, - }); - } + }, + }); document.getElementById('github-login-wrapper')?.remove(); document diff --git a/packages/graphql-language-service-server/src/GraphQLCache.ts b/packages/graphql-language-service-server/src/GraphQLCache.ts index 975fd56c376..93a0db3374c 100644 --- a/packages/graphql-language-service-server/src/GraphQLCache.ts +++ b/packages/graphql-language-service-server/src/GraphQLCache.ts @@ -69,10 +69,7 @@ export async function getGraphQLCache({ loadConfigOptions: LoadConfigOptions; config?: GraphQLConfig; }): Promise { - let graphQLConfig = config; - if (!graphQLConfig) { - graphQLConfig = await loadConfig(loadConfigOptions); - } + const graphQLConfig = config || (await loadConfig(loadConfigOptions)); return new GraphQLCache({ configDir: loadConfigOptions.rootDir as string, config: graphQLConfig as GraphQLConfig,