2
0

♻️ Add shared eslint config

This commit is contained in:
Baptiste Arnaud
2022-11-21 11:12:43 +01:00
parent e09adf5c64
commit 451ffbcacf
123 changed files with 1151 additions and 1523 deletions

View File

@ -17,7 +17,6 @@ const resultsContext = createContext<{
onDeleteResults: (totalResultsDeleted: number) => void
fetchNextPage: () => void
refetchResults: () => void
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
}>({})

View File

@ -13,7 +13,7 @@ import {
} from '@chakra-ui/react'
import { ToolIcon, EyeIcon, EyeOffIcon, GripIcon } from '@/components/icons'
import { ResultHeaderCell } from 'models'
import React, { forwardRef, useState } from 'react'
import React, { useState } from 'react'
import { isNotDefined } from 'utils'
import {
DndContext,
@ -128,7 +128,7 @@ export const ColumnSettingsButton = ({
</SortableContext>
<Portal>
<DragOverlay dropAnimation={{ duration: 0 }}>
{draggingColumnId ? <SortableColumnOverlay /> : null}
{draggingColumnId ? <Flex /> : null}
</DragOverlay>
</Portal>
</DndContext>
@ -210,9 +210,3 @@ const SortableColumns = ({
</Flex>
)
}
const SortableColumnOverlay = forwardRef(
(_, ref: React.LegacyRef<HTMLDivElement>) => {
return <HStack ref={ref}></HStack>
}
)

View File

@ -0,0 +1,23 @@
import { Checkbox, Flex } from '@chakra-ui/react'
import React from 'react'
const TableCheckBox = (
{ indeterminate, checked, ...rest }: any,
ref: React.LegacyRef<HTMLInputElement>
) => {
const defaultRef = React.useRef()
const resolvedRef: any = ref || defaultRef
return (
<Flex justify="center" data-testid="checkbox">
<Checkbox
ref={resolvedRef}
{...rest}
isIndeterminate={indeterminate}
isChecked={checked}
/>
</Flex>
)
}
export const IndeterminateCheckbox = React.forwardRef(TableCheckBox)

View File

@ -2,7 +2,6 @@ import {
Box,
Button,
chakra,
Checkbox,
Flex,
HStack,
Stack,
@ -26,6 +25,7 @@ import { Row } from './Row'
import { HeaderRow } from './HeaderRow'
import { CellValueType, TableData } from '../../types'
import { HeaderIcon } from '../../utils'
import { IndeterminateCheckbox } from './IndeterminateCheckbox'
type ResultsTableProps = {
resultHeader: ResultHeaderCell[]
@ -238,23 +238,3 @@ export const ResultsTable = ({
</Stack>
)
}
const IndeterminateCheckbox = React.forwardRef(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
({ indeterminate, checked, ...rest }: any, ref) => {
const defaultRef = React.useRef()
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const resolvedRef: any = ref || defaultRef
return (
<Flex justify="center" data-testid="checkbox">
<Checkbox
ref={resolvedRef}
{...rest}
isIndeterminate={indeterminate}
isChecked={checked}
/>
</Flex>
)
}
)