react/jsx-no-bind
eslint-plugin-react
No autofix
eslint.config.js
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/jsx-no-bind": "error",
},
},
];<Foo onClick={this._handleClick.bind(this)}></Foo><Foo onClick={() => console.log('Hello!')}></Foo>function onClick() { console.log('Hello!'); }
<Foo onClick={onClick} /><Foo onClick={this._handleClick}></Foo>Examples from the ESLint documentation.
react/jsx-no-bind
eslint-plugin-react
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/jsx-no-bind": "error",
},
},
];Oxlint does not have this rule.
performance/noJsxPropsBind
performance · since 2.3.11
{
"linter": {
"rules": {
"performance": {
"noJsxPropsBind": "error"
}
}
}
}Enforce shorthand or standard form for React fragments
Disallow file extensions that may contain JSX
Disallow usage of setState in componentDidUpdate
Disallow creating unstable components inside components
Disallow unnecessary JSX expressions when literals alone are sufficient or enforce JSX expressions on literals in JSX children or attributes