Skip to content

Commit 4a8b2e1

Browse files
authored
enable unicorn/prefer-logical-operator-over-ternary rule (#2941)
1 parent 6a9d913 commit 4a8b2e1

File tree

7 files changed

+13
-12
lines changed

7 files changed

+13
-12
lines changed

.changeset/dirty-turkeys-study.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'codemirror-graphql': patch
3+
'graphiql': patch
4+
'graphql-language-service': patch
5+
---
6+
7+
enable `unicorn/prefer-logical-operator-over-ternary` rule

packages/codemirror-graphql/src/__tests__/lint-test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { TestSchema } from './testSchema';
1919
function createEditorWithLint(lintConfig?: any) {
2020
return CodeMirror(document.createElement('div'), {
2121
mode: 'graphql',
22-
lint: lintConfig ? lintConfig : true,
22+
lint: lintConfig || true,
2323
});
2424
}
2525

packages/codemirror-graphql/src/variables/__tests__/lint-test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import '../mode';
1919
function createEditorWithLint(lintConfig?: any) {
2020
return CodeMirror(document.createElement('div'), {
2121
mode: 'graphql-variables',
22-
lint: lintConfig ? lintConfig : true,
22+
lint: lintConfig || true,
2323
});
2424
}
2525

packages/graphiql/postcss.config.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ module.exports = ({ file, options }) => ({
22
plugins: {
33
'postcss-import': { root: file.dirname },
44
// contains autoprefixer, etc
5-
'postcss-preset-env': options['postcss-preset-env']
6-
? options['postcss-preset-env']
7-
: false,
5+
'postcss-preset-env': options['postcss-preset-env'] || false,
86
cssnano: process.env.NODE_ENV === 'production' ? options.cssnano : false,
97
},
108
});

packages/graphiql/src/components/GraphiQL.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,7 @@ export function GraphiQLInterface(props: GraphiQLInterfaceProps) {
303303
<ToolbarButton onClick={() => copy()} label="Copy query (Shift-Ctrl-C)">
304304
<CopyIcon className="graphiql-toolbar-icon" aria-hidden="true" />
305305
</ToolbarButton>
306-
{props.toolbar?.additionalContent
307-
? props.toolbar.additionalContent
308-
: null}
306+
{props.toolbar?.additionalContent || null}
309307
</>
310308
);
311309

packages/graphql-language-service/src/interface/getHoverInformation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ function renderDeprecation(
232232
return;
233233
}
234234

235-
const reason = def.deprecationReason ? def.deprecationReason : null;
235+
const reason = def.deprecationReason || null;
236236
if (!reason) {
237237
return;
238238
}

packages/graphql-language-service/src/parser/CharacterStream.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ export default class CharacterStream implements CharacterStreamInterface {
5353
public sol = (): boolean => this._pos === 0;
5454

5555
public peek = (): string | null => {
56-
return this._sourceText.charAt(this._pos)
57-
? this._sourceText.charAt(this._pos)
58-
: null;
56+
return this._sourceText.charAt(this._pos) || null;
5957
};
6058

6159
public next = (): string => {

0 commit comments

Comments
 (0)