Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions packages/app/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,23 @@ export default [
...nextPlugin.configs.recommended.rules,
...nextPlugin.configs['core-web-vitals'].rules,
...reactHooksPlugin.configs.recommended.rules,
...eslintReactPlugin.configs.recommended.rules,
// Disable rules from eslint-plugin-react-hooks that have equivalent rules in @eslint-react
...eslintReactPlugin.configs['disable-conflict-eslint-plugin-react-hooks'].rules,
...eslintReactPlugin.configs['recommended-type-checked'].rules,
'react-hooks/set-state-in-effect': 'warn',
'react-hooks/exhaustive-deps': 'error',
'@eslint-react/exhaustive-deps': 'error',

// @eslint-react version is experimental, we'll use react-hooks/set-state-in-render instead
'@eslint-react/set-state-in-render': 'off',
'react-hooks/set-state-in-render': 'error',

// Disable rules from eslint-plugin-react-hooks that have equivalent rules enabled in @eslint-react
'react-hooks/rules-of-hooks': 'off',
'react-hooks/static-components': 'off',
'react-hooks/use-memo': 'off',
'react-hooks/component-hook-factories': 'off',
'react-hooks/error-boundaries': 'off',
'react-hooks/set-state-in-effect': 'off',
'react-hooks/unsupported-syntax': 'off',
'react-hooks/exhaustive-deps': 'off',

'react-hook-form/no-use-watch': 'error',
'@eslint-react/no-unstable-default-props': 'error',
'@typescript-eslint/ban-ts-comment': 'warn',
Expand Down
1 change: 1 addition & 0 deletions packages/app/src/DBChartPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ function AIAssistant({
</Group>
<Collapse in={opened}>
{opened && (
// eslint-disable-next-line react-hooks/refs
<form onSubmit={handleSubmit(onSubmit)}>
<Group mb="md">
<SourceSelectControlled
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/DBSearchPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@ function DBSearchPage() {
updateRelativeTimeInputValue(interval);
}
// we only want this to run on initial mount
// eslint-disable-next-line react-hooks/exhaustive-deps
// eslint-disable-next-line @eslint-react/exhaustive-deps
}, [updateRelativeTimeInputValue, searchedConfig.source, isReady]);

useLiveUpdate({
Expand Down
1 change: 1 addition & 0 deletions packages/app/src/DOMPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ export default function DOMPlayer({
);
}

// eslint-disable-next-line react-hooks/immutability
updatePlayerTimeRafRef.current = requestAnimationFrame(updatePlayerTime);
}, []);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ export default function EditTimeChartForm({

// Emulate the date range picker auto-searching similar to dashboards
useEffect(() => {
// eslint-disable-next-line react-hooks/set-state-in-effect
setQueriedConfig((config: ChartConfigWithDateRange | undefined) => {
if (config == null) {
return config;
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/components/DBHeatmapChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ function Heatmap({
},
plugins: [
// legendAsTooltipPlugin()

// eslint-disable-next-line react-hooks/refs -- mouseInsideRef is read at event time, not during render
highlightDataPlugin({
proximity: 20,
yFormatter: tickFormatter,
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/components/DBRowTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ export const RawLogTable = memo(
// Conditions not met, clear flag
tableSearch.clearShouldScrollToMatch();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
// eslint-disable-next-line @eslint-react/exhaustive-deps
}, [
tableSearch.shouldScrollToMatch,
tableSearch.currentMatchIndex,
Expand Down Expand Up @@ -1531,7 +1531,7 @@ function DBSqlRowTableComponent({
if (prevSourceId && prevSourceId !== sourceId) {
_onSortingChange(null);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
// eslint-disable-next-line @eslint-react/exhaustive-deps
}, [sourceId]);

// Sync local orderBy state with initialSortBy when it changes
Expand Down
3 changes: 2 additions & 1 deletion packages/app/src/components/DBTable/TableSearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export const TableSearchInput = ({

// Handle keyboard shortcuts (Cmd+F, Escape)
const handleKeyDown = useCallback(
// eslint-disable-next-line react-hooks/preserve-manual-memoization
(e: KeyboardEvent) => {
// Detect Cmd+F (Mac) or Ctrl+F (Windows/Linux)
if ((e.metaKey || e.ctrlKey) && e.key === 'f') {
Expand All @@ -155,7 +156,7 @@ export const TableSearchInput = ({
handleClose();
}
},
// eslint-disable-next-line react-hooks/exhaustive-deps
// eslint-disable-next-line @eslint-react/exhaustive-deps
[isVisible, handleClose, handleShow],
);

Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/components/SQLEditor/SQLEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default function SQLEditor({
minHeight={'100px'}
extensions={[
createCodeMirrorStyleTheme(),

// eslint-disable-next-line react-hooks/refs
compartmentRef.current.of(
clickhouseSql({
upperCaseKeywords: true,
Expand Down
1 change: 1 addition & 0 deletions packages/app/src/components/SQLEditor/SQLInlineEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ export default function SQLInlineEditor({
// Enable line wrapping when multiline is allowed (regardless of focus)
...(allowMultiline ? [EditorView.lineWrapping] : []),

// eslint-disable-next-line react-hooks/refs
compartmentRef.current.of(
clickhouseSql({
upperCaseKeywords: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/components/TimePicker/TimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const TimePickerComponent = ({
}
}
// only run when dateRange changes or opened state changes
// eslint-disable-next-line react-hooks/exhaustive-deps
// eslint-disable-next-line @eslint-react/exhaustive-deps
}, [dateRange, opened, mode]);

const handleRelativeSearch = React.useCallback(
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/hooks/useResizable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function useResizable(

const endResize = useCallback(() => {
document.removeEventListener('mousemove', handleResize);

// eslint-disable-next-line react-hooks/immutability
document.removeEventListener('mouseup', endResize);
}, [handleResize]);

Expand Down
4 changes: 3 additions & 1 deletion packages/app/src/hooks/useTableSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export function useTableSearch({
shouldScrollToMatchRef.current = true;
}
// Otherwise keep the current match index as is (loading more data shouldn't change position)
// eslint-disable-next-line react-hooks/exhaustive-deps
// eslint-disable-next-line @eslint-react/exhaustive-deps
}, [debouncedSearchQuery, rows, searchableColumns]);

// Handle visibility changes
Expand Down Expand Up @@ -146,6 +146,7 @@ export function useTableSearch({
shouldScrollToMatchRef.current = false;
}, []);

// eslint-disable-next-line react-hooks/refs
return {
searchQuery: debouncedSearchQuery,
inputValue,
Expand All @@ -154,6 +155,7 @@ export function useTableSearch({
currentMatchIndex,
isSearchVisible,
setIsSearchVisible,
// eslint-disable-next-line react-hooks/refs
shouldScrollToMatch: shouldScrollToMatchRef.current,
clearShouldScrollToMatch,
handlePreviousMatch,
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/searchFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ export const useSearchPageFilterState = ({
setFilters(parsedQuery.filters);
}
// only react to changes in parsed query
// eslint-disable-next-line react-hooks/exhaustive-deps
// eslint-disable-next-line @eslint-react/exhaustive-deps
}, [parsedQuery.filters]);

const updateFilterQuery = React.useCallback(
Expand Down
4 changes: 3 additions & 1 deletion packages/app/src/timeQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,13 @@ export function useTimeQuery({
liveTailTimeRange == null &&
tempLiveTailTimeRange == null &&
!isInputTimeQueryLive(inputTimeQuery) &&
// eslint-disable-next-line react-hooks/refs
inputTimeQueryDerivedTimeQueryRef.current != null
) {
// Use the input time query, allows users to specify relative time ranges
// via url ex. /logs?tq=Last+30+minutes
// return inputTimeQueryDerivedTimeQuery as [Date, Date];

// eslint-disable-next-line react-hooks/refs
return inputTimeQueryDerivedTimeQueryRef.current;
} else if (
isReady &&
Expand Down Expand Up @@ -344,6 +345,7 @@ export function useTimeQuery({
],
);

// eslint-disable-next-line react-hooks/refs
return {
isReady, // Don't search until we know what we want to do
isLive,
Expand Down
1 change: 1 addition & 0 deletions packages/app/src/useQueryParam.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const QueryParamProvider = ({

const setState = useCallback(
(state: Record<string, any>) => {
// eslint-disable-next-line react-hooks/immutability
setCache(oldCache => {
const newCache = {
...oldCache,
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ export const usePrevious = <T>(value: T): T | undefined => {
useEffect(() => {
ref.current = value;
});

// eslint-disable-next-line react-hooks/refs
return ref.current;
};

Expand Down
Loading