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 1.1.0 to 2.0.0

8

CHANGELOG.md

@@ -12,2 +12,10 @@ # Changelog

## master
### Removed
- removed `jsx-for-single-child` (Multiple children are now supported).
- removed `jsx-if-single-child` (Multiple children are now supported).
- removed `jsx-for-require-index`.
- removed `lodash` dependency.
## v1.0.2

@@ -14,0 +22,0 @@

3

index.js

@@ -7,7 +7,4 @@ "use strict";

"jsx-for-require-each": require("./lib/rules/jsx-for-require-each"),
"jsx-for-require-index": require("./lib/rules/jsx-for-require-index"),
"jsx-for-require-of": require("./lib/rules/jsx-for-require-of"),
"jsx-for-single-child": require("./lib/rules/jsx-for-single-child"),
"jsx-if-require-condition": require("./lib/rules/jsx-if-require-condition"),
"jsx-if-single-child": require("./lib/rules/jsx-if-single-child"),
"jsx-otherwise-once-last": require("./lib/rules/jsx-otherwise-once-last"),

@@ -14,0 +11,0 @@ "jsx-use-if-tag": require("./lib/rules/jsx-use-if-tag"),

@@ -16,3 +16,3 @@ /**

function isWhenComponent(child) {
return child.type === 'JSXElement' && child.openingElement.name.name === 'When';
return child.type === "JSXElement" && child.openingElement.name.name === "When";
}

@@ -19,0 +19,0 @@

@@ -8,4 +8,3 @@ /**

var utils = require("../utils"),
_ = require("lodash");
var utils = require("../utils");

@@ -18,3 +17,3 @@ //------------------------------------------------------------------------------

function eachAttr(decl) {
return utils.isAttr(decl, 'each');
return utils.isAttr(decl, "each");
}

@@ -29,3 +28,4 @@

var attributes = node.attributes,
attr = _.find(attributes, eachAttr);
attrIdx = attributes.findIndex(eachAttr),
attr = attributes[attrIdx];

@@ -32,0 +32,0 @@ if (!utils.isForComponent(node)) return;

@@ -16,3 +16,3 @@ /**

function hasOfAttr(decl) {
return utils.isAttr(decl, 'of');
return utils.isAttr(decl, "of");
}

@@ -19,0 +19,0 @@

@@ -16,3 +16,3 @@ /**

function hasConditionAttr(decl) {
return utils.isAttr(decl, 'condition');
return utils.isAttr(decl, "condition");
}

@@ -19,0 +19,0 @@

@@ -16,3 +16,3 @@ /**

function isOtherwiseComponent(child) {
return child.type === 'JSXElement' && child.openingElement.name.name === 'Otherwise';
return child.type === "JSXElement" && child.openingElement.name.name === "Otherwise";
}

@@ -19,0 +19,0 @@

@@ -16,3 +16,3 @@ /**

function hasConditionAttr(decl) {
return utils.isAttr(decl, 'condition');
return utils.isAttr(decl, "condition");
}

@@ -19,0 +19,0 @@

@@ -19,3 +19,3 @@ "use strict";

function isAttr(decl, name) {
if (decl.type === 'JSXSpreadAttribute') {
if (decl.type === "JSXSpreadAttribute") {
return false;

@@ -22,0 +22,0 @@ }

{
"name": "eslint-plugin-jsx-control-statements",
"version": "1.1.0",
"version": "2.0.0",
"author": "Vivek Kumar Bansal <vkb0310@gmail.com>",

@@ -25,8 +25,7 @@ "description": "jsx-control-statements specific linting rules for ESLint",

"devDependencies": {
"babel-eslint": "^5.0.0-beta4",
"coveralls": "^2.11.4",
"eslint": "^1.10.2",
"eslint-config-vkbansal": "^0.1.2",
"istanbul": "^0.4.1",
"mocha": "^2.3.4"
"coveralls": "^2.11.6",
"eslint": "^2.0.0",
"eslint-config-vkbansal": "^1.0.0",
"istanbul": "^0.4.2",
"mocha": "^2.4.5"
},

@@ -41,5 +40,3 @@ "keywords": [

"license": "MIT",
"dependencies": {
"lodash": "^3.10.1"
}
"dependencies": {}
}

@@ -22,3 +22,3 @@ # ESLint-plugin-JSX-control-statements

Add `plugins` section and specify ESLint-plugin-JSX-Control-Statements as a plugin.
Also add `If` and `For` to globals.
Also add `If`, `Else` and `For` to globals.

@@ -32,2 +32,3 @@ ```json

"If": true,
"Else": true,
"For": true

@@ -55,7 +56,4 @@ }

"jsx-control-statements/jsx-for-require-each": 1,
"jsx-control-statements/jsx-for-require-index": 1,
"jsx-control-statements/jsx-for-require-of": 1,
"jsx-control-statements/jsx-for-single-child": 1,
"jsx-control-statements/jsx-if-require-condition": 1,
"jsx-control-statements/jsx-if-single-child": 1,
"jsx-control-statements/jsx-otherwise-once-last": 1,

@@ -71,7 +69,4 @@ "jsx-control-statements/jsx-use-if-tag": 1,

* [jsx-for-require-each](docs/rules/jsx-for-require-each.md): Warn if `For` tag is missing `each` attribute. And also marks the variable as defined.
* [jsx-for-require-index](docs/rules/jsx-for-require-index.md): Warn if `For` tag is missing `index` attribute. And also marks the variable as defined.
* [jsx-for-require-of](docs/rules/jsx-for-require-of.md): Warn if `For` tag is missing `of` attribute.
* [jsx-for-single-child](docs/rules/jsx-for-single-child.md): Warn if `For` tags does not have single child.
* [jsx-if-require-condition](docs/rules/jsx-if-require-condition.md): Warn if `If` tag is missing `condition` attribute.
* [jsx-if-single-child](docs/rules/jsx-if-single-child.md): Warn if `If` and `Else` tags does not have single child.
* [jsx-otherwise-once-last](docs/rules/jsx-otherwise-once-last.md): Warn when `Otherwise` tag is used more than once inside `Choose` and is not last child.

@@ -78,0 +73,0 @@ * [jsx-use-if-tag](docs/rules/jsx-use-if-tag.md): Use `If` tag instead of ternary operator.

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