Update checked-in dependencies

This commit is contained in:
github-actions[bot]
2023-07-24 17:15:38 +00:00
parent 601c5ba56e
commit eff6331393
1778 changed files with 42517 additions and 154082 deletions

View File

@@ -22,5 +22,13 @@ module.exports = {
words: ['this', 'more', 'read here', 'read more'],
},
],
'jsx-a11y/no-interactive-element-to-noninteractive-role': [
'error',
{
tr: ['none', 'presentation'],
td: ['cell'], // TODO: Remove once https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/pull/937#issuecomment-1638128318 is addressed.
canvas: ['img'],
},
],
},
}

View File

@@ -50,7 +50,7 @@ module.exports = {
create(context) {
return {
JSXElement: node => {
const elementType = getElementType(context, node.openingElement)
const elementType = getElementType(context, node.openingElement, true)
if (elementType !== `iframe` && ifSemanticElement(context, node)) {
const titleProp = getPropValue(getProp(node.openingElement.attributes, `title`))
if (titleProp) {

View File

@@ -1,4 +1,4 @@
const {getProp, getPropValue} = require('jsx-ast-utils')
const {getProp, getLiteralPropValue} = require('jsx-ast-utils')
const {getElementType} = require('../utils/get-element-type')
const {generateObjSchema} = require('eslint-plugin-jsx-a11y/lib/util/schemas')
@@ -32,9 +32,12 @@ const checkIfInteractiveElement = (context, node) => {
const checkIfVisuallyHiddenAndInteractive = (context, options, node, isParentVisuallyHidden) => {
const {className, componentName} = options
if (node.type === 'JSXElement') {
const classes = getPropValue(getProp(node.openingElement.attributes, 'className'))
const classes = getLiteralPropValue(getProp(node.openingElement.attributes, 'className'))
const isVisuallyHiddenElement = node.openingElement.name.name === componentName
const hasSROnlyClass = typeof classes !== 'undefined' && classes.includes(className)
let hasSROnlyClass = false
if (classes != null) {
hasSROnlyClass = classes.includes(className)
}
let isHidden = false
if (hasSROnlyClass || isVisuallyHiddenElement || !!isParentVisuallyHidden) {
if (checkIfInteractiveElement(context, node)) {

View File

@@ -12,6 +12,10 @@ module.exports = {
create(context) {
return {
MemberExpression(node) {
// If the member expression is part of a call expression like `.innerText()` then it is not the same
// as the `Element.innerText` property, and should not trigger a warning
if (node.parent.type === 'CallExpression') return
if (node.property && node.property.name === 'innerText') {
context.report({
meta: {

View File

@@ -1,4 +1,4 @@
const {elementType, getProp, getPropValue} = require('jsx-ast-utils')
const {elementType, getProp, getLiteralPropValue} = require('jsx-ast-utils')
/*
Allows custom component to be mapped to an element type.
@@ -7,15 +7,19 @@ If a prop determines the type, it can be specified with `props`.
For now, we only support the mapping of one prop type to an element type, rather than combinations of props.
*/
function getElementType(context, node, ignoreMap = false) {
function getElementType(context, node, lazyElementCheck = false) {
const {settings} = context
if (lazyElementCheck) {
return elementType(node)
}
// check if the node contains a polymorphic prop
const polymorphicPropName = settings?.github?.polymorphicPropName ?? 'as'
const rawElement = getPropValue(getProp(node.attributes, polymorphicPropName)) ?? elementType(node)
const rawElement = getLiteralPropValue(getProp(node.attributes, polymorphicPropName)) ?? elementType(node)
// if a component configuration does not exists, return the raw element
if (ignoreMap || !settings?.github?.components?.[rawElement]) return rawElement
if (!settings?.github?.components?.[rawElement]) return rawElement
const defaultComponent = settings.github.components[rawElement]

View File

@@ -1,4 +1,4 @@
const {getProp, getPropValue} = require('jsx-ast-utils')
const {getProp, getLiteralPropValue} = require('jsx-ast-utils')
const {elementRoles} = require('aria-query')
const {getElementType} = require('./get-element-type')
const ObjectMap = require('./object-map')
@@ -43,7 +43,7 @@ function cleanElementRolesMap() {
*/
function getRole(context, node) {
// Early return if role is explicitly set
const explicitRole = getPropValue(getProp(node.attributes, 'role'))
const explicitRole = getLiteralPropValue(getProp(node.attributes, 'role'))
if (explicitRole) {
return explicitRole
}
@@ -80,8 +80,8 @@ function getRole(context, node) {
continue
}
const value = getPropValue(propOnNode)
if (value || (value === '' && prop === 'alt')) {
const value = getLiteralPropValue(propOnNode)
if (propOnNode) {
if (
prop === 'href' ||
prop === 'aria-labelledby' ||
@@ -90,7 +90,7 @@ function getRole(context, node) {
(prop === 'alt' && value !== '')
) {
key.attributes.push({name: prop, constraints: ['set']})
} else {
} else if (value || (value === '' && prop === 'alt')) {
key.attributes.push({name: prop, value})
}
}