From 16cc089b198dcdebc2422845aa08d18233c6b3a4 Mon Sep 17 00:00:00 2001 From: "JUST.in DO IT" Date: Tue, 17 Oct 2023 15:33:07 -0400 Subject: [PATCH] fix: warning of nth-child (#23638) --- .../src/ReactParallelCoordinates.jsx | 2 +- .../plugins/legacy-preset-chart-nvd3/src/ReactNVD3.jsx | 2 +- .../src/SqlLab/components/SaveDatasetActionButton/index.tsx | 2 +- superset-frontend/src/components/ButtonGroup/index.tsx | 6 +++--- superset-frontend/src/components/DropdownButton/index.tsx | 2 +- .../src/components/DropdownSelectableIcon/index.tsx | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/ReactParallelCoordinates.jsx b/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/ReactParallelCoordinates.jsx index 4a7675d555cd6..7f30716057604 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/ReactParallelCoordinates.jsx +++ b/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/ReactParallelCoordinates.jsx @@ -106,7 +106,7 @@ export default styled(ParallelCoordinates)` height: 18px; margin: 0px; } - .parcoords .row:nth-child(odd) { + .parcoords .row:nth-of-type(odd) { background: ${addAlpha(theme.colors.grayscale.dark2, 0.05)}; } .parcoords .header { diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/ReactNVD3.jsx b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/ReactNVD3.jsx index 9a9962e8aaca4..f7f219a05d219 100644 --- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/ReactNVD3.jsx +++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/ReactNVD3.jsx @@ -152,7 +152,7 @@ export default styled(NVD3)` white-space: nowrap; font-weight: ${({ theme }) => theme.typography.weights.bold}; } - tbody tr:not(.tooltip-header) td:nth-child(2) { + tbody tr:not(.tooltip-header) td:nth-of-type(2) { word-break: break-word; } } diff --git a/superset-frontend/src/SqlLab/components/SaveDatasetActionButton/index.tsx b/superset-frontend/src/SqlLab/components/SaveDatasetActionButton/index.tsx index dbb25b138a58e..79a3bf0b8ee9c 100644 --- a/superset-frontend/src/SqlLab/components/SaveDatasetActionButton/index.tsx +++ b/superset-frontend/src/SqlLab/components/SaveDatasetActionButton/index.tsx @@ -44,7 +44,7 @@ const SaveDatasetActionButton = ({ font-weight: ${theme.gridUnit * 150}; background-color: ${theme.colors.primary.light4}; color: ${theme.colors.primary.dark1}; - &:nth-child(2) { + &:nth-of-type(2) { &:before, &:hover:before { border-left: 2px solid ${theme.colors.primary.dark2}; diff --git a/superset-frontend/src/components/ButtonGroup/index.tsx b/superset-frontend/src/components/ButtonGroup/index.tsx index 463a042066585..78e29714cd3f2 100644 --- a/superset-frontend/src/components/ButtonGroup/index.tsx +++ b/superset-frontend/src/components/ButtonGroup/index.tsx @@ -30,18 +30,18 @@ export default function ButtonGroup(props: ButtonGroupProps) { role="group" className={className} css={{ - '& :nth-child(1):not(:nth-last-child(1))': { + '& :nth-of-type(1):not(:nth-last-of-type(1))': { borderTopRightRadius: 0, borderBottomRightRadius: 0, borderRight: 0, marginLeft: 0, }, - '& :not(:nth-child(1)):not(:nth-last-child(1))': { + '& :not(:nth-of-type(1)):not(:nth-last-of-type(1))': { borderRadius: 0, borderRight: 0, marginLeft: 0, }, - '& :nth-last-child(1):not(:nth-child(1))': { + '& :nth-last-of-type(1):not(:nth-of-type(1))': { borderTopLeftRadius: 0, borderBottomLeftRadius: 0, marginLeft: 0, diff --git a/superset-frontend/src/components/DropdownButton/index.tsx b/superset-frontend/src/components/DropdownButton/index.tsx index c6293f66a3fbd..a35e66b5d7329 100644 --- a/superset-frontend/src/components/DropdownButton/index.tsx +++ b/superset-frontend/src/components/DropdownButton/index.tsx @@ -42,7 +42,7 @@ const StyledDropdownButton = styled.div` background-color: ${({ theme }) => theme.colors.grayscale.light2}; color: ${({ theme }) => theme.colors.grayscale.base}; } - &:nth-child(2) { + &:nth-of-type(2) { margin: 0; border-radius: ${({ theme }) => `0 ${theme.gridUnit}px ${theme.gridUnit}px 0`}; diff --git a/superset-frontend/src/components/DropdownSelectableIcon/index.tsx b/superset-frontend/src/components/DropdownSelectableIcon/index.tsx index 582bc182e3c15..f668aa720d162 100644 --- a/superset-frontend/src/components/DropdownSelectableIcon/index.tsx +++ b/superset-frontend/src/components/DropdownSelectableIcon/index.tsx @@ -46,7 +46,7 @@ const StyledDropdownButton = styled( button.ant-btn:first-of-type { display: none; } - > button.ant-btn:nth-child(2) { + > button.ant-btn:nth-of-type(2) { display: inline-flex; background-color: transparent !important; height: unset;