Skip to content

Commit 5a02508

Browse files
committed
add missing prefix on option examples
1 parent 647bcd4 commit 5a02508

7 files changed

+60
-12
lines changed

docs/rules/jsx-closing-bracket-location.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ The following patterns are considered warnings:
7171
// 'jsx-closing-bracket-location': 1
7272
// 'jsx-closing-bracket-location': [1, 'tag-aligned']
7373
// 'jsx-closing-bracket-location': [1, 'line-aligned']
74-
<Hello
74+
<Hello
7575
firstName="John"
7676
lastName="Smith"
7777
/>;
@@ -114,7 +114,7 @@ var x = function() {
114114
};
115115

116116
// 'jsx-closing-bracket-location': [1, 'after-props']
117-
<Hello
117+
<Hello
118118
firstName="John"
119119
lastName="Smith"
120120
/>;
@@ -127,7 +127,7 @@ var x = function() {
127127
</Say>;
128128

129129
// 'jsx-closing-bracket-location': [1, 'props-aligned']
130-
<Hello
130+
<Hello
131131
firstName="John"
132132
lastName="Smith" />;
133133

@@ -188,7 +188,7 @@ var x = function() {
188188
};
189189

190190
// 'jsx-closing-bracket-location': [1, {selfClosing: 'after-props'}]
191-
<Hello
191+
<Hello
192192
firstName="John"
193193
lastName="Smith" />;
194194

@@ -200,7 +200,7 @@ var x = function() {
200200
</Say>;
201201

202202
// 'jsx-closing-bracket-location': [1, {selfClosing: 'props-aligned', nonEmpty: 'after-props'}]
203-
<Hello
203+
<Hello
204204
firstName="John"
205205
lastName="Smith"
206206
/>;

docs/rules/jsx-max-props-per-line.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ The following patterns are not considered warnings:
7676
```jsx
7777
// [1, { "when": "multiline" }]
7878
<Hello firstName="John" lastName="Smith" />
79-
<Hello
80-
firstName="John"
81-
lastName="Smith"
79+
<Hello
80+
firstName="John"
81+
lastName="Smith"
8282
/>
8383
```
8484

docs/rules/no-unused-prop-types.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ var Hello = createReactClass({
4545

4646
This rule can take one argument to ignore some specific props during validation.
4747

48-
```
48+
```js
4949
...
5050
"react/no-unused-prop-types": [<enabled>, { customValidators: <customValidator>, skipShapeProps: <skipShapeProps> }]
5151
...

docs/rules/prop-types.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Hello.propTypes = {
100100

101101
This rule can take one argument to ignore some specific props during validation.
102102

103-
```
103+
```js
104104
...
105105
"react/prop-types": [<enabled>, { ignore: <ignore>, customValidators: <customValidator> }]
106106
...

docs/rules/require-extension.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Restrict file extensions that may be required (require-extension)
2+
3+
**Deprecation notice**: This rule is deprecated. Please use the eslint-plugin-import [extensions](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md) rule instead.
4+
5+
`require()` statements should generally not include a file extension as there is a well defined mechanism for resolving a module ID to a specific file. This rule inspects the module ID being required and creates a warning if the ID contains a '.jsx' file extension.
6+
7+
Note: this rule does not prevent required files from containing these extensions, it merely prevents the extension from being included in the `require()` statement.
8+
9+
## Rule Details
10+
11+
The following patterns are considered warnings:
12+
13+
```js
14+
var index = require('./index.jsx');
15+
16+
// When [1, {extensions: ['.js']}]
17+
var index = require('./index.js');
18+
```
19+
20+
The following patterns are not considered warnings:
21+
22+
```js
23+
var index = require('./index');
24+
25+
var eslint = require('eslint');
26+
```
27+
28+
## Rule Options
29+
30+
The set of forbidden extensions is configurable. By default '.jsx' is blocked. If you wanted to forbid both '.jsx' and '.js', the configuration would be:
31+
32+
```js
33+
...
34+
"react/require-extension": [1, { "extensions": [".js", ".jsx"] }],
35+
...
36+
```
37+
38+
To configure WebPack to resolve '.jsx' add the following to `webpack.config.js`:
39+
40+
```js
41+
resolve: {
42+
extensions: ["", ".js", ".jsx"]
43+
},
44+
```
45+
46+
## When Not To Use It
47+
48+
If you have file in your project with a '.jsx' file extension and do not have `require()` configured to automatically resolve '.jsx' files.

docs/rules/self-closing-comp.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Prevent extra closing tags for components without children (self-closing-comp)
1+
# Prevent extra closing tags for components without children (react/self-closing-comp)
22

33
Components without children can be self-closed to avoid unnecessary extra closing tag.
44

docs/rules/sort-comp.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var Hello = createReactClass({
3939

4040
This rule can take one argument to customize the components organisation.
4141

42-
```
42+
```js
4343
...
4444
"react/sort-comp": [<enabled>, { order: <order>, groups: <groups> }]
4545
...

0 commit comments

Comments
 (0)