eslint-plugin-react
Advanced tools
Comparing version 3.7.0 to 3.7.1
@@ -6,2 +6,13 @@ # Change Log | ||
## [3.7.1] - 2015-11-05 | ||
### Fixed | ||
* Fix `sort-comp` crash on stateless components ([#285][]) | ||
* Fix crash in ES5 components detection ([#286][]) | ||
* Fix ES5 components detection from nested functions ([#287][]) | ||
[3.7.1]: https://github.com/yannickcr/eslint-plugin-react/compare/v3.7.0...v3.7.1 | ||
[#285]: https://github.com/yannickcr/eslint-plugin-react/issues/285 | ||
[#286]: https://github.com/yannickcr/eslint-plugin-react/issues/286 | ||
[#287]: https://github.com/yannickcr/eslint-plugin-react/issues/287 | ||
## [3.7.0] - 2015-11-05 | ||
@@ -8,0 +19,0 @@ ### Added |
@@ -78,14 +78,2 @@ /** | ||
/** | ||
* Checks if the component must be validated | ||
* @param {Object} component The component to process | ||
* @returns {Boolean} True if the component must be validated, false if not. | ||
*/ | ||
function mustBeValidated(component) { | ||
return ( | ||
component && | ||
!component.hasDisplayName | ||
); | ||
} | ||
// -------------------------------------------------------------------------- | ||
@@ -240,6 +228,10 @@ // Public | ||
function getComponentProperties(node) { | ||
if (node.type === 'ClassDeclaration') { | ||
return node.body.body; | ||
switch (node.type) { | ||
case 'ClassDeclaration': | ||
return node.body.body; | ||
case 'ObjectExpression': | ||
return node.properties; | ||
default: | ||
return []; | ||
} | ||
return node.properties; | ||
} | ||
@@ -351,3 +343,3 @@ | ||
for (var component in list) { | ||
if (!list.hasOwnProperty(component) || !mustBeValidated(list[component])) { | ||
if (!list.hasOwnProperty(component)) { | ||
continue; | ||
@@ -354,0 +346,0 @@ } |
@@ -113,3 +113,3 @@ /** | ||
isES5Component: function(node) { | ||
return sourceCode.getText(node.parent.callee) === 'React.createClass'; | ||
return node.parent && sourceCode.getText(node.parent.callee) === 'React.createClass'; | ||
}, | ||
@@ -183,7 +183,10 @@ | ||
var scope = context.getScope(); | ||
var node = scope.block && scope.block.parent && scope.block.parent.parent; | ||
if (!node || !context.react.isES5Component(node)) { | ||
return null; | ||
while (scope) { | ||
var node = scope.block && scope.block.parent && scope.block.parent.parent; | ||
if (node && context.react.isES5Component(node)) { | ||
return node; | ||
} | ||
scope = scope.upper; | ||
} | ||
return node; | ||
return null; | ||
}, | ||
@@ -190,0 +193,0 @@ |
{ | ||
"name": "eslint-plugin-react", | ||
"version": "3.7.0", | ||
"version": "3.7.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
142499
3307