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

Revert "chore(eslint): add simple import sort plugin and rules" #128

Merged
merged 1 commit into from
Nov 3, 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
36 changes: 17 additions & 19 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"react-hooks",
"jsx-a11y",
"import",
"unused-imports",
"simple-import-sort"
"unused-imports"
],
"settings": {
"react": {
Expand All @@ -33,23 +32,6 @@
"object-shorthand": "error",
"no-undef": "off",
"no-duplicate-imports": "error",
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error",
"simple-import-sort/exports": "error",
"simple-import-sort/imports": [
"error",
{
"groups": [
["^react", "^@?\\w"],
["^(@components|@models|@services|@stores|@hooks|@helpers|@utils|@tests)(/.*|$)"],
["^\\u0000"],
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
["^.+\\.s?css$"]
]
}
],
"@typescript-eslint/consistent-type-imports": [
"error",
{
Expand All @@ -62,6 +44,22 @@
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
],
"import/order": [
"error",
{
"newlines-between": "always",
"alphabetize": {
"order": "asc"
},
"groups": [
"builtin",
"external",
"internal",
"parent",
["index", "sibling"]
]
}
]
}
}
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"eslint:fix": "eslint --fix .",
"prettier:check": "prettier --check .",
"prettier:write": "prettier --write .",
"test": "DEBUG_PRINT_LIMIT=30000 jest --silent --config tests/jest.config.js",
"test": "DEBUG_PRINT_LIMIT=30000 jest --config tests/jest.config.js",
"test:watch": "yarn test --watch",
"test:coverage": "yarn test --coverage",
"test:clear-cache": "jest --clearCache",
Expand Down Expand Up @@ -97,7 +97,6 @@
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-unused-imports": "^3.0.0",
"husky": "^8.0.3",
"jest": "^29.7.0",
Expand Down
7 changes: 3 additions & 4 deletions src/components/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { generateCalendarRange } from '@helpers';
import { getWeeksInMonth } from '@internationalized/date';
import { act, render } from '@testing-library/react';
import React from 'react';
import { useCalendar } from 'react-aria';
import { useCalendarState } from 'react-stately';
import { getWeeksInMonth } from '@internationalized/date';
import { act, render } from '@testing-library/react';

import { generateCalendarRange } from '@helpers';

import App from './App';

Expand Down
11 changes: 5 additions & 6 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import React from 'react';
import { Navigate, Route, Routes } from 'react-router-dom';
import { setDefaultOptions } from 'date-fns';
import { enGB } from 'date-fns/locale';

import {
AccountPage,
AppHeader,
Calendar,
AccountPage,
HabitsPage,
Snackbars,
} from '@components';
import { setDefaultOptions } from 'date-fns';
import { enGB } from 'date-fns/locale';
import React from 'react';
import { Navigate, Route, Routes } from 'react-router-dom';

import Providers from './Providers';

Expand Down
7 changes: 3 additions & 4 deletions src/components/Providers.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { supabaseClient } from '@helpers';
import { NextUIProvider } from '@nextui-org/react';
import { SessionContextProvider } from '@supabase/auth-helpers-react';
import React, { type ReactNode } from 'react';
import { I18nProvider } from 'react-aria';
import { BrowserRouter, useNavigate } from 'react-router-dom';
import { NextUIProvider } from '@nextui-org/react';
import { SessionContextProvider } from '@supabase/auth-helpers-react';

import { supabaseClient } from '@helpers';

type ProviderProps = {
children: ReactNode;
Expand Down
6 changes: 0 additions & 6 deletions src/components/calendar/Calendar.test.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import Calendar from './Calendar';

jest.mock('@stores', () => ({
useHabitsStore: jest.fn(),
useOccurrencesStore: jest.fn(),
useTraitsStore: jest.fn(),
}));

describe(Calendar.name, () => {
it('should be tested', () => {
expect(true).toBeTruthy();
Expand Down
9 changes: 4 additions & 5 deletions src/components/calendar/Calendar.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React from 'react';
import { type AriaButtonProps, useCalendar, useLocale } from 'react-aria';
import { useCalendarState } from 'react-stately';
import { CalendarDate, GregorianCalendar } from '@internationalized/date';

import { generateCalendarRange } from '@helpers';
import { useDocumentTitle } from '@hooks';
import { CalendarDate, GregorianCalendar } from '@internationalized/date';
import { useOccurrencesStore } from '@stores';
import { capitalizeFirstLetter } from '@utils';
import React from 'react';
import { type AriaButtonProps, useCalendar, useLocale } from 'react-aria';
import { useCalendarState } from 'react-stately';

import CalendarGrid from './CalendarGrid';
import CalendarHeader from './CalendarHeader';
Expand Down
6 changes: 0 additions & 6 deletions src/components/calendar/CalendarCell.test.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import CalendarCell from './CalendarCell';

jest.mock('@stores', () => ({
useHabitsStore: jest.fn(),
useOccurrencesStore: jest.fn(),
useTraitsStore: jest.fn(),
}));

describe(CalendarCell.name, () => {
it('should render', () => {
expect(true).toBe(true);
Expand Down
7 changes: 3 additions & 4 deletions src/components/calendar/CalendarCell.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React from 'react';
import { useScreenSize } from '@hooks';
import { CalendarBlank } from '@phosphor-icons/react';
import { useOccurrencesStore } from '@stores';
import { useUser } from '@supabase/auth-helpers-react';
import clsx from 'clsx';
import { format } from 'date-fns';
import { AnimatePresence, motion } from 'framer-motion';

import { useScreenSize } from '@hooks';
import { useOccurrencesStore } from '@stores';
import React from 'react';

import OccurrenceChip from './OccurrenceChip';

Expand Down
6 changes: 0 additions & 6 deletions src/components/calendar/CalendarGrid.test.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import CalendarGrid from './CalendarGrid';

jest.mock('@stores', () => ({
useHabitsStore: jest.fn(),
useOccurrencesStore: jest.fn(),
useTraitsStore: jest.fn(),
}));

describe(CalendarGrid.name, () => {
it('should be tested', () => {
expect(true).toBeTruthy();
Expand Down
8 changes: 1 addition & 7 deletions src/components/calendar/CalendarHeader.test.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import React from 'react';
import { render } from '@testing-library/react';
import React from 'react';

import CalendarHeader, { type CalendarHeaderProps } from './CalendarHeader';

jest.mock('@stores', () => ({
useHabitsStore: jest.fn(),
useOccurrencesStore: jest.fn(),
useTraitsStore: jest.fn(),
}));

describe(CalendarHeader.name, () => {
const props: CalendarHeaderProps = {
activeMonthLabel: 'January',
Expand Down
9 changes: 4 additions & 5 deletions src/components/calendar/CalendarHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from 'react';
import { Button, Select, SelectItem, SelectSection } from '@nextui-org/react';
import { useScreenSize } from '@hooks';
import { Select, SelectItem, Button, SelectSection } from '@nextui-org/react';
import { ArrowFatLeft, ArrowFatRight } from '@phosphor-icons/react';
import { useTraitsStore, useHabitsStore, useOccurrencesStore } from '@stores';
import { useUser } from '@supabase/auth-helpers-react';

import { useScreenSize } from '@hooks';
import { useHabitsStore, useOccurrencesStore, useTraitsStore } from '@stores';
import React from 'react';

type NavigationButtonProps = {
disabled: boolean;
Expand Down
4 changes: 2 additions & 2 deletions src/components/calendar/CalendarMonthGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { type CalendarDate, getWeeksInMonth } from '@internationalized/date';
import clsx from 'clsx';
import React, { type ForwardedRef } from 'react';
import { useLocale } from 'react-aria';
import { type CalendarState } from 'react-stately';
import { type CalendarDate, getWeeksInMonth } from '@internationalized/date';
import clsx from 'clsx';

import CalendarCell from './CalendarCell';

Expand Down
7 changes: 3 additions & 4 deletions src/components/calendar/DayHabitModalDialog.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from 'react';
import { useHabitsStore, useOccurrencesStore } from '@stores';
import { useUser } from '@supabase/auth-helpers-react';
import { fireEvent, render, waitFor } from '@testing-library/react';
import { format } from 'date-fns';

import { useHabitsStore, useOccurrencesStore } from '@stores';
import { makeTestHabit } from '@tests';
import { format } from 'date-fns';
import React from 'react';

import DayHabitModalDialog from './DayHabitModalDialog';

Expand Down
9 changes: 4 additions & 5 deletions src/components/calendar/DayHabitModalDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import React, { type MouseEventHandler } from 'react';
import {
Button,
Modal,
ModalBody,
ModalContent,
ModalFooter,
ModalHeader,
ModalBody,
ModalFooter,
Select,
SelectItem,
} from '@nextui-org/react';
import { useHabitsStore, useOccurrencesStore } from '@stores';
import { useUser } from '@supabase/auth-helpers-react';
import { format } from 'date-fns';

import { useHabitsStore, useOccurrencesStore } from '@stores';
import React, { type MouseEventHandler } from 'react';

type DayHabitModalDialogProps = {
open: boolean;
Expand Down
5 changes: 2 additions & 3 deletions src/components/calendar/OccurrenceChip.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React from 'react';
import { fireEvent, render, waitFor } from '@testing-library/react';

import { useScreenSize } from '@hooks';
import { fireEvent, render, waitFor } from '@testing-library/react';
import { makeTestOccurrence } from '@tests';
import { getHabitIconUrl } from '@utils';
import React from 'react';

import OccurrenceChip, { type OccurrenceChipProps } from './OccurrenceChip';

Expand Down
3 changes: 1 addition & 2 deletions src/components/calendar/OccurrenceChip.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React from 'react';
import type { Occurrence } from '@models';
import { Badge, Button, Tooltip } from '@nextui-org/react';
import { Trash } from '@phosphor-icons/react';

import { getHabitIconUrl } from '@utils';
import React from 'react';

export type OccurrenceChipProps = {
occurrences: Occurrence[];
Expand Down
1 change: 1 addition & 0 deletions src/components/calendar/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './Calendar';
export { default as Calendar } from './Calendar';

export * from './OccurrenceChip';
export { default as OccurrenceChip } from './OccurrenceChip';
2 changes: 1 addition & 1 deletion src/components/common/Alert/Alert.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React, { type ReactNode } from 'react';
import { type ButtonProps } from '@nextui-org/react';
import {
BellRinging,
Expand All @@ -10,6 +9,7 @@ import {
WarningCircle,
} from '@phosphor-icons/react';
import clsx from 'clsx';
import React, { type ReactNode } from 'react';
import { type SetRequired, type ValueOf } from 'type-fest';

export type ButtonColor = ValueOf<
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/ConfirmDialog/ConfirmDialog.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render } from '@testing-library/react';
import React from 'react';

import ConfirmDialog from './ConfirmDialog';

Expand Down
6 changes: 3 additions & 3 deletions src/components/common/ConfirmDialog/ConfirmDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import {
Button,
Modal,
ModalBody,
ModalContent,
ModalHeader,
Modal,
ModalContent,
} from '@nextui-org/react';
import React from 'react';

type ConfirmDialogProps = {
open: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/PasswordInput/PasswordInput.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { type ChangeEventHandler } from 'react';
import { Button, Input } from '@nextui-org/react';
import { Eye, EyeSlash } from '@phosphor-icons/react';
import React, { type ChangeEventHandler } from 'react';

type PasswordInputProps = {
variant?: 'flat' | 'bordered' | 'faded' | 'underlined';
Expand Down
7 changes: 3 additions & 4 deletions src/components/common/Snackbars/Snackbars.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React from 'react';
import { Button } from '@nextui-org/react';
import { AnimatePresence, motion } from 'framer-motion';

import { Alert } from '@components';
import { Button } from '@nextui-org/react';
import { useSnackbarsStore } from '@stores';
import { AnimatePresence, motion } from 'framer-motion';
import React from 'react';

const Snackbars = () => {
const { snackbars, hideSnackbar } = useSnackbarsStore();
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from './Alert';
export * from './ConfirmDialog';
export * from './VisuallyHiddenInput';
export * from './PasswordInput';
export * from './Alert';
export * from './Snackbars';
export * from './VisuallyHiddenInput';
7 changes: 3 additions & 4 deletions src/components/habit/add-habit/AddHabitDialogButton.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React from 'react';
import { StorageBuckets, uploadFile } from '@services';
import { useSnackbarsStore, useHabitsStore } from '@stores';
import { useUser } from '@supabase/auth-helpers-react';
import { act, fireEvent, render, waitFor } from '@testing-library/react';

import { StorageBuckets, uploadFile } from '@services';
import { useHabitsStore, useSnackbarsStore } from '@stores';
import React from 'react';

import AddHabitDialogButton from './AddHabitDialogButton';

Expand Down
9 changes: 4 additions & 5 deletions src/components/habit/add-habit/AddHabitDialogButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { AddCustomTraitModal, VisuallyHiddenInput } from '@components';
import { useTextField, useFileField } from '@hooks';
import {
Button,
Input,
Expand All @@ -12,11 +13,9 @@ import {
Textarea,
} from '@nextui-org/react';
import { CloudArrowUp, Plus } from '@phosphor-icons/react';
import { useUser } from '@supabase/auth-helpers-react';

import { AddCustomTraitModal, VisuallyHiddenInput } from '@components';
import { useFileField, useTextField } from '@hooks';
import { useHabitsStore, useTraitsStore } from '@stores';
import { useUser } from '@supabase/auth-helpers-react';
import React from 'react';

const AddHabitDialogButton = () => {
const user = useUser();
Expand Down
Loading
Loading