Skip to content

Commit

Permalink
Extend mapping from the github plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
khiga8 committed May 13, 2024
1 parent d9832b8 commit 45ce5ad
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 10 additions & 2 deletions src/configs/components.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const {flattenComponents} = require('../utils/flatten-components')

const components = flattenComponents({
let components = flattenComponents({

Check failure on line 3 in src/configs/components.js

View workflow job for this annotation

GitHub Actions / lint

'components' is never reassigned. Use 'const' instead
Button: 'button',
IconButton: 'button',
ToggleSwitch: 'button',
Expand All @@ -20,4 +20,12 @@ const components = flattenComponents({
},
})

module.exports = components
// We want to avoid setting a jsx-a11y mapping from `Box` to `div` until polymorphic linting is enabled for jsx-a11y.
// 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)
let githubMapping = Object.assign({}, components);

Check failure on line 25 in src/configs/components.js

View workflow job for this annotation

GitHub Actions / lint

'githubMapping' is never reassigned. Use 'const' instead

Check failure on line 25 in src/configs/components.js

View workflow job for this annotation

GitHub Actions / lint

Delete `;`
githubMapping['Box'] = 'div'

module.exports = {
jsxA11yMapping: components,
githubMapping: githubMapping

Check failure on line 30 in src/configs/components.js

View workflow job for this annotation

GitHub Actions / lint

Expected property shorthand

Check failure on line 30 in src/configs/components.js

View workflow job for this annotation

GitHub Actions / lint

Insert `,`
}
6 changes: 3 additions & 3 deletions src/configs/recommended.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const components = require('./components')
const {jsxA11yMapping, gihubMapping} = require('./components')

module.exports = {
parserOptions: {
Expand All @@ -19,10 +19,10 @@ module.exports = {
},
settings: {
github: {
components,
gihubMapping,
},
'jsx-a11y': {
components,
jsxA11yMapping,
},
},
}

0 comments on commit 45ce5ad

Please sign in to comment.