Skip to content

Commit bb8278d

Browse files
saul-atomrigsTkDodo
andauthoredOct 4, 2024··
fix(eslint-plugin-query): update deprecated getSourceCode() method (#8117)
* fix(eslint-plugin-query): update deprecated `getSourceCode()` method * chore: add eslint-disable --------- Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
1 parent 05924f4 commit bb8278d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎packages/eslint-plugin-query/src/rules/stable-query-client/stable-query-client.rule.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ export const rule = createRule({
6868
return
6969
}
7070

71-
const nodeText = context.getSourceCode().getText(node)
71+
// we need the fallbacks for backwards compat with eslint < 8.37.0
72+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
73+
const sourceCode = context.sourceCode ?? context.getSourceCode()
74+
const nodeText = sourceCode.getText(node)
7275
const variableName = parent.id.name
7376

7477
return (fixer: TSESLint.RuleFixer) => {

0 commit comments

Comments
 (0)
Please sign in to comment.