Install
Terminal
npm install --save-dev @eslint-react/eslint-pluginSetup
.eslintrc.js
module.exports = {
// ...
parser: "@typescript-eslint/parser",
extends: [
// ...
"plugin:@eslint-react/recommended-legacy",
],
};Linting with type information
Rules that require type information are not enabled by default.
To enable them, you need to set the project option in parserOptions to the path of your tsconfig.json file.
Then, you can enable the rules that require type information.
.eslintrc.js
module.exports = {
// ...
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.json", // <-- Point to your project's "tsconfig.json" or create a new one.
},
extends: ["plugin:@eslint-react/recmmended-legacy"],
rules: {
// ...
"@eslint-react/no-leaked-conditional-rendering": "error", // <-- Requires type information
},
// ...
};