react/jsx-no-literals
eslint-plugin-react
No autofix
eslint.config.js
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/jsx-no-literals": "error",
},
},
];var Hello = <div>test</div>;var Hello = <div>{'test'}</div>;var Hello = <div>
{'test'}
</div>;Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
react/jsx-no-literals
eslint-plugin-react
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/jsx-no-literals": "error",
},
},
];react/jsx-no-literals
react plugin · restriction
{
"plugins": [
"react"
],
"rules": {
"react/jsx-no-literals": "error"
}
}style/noJsxLiterals
style · since 2.2.4
{
"linter": {
"rules": {
"style": {
"noJsxLiterals": "error"
}
}
}
}Enforce using onChange or readonly attribute when checked is used
Require all forwardRef components include a ref parameter
Ensure destructuring and symmetric naming of useState hook value and setter variables