UNPKG

@viclafouch/eslint-config-viclafouch

Version:

ESLint and Prettier Config from Victor de la Fouchardiere

34 lines (30 loc) 1.14 kB
import pluginReact from 'eslint-plugin-react' import pluginReactHooks from 'eslint-plugin-react-hooks' import globals from 'globals' /** * @type {import("eslint").Linter.Config} */ export default { name: 'react-hooks', plugins: { 'react-hooks': pluginReactHooks }, languageOptions: { ...pluginReact.configs.flat.recommended.languageOptions, globals: { ...globals.serviceworker } }, rules: { // Enforce Rules of Hooks // https://github.com/facebook/react/blob/c11015ff4f610ac2924d1fc6d569a17657a404fd/packages/eslint-plugin-react-hooks/src/RulesOfHooks.js 'react-hooks/rules-of-hooks': 'error', // Verify the list of the dependencies for Hooks like useEffect and similar // https://github.com/facebook/react/blob/1204c789776cb01fbaf3e9f032e7e2ba85a44137/packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js 'react-hooks/exhaustive-deps': 'error', // Prefer to have a convention for naming states // E.g: [thing, setThing] // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md 'react/hook-use-state': 'error' } }