eslint-plugin-jsx-control-statements
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -23,9 +23,17 @@ /** | ||
function hasSingleChild(node) { | ||
var children = node.parent.children; | ||
function filterChildren(children) { | ||
return children.filter(function(c) { | ||
if (c.type === "JSXElement") return true; | ||
return children.length && children.length === 1 | ||
&& ["JSXElement", "Literal"].indexOf(children[0].type) > -1; | ||
if (c.type === "Literal") return c.value.trim() !== ""; | ||
return false; | ||
}); | ||
} | ||
function hasSingleChild(node) { | ||
var children = filterChildren(node.parent.children); | ||
return children.length && children.length === 1; | ||
} | ||
function hasElseCondition(node) { | ||
@@ -40,3 +48,3 @@ var children = node.parent.children; | ||
function hasSingleChildrenBetween(node) { | ||
var children = node.parent.children; | ||
var children = filterChildren(node.parent.children); | ||
@@ -43,0 +51,0 @@ return children.length |
{ | ||
"name": "eslint-plugin-jsx-control-statements", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"author": "Vivek Kumar Bansal <vkb0310@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "jsx-control-statements specific linting rules for ESLint", |
@@ -16,3 +16,3 @@ # ESLint-plugin-JSX-control-statements | ||
```sh | ||
$ npm install eslint-plugin-react | ||
$ npm install eslint-plugin-jsx-control-statements | ||
``` | ||
@@ -22,3 +22,3 @@ | ||
Add `plugins` section and specify ESLint-plugin-React as a plugin. | ||
Add `plugins` section and specify ESLint-plugin-JSX-Control-Statements as a plugin. | ||
@@ -59,2 +59,5 @@ ```json | ||
## Credits | ||
Thanks to @yannickcr for his awesome [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react). | ||
## License | ||
@@ -61,0 +64,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7443
95
79