Skip to content
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

EC505 avoid keep awake (react-native hook and function) #45

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

FanchGadjo
Copy link

No description provided.

Identifier(node) {
if (
node?.name === "useKeepAwake" &&
node?.parent.type === "CallExpression"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you could check that this method comes from expo-keep-awake? This would prevent false positives if a developer uses this name in this JavaScript code

) {
context.report({ node, messageId: "AvoidKeepAwake" });
} else if (
node?.name === "activateKeepAwake" &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment for this method


```js
export default function KeepAwakeExample() {
useKeepAwake(); // Non compliant
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that you should also include the expo-keep-awake dependency in exemple codes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏆 challenge 🏆 Work done during the ecoCode Challenge 🗃️ rule Impacts a rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants