
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
eslint-plugin-jsx-control-statements
Advanced tools
jsx-control-statements specific linting rules for ESLint
Install ESLint either locally or globally.
$ npm install eslint
If you installed ESLint
globally, you have to install React plugin globally too. Otherwise, install it locally.
$ npm install eslint-plugin-jsx-control-statements
Add plugins
section and specify ESLint-plugin-JSX-Control-Statements as a plugin and plugin:jsx-control-statements/recommended
to "extends"
{
"plugins": [
"jsx-control-statements"
],
"extends": ["plugin:jsx-control-statements/recommended"]
}
If it is not already the case you must also configure ESLint
to support JSX.
{
"ecmaFeatures": {
"jsx": true
}
}
The plugin comes with a number of rules and an environment that sets the control statements (<If>
, <For>
etc) as global variables:
{
"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 // Replace this with jsx-jcs-no-undef
},
env: {
"jsx-control-statements/jsx-control-statements": true
}
}
Choose
tag is empty or does not have at least one When
tag as child.For
tag is missing each
attribute. And also marks the variable as defined.For
tag is missing of
attribute.If
tag is missing condition
attribute.Otherwise
tag is used more than once inside Choose
and is not last child.If
tag instead of ternary operator.When
tag is missing condition
attribute.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.Thanks to @yannickcr for his awesome eslint-plugin-react.
MIT License. Copyright(c) Vivek Kumar Bansal
v2.1.0
jsx-jcs-no-undef
rule that replaces the built-in no-undef
rule with one that is tolerant of variables expressed in <For>
.FAQs
jsx-control-statements specific linting rules for ESLint
The npm package eslint-plugin-jsx-control-statements receives a total of 15,167 weekly downloads. As such, eslint-plugin-jsx-control-statements popularity was classified as popular.
We found that eslint-plugin-jsx-control-statements demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.