Skip to content

Commit 4302562

Browse files
authored
Add mapping of "Box" to "div" (#176)
* Extend mapping from the github plugin * Run linters * Fix mapping
1 parent 29d7638 commit 4302562

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/configs/components.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,12 @@ const components = flattenComponents({
2020
},
2121
})
2222

23-
module.exports = components
23+
// We want to avoid setting a jsx-a11y mapping from `Box` to `div` until polymorphic linting is enabled for jsx-a11y.
24+
// However, polymorphic linting is enabled for the github plugin, so we can safely map `Box` to `div` (while also having it properly interpret the `as` prop)
25+
const githubMapping = Object.assign({}, components)
26+
githubMapping['Box'] = 'div'
27+
28+
module.exports = {
29+
jsxA11yMapping: components,
30+
githubMapping,
31+
}

src/configs/recommended.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const components = require('./components')
1+
const {jsxA11yMapping, githubMapping} = require('./components')
22

33
module.exports = {
44
parserOptions: {
@@ -19,10 +19,10 @@ module.exports = {
1919
},
2020
settings: {
2121
github: {
22-
components,
22+
components: githubMapping,
2323
},
2424
'jsx-a11y': {
25-
components,
25+
components: jsxA11yMapping,
2626
},
2727
},
2828
}

0 commit comments

Comments
 (0)