You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-4Lines changed: 9 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,8 @@ You can also specify some settings that will be shared across all the plugin rul
40
40
"createClass":"createReactClass", // Regex for Component Factory to use, default to "createReactClass"
41
41
"pragma":"React", // Pragma to use, default to "React"
42
42
"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.
44
45
}
45
46
}
46
47
```
@@ -80,6 +81,8 @@ Finally, enable all of the rules that you would like to use. Use [our preset](#
80
81
81
82
# List of supported rules
82
83
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
83
86
*[react/display-name](docs/rules/display-name.md): Prevent missing `displayName` in a React component definition
84
87
*[react/forbid-component-props](docs/rules/forbid-component-props.md): Forbid certain props on Components
85
88
*[react/forbid-elements](docs/rules/forbid-elements.md): Forbid certain elements
@@ -99,6 +102,7 @@ Finally, enable all of the rules that you would like to use. Use [our preset](#
99
102
*[react/no-redundant-should-component-update](docs/rules/no-redundant-should-component-update.md): Prevent usage of `shouldComponentUpdate` when extending React.PureComponent
100
103
*[react/no-render-return-value](docs/rules/no-render-return-value.md): Prevent usage of the return value of `React.render`
101
104
*[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
102
106
*[react/no-string-refs](docs/rules/no-string-refs.md): Prevent using string references in `ref` attribute.
103
107
*[react/no-unescaped-entities](docs/rules/no-unescaped-entities.md): Prevent invalid characters from appearing in markup
104
108
*[react/no-unknown-property](docs/rules/no-unknown-property.md): Prevent usage of unknown DOM property (fixable)
@@ -109,7 +113,7 @@ Finally, enable all of the rules that you would like to use. Use [our preset](#
109
113
*[react/prop-types](docs/rules/prop-types.md): Prevent missing props validation in a React component definition
110
114
*[react/react-in-jsx-scope](docs/rules/react-in-jsx-scope.md): Prevent missing `React` when using JSX
111
115
*[react/require-default-props](docs/rules/require-default-props.md): Enforce a defaultProps definition for every prop that is not a required prop
112
-
*[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
113
117
*[react/require-render-return](docs/rules/require-render-return.md): Enforce ES5 or ES6 class for returning value in render function
114
118
*[react/self-closing-comp](docs/rules/self-closing-comp.md): Prevent extra closing tags for components without children (fixable)
115
119
*[react/sort-comp](docs/rules/sort-comp.md): Enforce component methods order
@@ -121,7 +125,8 @@ Finally, enable all of the rules that you would like to use. Use [our preset](#
121
125
122
126
*[react/jsx-boolean-value](docs/rules/jsx-boolean-value.md): Enforce boolean attributes notation in JSX (fixable)
123
127
*[react/jsx-closing-bracket-location](docs/rules/jsx-closing-bracket-location.md): Validate closing bracket location in JSX (fixable)
124
-
*[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)
125
130
*[react/jsx-equals-spacing](docs/rules/jsx-equals-spacing.md): Enforce or disallow spaces around equal signs in JSX attributes (fixable)
126
131
*[react/jsx-filename-extension](docs/rules/jsx-filename-extension.md): Restrict file extensions that may contain JSX
127
132
*[react/jsx-first-prop-new-line](docs/rules/jsx-first-prop-new-line.md): Enforce position of the first prop in JSX (fixable)
@@ -153,7 +158,7 @@ Finally, enable all of the rules that you would like to use. Use [our preset](#
153
158
154
159
## Recommended
155
160
156
-
This plugin exports a `recommended` configuration that enforce React good practices.
161
+
This plugin exports a `recommended` configuration that enforces React good practices.
157
162
158
163
To enable this configuration use the `extends` property in your `.eslintrc` config file:
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.
Copy file name to clipboardExpand all lines: docs/rules/jsx-boolean-value.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,27 +6,29 @@
6
6
7
7
## Rule Details
8
8
9
-
This rule takes one argument. If it is `"always"` then it warns whenever an attribute is missing its value. If `"never"` then it warns if an attribute has a `true` value. The default value of this option is `"never"`.
9
+
This rule takes two arguments. If the first argument is `"always"` then it warns whenever an attribute is missing its value. If `"never"` then it warns if an attribute has a `true` value. The default value of this option is `"never"`.
10
10
11
-
The following patterns are considered warnings when configured `"never"`:
11
+
The second argument is optional: if provided, it must be an object with a `"never"` property (if the first argument is `"always"`), or an `"always"` property (if the first argument is `"never"`). This property’s value must be an array of strings representing prop names.
12
+
13
+
The following patterns are considered warnings when configured `"never"`, or with `"always", { "never": ["personal"] }`:
12
14
13
15
```jsx
14
16
var Hello =<Hello personal={true} />;
15
17
```
16
18
17
-
The following patterns are not considered warnings when configured `"never"`:
19
+
The following patterns are not considered warnings when configured `"never"`, or with `"always", { "never": ["personal"] }`:
18
20
19
21
```jsx
20
22
var Hello =<Hello personal />;
21
23
```
22
24
23
-
The following patterns are considered warnings when configured `"always"`:
25
+
The following patterns are considered warnings when configured `"always"`, or with `"never", { "always": ["personal"] }`:
24
26
25
27
```jsx
26
28
var Hello =<Hello personal />;
27
29
```
28
30
29
-
The following patterns are not considered warnings when configured `"always"`:
31
+
The following patterns are not considered warnings when configured `"always"`, or with `"never", { "always": ["personal"] }`:
0 commit comments