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 2.0.1 to 2.1.0

lib/rules/jsx-jcs-no-undef.js

5

CHANGELOG.md

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

## v2.1.0
### Added
- Added `jsx-jcs-no-undef` rule that replaces the built-in `no-undef` rule with one that is tolerant of variables expressed in `<For>`.
## v2.0.1

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

33

index.js
"use strict";
module.exports = {
environments: {
"jsx-control-statements": {
globals: {
"If": true,
"Else": true,
"For": true,
"When": true,
"Choose": true,
"Otherwise": true
}
}
},
rules: {

@@ -11,4 +23,23 @@ "jsx-choose-not-empty": require("./lib/rules/jsx-choose-not-empty"),

"jsx-use-if-tag": require("./lib/rules/jsx-use-if-tag"),
"jsx-when-require-condition": require("./lib/rules/jsx-when-require-condition")
"jsx-when-require-condition": require("./lib/rules/jsx-when-require-condition"),
"jsx-jcs-no-undef": require("./lib/rules/jsx-jcs-no-undef")
},
configs: {
recommended: {
env: {
"jsx-control-statements/jsx-control-statements": true
},
rules: {
"jsx-control-statements/jsx-choose-not-empty": 1,
"jsx-control-statements/jsx-for-require-each": 1,
"jsx-control-statements/jsx-for-require-of": 1,
"jsx-control-statements/jsx-if-require-condition": 1,
"jsx-control-statements/jsx-otherwise-once-last": 1,
"jsx-control-statements/jsx-use-if-tag": 1,
"jsx-control-statements/jsx-when-require-condition": 1,
"jsx-control-statements/jsx-jcs-no-undef": 1,
"no-undef": 0
}
}
}
};

2

lib/rules/jsx-use-if-tag.js

@@ -20,3 +20,3 @@ /**

if (node.alternate.type === "JSXElement" || node.consequent.type === "JSXElement") {
context.report(node, "Ternary opertor used. Use 'If' tag instead.");
context.report(node, "Ternary operator used. Use 'If' tag instead.");
}

@@ -23,0 +23,0 @@ }

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

@@ -39,3 +39,6 @@ "description": "jsx-control-statements specific linting rules for ESLint",

"license": "MIT",
"dependencies": {}
"dependencies": {},
"peerDependencies": {
"eslint": ">=0.8.0"
}
}
# ESLint-plugin-JSX-control-statements
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][deps-image]][deps-url] [![Coverage Status][coverage-image]][coverage-url] [![Code Climate][climate-image]][climate-url]
[![NPM version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]
[![Dependency Status][deps-image]][deps-url]
[![Coverage Status][coverage-image]][coverage-url]
[![Code Climate][climate-image]][climate-url]

@@ -19,6 +23,6 @@ ## Installation

# Configuration
## Configuration (Simple)
Add `plugins` section and specify ESLint-plugin-JSX-Control-Statements as a plugin.
Also add `If`, `Else` and `For` to globals.
Add `plugins` section and specify ESLint-plugin-JSX-Control-Statements as a plugin and plugin:jsx-control-statements/recommended
to "extends"

@@ -30,7 +34,3 @@ ```json

],
"globals": {
"If": true,
"Else": true,
"For": true
}
"extends": ["plugin:jsx-control-statements/recommended"]
}

@@ -49,5 +49,6 @@ ```

Finally, enable all of the rules that you would like to use.
## Configuration (Advanced)
The plugin comes with a number of rules and an environment that sets the control statements (`<If>`, `<For>` etc) as global variables:
```json
```js
{

@@ -61,3 +62,8 @@ "rules": {

"jsx-control-statements/jsx-use-if-tag": 1,
"jsx-control-statements/jsx-when-require-condition": 1
"jsx-control-statements/jsx-when-require-condition": 1,
"jsx-control-statements/jsx-jcs-no-undef": 1,
"no-undef": 0 // Replace this with jsx-jcs-no-undef
},
env: {
"jsx-control-statements/jsx-control-statements": true
}

@@ -75,2 +81,3 @@ }

* [jsx-when-require-condition](docs/rules/jsx-when-require-condition.md): Warn if `When` tag is missing `condition` attribute.
* [jsx-jcs-no-undef](docs/rules/jsx-jcs-no-undef.md): Replaces the built-in `no-undef` rule with one that is tolerant of variables expressed in `<For>` (`each` and `index` attributes). Note that to stop getting errors from `no-undef` you have to turn it off and this on.

@@ -81,3 +88,2 @@ ## Credits

## License
[MIT License](http://www.opensource.org/licenses/mit-license.php). Copyright(c) [Vivek Kumar Bansal](http://vkbansal.me/)

@@ -84,0 +90,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