From e1096b188c05be0ea49af3a2fb0c534aa2fbc287 Mon Sep 17 00:00:00 2001 From: Diego Andai Date: Thu, 2 May 2024 15:49:41 -0400 Subject: [PATCH] prettier --- .../divider-props/divider-props.js | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/packages/mui-codemod/src/deprecations/divider-props/divider-props.js b/packages/mui-codemod/src/deprecations/divider-props/divider-props.js index 9f13fe5013c0bf..6133aacd611d3f 100644 --- a/packages/mui-codemod/src/deprecations/divider-props/divider-props.js +++ b/packages/mui-codemod/src/deprecations/divider-props/divider-props.js @@ -12,20 +12,20 @@ export default function transformer(file, api, options) { const printOptions = options.printOptions; findComponentJSX(j, { root, componentName: 'Divider' }, (elementPath) => { - const hasLightProp = elementPath.node.openingElement.attributes.findIndex( - (attr) => attr.type === 'JSXAttribute' && attr.name.name === 'light', - ) !== -1; - + const hasLightProp = + elementPath.node.openingElement.attributes.findIndex( + (attr) => attr.type === 'JSXAttribute' && attr.name.name === 'light', + ) !== -1; + if (hasLightProp) { - elementPath.node.openingElement.attributes = elementPath.node.openingElement.attributes.filter( - (attr) => { + elementPath.node.openingElement.attributes = + elementPath.node.openingElement.attributes.filter((attr) => { if (attr.type === 'JSXAttribute' && attr.name.name === 'light') { return false; } return true; - }, - ); - + }); + const sxIndex = elementPath.node.openingElement.attributes.findIndex( (attr) => attr.type === 'JSXAttribute' && attr.name.name === 'sx', ); @@ -41,7 +41,7 @@ export default function transformer(file, api, options) { const opacityIndex = elementPath.node.openingElement.attributes[ sxIndex ].value.expression.properties.findIndex((key) => key.key.name === 'opacity'); - + if (opacityIndex === -1) { assignObject(j, { target: elementPath.node.openingElement.attributes[sxIndex], @@ -58,17 +58,17 @@ export default function transformer(file, api, options) { (key) => key.key.name === 'defaultProps', ); - const hasLightProp = defaultPropsObject.value.properties.findIndex( - (prop) => prop.key.name === 'light', - ) !== -1; + const hasLightProp = + defaultPropsObject.value.properties.findIndex((prop) => prop.key.name === 'light') !== -1; if (hasLightProp) { - defaultPropsObject.value.properties = defaultPropsObject.value.properties.filter( (prop) => !['light'].includes(prop?.key?.name), ); - const sxIndex = defaultPropsObject.value.properties.findIndex((prop) => prop.key.name === 'sx'); + const sxIndex = defaultPropsObject.value.properties.findIndex( + (prop) => prop.key.name === 'sx', + ); if (sxIndex === -1) { defaultPropsObject.value.properties.push( @@ -78,9 +78,9 @@ export default function transformer(file, api, options) { ), ); } else { - const opacityIndex = defaultPropsObject.value.properties[sxIndex].value.properties.findIndex( - (key) => key.key.name === 'opacity', - ); + const opacityIndex = defaultPropsObject.value.properties[ + sxIndex + ].value.properties.findIndex((key) => key.key.name === 'opacity'); if (opacityIndex === -1) { defaultPropsObject.value.properties[sxIndex].value.properties.push(