eslint-plugin-react
Advanced tools
Comparing version 1.4.1 to 1.5.0
@@ -0,1 +1,6 @@ | ||
1.5.0 / 2015-03-14 | ||
================== | ||
* add jsx-uses-vars rule | ||
* fix jsx-uses-react for ESLint 0.17.0 | ||
1.4.1 / 2015-03-03 | ||
@@ -2,0 +7,0 @@ ================== |
@@ -13,3 +13,4 @@ 'use strict'; | ||
'no-did-update-set-state': require('./lib/rules/no-did-update-set-state'), | ||
'react-in-jsx-scope': require('./lib/rules/react-in-jsx-scope') | ||
'react-in-jsx-scope': require('./lib/rules/react-in-jsx-scope'), | ||
'jsx-uses-vars': require('./lib/rules/jsx-uses-vars') | ||
}, | ||
@@ -25,4 +26,5 @@ rulesConfig: { | ||
'no-did-update-set-state': 0, | ||
'react-in-jsx-scope': 0 | ||
'react-in-jsx-scope': 0, | ||
'jsx-uses-vars': 0 | ||
} | ||
}; |
@@ -13,22 +13,2 @@ /** | ||
function flagReactAsUsedInJSX() { | ||
var scope = context.getScope(), | ||
variables = scope.variables, | ||
i, | ||
len; | ||
while (scope.type !== 'global') { | ||
scope = scope.upper; | ||
variables = [].concat.apply(scope.variables, variables); | ||
} | ||
// mark first React found with the same special flag used by no-unused-vars | ||
for (i = 0, len = variables.length; i < len; i++) { | ||
if (variables[i].name === 'React') { | ||
variables[i].eslintJSXUsed = true; | ||
return; | ||
} | ||
} | ||
} | ||
// -------------------------------------------------------------------------- | ||
@@ -41,3 +21,3 @@ // Public | ||
'JSXOpeningElement': function() { | ||
flagReactAsUsedInJSX(); | ||
context.markVariableAsUsed('React'); | ||
} | ||
@@ -44,0 +24,0 @@ }; |
{ | ||
"name": "eslint-plugin-react", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"author": "Yannick Croissant <yannick.croissant+npm@gmail.com>", | ||
@@ -27,3 +27,3 @@ "description": "React specific linting rules for ESLint", | ||
"coveralls": "2.11.2", | ||
"eslint": "0.15.0", | ||
"eslint": "0.17.0", | ||
"eslint-tester": "0.6.0", | ||
@@ -30,0 +30,0 @@ "istanbul": "0.3.6", |
@@ -53,2 +53,3 @@ ESLint-plugin-React | ||
"react/jsx-uses-react": 1, | ||
"react/jsx-uses-vars": 1, | ||
"react/react-in-jsx-scope": 1 | ||
@@ -69,2 +70,3 @@ } | ||
* [jsx-uses-react](docs/rules/jsx-uses-react.md): Prevent React to be incorrectly marked as unused | ||
* [jsx-uses-vars](docs/rules/jsx-uses-vars.md): Prevent variables used in JSX to be incorrectly marked as unused | ||
* [react-in-jsx-scope](docs/rules/react-in-jsx-scope.md): Prevent missing React when using JSX | ||
@@ -71,0 +73,0 @@ |
20550
362
105