Is there an existing issue for this?
Description Overview
Brief description
The react/no-object-type-as-default-prop does not run when a component has a ref prop as a second argument.
Show example of your code (as text format), add images/videos/gifs to help explain example
Both of these components should error because an object type is used as a default prop.
However, the second component (with a ref) does not error.
const ErrorIsShown = ({ foo = {} }) => null;
const ErrorIsAbsent = ({ foo = {} }, ref) => null;

Link to repro: https://github.com/JulienR1/eslint-react-no-object-type-as-default-prop-repro
What command(s) did you run to reproduce issue?
npm run lint
# OR
eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0
// .eslintrc.cjs
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: ["plugin:react/recommended"],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parserOptions: { ecmaVersion: "latest", sourceType: "module" },
rules: {
"react/no-object-type-as-default-prop": "error",
"react/prop-types": "off",
},
};
Expected Behavior
Brief description
Components with ref props should also generate errors when using default object type props.

eslint-plugin-react version
v7.34.2
eslint version
v8.57.0
node version
v20.12.2
Is there an existing issue for this?
Description Overview
Brief description
The
react/no-object-type-as-default-propdoes not run when a component has arefprop as a second argument.Show example of your code (as text format), add images/videos/gifs to help explain example
Both of these components should error because an object type is used as a default prop.
However, the second component (with a ref) does not error.
Link to repro: https://github.com/JulienR1/eslint-react-no-object-type-as-default-prop-repro
What command(s) did you run to reproduce issue?
Expected Behavior
Brief description
Components with
refprops should also generate errors when using default object type props.eslint-plugin-react version
v7.34.2
eslint version
v8.57.0
node version
v20.12.2