eslint-plugin-react-helpers
Advanced tools
Comparing version 0.0.0 to 0.1.0
@@ -1,3 +0,5 @@ | ||
# Disallows named function in useEffect hooks (`no-named-useeffect-functions`) | ||
# Disallows named function in useEffect hooks (`react-helpers/no-named-useeffect-functions`) | ||
<!-- end auto-generated rule header --> | ||
Please describe the origin of the rule here. | ||
@@ -4,0 +6,0 @@ |
@@ -42,3 +42,3 @@ /** | ||
CallExpression(node) { | ||
if (node.callee.name === 'useEffect') { | ||
if (node.callee && node.callee.name === 'useEffect') { | ||
if (node.arguments.length > 0) { | ||
@@ -45,0 +45,0 @@ const inputFunction = node.arguments[0]; |
{ | ||
"name": "eslint-plugin-react-helpers", | ||
"version": "0.0.0", | ||
"version": "0.1.0", | ||
"description": "A set of react eslint rules", | ||
@@ -21,2 +21,3 @@ "keywords": [ | ||
"dependencies": { | ||
"eslint-plugin-react-helpers": "^0.0.0", | ||
"requireindex": "^1.2.0" | ||
@@ -23,0 +24,0 @@ }, |
@@ -37,3 +37,3 @@ # eslint-plugin-react-helpers | ||
"rules": { | ||
"react-helpers/rule-name": 2 | ||
"react-helpers/prefer-use-state-lazy-initialization": 2 | ||
} | ||
@@ -46,5 +46,10 @@ } | ||
<!-- begin auto-generated rules list --> | ||
TODO: Run eslint-doc-generator to generate the rules list. | ||
| Name | Description | | ||
| :----------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | ||
| [no-named-useeffect-functions](docs/rules/no-named-useeffect-functions.md) | Disallows named function in useEffect hooks | | ||
| [prefer-use-state-lazy-initialization](docs/rules/prefer-use-state-lazy-initialization.md) | Detects function calls in useState and suggests using lazy initialization instead. | | ||
<!-- end auto-generated rules list --> | ||
@@ -38,3 +38,3 @@ /** | ||
code: "useEffect(function myUseEffect() {})", | ||
errors: [{ message: "Please do not name useEffect input functions.", type: "CallExpression" }], | ||
errors: [{ message: rule.meta.messages.namedUseEffect, type: "CallExpression" }], | ||
}, | ||
@@ -50,5 +50,5 @@ { | ||
`, | ||
errors: [{ message: "Please do not name useEffect input functions.", type: "CallExpression" }], | ||
errors: [{ message: rule.meta.messages.namedUseEffect, type: "CallExpression" }], | ||
}, | ||
], | ||
}); |
13615
15
223
54
3
+ Addedeslint-plugin-react-helpers@0.0.0(transitive)