Skip to content

Commit

Permalink
fix(eslint-plugin-baseui): object spread crash (uber#3113)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandgraham authored and VladimirMilenko committed Apr 2, 2020
1 parent b4348f4 commit fb7b153
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Expand Up @@ -100,6 +100,18 @@ const tests = {
}
`,
},

// Modal - Backdrop
// Regression: object spread in overrides
{
code: `
import {Modal as BaseModal} from "baseui/modal"
const overrides = { Backdrop: {}}
export default function(props) {
return <BaseModal overrides={{ ...overrides }} />
}
`,
},
],
invalid: [
// Accordion - renderPanelContent
Expand Down
Expand Up @@ -283,7 +283,10 @@ module.exports = {
if (node.parent.value.expression.type === 'ObjectExpression') {
// Find object property with "Backdrop" as key.
const property = node.parent.value.expression.properties.find(
property => property.key.name === 'Backdrop',
property =>
property.key &&
property.key.name &&
property.key.name === 'Backdrop',
);
if (property) {
context.report({
Expand Down

0 comments on commit fb7b153

Please sign in to comment.