Skip to content

Commit

Permalink
Fix: Eslint 9 crash in has-valid-accessibility-ignores-invert-colors (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
stephen-pearce authored Oct 15, 2024
1 parent 8b41fb1 commit b945d94
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/odd-steaks-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'eslint-plugin-react-native-a11y': patch
---

Fix for has-valid-accessibility-ignores-invert-colors with eslint 9
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 b945d94

Please sign in to comment.