eslint-plugin-react
Advanced tools
Comparing version 2.4.0 to 2.5.0
@@ -0,1 +1,12 @@ | ||
2.5.0 / 2015-06-04 | ||
================== | ||
* update dependencies | ||
* add option to make wrap-multilines more granular ([#94][] @PiPeep) | ||
* documentation improvements ([#92][] [#93][] @lencioni) | ||
[#94]: https://github.com/yannickcr/eslint-plugin-react/pull/94 | ||
[#92]: https://github.com/yannickcr/eslint-plugin-react/pull/92 | ||
[#93]: https://github.com/yannickcr/eslint-plugin-react/pull/93 | ||
2.4.0 / 2015-05-30 | ||
@@ -2,0 +13,0 @@ ================== |
@@ -8,2 +8,12 @@ /** | ||
// ------------------------------------------------------------------------------ | ||
// Constants | ||
// ------------------------------------------------------------------------------ | ||
var DEFAULTS = { | ||
declaration: true, | ||
assignment: true, | ||
return: true | ||
}; | ||
// ------------------------------------------------------------------------------ | ||
// Rule Definition | ||
@@ -37,2 +47,10 @@ // ------------------------------------------------------------------------------ | ||
function isEnabled(type) { | ||
var userOptions = context.options[0] || {}; | ||
if (({}).hasOwnProperty.call(userOptions, type)) { | ||
return userOptions[type]; | ||
} | ||
return DEFAULTS[type]; | ||
} | ||
// -------------------------------------------------------------------------- | ||
@@ -45,11 +63,17 @@ // Public | ||
VariableDeclarator: function(node) { | ||
check(node.init); | ||
if (isEnabled('declaration')) { | ||
check(node.init); | ||
} | ||
}, | ||
AssignmentExpression: function(node) { | ||
check(node.right); | ||
if (isEnabled('assignment')) { | ||
check(node.right); | ||
} | ||
}, | ||
ReturnStatement: function(node) { | ||
check(node.argument); | ||
if (isEnabled('return')) { | ||
check(node.argument); | ||
} | ||
} | ||
@@ -59,1 +83,10 @@ }; | ||
}; | ||
module.exports.schema = [{ | ||
type: 'object', | ||
properties: { | ||
declaration: {type: 'boolean'}, | ||
assignment: {type: 'boolean'}, | ||
return: {type: 'boolean'} | ||
} | ||
}]; |
{ | ||
"name": "eslint-plugin-react", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"author": "Yannick Croissant <yannick.croissant+npm@gmail.com>", | ||
@@ -28,4 +28,4 @@ "description": "React specific linting rules for ESLint", | ||
"coveralls": "2.11.2", | ||
"eslint": "0.21.2", | ||
"eslint-tester": "eslint/eslint-tester#c2a1f722cd", | ||
"eslint": "0.22.1", | ||
"eslint-tester": "0.7.0", | ||
"istanbul": "0.3.14", | ||
@@ -32,0 +32,0 @@ "mocha": "2.2.5" |
@@ -47,6 +47,6 @@ ESLint-plugin-React | ||
"react/jsx-boolean-value": 1, | ||
"react/jsx-no-undef": 1, | ||
"react/jsx-quotes": 1, | ||
"react/jsx-no-undef": 1, | ||
"react/jsx-sort-prop-types": 1, | ||
"react/jsx-sort-props": 1, | ||
"react/jsx-sort-prop-types": 1, | ||
"react/jsx-uses-react": 1, | ||
@@ -71,6 +71,6 @@ "react/jsx-uses-vars": 1, | ||
* [jsx-boolean-value](docs/rules/jsx-boolean-value.md): Enforce boolean attributes notation in JSX | ||
* [jsx-no-undef](docs/rules/jsx-no-undef.md): Disallow undeclared variables in JSX | ||
* [jsx-quotes](docs/rules/jsx-quotes.md): Enforce quote style for JSX attributes | ||
* [jsx-no-undef](docs/rules/jsx-no-undef.md): Disallow undeclared variables in JSX | ||
* [jsx-sort-prop-types](docs/rules/jsx-sort-prop-types.md): Enforce propTypes declarations alphabetical sorting | ||
* [jsx-sort-props](docs/rules/jsx-sort-props.md): Enforce props alphabetical sorting | ||
* [jsx-sort-prop-types](docs/rules/jsx-sort-prop-types.md): Enforce propTypes declarations alphabetical sorting | ||
* [jsx-uses-react](docs/rules/jsx-uses-react.md): Prevent React to be incorrectly marked as unused | ||
@@ -77,0 +77,0 @@ * [jsx-uses-vars](docs/rules/jsx-uses-vars.md): Prevent variables used in JSX to be incorrectly marked as unused |
67493
1628