eslint-plugin-react
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -0,1 +1,11 @@ | ||
2.1.1 / 2015-04-17 | ||
================== | ||
* add support for classes static properties ([#43][]) | ||
* add tests for the babel-eslint parser | ||
* add ESLint as peerDependency (@AlexKVal) | ||
* documentation improvements (@AlexKVal, @chriscalo) | ||
[#43]: https://github.com/yannickcr/eslint-plugin-react/issues/43 | ||
2.1.0 / 2015-04-06 | ||
@@ -2,0 +12,0 @@ ================== |
@@ -40,2 +40,13 @@ /** | ||
function isDisplayNameDeclaration(node) { | ||
// Special case for class properties | ||
// (babel-eslint does not expose property name so we have to rely on tokens) | ||
if (node.type === 'ClassProperty') { | ||
var tokens = context.getFirstTokens(node, 2); | ||
if (tokens[0].value === 'displayName' || tokens[1].value === 'displayName') { | ||
return true; | ||
} | ||
return false; | ||
} | ||
return Boolean( | ||
@@ -76,2 +87,10 @@ node && | ||
ClassProperty: function(node) { | ||
if (!isDisplayNameDeclaration(node)) { | ||
return; | ||
} | ||
markDisplayNameAsDeclared(node); | ||
}, | ||
MemberExpression: function(node) { | ||
@@ -78,0 +97,0 @@ if (!isDisplayNameDeclaration(node.property)) { |
@@ -7,2 +7,5 @@ /** | ||
// As for exceptions for props.children or props.className (and alike) look at | ||
// https://github.com/yannickcr/eslint-plugin-react/issues/7 | ||
var componentUtil = require('../util/component'); | ||
@@ -43,2 +46,13 @@ var ComponentList = componentUtil.List; | ||
function isPropTypesDeclaration(node) { | ||
// Special case for class properties | ||
// (babel-eslint does not expose property name so we have to rely on tokens) | ||
if (node.type === 'ClassProperty') { | ||
var tokens = context.getFirstTokens(node, 2); | ||
if (tokens[0].value === 'propTypes' || tokens[1].value === 'propTypes') { | ||
return true; | ||
} | ||
return false; | ||
} | ||
return Boolean( | ||
@@ -48,2 +62,3 @@ node && | ||
); | ||
} | ||
@@ -201,2 +216,10 @@ | ||
ClassProperty: function(node) { | ||
if (!isPropTypesDeclaration(node)) { | ||
return; | ||
} | ||
markPropTypesAsDeclared(node, node.value); | ||
}, | ||
MemberExpression: function(node) { | ||
@@ -203,0 +226,0 @@ var type; |
{ | ||
"name": "eslint-plugin-react", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"author": "Yannick Croissant <yannick.croissant+npm@gmail.com>", | ||
@@ -26,8 +26,12 @@ "description": "React specific linting rules for ESLint", | ||
"devDependencies": { | ||
"babel-eslint": "3.0.1", | ||
"coveralls": "2.11.2", | ||
"eslint": "0.18", | ||
"eslint-tester": "0.6.0", | ||
"istanbul": "0.3.11", | ||
"mocha": "2.2.1" | ||
"eslint": "0.19.0", | ||
"eslint-tester": "eslint/eslint-tester#c2a1f722cd", | ||
"istanbul": "0.3.13", | ||
"mocha": "2.2.4" | ||
}, | ||
"peerDependencies": { | ||
"eslint": ">=0.8.0" | ||
}, | ||
"keywords": [ | ||
@@ -34,0 +38,0 @@ "eslint-plugin", |
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
51257
1181
1
6