File tree Expand file tree Collapse file tree 2 files changed +49
-5
lines changed Expand file tree Collapse file tree 2 files changed +49
-5
lines changed Original file line number Diff line number Diff line change
1
+ const components = {
2
+ Button : 'button' ,
3
+ IconButton : 'button' ,
4
+ Link : 'a' ,
5
+ Spinner : 'svg' ,
6
+ Octicon : 'svg' ,
7
+ ToggleSwitch : 'button' ,
8
+ Radio : 'input' ,
9
+ TextInput : {
10
+ Action : 'button' ,
11
+ self : 'input' ,
12
+ } ,
13
+ Select : {
14
+ Option : 'option' ,
15
+ self : 'select' ,
16
+ } ,
17
+ UnderlineNav : {
18
+ Link : 'a' ,
19
+ self : 'nav' ,
20
+ } ,
21
+ TabNav : {
22
+ Link : 'a' ,
23
+ self : 'nav' ,
24
+ } ,
25
+ SubNav : {
26
+ Link : 'a' ,
27
+ self : 'nav' ,
28
+ } ,
29
+ }
30
+
31
+ const flattenComponents = ( componentObj ) => {
32
+ let result = { } ;
33
+
34
+ Object . keys ( componentObj ) . forEach ( ( key ) => {
35
+ if ( typeof componentObj [ key ] === 'object' ) {
36
+ const test = Object . keys ( componentObj [ key ] ) . forEach ( ( item ) => {
37
+ result = { ...result , [ `${ key } ${ item !== 'self' ? `.${ item } ` : '' } ` ] : componentObj [ key ] [ item ] } ;
38
+ } ) ;
39
+ } else {
40
+ result = { ...result , [ key ] : componentObj [ key ] }
41
+ }
42
+ } ) ;
43
+
44
+ return result ;
45
+ }
46
+
47
+
48
+ exports . components = flattenComponents ( components ) ;
Original file line number Diff line number Diff line change @@ -15,11 +15,7 @@ module.exports = {
15
15
} ,
16
16
settings : {
17
17
'jsx-a11y' : {
18
- components : {
19
- Button : 'button' ,
20
- IconButton : 'button' ,
21
- Link : 'a'
22
- }
18
+ components : require ( './components' )
23
19
}
24
20
}
25
21
}
You can’t perform that action at this time.
0 commit comments