Skip to content

fix(rn-prefer-reanimated): stay silent when every Animated call uses the native driver - #1790

Open
aidenybai wants to merge 1 commit into
mainfrom
devin/1789027038-rn-prefer-reanimated-native-driver
Open

aidenybai wants to merge 1 commit into
mainfrom
devin/1789027038-rn-prefer-reanimated-native-driver

Conversation

@aidenybai

Copy link
Copy Markdown
Member

Summary

Closes #1784. rn-prefer-reanimated fired on any value import of Animated from react-native, so a file whose only animation was Animated.loop(Animated.timing(opacity, { useNativeDriver: true })) was told its animation ran on the JS thread.

The rule now defers the Animated import diagnostic to Program:exit and only drops it when the file has static proof that everything runs natively:

// per CallExpression: Animated.(timing|spring|decay|event)(value, config)
//   receiver resolved via resolveImportedApiReference → { source: "react-native", importedName: "Animated" }
//   config resolved via resolveConstIdentifierAlias (so `const FADE = { ..., useNativeDriver: true }` counts)
isNativeDriverConfig(config) ? hasNativeDriverAnimation = true : hasJsThreadAnimation = true;

// Program:exit
if (hasNativeDriverAnimation && !hasJsThreadAnimation) return; // otherwise report each Animated specifier as before

Boundaries kept deliberately tight:

  • Any timing/spring/decay/event with a missing, false, spread, or unresolvable useNativeDriver still marks the file JS-threaded, so one native call cannot exempt a JS-driven one in the same file.
  • A file that imports Animated but has no recognized config call keeps the existing import-level heuristic (still reports).
  • LayoutAnimation is unchanged and reports immediately.
  • Reanimated.timing(...) from react-native-reanimated is ignored (receiver must resolve to the react-native export).

Regression tests cover the issue repro, const-object config, aliased import with spring/event, false/missing driver, mixed native + JS in one file, and LayoutAnimation alongside a native Animated. Changeset added for oxlint-plugin-react-doctor.

Link to Devin session: https://app.devin.ai/sessions/3401e96268dc4245bf9a058d631ccc36
Open in Devin Desktop: https://app.devin.ai/desktop/session/3401e96268dc4245bf9a058d631ccc36?variant=devin
Requested by: @aidenybai

…the native driver

Closes #1784

Co-Authored-By: aiden@million.dev <aiden.bai05@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Original prompt from Aiden

fix latest rd issues and run ship skill on them

@pkg-pr-new

pkg-pr-new Bot commented Sep 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/eslint-plugin-react-doctor@1790
npm i https://pkg.pr.new/oxlint-plugin-react-doctor@1790
npm i https://pkg.pr.new/react-doctor@1790

commit: 5faece1

@github-actions

Copy link
Copy Markdown
Contributor

Interactive terminal E2E

Terminal Control verified the built CLI at 5faece1 in a real PTY:

  • selected a project interactively and observed Scanning... before the three-second Git delay completed
  • waited for the clean result and exercised the compact report
  • opened copy context and the GitHub Actions confirmation, then cancelled safely

Download the edited MP4 and PNG evidence

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rn-prefer-reanimated: native-driver opacity animation reported as JS-thread animation

1 participant