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.0.0 to 4.1.0

20

CHANGELOG.md

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

## [4.1.0] - 2016-02-23
### Added
* Add component detection for class expressions
* Add displayName detection for class expressions in `display-name` ([#419][])
### Fixed
* Fix used props detection in components for which we are not confident in `prop-types` ([#420][])
* Fix false positive in `jsx-key` ([#456][] @jkimbo)
### Changed
* Documentation improvements ([#457][] @wyze)
[4.1.0]: https://github.com/yannickcr/eslint-plugin-react/compare/v4.0.0...v4.1.0
[#419]: https://github.com/yannickcr/eslint-plugin-react/issues/419
[#420]: https://github.com/yannickcr/eslint-plugin-react/issues/420
[#456]: https://github.com/yannickcr/eslint-plugin-react/pull/456
[#457]: https://github.com/yannickcr/eslint-plugin-react/pull/457
## [4.0.0] - 2016-02-19

@@ -26,3 +44,3 @@ ### Added

* Update dependencies ([#426][] @quentin-)
* Documentation improvements ([#414][] @vkrol, [#370][] @tmcw, [#441][] [#429][] @lencioni, [#432][] @Niler851, [#438][] @jmann6)
* Documentation improvements ([#414][] @vkrol, [#370][] @tmcw, [#441][] [#429][] @lencioni, [#432][] @note89, [#438][] @jmann6)

@@ -29,0 +47,0 @@ [4.0.0]: https://github.com/yannickcr/eslint-plugin-react/compare/v3.16.1...v4.0.0

@@ -93,4 +93,5 @@ /**

var namedClass = (
node.type === 'ClassDeclaration' &&
node.id && node.id.name
(node.type === 'ClassDeclaration' || node.type === 'ClassExpression') &&
node.id &&
node.id.name
);

@@ -172,2 +173,9 @@

ClassExpression: function(node) {
if (ignoreTranspilerName || !hasTranspilerName(node)) {
return;
}
markDisplayNameAsDeclared(node);
},
ClassDeclaration: function(node) {

@@ -174,0 +182,0 @@ if (ignoreTranspilerName || !hasTranspilerName(node)) {

@@ -55,2 +55,6 @@ /**

CallExpression: function (node) {
if (node.callee && node.callee.type !== 'MemberExpression') {
return;
}
if (node.callee && node.callee.property && node.callee.property.name !== 'map') {

@@ -57,0 +61,0 @@ return;

@@ -80,8 +80,30 @@ /**

var list = {};
var usedPropTypes = {};
// Find props used in components for which we are not confident
for (var i in this._list) {
if (!this._list.hasOwnProperty(i) || this._list[i].confidence < 2) {
if (!this._list.hasOwnProperty(i) || this._list[i].confidence >= 2) {
continue;
}
list[i] = this._list[i];
var component;
var node;
node = this._list[i].node;
while (!component && node.parent) {
node = node.parent;
component = this.get(node);
}
if (component) {
usedPropTypes[this._getId(component.node)] = this._list[i].usedPropTypes;
}
}
// Assign used props in not confident components to the parent component
for (var j in this._list) {
if (!this._list.hasOwnProperty(j) || this._list[j].confidence < 2) {
continue;
}
var id = this._getId(this._list[j].node);
list[j] = this._list[j];
if (usedPropTypes[id]) {
list[j].usedPropTypes = (list[j].usedPropTypes || []).concat(usedPropTypes[id]);
}
}
return list;

@@ -321,2 +343,9 @@ };

var detectionInstructions = {
ClassExpression: function(node) {
if (!utils.isES6Component(node)) {
return;
}
components.add(node, 2);
},
ClassDeclaration: function(node) {

@@ -323,0 +352,0 @@ if (!utils.isES6Component(node)) {

2

package.json
{
"name": "eslint-plugin-react",
"version": "4.0.0",
"version": "4.1.0",
"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