Skip to content

Commit 8a2bc81

Browse files
authored
Merge branch 'master' into master
2 parents 3bdc7da + 4a35536 commit 8a2bc81

File tree

158 files changed

+9228
-1602
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+9228
-1602
lines changed

.eslintrc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"env": {
3-
"node": true
3+
"es6": true,
4+
"node": true
45
},
56
parserOptions: {
67
ecmaVersion: 6,
@@ -11,6 +12,7 @@
1112
"rules": {
1213
// Possible Errors
1314
"comma-dangle": [2, "never"],
15+
"computed-property-spacing": [2, "never"],
1416
"no-cond-assign": 2,
1517
"no-console": 2,
1618
"no-constant-condition": 2,
@@ -86,7 +88,9 @@
8688
// Strict Mode
8789
"strict": [2, "global"],
8890
// Variables
91+
"prefer-const": 2,
8992
"no-catch-shadow": 2,
93+
"no-const-assign": 2,
9094
"no-delete-var": 2,
9195
"no-label-var": 2,
9296
"no-shadow": 2,
@@ -96,6 +100,7 @@
96100
"no-undefined": 2,
97101
"no-unused-vars": 2,
98102
"no-use-before-define": 2,
103+
"no-var": 2,
99104
// Stylistic Issues
100105
"indent": [2, 2, {
101106
"SwitchCase": 1
@@ -132,7 +137,7 @@
132137
"no-underscore-dangle": 0,
133138
"one-var": 0,
134139
"operator-assignment": [2, "always"],
135-
"padded-blocks": 0,
140+
"padded-blocks": [2, { "blocks": "never", "classes": "never", "switches": "never" }],
136141
"quotes": [2, "single"],
137142
"quote-props": [2, "as-needed"],
138143
"semi": [2, "always"],
@@ -158,6 +163,6 @@
158163
"no-plusplus": 0,
159164
"no-prototype-builtins": 2,
160165
"prefer-template": 2,
161-
"template-curly-spacing": [2, "never"]
166+
"template-curly-spacing": [2, "never"],
162167
}
163168
}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# gitignore
2+
13
lib-cov
24
*.seed
35
*.log
@@ -15,3 +17,7 @@ build
1517
node_modules
1618
npm-debug.log
1719
sftp-config.json
20+
21+
# Only apps should have lockfiles
22+
yarn.lock
23+
package-lock.json

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
sudo: false
22
language: node_js
33
node_js:
4+
- '8'
45
- '7'
56
- '6'
67
- '5'

CHANGELOG.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,57 @@ All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44
This change log adheres to standards from [Keep a CHANGELOG](http://keepachangelog.com).
55

6+
## [7.1.0] - 2017-06-13
7+
### Added
8+
* Add [`default-props-match-prop-types`][] rule ([#1022][] @webOS101)
9+
* Add [`no-redundant-should-component-update`][] rule ([#985][] @jomasti)
10+
* Add [`jsx-closing-tag-location`][] rule ([#1206][] @rsolomon)
11+
* Add auto fix for [`jsx-max-props-per-line`][] ([#949][] @snowypowers)
12+
* Add support for lifecycle methods with `nextProps`/`prevProps` in [`no-unused-prop-types`][] ([#1213][] @jseminck)
13+
* Add Flow SuperTypeParameters support to [`prop-types`][] ([#1236][] @gpeal)
14+
* Add `children` option to [`jsx-curly-spacing`][] ([#857][] @fatfisz)
15+
16+
### Fixed
17+
* Fix [`prefer-stateless-function`][] `ignorePureComponents` option when using class expressions ([#1122][] @dreid)
18+
* Fix [`void-dom-elements-no-children`][] crash ([#1195][] @oliviertassinari)
19+
* Fix [`require-default-props`][] quoted `defaultProps` detection ([#1201][])
20+
* Fix [`jsx-sort-props`][] bug with `ignoreCase` and `callbacksLast` options set to `true` ([#1175][] @jseminck)
21+
* Fix [`no-unused-prop-types`][] false positive ([#1183][] [#1135][] @jseminck)
22+
* Fix [`jsx-no-target-blank`][] to not issue errors for non-external URLs ([#1216][] @gfx)
23+
* Fix [`prop-types`][] quoted Flow types detection ([#1132][] @ethanjgoldberg)
24+
* Fix [`no-array-index-key`][] crash with `key` without value ([#1242][] @jseminck)
25+
26+
### Changed
27+
* Set ESLint 4.0.0 as valid peerDependency
28+
* Dead code removal ([#1227][] @jseminck)
29+
* Update dependencies (@ljharb)
30+
* Documentation improvements ([#1071][] @adnasa, [#1199][] @preco21, [#1222][] @alexilyaev, [#1231][] @vonovak, [#1239][] @webOS101, [#1241][] @102)
31+
32+
[7.1.0]: https://github.com/yannickcr/eslint-plugin-react/compare/v7.0.1...v7.1.0
33+
[#1022]: https://github.com/yannickcr/eslint-plugin-react/issues/1022
34+
[#949]: https://github.com/yannickcr/eslint-plugin-react/pull/949
35+
[#985]: https://github.com/yannickcr/eslint-plugin-react/issues/985
36+
[#1213]: https://github.com/yannickcr/eslint-plugin-react/issues/1213
37+
[#1236]: https://github.com/yannickcr/eslint-plugin-react/pull/1236
38+
[#1206]: https://github.com/yannickcr/eslint-plugin-react/issues/1206
39+
[#857]: https://github.com/yannickcr/eslint-plugin-react/issues/857
40+
[#1122]: https://github.com/yannickcr/eslint-plugin-react/pull/1122
41+
[#1195]: https://github.com/yannickcr/eslint-plugin-react/pull/1195
42+
[#1201]: https://github.com/yannickcr/eslint-plugin-react/issues/1201
43+
[#1175]: https://github.com/yannickcr/eslint-plugin-react/issues/1175
44+
[#1183]: https://github.com/yannickcr/eslint-plugin-react/issues/1183
45+
[#1135]: https://github.com/yannickcr/eslint-plugin-react/issues/1135
46+
[#1216]: https://github.com/yannickcr/eslint-plugin-react/pull/1216
47+
[#1132]: https://github.com/yannickcr/eslint-plugin-react/pull/1132
48+
[#1242]: https://github.com/yannickcr/eslint-plugin-react/issues/1242
49+
[#1227]: https://github.com/yannickcr/eslint-plugin-react/pull/1227
50+
[#1071]: https://github.com/yannickcr/eslint-plugin-react/pull/1071
51+
[#1199]: https://github.com/yannickcr/eslint-plugin-react/pull/1199
52+
[#1222]: https://github.com/yannickcr/eslint-plugin-react/pull/1222
53+
[#1231]: https://github.com/yannickcr/eslint-plugin-react/pull/1231
54+
[#1239]: https://github.com/yannickcr/eslint-plugin-react/pull/1239
55+
[#1241]: https://github.com/yannickcr/eslint-plugin-react/pull/1241
56+
657
## [7.0.1] - 2017-05-13
758
### Fixed
859
* Fix [`jsx-curly-spacing`][] `allowMultiline` option being undefined in some cases ([#1179][] @fatfisz)
@@ -1746,6 +1797,9 @@ If you're still not using React 15 you can keep the old behavior by setting the
17461797
[`jsx-uses-vars`]: docs/rules/jsx-uses-vars.md
17471798
[`jsx-wrap-multilines`]: docs/rules/jsx-wrap-multilines.md
17481799
[`void-dom-elements-no-children`]: docs/rules/void-dom-elements-no-children.md
1800+
[`default-props-match-prop-types`]: docs/rules/default-props-match-prop-types.md
1801+
[`no-redundant-should-component-update`]: docs/rules/no-redundant-should-component-update.md
1802+
[`jsx-closing-tag-location`]: docs/rules/jsx-closing-tag-location.md
17491803

17501804
[`jsx-sort-prop-types`]: docs/rules/sort-prop-types.md
17511805
[`require-extension`]: docs/rules/require-extension.md

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ You can also specify some settings that will be shared across all the plugin rul
4040
"createClass": "createReactClass", // Regex for Component Factory to use, default to "createReactClass"
4141
"pragma": "React", // Pragma to use, default to "React"
4242
"version": "15.0" // React version, default to the latest React stable release
43-
}
43+
},
44+
"propWrapperFunctions": [ "forbidExtraProps" ] // The names of any functions used to wrap the propTypes object, such as `forbidExtraProps`. If this isn't set, any propTypes wrapped in a function will be skipped.
4445
}
4546
}
4647
```
@@ -80,6 +81,8 @@ Finally, enable all of the rules that you would like to use. Use [our preset](#
8081

8182
# List of supported rules
8283

84+
* [react/boolean-prop-naming](docs/rules/boolean-prop-naming.md): Enforces consistent naming for boolean props
85+
* [react/default-props-match-prop-types](docs/rules/default-props-match-prop-types.md): Prevent extraneous defaultProps on components
8386
* [react/display-name](docs/rules/display-name.md): Prevent missing `displayName` in a React component definition
8487
* [react/forbid-component-props](docs/rules/forbid-component-props.md): Forbid certain props on Components
8588
* [react/forbid-elements](docs/rules/forbid-elements.md): Forbid certain elements
@@ -96,8 +99,10 @@ Finally, enable all of the rules that you would like to use. Use [our preset](#
9699
* [react/no-find-dom-node](docs/rules/no-find-dom-node.md): Prevent usage of `findDOMNode`
97100
* [react/no-is-mounted](docs/rules/no-is-mounted.md): Prevent usage of `isMounted`
98101
* [react/no-multi-comp](docs/rules/no-multi-comp.md): Prevent multiple component definition per file
102+
* [react/no-redundant-should-component-update](docs/rules/no-redundant-should-component-update.md): Prevent usage of `shouldComponentUpdate` when extending React.PureComponent
99103
* [react/no-render-return-value](docs/rules/no-render-return-value.md): Prevent usage of the return value of `React.render`
100104
* [react/no-set-state](docs/rules/no-set-state.md): Prevent usage of `setState`
105+
* [react/no-typos](docs/rules/no-typos.md): Prevent common casing typos
101106
* [react/no-string-refs](docs/rules/no-string-refs.md): Prevent using string references in `ref` attribute.
102107
* [react/no-unescaped-entities](docs/rules/no-unescaped-entities.md): Prevent invalid characters from appearing in markup
103108
* [react/no-unknown-property](docs/rules/no-unknown-property.md): Prevent usage of unknown DOM property (fixable)
@@ -108,7 +113,7 @@ Finally, enable all of the rules that you would like to use. Use [our preset](#
108113
* [react/prop-types](docs/rules/prop-types.md): Prevent missing props validation in a React component definition
109114
* [react/react-in-jsx-scope](docs/rules/react-in-jsx-scope.md): Prevent missing `React` when using JSX
110115
* [react/require-default-props](docs/rules/require-default-props.md): Enforce a defaultProps definition for every prop that is not a required prop
111-
* [react/require-optimization](docs/rules/require-optimization.md): Enforce React components to have a shouldComponentUpdate method
116+
* [react/require-optimization](docs/rules/require-optimization.md): Enforce React components to have a `shouldComponentUpdate` method
112117
* [react/require-render-return](docs/rules/require-render-return.md): Enforce ES5 or ES6 class for returning value in render function
113118
* [react/self-closing-comp](docs/rules/self-closing-comp.md): Prevent extra closing tags for components without children (fixable)
114119
* [react/sort-comp](docs/rules/sort-comp.md): Enforce component methods order
@@ -120,15 +125,16 @@ Finally, enable all of the rules that you would like to use. Use [our preset](#
120125

121126
* [react/jsx-boolean-value](docs/rules/jsx-boolean-value.md): Enforce boolean attributes notation in JSX (fixable)
122127
* [react/jsx-closing-bracket-location](docs/rules/jsx-closing-bracket-location.md): Validate closing bracket location in JSX (fixable)
123-
* [react/jsx-curly-spacing](docs/rules/jsx-curly-spacing.md): Enforce or disallow spaces inside of curly braces in JSX attributes (fixable)
128+
* [react/jsx-closing-tag-location](docs/rules/jsx-closing-tag-location.md): Validate closing tag location in JSX (fixable)
129+
* [react/jsx-curly-spacing](docs/rules/jsx-curly-spacing.md): Enforce or disallow spaces inside of curly braces in JSX attributes and expressions (fixable)
124130
* [react/jsx-equals-spacing](docs/rules/jsx-equals-spacing.md): Enforce or disallow spaces around equal signs in JSX attributes (fixable)
125131
* [react/jsx-filename-extension](docs/rules/jsx-filename-extension.md): Restrict file extensions that may contain JSX
126132
* [react/jsx-first-prop-new-line](docs/rules/jsx-first-prop-new-line.md): Enforce position of the first prop in JSX (fixable)
127133
* [react/jsx-handler-names](docs/rules/jsx-handler-names.md): Enforce event handler naming conventions in JSX
128134
* [react/jsx-indent](docs/rules/jsx-indent.md): Validate JSX indentation (fixable)
129135
* [react/jsx-indent-props](docs/rules/jsx-indent-props.md): Validate props indentation in JSX (fixable)
130136
* [react/jsx-key](docs/rules/jsx-key.md): Validate JSX has key prop when in array or iterator
131-
* [react/jsx-max-props-per-line](docs/rules/jsx-max-props-per-line.md): Limit maximum of props on a single line in JSX
137+
* [react/jsx-max-props-per-line](docs/rules/jsx-max-props-per-line.md): Limit maximum of props on a single line in JSX (fixable)
132138
* [react/jsx-no-bind](docs/rules/jsx-no-bind.md): Prevent usage of `.bind()` and arrow functions in JSX props
133139
* [react/jsx-no-comment-textnodes](docs/rules/jsx-no-comment-textnodes.md): Prevent comments from being inserted as text nodes
134140
* [react/jsx-no-duplicate-props](docs/rules/jsx-no-duplicate-props.md): Prevent duplicate props in JSX
@@ -152,7 +158,7 @@ Finally, enable all of the rules that you would like to use. Use [our preset](#
152158

153159
## Recommended
154160

155-
This plugin exports a `recommended` configuration that enforce React good practices.
161+
This plugin exports a `recommended` configuration that enforces React good practices.
156162

157163
To enable this configuration use the `extends` property in your `.eslintrc` config file:
158164

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ environment:
44
- nodejs_version: '5'
55
- nodejs_version: '6'
66
- nodejs_version: '7'
7+
- nodejs_version: '8'
78
install:
89
- ps: Install-Product node $env:nodejs_version
910
- set CI=true

docs/rules/boolean-prop-naming.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Enforces consistent naming for boolean props (react/boolean-prop-naming)
2+
3+
Allows you to enforce a consistent naming pattern for props which expect a boolean value.
4+
5+
## Rule Details
6+
7+
The following patterns are considered warnings:
8+
9+
```jsx
10+
var Hello = createReactClass({
11+
propTypes: {
12+
enabled: PropTypes.bool
13+
},
14+
render: function() { return <div />; };
15+
});
16+
```
17+
18+
The following patterns are not considered warnings:
19+
20+
```jsx
21+
var Hello = createReactClass({
22+
propTypes: {
23+
isEnabled: PropTypes.bool
24+
},
25+
render: function() { return <div />; };
26+
});
27+
```
28+
29+
## Rule Options
30+
31+
```js
32+
...
33+
"react/boolean-prop-naming": [<enabled>, { "propTypeNames": Array<string>, "rule": <string> }]
34+
...
35+
```
36+
37+
### `propTypeNames`
38+
39+
The list of prop type names that are considered to be booleans. By default this is set to `['bool']` but you can include other custom types like so:
40+
41+
```jsx
42+
"react/boolean-prop-naming": ["error", { "propTypeNames": ["bool", "mutuallyExclusiveTrueProps"] }]
43+
```
44+
45+
### `rule`
46+
47+
The RegExp pattern to use when validating the name of the prop. The default value for this option is set to: `"^(is|has)[A-Z]([A-Za-z0-9]?)+"` to enforce `is` and `has` prefixes.
48+
49+
For supporting "is" and "has" naming (default):
50+
51+
- isEnabled
52+
- isAFK
53+
- hasCondition
54+
- hasLOL
55+
56+
```jsx
57+
"react/boolean-prop-naming": ["error", { "rule": "^(is|has)[A-Z]([A-Za-z0-9]?)+" }]
58+
```
59+
60+
For supporting "is" naming:
61+
62+
- isEnabled
63+
- isAFK
64+
65+
```jsx
66+
"react/boolean-prop-naming": ["error", { "rule": "^is[A-Z]([A-Za-z0-9]?)+" }]
67+
```

0 commit comments

Comments
 (0)