Skip to content

Commit

Permalink
enable @typescript-eslint/no-unused-expressions rule (#2933)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaMachina committed Dec 8, 2022
1 parent 114564b commit d502a33
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .changeset/polite-crabs-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@graphiql/react': patch
'graphql-language-service-server': patch
---

enable @typescript-eslint/no-unused-expressions
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ module.exports = {
'error',
{ argsIgnorePattern: '^_', ignoreRestSiblings: true },
],
'@typescript-eslint/no-unused-expressions': 'error',

'no-use-before-define': 0,

Expand Down
10 changes: 6 additions & 4 deletions examples/monaco-graphql-react-vite/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,22 +108,24 @@ export default function App() {
const variablesModel = getOrCreateModel('variables.json', defaultVariables);
const resultsModel = getOrCreateModel('results.json', '{}');

queryEditor ??
if (!queryEditor) {
setQueryEditor(
createEditor(opsRef, {
theme: 'vs-dark',
model: queryModel,
language: 'graphql',
}),
);
variablesEditor ??
}
if (!variablesEditor) {
setVariablesEditor(
createEditor(varsRef, {
theme: 'vs-dark',
model: variablesModel,
}),
);
resultsViewer ??
}
if (!resultsViewer) {
setResultsViewer(
createEditor(resultsRef, {
theme: 'vs-dark',
Expand All @@ -132,7 +134,7 @@ export default function App() {
smoothScrolling: true,
}),
);

}
queryModel.onDidChangeContent(
debounce(300, () => {
localStorage.setItem('operations', queryModel.getValue());
Expand Down
1 change: 0 additions & 1 deletion packages/graphiql-react/src/utility/resize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ export function useDragResize({
if (!Number.isFinite(flex) || flex < 1) {
firstRef.current.style.flex = '1';
}
firstRef.current.style.flex;
}
}, []);

Expand Down
4 changes: 3 additions & 1 deletion packages/graphql-language-service-server/src/GraphQLCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,9 @@ export class GraphQLCache implements GraphQLCacheInterface {
const schemaKey = this._getSchemaCacheKeyForProject(
projectConfig,
) as string;
schemaKey && this._schemaMap.delete(schemaKey);
if (schemaKey) {
this._schemaMap.delete(schemaKey);
}
}

_getSchemaCacheKeyForProject(
Expand Down

0 comments on commit d502a33

Please sign in to comment.