From 192f1d948850d0217d1f3e571faa1e6ce5184ff5 Mon Sep 17 00:00:00 2001 From: Szymon Brud Date: Sat, 24 Feb 2024 00:43:05 +0100 Subject: [PATCH] feature: add react-hooks plugin for eslint --- .eslintrc.js | 4 +++- package.json | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index d57d989..ec43e8e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -12,9 +12,11 @@ module.exports = { ecmaVersion: 'latest', sourceType: 'module', }, - plugins: ['react', 'simple-import-sort'], + plugins: ['react', 'simple-import-sort', 'react-hooks'], rules: { 'simple-import-sort/imports': 'error', + 'react-hooks/rules-of-hooks': 'error', + 'react-hooks/exhaustive-deps': 'warn', }, globals: { module: true, diff --git a/package.json b/package.json index 539be3b..df92687 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.1.3", "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-simple-import-sort": "^12.0.0", "husky": "^8.0.0", "jest-junit": "^16.0.0", @@ -61,6 +62,8 @@ ] }, "jest": { - "coverageReporters": ["jest-junit"] + "coverageReporters": [ + "jest-junit" + ] } }