chore(frontend): enable additional oxlint rules for better code hygiene (#38145)

This commit is contained in:
Evan Rusackas
2026-02-22 22:36:24 -05:00
committed by GitHub
parent a87a006aae
commit 672a380587
27 changed files with 296 additions and 293 deletions

View File

@@ -87,31 +87,29 @@ function getQueryMode(controls: ControlStateMapping): QueryMode {
}
const processComparisonColumns = (columns: any[], suffix: string) =>
columns
.map(col => {
if (!col.label.includes(suffix)) {
return [
{
label: `${t('Main')} ${col.label}`,
value: `${t('Main')} ${col.value}`,
},
{
label: `# ${col.label}`,
value: `# ${col.value}`,
},
{
label: `${col.label}`,
value: `${col.value}`,
},
{
label: `% ${col.label}`,
value: `% ${col.value}`,
},
];
}
return [];
})
.flat();
columns.flatMap(col => {
if (!col.label.includes(suffix)) {
return [
{
label: `${t('Main')} ${col.label}`,
value: `${t('Main')} ${col.value}`,
},
{
label: `# ${col.label}`,
value: `# ${col.value}`,
},
{
label: `${col.label}`,
value: `${col.value}`,
},
{
label: `% ${col.label}`,
value: `% ${col.value}`,
},
];
}
return [];
});
/**
* Visibility check

View File

@@ -216,93 +216,91 @@ const processComparisonColumns = (
props: TableChartProps,
comparisonSuffix: string,
) =>
columns
.map(col => {
const {
datasource: { columnFormats, currencyFormats },
rawFormData: { column_config: columnConfig = {} },
} = props;
const savedFormat = columnFormats?.[col.key];
const savedCurrency = currencyFormats?.[col.key];
const originalLabel = col.label;
if (
(col.isMetric || col.isPercentMetric) &&
!col.key.includes(comparisonSuffix) &&
col.isNumeric
) {
return [
{
...col,
originalLabel,
metricName: col.key,
label: t('Main'),
key: `${t('Main')} ${col.key}`,
config: getComparisonColConfig(t('Main'), col.key, columnConfig),
formatter: getComparisonColFormatter(
t('Main'),
col,
columnConfig,
savedFormat,
savedCurrency,
),
},
{
...col,
originalLabel,
metricName: col.key,
label: `#`,
key: `# ${col.key}`,
config: getComparisonColConfig(`#`, col.key, columnConfig),
formatter: getComparisonColFormatter(
`#`,
col,
columnConfig,
savedFormat,
savedCurrency,
),
},
{
...col,
originalLabel,
metricName: col.key,
label: ``,
key: `${col.key}`,
config: getComparisonColConfig(``, col.key, columnConfig),
formatter: getComparisonColFormatter(
``,
col,
columnConfig,
savedFormat,
savedCurrency,
),
},
{
...col,
originalLabel,
metricName: col.key,
label: `%`,
key: `% ${col.key}`,
config: getComparisonColConfig(`%`, col.key, columnConfig),
formatter: getComparisonColFormatter(
`%`,
col,
columnConfig,
savedFormat,
savedCurrency,
),
},
];
}
if (
!col.isMetric &&
!col.isPercentMetric &&
!col.key.includes(comparisonSuffix)
) {
return [col];
}
return [];
})
.flat();
columns.flatMap(col => {
const {
datasource: { columnFormats, currencyFormats },
rawFormData: { column_config: columnConfig = {} },
} = props;
const savedFormat = columnFormats?.[col.key];
const savedCurrency = currencyFormats?.[col.key];
const originalLabel = col.label;
if (
(col.isMetric || col.isPercentMetric) &&
!col.key.includes(comparisonSuffix) &&
col.isNumeric
) {
return [
{
...col,
originalLabel,
metricName: col.key,
label: t('Main'),
key: `${t('Main')} ${col.key}`,
config: getComparisonColConfig(t('Main'), col.key, columnConfig),
formatter: getComparisonColFormatter(
t('Main'),
col,
columnConfig,
savedFormat,
savedCurrency,
),
},
{
...col,
originalLabel,
metricName: col.key,
label: `#`,
key: `# ${col.key}`,
config: getComparisonColConfig(`#`, col.key, columnConfig),
formatter: getComparisonColFormatter(
`#`,
col,
columnConfig,
savedFormat,
savedCurrency,
),
},
{
...col,
originalLabel,
metricName: col.key,
label: ``,
key: ` ${col.key}`,
config: getComparisonColConfig(``, col.key, columnConfig),
formatter: getComparisonColFormatter(
``,
col,
columnConfig,
savedFormat,
savedCurrency,
),
},
{
...col,
originalLabel,
metricName: col.key,
label: `%`,
key: `% ${col.key}`,
config: getComparisonColConfig(`%`, col.key, columnConfig),
formatter: getComparisonColFormatter(
`%`,
col,
columnConfig,
savedFormat,
savedCurrency,
),
},
];
}
if (
!col.isMetric &&
!col.isPercentMetric &&
!col.key.includes(comparisonSuffix)
) {
return [col];
}
return [];
});
const serverPageLengthMap = new Map();