File tree 2 files changed +13
-13
lines changed
2 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ Examples of **correct** code for this rule:
23
23
< a href= {" javascript:" }>< / a>
24
24
```
25
25
26
- This rule takes into account ` linkComponents ` setting.
26
+ This rule takes the ` linkComponents ` setting into account .
27
27
28
28
## Rule Options
29
29
@@ -48,9 +48,8 @@ This rule takes into account `linkComponents` setting.
48
48
Allows you to indicate a specific list of properties used by a custom component to be checked.
49
49
This will override anything passed to ` linkComponents ` setting.
50
50
51
- NOTE: This rule now takes into account ` linkComponents ` setting and it should be used as primary source of link components.
52
- The rule still allows passing link components as rule option, but it is meant only as backwards-compatibility feature.
53
- New setups should only use ` linkComponents ` setting.
51
+ NOTE: This rule now takes into account the ` linkComponents ` setting, which should be used as the sole source of truth for link components.
52
+ The rule still allows passing link components as rule option for backwards compatibility, but this option is deprecated.
54
53
55
54
### name
56
55
Original file line number Diff line number Diff line change @@ -31,14 +31,12 @@ function shouldVerifyProp(node, config) {
31
31
return name === config . get ( parentName )
32
32
}
33
33
34
- function parseLegacyOption ( option ) {
35
- const config = linkComponentsUtil . getLinkComponents ( { } ) // get defaults
36
- option . forEach ( function ( opt ) {
37
- opt . props . forEach ( function ( prop ) { // FIXME: only last prop will work at the moment
38
- config . set ( opt . name , prop )
39
- } )
34
+ function parseLegacyOption ( config , option ) {
35
+ option . forEach ( ( opt ) => {
36
+ opt . props . forEach ( ( prop ) => {
37
+ config . set ( opt . name , prop ) ;
38
+ } ) ;
40
39
} )
41
- return config
42
40
}
43
41
44
42
const messages = {
@@ -75,13 +73,16 @@ module.exports = {
75
73
} ,
76
74
required : [ 'name' , 'props' ] ,
77
75
additionalProperties : false ,
78
- deprecated : true , // ?
76
+ deprecated : true ,
79
77
} ,
80
78
} ] ,
81
79
} ,
82
80
83
81
create ( context ) {
84
- const linkComponents = context . options [ 0 ] ? parseLegacyOption ( context . options [ 0 ] ) : linkComponentsUtil . getLinkComponents ( context ) ;
82
+ const linkComponents = linkComponentsUtil . getLinkComponents ( context ) ;
83
+ if ( context . options [ 0 ] ) {
84
+ parseLegacyOption ( linkComponents , context . options [ 0 ] ) ;
85
+ }
85
86
86
87
return {
87
88
JSXAttribute ( node ) {
You can’t perform that action at this time.
0 commit comments