diff --git a/.changeset/dirty-turkeys-study.md b/.changeset/dirty-turkeys-study.md new file mode 100644 index 00000000000..92b4e488e28 --- /dev/null +++ b/.changeset/dirty-turkeys-study.md @@ -0,0 +1,7 @@ +--- +'codemirror-graphql': patch +'graphiql': patch +'graphql-language-service': patch +--- + +enable `unicorn/prefer-logical-operator-over-ternary` rule diff --git a/packages/codemirror-graphql/src/__tests__/lint-test.ts b/packages/codemirror-graphql/src/__tests__/lint-test.ts index dfb6d072b81..2b9dc34e19f 100644 --- a/packages/codemirror-graphql/src/__tests__/lint-test.ts +++ b/packages/codemirror-graphql/src/__tests__/lint-test.ts @@ -19,7 +19,7 @@ import { TestSchema } from './testSchema'; function createEditorWithLint(lintConfig?: any) { return CodeMirror(document.createElement('div'), { mode: 'graphql', - lint: lintConfig ? lintConfig : true, + lint: lintConfig || true, }); } diff --git a/packages/codemirror-graphql/src/variables/__tests__/lint-test.ts b/packages/codemirror-graphql/src/variables/__tests__/lint-test.ts index d2f4840adcd..63623f78b5b 100644 --- a/packages/codemirror-graphql/src/variables/__tests__/lint-test.ts +++ b/packages/codemirror-graphql/src/variables/__tests__/lint-test.ts @@ -19,7 +19,7 @@ import '../mode'; function createEditorWithLint(lintConfig?: any) { return CodeMirror(document.createElement('div'), { mode: 'graphql-variables', - lint: lintConfig ? lintConfig : true, + lint: lintConfig || true, }); } diff --git a/packages/graphiql/postcss.config.js b/packages/graphiql/postcss.config.js index dea966bec86..72c0ea1d81b 100644 --- a/packages/graphiql/postcss.config.js +++ b/packages/graphiql/postcss.config.js @@ -2,9 +2,7 @@ module.exports = ({ file, options }) => ({ plugins: { 'postcss-import': { root: file.dirname }, // contains autoprefixer, etc - 'postcss-preset-env': options['postcss-preset-env'] - ? options['postcss-preset-env'] - : false, + 'postcss-preset-env': options['postcss-preset-env'] || false, cssnano: process.env.NODE_ENV === 'production' ? options.cssnano : false, }, }); diff --git a/packages/graphiql/src/components/GraphiQL.tsx b/packages/graphiql/src/components/GraphiQL.tsx index 90734a32b40..83fa696c6ba 100644 --- a/packages/graphiql/src/components/GraphiQL.tsx +++ b/packages/graphiql/src/components/GraphiQL.tsx @@ -303,9 +303,7 @@ export function GraphiQLInterface(props: GraphiQLInterfaceProps) { copy()} label="Copy query (Shift-Ctrl-C)"> - {props.toolbar?.additionalContent - ? props.toolbar.additionalContent - : null} + {props.toolbar?.additionalContent || null} ); diff --git a/packages/graphql-language-service/src/interface/getHoverInformation.ts b/packages/graphql-language-service/src/interface/getHoverInformation.ts index f54815cdbdd..3b5c5258cf6 100644 --- a/packages/graphql-language-service/src/interface/getHoverInformation.ts +++ b/packages/graphql-language-service/src/interface/getHoverInformation.ts @@ -232,7 +232,7 @@ function renderDeprecation( return; } - const reason = def.deprecationReason ? def.deprecationReason : null; + const reason = def.deprecationReason || null; if (!reason) { return; } diff --git a/packages/graphql-language-service/src/parser/CharacterStream.ts b/packages/graphql-language-service/src/parser/CharacterStream.ts index 7168747919d..96a145075bd 100644 --- a/packages/graphql-language-service/src/parser/CharacterStream.ts +++ b/packages/graphql-language-service/src/parser/CharacterStream.ts @@ -53,9 +53,7 @@ export default class CharacterStream implements CharacterStreamInterface { public sol = (): boolean => this._pos === 0; public peek = (): string | null => { - return this._sourceText.charAt(this._pos) - ? this._sourceText.charAt(this._pos) - : null; + return this._sourceText.charAt(this._pos) || null; }; public next = (): string => {