Skip to content

Commit 36cbee1

Browse files
feat: Added useEffect rule for ESLint (#140)
Added rule that leads to the docs explaining why you should not use an useEffect
1 parent 891c1f8 commit 36cbee1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

config/eslintrc.template.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,13 @@ module.exports = ({ tsconfigRootDir, optimizeImports = true }) => ({
4646
'no-nested-ternary': 'off',
4747
'no-return-assign': 'warn',
4848
'no-restricted-exports': 'off',
49-
'no-restricted-syntax': 'off',
49+
'no-restricted-syntax': [
50+
'warn',
51+
{
52+
selector: "MemberExpression[object.name='React'][property.name='useEffect']",
53+
message: 'You Might Not Need an Effect\nhttps://react.dev/learn/you-might-not-need-an-effect',
54+
},
55+
],
5056
'no-plusplus': 'off',
5157
'no-prototype-builtins': 'warn',
5258
'no-minusminus': 'off',

0 commit comments

Comments
 (0)