Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tech: Apply no-useless-computed-key eslint rule #7571

Merged
merged 1 commit into from
Sep 11, 2024
Merged
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
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"eqeqeq": "error", // Only type-safe equality operators
"unicorn/expiring-todo-comments": ["error"],
"no-console": "error",
"react-compiler/react-compiler": 2
"react-compiler/react-compiler": 2,
"no-useless-computed-key": "error"
}
}
2 changes: 1 addition & 1 deletion packages/vkui/src/components/AspectRatio/AspectRatio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function AspectRatio({
...props
}: AspectRatioProps): JSX.Element {
const style: React.CSSProperties & CSSCustomProperties = {
['--vkui_internal--aspect_ratio']: String(ratio),
'--vkui_internal--aspect_ratio': String(ratio),
};

return (
Expand Down
2 changes: 1 addition & 1 deletion packages/vkui/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const stylesAlign = {

const sizeYClassNames = {
none: styles['Button--sizeY-none'],
['regular']: styles['Button--sizeY-regular'],
regular: styles['Button--sizeY-regular'],
};

export interface VKUIButtonProps extends HasAlign {
Expand Down
2 changes: 1 addition & 1 deletion packages/vkui/src/components/CardGrid/CardGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import styles from './CardGrid.module.css';

const sizeXClassNames = {
none: styles['CardGrid--sizeX-none'],
['compact']: styles['CardGrid--sizeX-compact'],
compact: styles['CardGrid--sizeX-compact'],
};

const stylesSize = {
Expand Down
14 changes: 7 additions & 7 deletions packages/vkui/src/components/CustomSelect/CustomSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import styles from './CustomSelect.module.css';

const sizeYClassNames = {
none: styles['CustomSelect--sizeY-none'],
['compact']: styles['CustomSelect--sizeY-compact'],
compact: styles['CustomSelect--sizeY-compact'],
};

const warn = warnOnce('CustomSelect');
Expand Down Expand Up @@ -179,7 +179,7 @@ export function CustomSelect<OptionInterfaceT extends CustomSelectOptionInterfac
style,
onChange,
children,
onInputChange: onInputChangeProp,
'onInputChange': onInputChangeProp,
renderDropdown,
onOpen,
onClose,
Expand All @@ -189,17 +189,17 @@ export function CustomSelect<OptionInterfaceT extends CustomSelectOptionInterfac
autoHideScrollbar,
autoHideScrollbarDelay,
searchable = false,
renderOption: renderOptionProp = defaultRenderOptionFn,
options: optionsProp,
'renderOption': renderOptionProp = defaultRenderOptionFn,
'options': optionsProp,
emptyText = 'Ничего не найдено',
filterFn = defaultFilterFn,
icon: iconProp,
'icon': iconProp,
ClearButton = CustomSelectClearButton,
allowClearButton = false,
dropdownOffsetDistance = 0,
dropdownAutoWidth = false,
noMaxHeight = false,
['aria-labelledby']: ariaLabelledBy,
'aria-labelledby': ariaLabelledBy,
clearButtonTestId,
nativeSelectTestId,
defaultValue,
Expand Down Expand Up @@ -790,7 +790,7 @@ export function CustomSelect<OptionInterfaceT extends CustomSelectOptionInterfac
'role': 'combobox',
'aria-controls': popupAriaId,
'aria-expanded': opened,
['aria-activedescendant']:
'aria-activedescendant':
ariaActiveDescendantId && opened ? `${popupAriaId}-${ariaActiveDescendantId}` : undefined,
'aria-labelledby': ariaLabelledBy,
'aria-haspopup': 'listbox',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import styles from './CustomSelectOption.module.css';

const sizeYClassNames = {
none: styles['CustomSelectOption--sizeY-none'],
['regular']: styles['CustomSelectOption--sizeY-regular'],
regular: styles['CustomSelectOption--sizeY-regular'],
};

export interface CustomSelectOptionProps extends HTMLAttributesWithRootRef<HTMLDivElement> {
Expand Down
2 changes: 1 addition & 1 deletion packages/vkui/src/components/DateInput/DateInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import styles from './DateInput.module.css';

const sizeYClassNames = {
none: styles['DateInput--sizeY-none'],
['compact']: styles['DateInput--sizeY-compact'],
compact: styles['DateInput--sizeY-compact'],
};

export interface DateInputProps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import dateInputStyles from '../DateInput/DateInput.module.css';

const sizeYClassNames = {
none: styles['DateRangeInput--sizeY-none'],
['compact']: styles['DateRangeInput--sizeY-compact'],
compact: styles['DateRangeInput--sizeY-compact'],
};

export interface DateRangeInputProps
Expand Down
2 changes: 1 addition & 1 deletion packages/vkui/src/components/FormField/FormField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import styles from './FormField.module.css';

const sizeYClassNames = {
none: styles['FormField--sizeY-none'],
['compact']: styles['FormField--sizeY-compact'],
compact: styles['FormField--sizeY-compact'],
};

const stylesStatus = {
Expand Down
2 changes: 1 addition & 1 deletion packages/vkui/src/components/FormItem/FormItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import styles from './FormItem.module.css';

const sizeYClassNames = {
none: classNames(styles['FormItem--sizeY-none'], 'vkuiInternalFormItem--sizeY-none'),
['compact']: classNames(styles['FormItem--sizeY-compact'], 'vkuiInternalFormItem--sizeY-compact'),
compact: classNames(styles['FormItem--sizeY-compact'], 'vkuiInternalFormItem--sizeY-compact'),
};

const stylesStatus = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const sizeYClassNames = {
styles['FormLayoutGroup--sizeY-none'],
'vkuiInternalFormLayoutGroup--sizeY-none',
),
['compact']: classNames(
compact: classNames(
styles['FormLayoutGroup--sizeY-compact'],
'vkuiInternalFormLayoutGroup--sizeY-compact',
),
Expand Down
2 changes: 1 addition & 1 deletion packages/vkui/src/components/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import styles from './Input.module.css';

const sizeYClassNames = {
none: styles['Input--sizeY-none'],
['compact']: styles['Input--sizeY-compact'],
compact: styles['Input--sizeY-compact'],
};

export interface InputProps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import styles from '../Select/Select.module.css';

const sizeYClassNames = {
none: styles['Select--sizeY-none'],
['compact']: styles['Select--sizeY-compact'],
compact: styles['Select--sizeY-compact'],
};

export interface NativeSelectProps
Expand Down
4 changes: 2 additions & 2 deletions packages/vkui/src/components/Panel/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import styles from './Panel.module.css';

const sizeXClassNames = {
none: styles['Panel--sizeX-none'],
['compact']: styles['Panel--sizeX-compact'],
['regular']: styles['Panel--sizeX-regular'],
compact: styles['Panel--sizeX-compact'],
regular: styles['Panel--sizeX-regular'],
};

const stylesMode = {
Expand Down
2 changes: 1 addition & 1 deletion packages/vkui/src/components/RichCell/RichCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import styles from './RichCell.module.css';

const sizeYClassNames = {
none: styles['RichCell--sizeY-none'],
['compact']: styles['RichCell--sizeY-compact'],
compact: styles['RichCell--sizeY-compact'],
};

const alignAfterClassNames = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import styles from './SegmentedControl.module.css';

const sizeYClassNames = {
none: styles['SegmentedControl--sizeY-none'],
['regular']: styles['SegmentedControl--sizeY-regular'],
regular: styles['SegmentedControl--sizeY-regular'],
};

export type SegmentedControlValue = string | number | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import styles from '../Select/Select.module.css';

const sizeYClassNames = {
none: styles['Select--sizeY-none'],
['compact']: styles['Select--sizeY-compact'],
compact: styles['Select--sizeY-compact'],
};

export interface SelectMimicryProps
Expand Down
2 changes: 1 addition & 1 deletion packages/vkui/src/components/SimpleCell/SimpleCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import styles from './SimpleCell.module.css';

const sizeYClassNames = {
none: styles['SimpleCell--sizeY-none'],
['compact']: styles['SimpleCell--sizeY-compact'],
compact: styles['SimpleCell--sizeY-compact'],
};

export interface SimpleCellOwnProps extends HasComponent {
Expand Down
2 changes: 1 addition & 1 deletion packages/vkui/src/components/Slider/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import styles from './Slider.module.css';

const sizeYClassNames = {
none: styles['Slider--sizeY-none'],
['compact']: styles['Slider--sizeY-compact'],
compact: styles['Slider--sizeY-compact'],
};

const sizeClassNames = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const sizeStyles = {

const sizeYClassNames = {
none: styles['SubnavigationButton--sizeY-none'],
['compact']: styles['SubnavigationButton--sizeY-compact'],
compact: styles['SubnavigationButton--sizeY-compact'],
};

export interface SubnavigationButtonProps extends Omit<TappableProps, 'size'> {
Expand Down
2 changes: 1 addition & 1 deletion packages/vkui/src/components/TabsItem/TabsItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import styles from './TabsItem.module.css';

const sizeYClassNames = {
none: styles['TabsItem--sizeY-none'],
['compact']: styles['TabsItem--sizeY-compact'],
compact: styles['TabsItem--sizeY-compact'],
};

const stylesMode = {
Expand Down
2 changes: 1 addition & 1 deletion packages/vkui/src/components/Textarea/Textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import styles from './Textarea.module.css';

const sizeYClassNames = {
none: styles['Textarea--sizeY-none'],
['compact']: styles['Textarea--sizeY-compact'],
compact: styles['Textarea--sizeY-compact'],
};

export interface TextareaProps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const stylesLevel = {

const sizeYClassNames = {
none: styles['Headline--sizeY-none'],
['compact']: styles['Headline--sizeY-compact'],
compact: styles['Headline--sizeY-compact'],
};

export interface HeadlineProps extends TypographyProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import styles from './Subhead.module.css';

const sizeYClassNames = {
none: styles['Subhead--sizeY-none'],
['compact']: styles['Subhead--sizeY-compact'],
compact: styles['Subhead--sizeY-compact'],
};

export type SubheadProps = TypographyProps;
Expand Down
2 changes: 1 addition & 1 deletion packages/vkui/src/components/Typography/Text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import styles from './Text.module.css';

const sizeYClassNames = {
none: styles['Text--sizeY-none'],
['compact']: styles['Text--sizeY-compact'],
compact: styles['Text--sizeY-compact'],
};

export type TextProps = TypographyProps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ import styles from '../../styles/adaptivity.module.css';

export const sizeXCompactClassNames: Record<'mq' | 'compact', { className: string }> = {
mq: { className: styles['-sizeX--compact-mq'] },
['compact']: { className: styles['-sizeX--compact-forced'] },
compact: { className: styles['-sizeX--compact-forced'] },
};

export const sizeXRegularClassNames: Record<'mq' | 'regular', { className: string }> = {
mq: { className: styles['-sizeX--regular-mq'] },
['regular']: { className: styles['-sizeX--regular-forced'] },
regular: { className: styles['-sizeX--regular-forced'] },
};

export const sizeYCompactClassNames: Record<'mq' | 'compact', { className: string }> = {
mq: { className: styles['-sizeY--compact-mq'] },
['compact']: { className: styles['-sizeY--compact-forced'] },
compact: { className: styles['-sizeY--compact-forced'] },
};

export const sizeYRegularClassNames: Record<'mq' | 'regular', { className: string }> = {
mq: { className: styles['-sizeY--regular-mq'] },
['regular']: { className: styles['-sizeY--regular-forced'] },
regular: { className: styles['-sizeY--regular-forced'] },
};

export const viewWidthClassNames: Record<
Expand Down
Loading