Files
zendegi/packages/eslint-config/react.js

39 lines
1.0 KiB
JavaScript

import jsxA11y from "eslint-plugin-jsx-a11y";
import react from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
import baseConfig from "./base.js";
export default [
...baseConfig,
{
files: ["**/*.tsx", "**/*.jsx"],
...react.configs.flat.recommended,
...react.configs.flat["jsx-runtime"],
settings: {
react: { version: "detect" },
},
rules: {
...react.configs.flat.recommended.rules,
...react.configs.flat["jsx-runtime"].rules,
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
},
},
{
files: ["**/*.tsx", "**/*.jsx"],
plugins: { "react-hooks": reactHooks },
rules: {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
},
},
{
files: ["**/*.tsx", "**/*.jsx"],
...jsxA11y.flatConfigs.recommended,
rules: {
...jsxA11y.flatConfigs.recommended.rules,
"jsx-a11y/label-has-associated-control": ["error", { assert: "either" }],
},
},
];