Socket
Socket
Sign inDemoInstall

eslint-plugin-react

Package Overview
Dependencies
Maintainers
1
Versions
210
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-react - npm Package Compare versions

Comparing version 4.2.0 to 4.2.1

13

CHANGELOG.md

@@ -6,2 +6,15 @@ # Change Log

## [4.2.1] - 2016-03-08
### Fixed
* Fix `sort-prop-types` crash with spread operator ([#478][])
* Fix stateless components detection when conditionally returning JSX ([#486][])
* Fix case where props were not assigned to the right component ([#485][])
* Fix missing `getChildContext` lifecycle method in `prefer-stateless-function` ([#492][])
[4.2.1]: https://github.com/yannickcr/eslint-plugin-react/compare/v4.2.0...v4.2.1
[#478]: https://github.com/yannickcr/eslint-plugin-react/issues/478
[#486]: https://github.com/yannickcr/eslint-plugin-react/issues/486
[#485]: https://github.com/yannickcr/eslint-plugin-react/issues/485
[#492]: https://github.com/yannickcr/eslint-plugin-react/issues/492
## [4.2.0] - 2016-03-05

@@ -8,0 +21,0 @@ ### Added

1

lib/rules/prefer-stateless-function.js

@@ -20,2 +20,3 @@ /**

'getInitialState',
'getChildContext',
'componentWillMount',

@@ -22,0 +23,0 @@ 'componentDidMount',

11

lib/rules/sort-prop-types.js

@@ -12,2 +12,3 @@ /**

var sourceCode = context.getSourceCode();
var configuration = context.options[0] || {};

@@ -40,7 +41,7 @@ var requiredFirst = configuration.requiredFirst || false;

function getKey(node) {
return node.key.type === 'Identifier' ? node.key.name : node.key.value;
return sourceCode.getText(node.key || node.argument);
}
function getValueName(node) {
return node.value.property && node.value.property.name;
return node.type === 'Property' && node.value.property && node.value.property.name;
}

@@ -62,3 +63,7 @@

function checkSorted(declarations) {
declarations.reduce(function(prev, curr) {
declarations.reduce(function(prev, curr, idx, decls) {
if (/SpreadProperty$/.test(curr.type)) {
return decls[idx + 1];
}
var prevPropName = getKey(prev);

@@ -65,0 +70,0 @@ var currentPropName = getKey(curr);

@@ -88,4 +88,4 @@ /**

}
var component;
var node;
var component = null;
var node = null;
node = this._list[i].node;

@@ -169,3 +169,3 @@ while (!component && node.parent) {

*
* @param {ASTNode} node The AST node being checked (must be a ReturnStatement).
* @param {ASTNode} node The AST node being checked (can be a ReturnStatement or an ArrowFunctionExpression).
* @returns {Boolean} True if the node is returning JSX, false if not

@@ -186,2 +186,12 @@ */

var returnsConditionalJSXConsequent =
node[property] &&
node[property].type === 'ConditionalExpression' &&
node[property].consequent.type === 'JSXElement'
;
var returnsConditionalJSXAlternate =
node[property] &&
node[property].type === 'ConditionalExpression' &&
node[property].alternate.type === 'JSXElement'
;
var returnsJSX =

@@ -198,3 +208,8 @@ node[property] &&

return Boolean(returnsJSX || returnsReactCreateElement);
return Boolean(
returnsConditionalJSXConsequent ||
returnsConditionalJSXAlternate ||
returnsJSX ||
returnsReactCreateElement
);
},

@@ -201,0 +216,0 @@

{
"name": "eslint-plugin-react",
"version": "4.2.0",
"version": "4.2.1",
"author": "Yannick Croissant <yannick.croissant+npm@gmail.com>",

@@ -5,0 +5,0 @@ "description": "React specific linting rules for ESLint",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc