Skip to content

False positive unused-file for Expo local config plugins referenced by string path #468

@wcastand

Description

@wcastand

Summary

React Review reports local Expo config plugins as unused-file when they are referenced from app.config.ts via Expo's documented string-path plugin syntax.

What happened

In an Expo SDK 56 app, app.config.ts uses local config plugins like this:

export default (): ExpoConfig => ({
  plugins: [
    "./plugins/android-secure-flag.plugin.ts",
    "./plugins/android-faster-startup-no-bundle.ts",
    "./plugins/android-day-night-theme.ts",
    "./plugins/android-res-config.ts",
  ],
})

React Review flagged each target plugin file:

plugins/android-day-night-theme.ts:0
Unused file — not reachable from any entry point
Rule: unused-file

plugins/android-faster-startup-no-bundle.ts:0
Unused file — not reachable from any entry point
Rule: unused-file

plugins/android-res-config.ts:0
Unused file — not reachable from any entry point
Rule: unused-file

plugins/android-secure-flag.plugin.ts:0
Unused file — not reachable from any entry point
Rule: unused-file

These files are not unused from Expo's perspective: Expo resolves and runs local config plugins listed by string path in the plugins array.

Why this seems like a false positive

Expo docs show local config plugins being added by path in app config:

plugins: [
  ["./plugins/withPlugin.ts"],
]

The app validates successfully:

npx expo config --json
npx expo config --type introspect --json

Native builds also pass:

cd android && ./gradlew :app:assembleDebug
bun ios -- --device generic --no-bundler --no-install

Expected behavior

unused-file should treat local Expo config plugin string paths in app.config.ts / app.config.js / app.json as reachability edges, so the plugin implementation files are not reported as unused.

Notes

I searched existing issues for combinations of unused-file, Expo, config plugin, and app.config.ts and did not find an existing report.

Interestingly, running the local CLI did not reproduce the exact unused-file warnings for me:

npx react-doctor@latest --verbose --diff --offline --fail-on none

This returned only unrelated warnings in changed React UI files, while React Review in the PR reported the four unused-file warnings above. So this may be specific to the React Review environment or to the dead-code/reachability pass used there.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions