mirror of
https://github.com/apache/superset.git
synced 2026-04-07 10:31:50 +00:00
chore(lint): enforce more strict eslint/oxlint rules (batch 2) (#37884)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -245,6 +245,16 @@ module.exports = {
|
||||
// Lodash
|
||||
'lodash/import-scope': [2, 'member'],
|
||||
|
||||
// React effect best practices
|
||||
'react-you-might-not-need-an-effect/no-reset-all-state-on-prop-change':
|
||||
'error',
|
||||
'react-you-might-not-need-an-effect/no-chain-state-updates': 'error',
|
||||
'react-you-might-not-need-an-effect/no-event-handler': 'error',
|
||||
'react-you-might-not-need-an-effect/no-derived-state': 'error',
|
||||
|
||||
// Storybook
|
||||
'storybook/prefer-pascal-case': 'error',
|
||||
|
||||
// File progress
|
||||
'file-progress/activate': 1,
|
||||
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
"no-unused-vars": "off",
|
||||
"no-undef": "error",
|
||||
"no-prototype-builtins": "off",
|
||||
"no-unsafe-optional-chaining": "off",
|
||||
"no-unsafe-optional-chaining": "error",
|
||||
"no-constant-binary-expression": "error",
|
||||
"no-import-assign": "off",
|
||||
"no-promise-executor-return": "off",
|
||||
|
||||
@@ -254,6 +255,7 @@
|
||||
// === Unicorn rules (bonus coverage) ===
|
||||
"unicorn/no-new-array": "error",
|
||||
"unicorn/no-invalid-remove-event-listener": "error",
|
||||
"unicorn/no-useless-length-check": "error",
|
||||
"unicorn/filename-case": "off",
|
||||
"unicorn/prevent-abbreviations": "off",
|
||||
"unicorn/no-null": "off",
|
||||
|
||||
@@ -47,9 +47,10 @@ describe('Layout Component', () => {
|
||||
});
|
||||
|
||||
test('hides Header when headerVisible is false', () => {
|
||||
const headerVisible = false;
|
||||
render(
|
||||
<Layout>
|
||||
{false && <Layout.Header>Header</Layout.Header>}
|
||||
{headerVisible && <Layout.Header>Header</Layout.Header>}
|
||||
<Layout.Content>Content Area</Layout.Content>
|
||||
<Layout.Footer>Ant Design Layout Footer</Layout.Footer>
|
||||
</Layout>,
|
||||
@@ -59,11 +60,14 @@ describe('Layout Component', () => {
|
||||
});
|
||||
|
||||
test('hides Footer when footerVisible is false', () => {
|
||||
const footerVisible = false;
|
||||
render(
|
||||
<Layout>
|
||||
<Layout.Header>Header</Layout.Header>
|
||||
<Layout.Content>Content Area</Layout.Content>
|
||||
{false && <Layout.Footer>Ant Design Layout Footer</Layout.Footer>}
|
||||
{footerVisible && (
|
||||
<Layout.Footer>Ant Design Layout Footer</Layout.Footer>
|
||||
)}
|
||||
</Layout>,
|
||||
);
|
||||
|
||||
|
||||
@@ -280,7 +280,7 @@ const CustomModal = ({
|
||||
const shouldShowMask = !(resizable || draggable);
|
||||
|
||||
const onDragStart = (_: DraggableEvent, uiData: DraggableData) => {
|
||||
const { clientWidth, clientHeight } = window?.document?.documentElement;
|
||||
const { clientWidth, clientHeight } = document.documentElement;
|
||||
const targetRect = draggableRef?.current?.getBoundingClientRect();
|
||||
|
||||
if (targetRect) {
|
||||
|
||||
@@ -606,7 +606,7 @@ const buildQuery: BuildQuery<TableChartFormData> = (
|
||||
{
|
||||
...queryObject,
|
||||
time_offsets: [],
|
||||
row_limit: Number(formData?.row_limit) ?? 0,
|
||||
row_limit: Number(formData?.row_limit ?? 0),
|
||||
row_offset: 0,
|
||||
post_processing: [],
|
||||
is_rowcount: true,
|
||||
|
||||
@@ -196,7 +196,9 @@ describe('BigNumberWithTrendline', () => {
|
||||
showXAxis: true,
|
||||
},
|
||||
});
|
||||
expect((transformed.echartOptions?.xAxis as any).show).toBe(true);
|
||||
expect((transformed.echartOptions!.xAxis as { show: boolean }).show).toBe(
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
test('should not show X axis when showXAxis is false', () => {
|
||||
@@ -207,7 +209,9 @@ describe('BigNumberWithTrendline', () => {
|
||||
showXAxis: false,
|
||||
},
|
||||
});
|
||||
expect((transformed.echartOptions?.xAxis as any).show).toBe(false);
|
||||
expect((transformed.echartOptions!.xAxis as { show: boolean }).show).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
test('should show Y axis when showYAxis is true', () => {
|
||||
@@ -218,7 +222,9 @@ describe('BigNumberWithTrendline', () => {
|
||||
showYAxis: true,
|
||||
},
|
||||
});
|
||||
expect((transformed.echartOptions?.yAxis as any).show).toBe(true);
|
||||
expect((transformed.echartOptions!.yAxis as { show: boolean }).show).toBe(
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
test('should not show Y axis when showYAxis is false', () => {
|
||||
@@ -229,7 +235,9 @@ describe('BigNumberWithTrendline', () => {
|
||||
showYAxis: false,
|
||||
},
|
||||
});
|
||||
expect((transformed.echartOptions?.yAxis as any).show).toBe(false);
|
||||
expect((transformed.echartOptions!.yAxis as { show: boolean }).show).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -347,7 +347,7 @@ const buildQuery: BuildQuery<TableChartFormData> = (
|
||||
{
|
||||
...queryObject,
|
||||
time_offsets: [],
|
||||
row_limit: Number(formData?.row_limit) ?? 0,
|
||||
row_limit: Number(formData?.row_limit ?? 0),
|
||||
row_offset: 0,
|
||||
post_processing: [],
|
||||
is_rowcount: true,
|
||||
|
||||
@@ -210,10 +210,9 @@ export function useIsFilterInScope() {
|
||||
if (hasChartsInScope) {
|
||||
isChartInScope = filter.chartsInScope!.some((chartId: number) => {
|
||||
const tabParents = selectChartTabParents(chartId);
|
||||
// Note: every() returns true for empty arrays, so length check is unnecessary
|
||||
return (
|
||||
!tabParents ||
|
||||
tabParents.length === 0 ||
|
||||
tabParents.every(tab => activeTabs.includes(tab))
|
||||
!tabParents || tabParents.every(tab => activeTabs.includes(tab))
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -276,10 +275,9 @@ export function useIsCustomizationInScope() {
|
||||
customization.chartsInScope.length > 0 &&
|
||||
customization.chartsInScope.some((chartId: number) => {
|
||||
const tabParents = selectChartTabParents(chartId);
|
||||
// Note: every() returns true for empty arrays, so length check is unnecessary
|
||||
return (
|
||||
!tabParents ||
|
||||
tabParents.length === 0 ||
|
||||
tabParents.every(tab => activeTabs.includes(tab))
|
||||
!tabParents || tabParents.every(tab => activeTabs.includes(tab))
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user