-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enable @typescript-eslint/no-unused-expressions
rule
#2933
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,22 +108,24 @@ export default function App() { | |
const variablesModel = getOrCreateModel('variables.json', defaultVariables); | ||
const resultsModel = getOrCreateModel('results.json', '{}'); | ||
|
||
queryEditor ?? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it seems the eslint rule doesn't recognize these valid expressions though? Though this style isn't very clear, but this code works as intended? (addressed by this suggestion: https://github.com/graphql/graphiql/pull/2933/files#r1038468647) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it’s a valid, code works as intended, but refactoring to use |
||
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', | ||
|
@@ -132,7 +134,7 @@ export default function App() { | |
smoothScrolling: true, | ||
}), | ||
); | ||
|
||
} | ||
queryModel.onDidChangeContent( | ||
debounce(300, () => { | ||
localStorage.setItem('operations', queryModel.getValue()); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -665,7 +665,9 @@ export class GraphQLCache implements GraphQLCacheInterface { | |
const schemaKey = this._getSchemaCacheKeyForProject( | ||
projectConfig, | ||
) as string; | ||
schemaKey && this._schemaMap.delete(schemaKey); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a valid expression as well? confused There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It’s valid but with |
||
if (schemaKey) { | ||
this._schemaMap.delete(schemaKey); | ||
} | ||
} | ||
|
||
_getSchemaCacheKeyForProject( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this config change would validate a few false negatives and perhaps reveal a few more issues:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would still like to have
allowShortCircuit: false
since it will forbid code style in favour ofif
statements, but if you dislike just click on theCommit suggestion
😜