Skip to content

Commit

Permalink
feat: turn on eslint-plugin-fsd-checker
Browse files Browse the repository at this point in the history
  • Loading branch information
sashtje committed Sep 14, 2023
1 parent 8e6d65f commit 8405666
Show file tree
Hide file tree
Showing 19 changed files with 24 additions and 28 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module.exports = {
'@typescript-eslint',
'i18next',
'react-hooks',
'eslint-plugin-fsd-checker',
],
rules: {
indent: [2, 2],
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion src/entities/Profile/model/slice/profileSlice.test.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion src/shared/lib/classNames/classNames.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { classNames } from 'shared/lib/classNames/classNames';
import { classNames } from './classNames';

describe('classNames', () => {
test('with only first param', () => {
Expand Down
3 changes: 1 addition & 2 deletions src/shared/ui/Button/ui/Button.test.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down
3 changes: 1 addition & 2 deletions src/shared/ui/Card/ui/Card.stories.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/shared/ui/Code/ui/Code.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions src/shared/ui/LangSwitcher/ui/LangSwitcher.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/shared/ui/Modal/Modal.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/shared/ui/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions src/shared/ui/PageLoader/ui/PageLoader.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/shared/ui/Tabs/ui/Tabs.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions src/shared/ui/ThemeSwitcher/ui/ThemeSwitcher.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/widgets/Sidebar/ui/SidebarItem/SidebarItem.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit 8405666

Please sign in to comment.