Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-jsx-control-statements

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-jsx-control-statements - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

18

lib/rules/jsx-if-single-child.js

@@ -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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc