refactor(frontend): fix eslint

This commit is contained in:
Sergey Krylov 2025-09-04 05:54:57 +03:00
parent 5b91157e6c
commit f19b7e231f
10 changed files with 77 additions and 62 deletions

View File

@ -81,8 +81,6 @@ export default [
'jsx-a11y/click-events-have-key-events': 'off', 'jsx-a11y/click-events-have-key-events': 'off',
'jsx-a11y/no-static-element-interactions': 'off', 'jsx-a11y/no-static-element-interactions': 'off',
'jsx-a11y/no-noninteractive-element-interactions': 'off', 'jsx-a11y/no-noninteractive-element-interactions': 'off',
'@stylistic/indent': 'off',
'@stylistic/jsx-one-expression-per-line': 'off',
}, },
}, },
{ {
@ -96,6 +94,7 @@ export default [
'**/*.test.tsx', '**/*.test.tsx',
'**/__tests__/**', '**/__tests__/**',
'**/tests/**', '**/tests/**',
'__mocks__/**',
], ],
rules: { rules: {
'import/no-extraneous-dependencies': [ 'import/no-extraneous-dependencies': [

View File

@ -35,7 +35,7 @@
"@types/jest": "30.0.0", "@types/jest": "30.0.0",
"@types/react": "19.1.9", "@types/react": "19.1.9",
"@types/react-dom": "19.1.7", "@types/react-dom": "19.1.7",
"@typescript-eslint/parser": "8.39.0", "@typescript-eslint/parser": "8.42.0",
"eslint": "9.34.0", "eslint": "9.34.0",
"eslint-config-ksv741": "0.2.0", "eslint-config-ksv741": "0.2.0",
"identity-obj-proxy": "3.0.0", "identity-obj-proxy": "3.0.0",
@ -45,5 +45,14 @@
"openapi-typescript": "7.9.1", "openapi-typescript": "7.9.1",
"ts-node": "10.9.2", "ts-node": "10.9.2",
"typescript": "5.9.2" "typescript": "5.9.2"
},
"overrides": {
"@stylistic/eslint-plugin": "5.3.1",
"typescript-eslint": "8.42.0"
},
"msw": {
"workerDirectory": [
"public"
]
} }
} }

View File

@ -3,7 +3,7 @@ import { Input } from '@/shared/ui/Input';
import classes from './AddExpenseItemForm.module.css'; import classes from './AddExpenseItemForm.module.css';
import type { import type {
FC, FC,
FormEventHandler, FormEventHandler,
FormHTMLAttributes, FormHTMLAttributes,
RefObject, RefObject,

View File

@ -58,7 +58,7 @@ describe('Test EditExpenseItemForm', () => {
test('should inputs have default value', () => { test('should inputs have default value', () => {
const { const {
titleInputElem, titleInputElem,
descriptionInputElem, descriptionInputElem,
dateInputElem, dateInputElem,
amountInputElem, amountInputElem,

View File

@ -4,7 +4,7 @@ import classes from './EditExpenseItemForm.module.css';
import type { ExpenseListItem } from '../../types'; import type { ExpenseListItem } from '../../types';
import type { import type {
FC, FC,
FormEventHandler, FormEventHandler,
FormHTMLAttributes, FormHTMLAttributes,
RefObject, RefObject,

View File

@ -1,6 +1,9 @@
import type { ExpenseList } from '@/entity/expenses/list'; import type { ExpenseList } from '@/entity/expenses/list';
import type { import type {
FC, FormEventHandler, FormHTMLAttributes, RefObject, FC,
FormEventHandler,
FormHTMLAttributes,
RefObject,
} from 'react'; } from 'react';
type BaseFormProps = Omit<FormHTMLAttributes<HTMLFormElement>, 'onSubmit'>; type BaseFormProps = Omit<FormHTMLAttributes<HTMLFormElement>, 'onSubmit'>;
@ -34,7 +37,9 @@ const DeleteExpensesListForm: FC<DeleteExpenseListFormProps> = (props) => {
Вы действительно хотите удалить список расходов Вы действительно хотите удалить список расходов
{' '} {' '}
<b>{`"${list.title}"`}</b> <b>
{`"${list.title}"`}
</b>
{' '} {' '}
? ?
@ -47,7 +52,9 @@ const DeleteExpensesListForm: FC<DeleteExpenseListFormProps> = (props) => {
В нем содержится В нем содержится
{' '} {' '}
<b>{list.items?.length}</b> <b>
{list.items?.length}
</b>
{' '} {' '}
расходов расходов

View File

@ -3,8 +3,8 @@ import { useLogout } from '@/entity/account';
const LogoutButton = () => { const LogoutButton = () => {
const { mutate: logout, isPending } = useLogout(); const { mutate: logout, isPending } = useLogout();
const onClickHandler = async () => { const onClickHandler = () => {
await logout(); logout();
}; };
return ( return (

View File

@ -31,15 +31,15 @@ const EditExpenseItemButton: FC<EditExpenseItemButtonProps> = (props) => {
return ( return (
<> <>
<button <button
ref={ref} ref={ref}
disabled={isPending} disabled={isPending}
type="button" type="button"
onClick={onClickHandler} onClick={onClickHandler}
{...restProps} {...restProps}
> >
Редактировать Редактировать
</button> </button>
<Modal open={isOpen} onClose={onCloseModalHandler}> <Modal open={isOpen} onClose={onCloseModalHandler}>
<EditExpenseItemForm disabled={isPending} item={item} onSubmit={onFormSubmitHandler} /> <EditExpenseItemForm disabled={isPending} item={item} onSubmit={onFormSubmitHandler} />

View File

@ -24,9 +24,9 @@ const EditExpensesListButton: FC<EditExpensesListButtonProps> = (props) => {
return ( return (
<> <>
<button type="button" onClick={onClickHandler} {...restProps}> <button type="button" onClick={onClickHandler} {...restProps}>
Редактировать Редактировать
</button> </button>
<Modal open={isOpen} onClose={onCloseModalHandler}> <Modal open={isOpen} onClose={onCloseModalHandler}>
<EditExpensesListForm disabled={isPending} list={list} onSubmit={onFormSubmitHandler} /> <EditExpensesListForm disabled={isPending} list={list} onSubmit={onFormSubmitHandler} />

View File

@ -16,63 +16,63 @@ const ExpenseItemsTable: FC<ExpenseItemsTableProps> = (props) => {
return ( return (
<table className={classes.table}> <table className={classes.table}>
<thead> <thead>
<tr> <tr>
<th>Идентификатор</th> <th>Идентификатор</th>
<th>Название</th> <th>Название</th>
<th>Описание</th> <th>Описание</th>
<th>Дата</th> <th>Дата</th>
<th>Сумма</th> <th>Сумма</th>
<th>Валюта</th> <th>Валюта</th>
<th>Количество</th> <th>Количество</th>
<th>Действия</th> <th>Действия</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{items?.map((item) => ( {items?.map((item) => (
<tr key={item.id}> <tr key={item.id}>
<td> <td>
{item.id} {item.id}
</td> </td>
<td> <td>
{item.title} {item.title}
</td> </td>
<td> <td>
{item.description} {item.description}
</td> </td>
<td> <td>
{item.date} {item.date}
</td> </td>
<td> <td>
{item.amount} {item.amount}
</td> </td>
<td> <td>
{item.currency} {item.currency}
</td> </td>
<td> <td>
{item.count} {item.count}
</td> </td>
<td> <td>
<EditExpenseItemButton item={item} /> <EditExpenseItemButton item={item} />
<DeleteExpenseItemButton item={item} /> <DeleteExpenseItemButton item={item} />
</td> </td>
</tr> </tr>
))} ))}
</tbody> </tbody>
</table> </table>
); );