Skip to content

Commit

Permalink
fix: use sourceCode by default instead of deprecated getSourceCode to
Browse files Browse the repository at this point in the history
resolve a crash with eslint 9
  • Loading branch information
stephen-pearce committed Oct 2, 2024
1 parent 8b41fb1 commit 23732df
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions flow/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ export type ESLintContext = {
getSourceCode: () => {
text: string,
},
sourceCode: {
text: string,
},
};
4 changes: 2 additions & 2 deletions src/rules/has-valid-accessibility-ignores-invert-colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ module.exports = {
verifyReactNativeImage,
},

create: ({ options, report, getSourceCode }: ESLintContext) => {
create: ({ options, report, getSourceCode, sourceCode }: ESLintContext) => {
/**
* 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
* */
const { text } = getSourceCode();
const { text } = sourceCode || getSourceCode();
const { enableLinting, elementsToCheck } = verifyReactNativeImage(text);

// Add in any other invertible components to check for
Expand Down
3 changes: 3 additions & 0 deletions src/util/isTouchable.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export default function isTouchable(
getSourceCode: () => ({
text: '',
}),
sourceCode: {
text: '',
},
}
) {
const { options } = context;
Expand Down

0 comments on commit 23732df

Please sign in to comment.