Skip to content

feat: add no-inline-object-props performance rule#30

Open
theakshaymore wants to merge 1 commit intomillionco:mainfrom
theakshaymore:main
Open

feat: add no-inline-object-props performance rule#30
theakshaymore wants to merge 1 commit intomillionco:mainfrom
theakshaymore:main

Conversation

@theakshaymore
Copy link

Summary

Adds a new performance rule no-inline-object-props that detects inline object and array literals passed directly as JSX props.

Problem

When objects or arrays are created inline as JSX props, a new reference is created on every render. This causes unnecessary re-renders of child components even when the actual data hasn't changed — a common and silent React performance issue.

Example

❌ Bad — new reference created on every render

<Component style={{ color: 'red' }} />
<Component data={[1, 2, 3]} />
<Component config={{ theme: 'dark', size: 'lg' }} />

✅ Good — stable reference, no unnecessary re-renders

const style = { color: 'red' };
<Component style={style} />

Changes

  • Added rule visitor in performance.ts
  • Registered rule in index.ts
  • Added severity (warn) in oxlint-config.ts
  • Added category mapping and help text in run-oxlint.ts
  • Added test coverage in run-oxlint.test.ts

Validation

  • All 81 tests pass (pnpm --filter react-doctor test)
  • Typecheck passes
  • Build passes
  • Rule emits 7 diagnostics on fixture with correct severity/category

Detects inline object/array literals passed directly as JSX props which
create new references on every render causing unnecessary re-renders.

- Added rule visitor in performance.ts
- Registered in index.ts
- Added severity (warn) in oxlint-config.ts
- Added category mapping and help text in run-oxlint.ts
- Added test coverage in run-oxlint.test.ts
@vercel
Copy link

vercel bot commented Feb 18, 2026

@theakshaymore is attempting to deploy a commit to the Million Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant