diff --git a/components/src/components/atoms/Button/Button.tsx b/components/src/components/atoms/Button/Button.tsx index d65236be..83beb3e0 100644 --- a/components/src/components/atoms/Button/Button.tsx +++ b/components/src/components/atoms/Button/Button.tsx @@ -335,7 +335,6 @@ export const Button = React.forwardRef( type={type} // position={zIndex && 'relative'} zIndex={zIndex} - // eslint-disable-next-line react/jsx-sort-props onClick={onClick} {...removeNullishProps(props)} > diff --git a/components/src/components/atoms/FileInput/FileInput.tsx b/components/src/components/atoms/FileInput/FileInput.tsx index 4f3d9f67..69ba7e68 100644 --- a/components/src/components/atoms/FileInput/FileInput.tsx +++ b/components/src/components/atoms/FileInput/FileInput.tsx @@ -95,12 +95,12 @@ export const FileInput = React.forwardRef( // Disallow file larger than max if (maxSize && file.size > maxSize * 1_000_000) { event?.preventDefault() - onError - && onError( + if (onError) + onError( `File is ${(file.size / 1_000_000).toFixed( 2, )} MB. Must be smaller than ${maxSize} MB`, - ) + ) return } setState(x => ({ @@ -109,7 +109,7 @@ export const FileInput = React.forwardRef( name: file.name, type: file.type, })) - onChange && onChange(file) + if (onChange) onChange(file) }, [maxSize, onChange, onError], ) @@ -164,7 +164,7 @@ export const FileInput = React.forwardRef( const handleFocus = React.useCallback( (event: React.FocusEvent) => { setState(x => ({ ...x, focused: true })) - onFocus && onFocus(event) + if (onFocus) onFocus(event) }, [onFocus], ) @@ -172,26 +172,24 @@ export const FileInput = React.forwardRef( const handleBlur = React.useCallback( (event: React.FocusEvent) => { setState(x => ({ ...x, focused: false })) - onBlur && onBlur(event) + if (onBlur) onBlur(event) }, [onBlur], ) - /* eslint-disable react-hooks/exhaustive-deps */ const reset = React.useCallback( (event: React.MouseEvent) => { event.preventDefault() setState(initialState) if (inputRef.current) inputRef.current.value = '' - onReset && onReset() + if (onReset) onReset() }, // No need to add defaultValue [inputRef, onReset], ) - /* eslint-enable react-hooks/exhaustive-deps */ // Display preview for default value - /* eslint-disable react-hooks/exhaustive-deps */ + React.useEffect(() => { if (!defaultValue) return setState({ @@ -200,7 +198,6 @@ export const FileInput = React.forwardRef( type: defaultValue.type, }) }, []) - /* eslint-enable react-hooks/exhaustive-deps */ // Create URL for displaying media preview React.useEffect(() => { diff --git a/components/src/components/atoms/RecordItem/RecordItem.tsx b/components/src/components/atoms/RecordItem/RecordItem.tsx index 82540cbd..05035608 100644 --- a/components/src/components/atoms/RecordItem/RecordItem.tsx +++ b/components/src/components/atoms/RecordItem/RecordItem.tsx @@ -168,6 +168,7 @@ export const RecordItem = React.forwardRef< children, ...props }, + // eslint-disable-next-line @typescript-eslint/no-unused-vars ref, ) => { const { copy, copied } = useCopied() diff --git a/components/src/components/atoms/ScrollBox/ScrollBox.tsx b/components/src/components/atoms/ScrollBox/ScrollBox.tsx index 50570ef7..e03a0a98 100644 --- a/components/src/components/atoms/ScrollBox/ScrollBox.tsx +++ b/components/src/components/atoms/ScrollBox/ScrollBox.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unused-expressions */ import * as React from 'react' import { commonVars } from '@/src/css/theme.css' diff --git a/components/src/components/molecules/CountdownCircle/CountdownCircle.tsx b/components/src/components/molecules/CountdownCircle/CountdownCircle.tsx index f307c6d2..d22bf023 100644 --- a/components/src/components/molecules/CountdownCircle/CountdownCircle.tsx +++ b/components/src/components/molecules/CountdownCircle/CountdownCircle.tsx @@ -134,7 +134,7 @@ export const CountdownCircle = React.forwardRef( const currentSeconds = calculateCurrentCount() if (currentSeconds === 0) { clearInterval(countInterval) - callback && callback() + if (callback) callback() } setCurrentCount(currentSeconds) }, 1000) diff --git a/components/src/components/molecules/Dropdown/Dropdown.tsx b/components/src/components/molecules/Dropdown/Dropdown.tsx index 51fe9036..985a41c2 100644 --- a/components/src/components/molecules/Dropdown/Dropdown.tsx +++ b/components/src/components/molecules/Dropdown/Dropdown.tsx @@ -239,7 +239,9 @@ const DropdownMenu = React.forwardRef( direction, state, height, + // eslint-disable-next-line @typescript-eslint/no-unused-vars placement: _placement, + // eslint-disable-next-line @typescript-eslint/no-unused-vars mobilePlacement: _mobilePlacement, ...props }, @@ -477,6 +479,7 @@ const useClickOutside = ( export const Dropdown = ({ children, buttonProps, + // eslint-disable-next-line @eslint-react/no-unstable-default-props items = [], chevron = true, align = 'left', diff --git a/components/src/components/molecules/PageButtons/PageButtons.test.tsx b/components/src/components/molecules/PageButtons/PageButtons.test.tsx index b4b804f1..f5c52988 100644 --- a/components/src/components/molecules/PageButtons/PageButtons.test.tsx +++ b/components/src/components/molecules/PageButtons/PageButtons.test.tsx @@ -25,14 +25,14 @@ describe('', () => { it('should render', () => { render( - void 0} total={100} />, + void 0} total={100} />, ) expect(screen.getByTestId('pagebuttons')).toBeInTheDocument() }) it('should show correct default max buttons', () => { render( - void 0} total={100} />, + void 0} total={100} />, ) expect(screen.getAllByTestId('pagebutton').length).toBe(5) }) @@ -41,7 +41,7 @@ describe('', () => { void 0} + mockCallback={() => void 0} total={100} />, ) @@ -53,7 +53,7 @@ describe('', () => { alwaysShowFirst alwaysShowLast current={50} - mockCallback={_ => void 0} + mockCallback={() => void 0} total={100} />, ) @@ -62,7 +62,7 @@ describe('', () => { }) it('should not show first and last buttons if specified', () => { render( - void 0} total={100} />, + void 0} total={100} />, ) expect(screen.queryByText('1')).not.toBeInTheDocument() expect(screen.queryByText('100')).not.toBeInTheDocument() @@ -73,7 +73,7 @@ describe('', () => { alwaysShowFirst alwaysShowLast current={50} - mockCallback={_ => void 0} + mockCallback={() => void 0} total={100} />, ) @@ -81,13 +81,13 @@ describe('', () => { }) it('should show dots if alwaysShowFirst/alwaysShowLast is not specified', () => { render( - void 0} total={100} />, + void 0} total={100} />, ) expect(screen.getAllByTestId('pagebutton-dots').length).toBe(2) }) it('should not show buttons past the total page count', () => { render( - void 0} total={100} />, + void 0} total={100} />, ) expect(screen.getByText('100')).toBeInTheDocument() expect(screen.queryByText('101')).not.toBeInTheDocument() diff --git a/components/src/components/molecules/RadioButtonGroup/RadioButtonGroup.tsx b/components/src/components/molecules/RadioButtonGroup/RadioButtonGroup.tsx index eed4e035..4de797bf 100644 --- a/components/src/components/molecules/RadioButtonGroup/RadioButtonGroup.tsx +++ b/components/src/components/molecules/RadioButtonGroup/RadioButtonGroup.tsx @@ -58,7 +58,6 @@ export const RadioButtonGroup = React.forwardRef( const [value, setValue] = React.useState(_value) React.useEffect(() => { if (_value && _value != value) setValue(_value) - }, [_value]) const handleChange = (e: React.ChangeEvent) => { diff --git a/components/src/components/molecules/Select/Select.tsx b/components/src/components/molecules/Select/Select.tsx index 09b9e0e1..c7de6487 100644 --- a/components/src/components/molecules/Select/Select.tsx +++ b/components/src/components/molecules/Select/Select.tsx @@ -655,7 +655,7 @@ export const Select = React.forwardRef( const selectHighlightedIndex = (event: any) => { const option = visibleOptions[highlightedIndex] - option && changeSelectedOption(option, event) + if (option) changeSelectedOption(option, event) handleReset() } diff --git a/components/src/tokens/color.ts b/components/src/tokens/color.ts index 93b7bf4d..e1dbe4e8 100644 --- a/components/src/tokens/color.ts +++ b/components/src/tokens/color.ts @@ -148,12 +148,11 @@ type NameColor = { [key in NamedShade]: string } type ColorItem< TObject extends Record, TName extends string, -> = TObject extends object - ? { - [key in Exclude as `${TName}${key}`]: string - } & { - [T in `${TName}`]: string - } +> = TObject extends object ? { + [key in Exclude as `${TName}${key}`]: string +} & { + [T in `${TName}`]: string +} : never type CalculatedColors = WithRaw> type AllColors = WithRaw diff --git a/components/src/tokens/colors2.ts b/components/src/tokens/colors2.ts index cc7520a2..e77dd902 100644 --- a/components/src/tokens/colors2.ts +++ b/components/src/tokens/colors2.ts @@ -152,12 +152,11 @@ type NameColor = { [key in NamedShade]: string } type ColorItem< TObject extends Record, TName extends string, -> = TObject extends object - ? { - [key in Exclude as `${TName}${key}`]: string - } & { - [T in `${TName}`]: string - } +> = TObject extends object ? { + [key in Exclude as `${TName}${key}`]: string +} & { + [T in `${TName}`]: string +} : never type CalculatedColors = WithRaw> type AllColors = WithRaw diff --git a/eslint.config.mjs b/eslint.config.mjs index a740cf15..65c0cf0e 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -19,7 +19,7 @@ const baseConfig = tseslint.config( }, }, { - ignores: ['docs/node_modules', 'docs/dist', 'docs/.next', '**/*.cjs', '**/*.js'], + ignores: ['docs/node_modules', 'docs/.next', '**/*.cjs', '**/*.js', '*/dist'], }, eslint.configs.recommended, ...tseslint.configs.recommended, @@ -36,7 +36,7 @@ const baseConfig = tseslint.config( rules: { '@eslint-react/dom/no-missing-button-type': 'off', 'stylistic/no-multiple-empty-lines': ['error', { max: 1 }], - '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-explicit-any': 'off', }, }, {