eslint-plugin-react
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -0,4 +1,16 @@ | ||
2.3.0 / 2015-05-14 | ||
================== | ||
* update dependencies | ||
* add sort-comp rule ([#39][]) | ||
* fix quoted propTypes in ES6 ([#77][]) | ||
* add allow-in-func option to no-did-mount-set-state ([#56][]) | ||
* improve errors locations for prop-types | ||
[#39]: https://github.com/yannickcr/eslint-plugin-react/issues/39 | ||
[#77]: https://github.com/yannickcr/eslint-plugin-react/issues/77 | ||
[#56]: https://github.com/yannickcr/eslint-plugin-react/issues/56 | ||
2.2.0 / 2015-04-22 | ||
================== | ||
* add jsx-sort-prop-types rule ([#38][] @AlexKVal) | ||
@@ -14,3 +26,2 @@ * fix variables marked as used when a prop has the same name ([#69][] @burnnat) | ||
================== | ||
* add support for classes static properties ([#43][]) | ||
@@ -28,3 +39,2 @@ * add tests for the babel-eslint parser | ||
================== | ||
* update jsx-sort-props to reset the alphabetical verification on spread ([#47][] @zertosh) | ||
@@ -44,3 +54,2 @@ * update jsx-uses-vars to be enabled by default ([#49][] @banderson) | ||
================== | ||
* fix ignore rest spread when destructuring props ([#46][]) | ||
@@ -47,0 +56,0 @@ * fix component detection in prop-types and display-name ([#45][]) |
@@ -20,3 +20,4 @@ 'use strict'; | ||
'jsx-sort-prop-types': require('./lib/rules/jsx-sort-prop-types'), | ||
'jsx-boolean-value': require('./lib/rules/jsx-boolean-value') | ||
'jsx-boolean-value': require('./lib/rules/jsx-boolean-value'), | ||
'sort-comp': require('./lib/rules/sort-comp') | ||
}, | ||
@@ -39,4 +40,5 @@ rulesConfig: { | ||
'jsx-sort-prop-types': 0, | ||
'jsx-boolean-value': 0 | ||
'jsx-boolean-value': 0, | ||
'sort-comp': 0 | ||
} | ||
}; |
@@ -13,2 +13,4 @@ /** | ||
var mode = context.options[0] || 'never'; | ||
// -------------------------------------------------------------------------- | ||
@@ -22,14 +24,24 @@ // Public | ||
var callee = node.callee; | ||
if (callee.type !== 'MemberExpression') { | ||
if ( | ||
callee.type !== 'MemberExpression' || | ||
callee.object.type !== 'ThisExpression' || | ||
callee.property.name !== 'setState' | ||
) { | ||
return; | ||
} | ||
if (callee.object.type !== 'ThisExpression' || callee.property.name !== 'setState') { | ||
return; | ||
} | ||
var ancestors = context.getAncestors(callee); | ||
var ancestors = context.getAncestors(callee).reverse(); | ||
var depth = 0; | ||
for (var i = 0, j = ancestors.length; i < j; i++) { | ||
if (ancestors[i].type !== 'Property' || ancestors[i].key.name !== 'componentDidMount') { | ||
if (/Function(Expression|Declaration)$/.test(ancestors[i].type)) { | ||
depth++; | ||
} | ||
if ( | ||
ancestors[i].type !== 'Property' || | ||
ancestors[i].key.name !== 'componentDidMount' || | ||
(mode === 'allow-in-func' && depth > 1) | ||
) { | ||
continue; | ||
} | ||
context.report(callee, 'Do not use setState in componentDidMount'); | ||
break; | ||
} | ||
@@ -36,0 +48,0 @@ } |
@@ -131,3 +131,3 @@ /** | ||
name: node.parent.property.name, | ||
node: node | ||
node: node.parent.property | ||
}); | ||
@@ -143,3 +143,3 @@ break; | ||
name: properties[i].key.name, | ||
node: node | ||
node: properties[i] | ||
}); | ||
@@ -170,3 +170,4 @@ } | ||
for (var i = 0, j = propTypes.properties.length; i < j; i++) { | ||
declaredPropTypes.push(propTypes.properties[i].key.name); | ||
var key = propTypes.properties[i].key; | ||
declaredPropTypes.push(key.type === 'Identifier' ? key.name : key.value); | ||
} | ||
@@ -173,0 +174,0 @@ break; |
{ | ||
"name": "eslint-plugin-react", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"author": "Yannick Croissant <yannick.croissant+npm@gmail.com>", | ||
@@ -26,7 +26,7 @@ "description": "React specific linting rules for ESLint", | ||
"devDependencies": { | ||
"babel-eslint": "3.0.1", | ||
"babel-eslint": "3.1.1", | ||
"coveralls": "2.11.2", | ||
"eslint": "0.19.0", | ||
"eslint": "0.21.0", | ||
"eslint-tester": "eslint/eslint-tester#c2a1f722cd", | ||
"istanbul": "0.3.13", | ||
"istanbul": "0.3.14", | ||
"mocha": "2.2.4" | ||
@@ -33,0 +33,0 @@ }, |
@@ -60,2 +60,3 @@ ESLint-plugin-React | ||
"react/self-closing-comp": 1, | ||
"react/sort-comp": 1, | ||
"react/wrap-multilines": 1 | ||
@@ -83,2 +84,3 @@ } | ||
* [self-closing-comp](docs/rules/self-closing-comp.md): Prevent extra closing tags for components without children | ||
* [sort-comp](docs/rules/sort-comp.md): Enforce component methods order | ||
* [wrap-multilines](docs/rules/wrap-multilines.md): Prevent missing parentheses around multilines JSX | ||
@@ -85,0 +87,0 @@ |
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
65551
24
1595
118