diff --git a/.eslintrc.js b/.eslintrc.js index b27c5ae1..0d7d4dc3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -18,6 +18,7 @@ module.exports = { '@typescript-eslint', 'i18next', 'react-hooks', + 'eslint-plugin-fsd-checker', ], rules: { indent: [2, 2], @@ -52,6 +53,7 @@ module.exports = { 'no-param-reassign': 'off', 'no-undef': 'off', 'react/no-array-index-key': 'off', + 'fsd-checker/path-checker': 'error', }, globals: { __IS_DEV__: true, diff --git a/src/entities/Article/ui/ArticleList/ArticleList.stories.tsx b/src/entities/Article/ui/ArticleList/ArticleList.stories.tsx index e99ad6f0..396eba6b 100644 --- a/src/entities/Article/ui/ArticleList/ArticleList.stories.tsx +++ b/src/entities/Article/ui/ArticleList/ArticleList.stories.tsx @@ -1,6 +1,6 @@ import type { ComponentMeta, ComponentStory } from '@storybook/react'; -import { ArticleView } from 'entities/Article'; +import { ArticleView } from '../../model/types/article'; import { article } from '../../mocks/data'; import { ArticleList } from './ArticleList'; diff --git a/src/entities/Article/ui/ArticleListItem/ArticleListItem.stories.tsx b/src/entities/Article/ui/ArticleListItem/ArticleListItem.stories.tsx index c77b300c..01db6d16 100644 --- a/src/entities/Article/ui/ArticleListItem/ArticleListItem.stories.tsx +++ b/src/entities/Article/ui/ArticleListItem/ArticleListItem.stories.tsx @@ -1,7 +1,7 @@ import type { ComponentMeta, ComponentStory } from '@storybook/react'; -import { article } from 'entities/Article/mocks/data'; -import { ArticleView } from 'entities/Article'; +import { article } from '../../mocks/data'; +import { ArticleView } from '../../model/types/article'; import { ArticleListItem } from './ArticleListItem'; export default { diff --git a/src/entities/Counter/model/selectors/getCounterValue/getCounterValue.ts b/src/entities/Counter/model/selectors/getCounterValue/getCounterValue.ts index d5e1a004..8e3dcffc 100644 --- a/src/entities/Counter/model/selectors/getCounterValue/getCounterValue.ts +++ b/src/entities/Counter/model/selectors/getCounterValue/getCounterValue.ts @@ -1,7 +1,6 @@ import { createSelector } from '@reduxjs/toolkit'; -import { CounterSchema } from 'entities/Counter'; - +import { CounterSchema } from '../../types/counterSchema'; import { getCounter } from '../getCounter/getCounter'; export const getCounterValue = createSelector( diff --git a/src/entities/Profile/model/selectors/getProfileValidateErrors/getProfileValidateErrors.test.ts b/src/entities/Profile/model/selectors/getProfileValidateErrors/getProfileValidateErrors.test.ts index 6d612f0f..60ed1b07 100644 --- a/src/entities/Profile/model/selectors/getProfileValidateErrors/getProfileValidateErrors.test.ts +++ b/src/entities/Profile/model/selectors/getProfileValidateErrors/getProfileValidateErrors.test.ts @@ -1,6 +1,6 @@ import { StateSchema } from 'app/providers/StoreProvider'; -import { ValidateProfileError } from 'entities/Profile'; +import { ValidateProfileError } from '../../types/profile'; import { getProfileValidateErrors } from './getProfileValidateErrors'; describe('getProfileValidateErrors.test', () => { diff --git a/src/entities/Profile/model/services/updateProfileData/updateProfileData.test.ts b/src/entities/Profile/model/services/updateProfileData/updateProfileData.test.ts index 4770cad6..ad84ab00 100644 --- a/src/entities/Profile/model/services/updateProfileData/updateProfileData.test.ts +++ b/src/entities/Profile/model/services/updateProfileData/updateProfileData.test.ts @@ -1,8 +1,8 @@ import { TestAsyncThunk } from 'shared/lib/tests/testAsyncThunk/TestAsyncThunk'; import { Country } from 'entities/Country'; import { Currency } from 'entities/Currency'; -import { ValidateProfileError } from 'entities/Profile'; +import { ValidateProfileError } from '../../types/profile'; import { updateProfileData } from './updateProfileData'; const form = { diff --git a/src/entities/Profile/model/services/validateProfileData/validateProfileData.test.ts b/src/entities/Profile/model/services/validateProfileData/validateProfileData.test.ts index 8863ec48..f59a7bb2 100644 --- a/src/entities/Profile/model/services/validateProfileData/validateProfileData.test.ts +++ b/src/entities/Profile/model/services/validateProfileData/validateProfileData.test.ts @@ -1,7 +1,7 @@ import { Country } from 'entities/Country'; import { Currency } from 'entities/Currency'; -import { ValidateProfileError } from 'entities/Profile'; +import { ValidateProfileError } from '../../types/profile'; import { validateProfileData } from './validateProfileData'; const data = { diff --git a/src/entities/Profile/model/slice/profileSlice.test.ts b/src/entities/Profile/model/slice/profileSlice.test.ts index 492c1bd7..1ed75988 100644 --- a/src/entities/Profile/model/slice/profileSlice.test.ts +++ b/src/entities/Profile/model/slice/profileSlice.test.ts @@ -1,7 +1,7 @@ -import { updateProfileData } from 'entities/Profile'; import { Country } from 'entities/Country'; import { Currency } from 'entities/Currency'; +import { updateProfileData } from '../services/updateProfileData/updateProfileData'; import { ProfileSchema, ValidateProfileError } from '../types/profile'; import { profileActions, profileReducer } from '../slice/profileSlice'; diff --git a/src/shared/lib/classNames/classNames.test.ts b/src/shared/lib/classNames/classNames.test.ts index 385ad2f7..3986d1b3 100644 --- a/src/shared/lib/classNames/classNames.test.ts +++ b/src/shared/lib/classNames/classNames.test.ts @@ -1,4 +1,4 @@ -import { classNames } from 'shared/lib/classNames/classNames'; +import { classNames } from './classNames'; describe('classNames', () => { test('with only first param', () => { diff --git a/src/shared/ui/Button/ui/Button.test.tsx b/src/shared/ui/Button/ui/Button.test.tsx index e70e2be1..77683284 100644 --- a/src/shared/ui/Button/ui/Button.test.tsx +++ b/src/shared/ui/Button/ui/Button.test.tsx @@ -1,7 +1,6 @@ import { render, screen } from '@testing-library/react'; -import { Button } from 'shared/ui/Button'; -import { ButtonTheme } from 'shared/ui/Button/ui/Button'; +import { Button, ButtonTheme } from './Button'; describe('Button', () => { test('renders Button', () => { diff --git a/src/shared/ui/Card/ui/Card.stories.tsx b/src/shared/ui/Card/ui/Card.stories.tsx index 64413d6f..ce80596e 100644 --- a/src/shared/ui/Card/ui/Card.stories.tsx +++ b/src/shared/ui/Card/ui/Card.stories.tsx @@ -1,7 +1,6 @@ import type { ComponentMeta, ComponentStory } from '@storybook/react'; -import { Text } from 'shared/ui/Text'; - +import { Text } from '../../Text'; import { Card } from './Card'; export default { diff --git a/src/shared/ui/Code/ui/Code.tsx b/src/shared/ui/Code/ui/Code.tsx index b25de264..e4268df2 100644 --- a/src/shared/ui/Code/ui/Code.tsx +++ b/src/shared/ui/Code/ui/Code.tsx @@ -1,9 +1,9 @@ import { memo, useCallback } from 'react'; import { classNames } from 'shared/lib/classNames'; -import { Button, ButtonTheme } from 'shared/ui/Button'; import CopyIcon from 'shared/assets/icons/copy-20-20.svg'; +import { Button, ButtonTheme } from '../../Button'; import cls from './Code.module.scss'; interface CodeProps { diff --git a/src/shared/ui/LangSwitcher/ui/LangSwitcher.tsx b/src/shared/ui/LangSwitcher/ui/LangSwitcher.tsx index 379b1fb6..d9babfb6 100644 --- a/src/shared/ui/LangSwitcher/ui/LangSwitcher.tsx +++ b/src/shared/ui/LangSwitcher/ui/LangSwitcher.tsx @@ -1,10 +1,9 @@ import { memo } from 'react'; import { useTranslation } from 'react-i18next'; -import { Button } from 'shared/ui'; import { classNames } from 'shared/lib/classNames'; -import { ButtonTheme } from 'shared/ui/Button/ui/Button'; +import { Button, ButtonTheme } from '../../Button'; interface LangSwitcherProps { className?: string; diff --git a/src/shared/ui/Modal/Modal.stories.tsx b/src/shared/ui/Modal/Modal.stories.tsx index e96c9367..62334bd8 100644 --- a/src/shared/ui/Modal/Modal.stories.tsx +++ b/src/shared/ui/Modal/Modal.stories.tsx @@ -2,7 +2,8 @@ import type { ComponentMeta, ComponentStory } from '@storybook/react'; import { ThemeDecorator } from 'shared/config/storybook/ThemeDecorator/ThemeDecorator'; import { Theme } from 'app/providers/ThemeProvider'; -import { Modal } from 'shared/ui/Modal/Modal'; + +import { Modal } from './Modal'; export default { title: 'shared/Modal', diff --git a/src/shared/ui/Modal/Modal.tsx b/src/shared/ui/Modal/Modal.tsx index 624e739d..cda1beee 100644 --- a/src/shared/ui/Modal/Modal.tsx +++ b/src/shared/ui/Modal/Modal.tsx @@ -3,8 +3,8 @@ import React, { } from 'react'; import { classNames, Mods } from 'shared/lib/classNames'; -import { Portal } from 'shared/ui/Portal/Portal'; +import { Portal } from '../Portal/Portal'; import cls from './Modal.module.scss'; interface ModalProps { diff --git a/src/shared/ui/PageLoader/ui/PageLoader.tsx b/src/shared/ui/PageLoader/ui/PageLoader.tsx index 0026d2d6..9cd7e045 100644 --- a/src/shared/ui/PageLoader/ui/PageLoader.tsx +++ b/src/shared/ui/PageLoader/ui/PageLoader.tsx @@ -1,7 +1,6 @@ import { classNames } from 'shared/lib/classNames'; -import { Loader } from 'shared/ui/Loader'; - +import { Loader } from '../../Loader'; import cls from './PageLoader.module.scss'; interface PageLoaderProps { diff --git a/src/shared/ui/Tabs/ui/Tabs.tsx b/src/shared/ui/Tabs/ui/Tabs.tsx index 01d2afbe..8d991223 100644 --- a/src/shared/ui/Tabs/ui/Tabs.tsx +++ b/src/shared/ui/Tabs/ui/Tabs.tsx @@ -1,8 +1,8 @@ import { memo, ReactNode, useCallback } from 'react'; import { classNames } from 'shared/lib/classNames'; -import { Card, CardTheme } from 'shared/ui/Card'; +import { Card, CardTheme } from '../../Card'; import cls from './Tabs.module.scss'; export interface TabItem { diff --git a/src/shared/ui/ThemeSwitcher/ui/ThemeSwitcher.tsx b/src/shared/ui/ThemeSwitcher/ui/ThemeSwitcher.tsx index 78cf998a..dce2bed7 100644 --- a/src/shared/ui/ThemeSwitcher/ui/ThemeSwitcher.tsx +++ b/src/shared/ui/ThemeSwitcher/ui/ThemeSwitcher.tsx @@ -1,13 +1,11 @@ import { memo } from 'react'; -import { Button } from 'shared/ui'; import { classNames } from 'shared/lib/classNames'; import LightIcon from 'shared/assets/icons/theme-light.svg'; import DarkIcon from 'shared/assets/icons/theme-dark.svg'; - import { Theme, useTheme } from 'app/providers/ThemeProvider'; -import { ButtonTheme } from 'shared/ui/Button/ui/Button'; +import { Button, ButtonTheme } from '../../Button'; interface ThemeSwitcherProps { className?: string; diff --git a/src/widgets/Sidebar/ui/SidebarItem/SidebarItem.tsx b/src/widgets/Sidebar/ui/SidebarItem/SidebarItem.tsx index c15a7bd9..5065f34d 100644 --- a/src/widgets/Sidebar/ui/SidebarItem/SidebarItem.tsx +++ b/src/widgets/Sidebar/ui/SidebarItem/SidebarItem.tsx @@ -1,12 +1,12 @@ import { memo } from 'react'; +import { useSelector } from 'react-redux'; import { useTranslation } from 'react-i18next'; import { AppLink, AppLinkTheme } from 'shared/ui/AppLink/ui/AppLink'; import { classNames } from 'shared/lib/classNames'; - -import { useSelector } from 'react-redux'; import { getUserAuthData } from 'entities/User'; -import { SidebarItemType } from 'widgets/Sidebar/model/types/sidebar'; + +import { SidebarItemType } from '../../model/types/sidebar'; import cls from './SidebarItem.module.scss'; interface SidebarItemProps {