eslint-plugin-react
Advanced tools
Comparing version 3.6.0 to 3.6.1
@@ -6,2 +6,9 @@ # Change Log | ||
## [3.6.1] - 2015-10-18 | ||
### Fixed | ||
* Fix props validation in constructor ([#254][]) | ||
[3.6.1]: https://github.com/yannickcr/eslint-plugin-react/compare/v3.6.0...v3.6.1 | ||
[#254]: https://github.com/yannickcr/eslint-plugin-react/issues/254 | ||
## [3.6.0] - 2015-10-18 | ||
@@ -8,0 +15,0 @@ ### Added |
@@ -311,2 +311,17 @@ /** | ||
/** | ||
* Check if we are in a class constructor | ||
* @return {boolean} true if we are in a class constructor, false if not | ||
*/ | ||
function inConstructor() { | ||
var scope = context.getScope(); | ||
while (scope) { | ||
if (scope.block && scope.block.parent && scope.block.parent.kind === 'constructor') { | ||
return true; | ||
} | ||
scope = scope.upper; | ||
} | ||
return false; | ||
} | ||
/** | ||
* Retrieve the name of a property node | ||
@@ -317,3 +332,6 @@ * @param {ASTNode} node The AST node with the property. | ||
function getPropertyName(node) { | ||
if (componentUtil.getNode(context, node)) { | ||
if (componentUtil.getNode(context, node) && !inConstructor()) { | ||
if (node.object.name === 'props') { | ||
return void 0; | ||
} | ||
node = node.parent; | ||
@@ -405,3 +423,3 @@ } | ||
allNames: allNames, | ||
node: node.object.name !== 'props' ? node.parent.property : node.property | ||
node: node.object.name !== 'props' && !inConstructor() ? node.parent.property : node.property | ||
}); | ||
@@ -408,0 +426,0 @@ break; |
{ | ||
"name": "eslint-plugin-react", | ||
"version": "3.6.0", | ||
"version": "3.6.1", | ||
"author": "Yannick Croissant <yannick.croissant+npm@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "React specific linting rules for ESLint", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
133729
3100