diff --git a/README.md b/README.md index df6cd8ae1d..e86aa03572 100644 --- a/README.md +++ b/README.md @@ -64,8 +64,8 @@ Finally, enable all of the rules that you would like to use. * [self-closing-comp](docs/rules/self-closing-comp.md): Prevent extra closing tags for components without children * [no-did-mount-set-state](docs/rules/no-did-mount-set-state.md): Prevent usage of setState in componentDidMount * [no-did-update-set-state](docs/rules/no-did-update-set-state.md): Prevent usage of setState in componentDidUpdate -* [jsx-uses-react](docs/rules/jsx-uses-react.md): Make JSX count towards use of a declared variable -* [react-in-jsx-scope](docs/rules/react-in-jsx-scope.md): Prevent errors from not requiring React when using JSX +* [jsx-uses-react](docs/rules/jsx-uses-react.md): Prevent React to be incorrectly marked as unused +* [react-in-jsx-scope](docs/rules/react-in-jsx-scope.md): Prevent missing React when using JSX ## To Do diff --git a/docs/rules/jsx-uses-react.md b/docs/rules/jsx-uses-react.md index 1002eda8e3..d373700100 100644 --- a/docs/rules/jsx-uses-react.md +++ b/docs/rules/jsx-uses-react.md @@ -1,7 +1,7 @@ -# Make JSX count towards use of a declared variable (jsx-uses-react) +# Prevent React to be incorrectly marked as unused (jsx-uses-react) JSX expands to a call to `React.createElement`, a file which includes `React` -but only uses JSX should still consider the `React` variable used. +but only uses JSX should consider the `React` variable as used. This rule has no effect if the `no-unused-vars` rule is not enabled. @@ -25,5 +25,4 @@ var elem =
Some Stuff
; ## When Not To Use It -If you are not using JSX, or React is delcared as global variable, this rule -will not be useful. +If you are not using JSX, if React is declared as global variable or if you do not use the `no-unused-vars` rule then you can disable this rule. diff --git a/docs/rules/react-in-jsx-scope.md b/docs/rules/react-in-jsx-scope.md index 8de1297dc5..7575164f8c 100644 --- a/docs/rules/react-in-jsx-scope.md +++ b/docs/rules/react-in-jsx-scope.md @@ -1,4 +1,4 @@ -# Prevent errors from not requiring React when using JSX (react-in-jsx-scope) +# Prevent missing React when using JSX (react-in-jsx-scope) When using JSX, `` expands to `React.createElement("a")`. Therefore the `React` variable must be in scope. @@ -20,4 +20,4 @@ var Hello =
Hello {this.props.name}
; ## When Not To Use It -If you are setting `React` as a global variable, you will not need this rule. +If you are setting `React` as a global variable you can disable this rule. diff --git a/lib/rules/jsx-uses-react.js b/lib/rules/jsx-uses-react.js index 519659629a..caa6395bc6 100644 --- a/lib/rules/jsx-uses-react.js +++ b/lib/rules/jsx-uses-react.js @@ -1,5 +1,5 @@ /** - * @fileoverview Count as use of the React variable + * @fileoverview Prevent React to be marked as unused * @author Glen Mailer */ 'use strict'; diff --git a/lib/rules/react-in-jsx-scope.js b/lib/rules/react-in-jsx-scope.js index ef3cd8d582..d25af921e8 100644 --- a/lib/rules/react-in-jsx-scope.js +++ b/lib/rules/react-in-jsx-scope.js @@ -1,5 +1,5 @@ /** - * @fileoverview Validate that React is in scope when using JSX. + * @fileoverview Prevent missing React when using JSX * @author Glen Mailer */ 'use strict';