Skip to content

Conversation

@christopher-buss
Copy link
Contributor

@christopher-buss christopher-buss commented Nov 9, 2025

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Docs
  • Test
  • New Binding issue #___
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes, and the changes were approved in issue #___
  • No

Checklist

  • When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • I have added a convincing reason for adding this feature, if necessary

Other information

Summary

Implements the safeDefaultProps option for the no-unstable-default-props rule to allow listing framework-specific value-type constructors and factory methods that are safe to use in default props.

Testing

  • Added 6 new valid test cases covering the new option functionality
  • Added 3 new invalid test cases ensuring non-allowlisted items still fail
  • Total: 32 tests for this rule (up from 28)
  • Full suite: All 2809 tests pass with no regressions
  • Backward compatible: default behavior unchanged when option not set

Examples

// ✅ Allowed with safeDefaultProps: ["Vector3"]
function MyComponent({ position = new Vector3(0, 0, 0) }) {
  return <div />;
}

// ❌ Still fails - not in allowlist
function MyComponent({ obj = {} }) {
  return <div />;
}

Configuration

{
  "@eslint-react/no-unstable-default-props": ["error", {
    "safeDefaultProps": ["Vector3", "vector", "Color3", "/^Immutable.*/"]
  }]
}

@vercel
Copy link

vercel bot commented Nov 9, 2025

@christopher-buss is attempting to deploy a commit to the Rel1cx's projects Team on Vercel.

A member of the Team first needs to authorize it.

@christopher-buss christopher-buss force-pushed the feature/allowable-default-props branch from 9cadef9 to 09983fd Compare November 9, 2025 13:19
@vercel
Copy link

vercel bot commented Nov 9, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
eslint-react Ready Ready Preview Comment Nov 9, 2025 11:17pm

Copy link
Owner

@Rel1cx Rel1cx left a comment

Choose a reason for hiding this comment

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

LGTM.

@Rel1cx Rel1cx merged commit 1643c00 into Rel1cx:main Nov 10, 2025
8 checks passed
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.

2 participants