Skip to content

Commit 23732df

Browse files
author
Stephen Pearce
committed
fix: use sourceCode by default instead of deprecated getSourceCode to
resolve a crash with eslint 9
1 parent 8b41fb1 commit 23732df

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

flow/eslint.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@ export type ESLintContext = {
1313
getSourceCode: () => {
1414
text: string,
1515
},
16+
sourceCode: {
17+
text: string,
18+
},
1619
};

src/rules/has-valid-accessibility-ignores-invert-colors.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ module.exports = {
8585
verifyReactNativeImage,
8686
},
8787

88-
create: ({ options, report, getSourceCode }: ESLintContext) => {
88+
create: ({ options, report, getSourceCode, sourceCode }: ESLintContext) => {
8989
/**
9090
* Checks to see if there are valid imports and if so verifies that those imports related to 'react-native' or if a custom module exists
9191
* */
92-
const { text } = getSourceCode();
92+
const { text } = sourceCode || getSourceCode();
9393
const { enableLinting, elementsToCheck } = verifyReactNativeImage(text);
9494

9595
// Add in any other invertible components to check for

src/util/isTouchable.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ export default function isTouchable(
2727
getSourceCode: () => ({
2828
text: '',
2929
}),
30+
sourceCode: {
31+
text: '',
32+
},
3033
}
3134
) {
3235
const { options } = context;

0 commit comments

Comments
 (0)