@@ -8,19 +8,19 @@ and `propTypes` are declared in an ES6 class.
8
8
9
9
By default, this rule will check for and warn about declaring any of the above properties outside of the class body.
10
10
11
- There are three key options are ` static public field ` , ` static getter ` , and ` property assignment ` .
11
+ The three key options are ` static public field ` , ` static getter ` , and ` property assignment ` .
12
12
13
13
### When ` static public field ` is enabled (default):
14
14
15
15
Examples of ** incorrect** code for this rule:
16
16
17
17
``` js
18
18
class MyComponent extends React .Component {
19
- static get childContextTypes () { /* ...*/ }
20
- static get contextTypes () { /* ...*/ }
21
- static get contextType () { /* ...*/ }
22
- static get displayName () { /* ...*/ }
23
- static get defaultProps () { /* ...*/ }
19
+ static get childContextTypes () { /* ...*/ }
20
+ static get contextTypes () { /* ...*/ }
21
+ static get contextType () { /* ...*/ }
22
+ static get displayName () { /* ...*/ }
23
+ static get defaultProps () { /* ...*/ }
24
24
static get propTypes () { /* ...*/ }
25
25
}
26
26
```
@@ -39,11 +39,11 @@ Examples of **correct** code for this rule:
39
39
40
40
``` js
41
41
class MyComponent extends React .Component {
42
- static childContextTypes = { /* ...*/ };
43
- static contextTypes = { /* ...*/ };
44
- static contextType = { /* ...*/ };
45
- static displayName = " Hello" ;
46
- static defaultProps = { /* ...*/ };
42
+ static childContextTypes = { /* ...*/ };
43
+ static contextTypes = { /* ...*/ };
44
+ static contextType = { /* ...*/ };
45
+ static displayName = " Hello" ;
46
+ static defaultProps = { /* ...*/ };
47
47
static propTypes = { /* ...*/ };
48
48
}
49
49
```
@@ -54,11 +54,11 @@ Examples of **incorrect** code for this rule:
54
54
55
55
``` js
56
56
class MyComponent extends React .Component {
57
- static childContextTypes = { /* ...*/ };
58
- static contextTypes = { /* ...*/ };
59
- static contextType = { /* ...*/ };
60
- static displayName = " Hello" ;
61
- static defaultProps = { /* ...*/ };
57
+ static childContextTypes = { /* ...*/ };
58
+ static contextTypes = { /* ...*/ };
59
+ static contextType = { /* ...*/ };
60
+ static displayName = " Hello" ;
61
+ static defaultProps = { /* ...*/ };
62
62
static propTypes = { /* ...*/ };
63
63
}
64
64
```
@@ -77,11 +77,11 @@ Examples of **correct** code for this rule:
77
77
78
78
``` js
79
79
class MyComponent extends React .Component {
80
- static get childContextTypes () { /* ...*/ }
81
- static get contextTypes () { /* ...*/ }
82
- static get contextType () { /* ...*/ }
83
- static get displayName () { /* ...*/ }
84
- static get defaultProps () { /* ...*/ }
80
+ static get childContextTypes () { /* ...*/ }
81
+ static get contextTypes () { /* ...*/ }
82
+ static get contextType () { /* ...*/ }
83
+ static get displayName () { /* ...*/ }
84
+ static get defaultProps () { /* ...*/ }
85
85
static get propTypes () { /* ...*/ }
86
86
}
87
87
```
@@ -92,22 +92,22 @@ Examples of **incorrect** code for this rule:
92
92
93
93
``` js
94
94
class MyComponent extends React .Component {
95
- static childContextTypes = { /* ...*/ };
96
- static contextTypes = { /* ...*/ };
97
- static contextType = { /* ...*/ };
98
- static displayName = " Hello" ;
99
- static defaultProps = { /* ...*/ };
95
+ static childContextTypes = { /* ...*/ };
96
+ static contextTypes = { /* ...*/ };
97
+ static contextType = { /* ...*/ };
98
+ static displayName = " Hello" ;
99
+ static defaultProps = { /* ...*/ };
100
100
static propTypes = { /* ...*/ };
101
101
}
102
102
```
103
103
104
104
``` js
105
105
class MyComponent extends React .Component {
106
- static get childContextTypes () { /* ...*/ }
107
- static get contextTypes () { /* ...*/ }
108
- static get contextType () { /* ...*/ }
109
- static get displayName () { /* ...*/ }
110
- static get defaultProps () { /* ...*/ }
106
+ static get childContextTypes () { /* ...*/ }
107
+ static get contextTypes () { /* ...*/ }
108
+ static get contextType () { /* ...*/ }
109
+ static get displayName () { /* ...*/ }
110
+ static get defaultProps () { /* ...*/ }
111
111
static get propTypes () { /* ...*/ }
112
112
}
113
113
```
@@ -159,7 +159,7 @@ The `<string>` value must be one these options:
159
159
* ` static getter `
160
160
* ` property assignment `
161
161
162
- The ` options ` schema defined above allows you to specify different rules for the different property fields available.
162
+ The ` options ` schema defined above allows you to specify different rules for the different property fields available.
163
163
164
164
##### Example configuration:
165
165
_ This is only an example, we do not recommend this as a configuration._
0 commit comments