From 346d219cd5b434118dff63e687d68de5901547b2 Mon Sep 17 00:00:00 2001 From: boojack Date: Thu, 7 Jul 2022 22:02:40 +0800 Subject: [PATCH] chore: reorder imports manually (#106) * chore: reorder imports manually * chore: remove unused less --- web/.eslintrc.json | 13 ++++++------- web/src/App.tsx | 1 - web/src/components/ConfirmResetOpenIdDialog.tsx | 6 +++--- web/src/components/DailyMemo.tsx | 2 +- web/src/components/Dialog.tsx | 2 +- web/src/components/Memo.tsx | 4 ++-- web/src/components/MemoCardDialog.tsx | 4 ++-- web/src/components/MemoEditor.tsx | 2 +- web/src/components/MemoList.tsx | 2 +- web/src/components/MenuBtnsPopup.tsx | 2 +- web/src/components/ShareMemoImageDialog.tsx | 2 +- web/src/components/Sidebar.tsx | 2 +- web/src/components/TagList.tsx | 2 +- web/src/components/UserBanner.tsx | 6 +++--- web/src/less/app.less | 4 ---- web/src/main.tsx | 2 +- 16 files changed, 25 insertions(+), 31 deletions(-) delete mode 100644 web/src/less/app.less diff --git a/web/.eslintrc.json b/web/.eslintrc.json index 173b34c6..39b2d4c4 100644 --- a/web/.eslintrc.json +++ b/web/.eslintrc.json @@ -23,12 +23,11 @@ ], "@typescript-eslint/no-empty-interface": ["off"], "@typescript-eslint/no-explicit-any": ["off"], - "react/react-in-jsx-scope": "off", - "sort-imports": [ - "error", - { - "memberSyntaxSortOrder": ["all", "multiple", "single", "none"] - } - ] + "react/react-in-jsx-scope": "off" + }, + "settings": { + "react": { + "version": "detect" + } } } diff --git a/web/src/App.tsx b/web/src/App.tsx index 0fe4dc72..50d83d6a 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -1,6 +1,5 @@ import { appRouterSwitch } from "./routers"; import { useAppSelector } from "./store"; -import "./less/app.less"; function App() { const pathname = useAppSelector((state) => state.location.pathname); diff --git a/web/src/components/ConfirmResetOpenIdDialog.tsx b/web/src/components/ConfirmResetOpenIdDialog.tsx index ffa60597..7efdbbbc 100644 --- a/web/src/components/ConfirmResetOpenIdDialog.tsx +++ b/web/src/components/ConfirmResetOpenIdDialog.tsx @@ -1,8 +1,8 @@ import { useEffect } from "react"; -import { showDialog } from "./Dialog"; -import useLoading from "../hooks/useLoading"; -import toastHelper from "./Toast"; import { userService } from "../services"; +import useLoading from "../hooks/useLoading"; +import { showDialog } from "./Dialog"; +import toastHelper from "./Toast"; import "../less/confirm-reset-openid-dialog.less"; interface Props extends DialogProps {} diff --git a/web/src/components/DailyMemo.tsx b/web/src/components/DailyMemo.tsx index 26eaa25b..8f7978c5 100644 --- a/web/src/components/DailyMemo.tsx +++ b/web/src/components/DailyMemo.tsx @@ -1,7 +1,7 @@ import { IMAGE_URL_REG } from "../helpers/consts"; import * as utils from "../helpers/utils"; -import { formatMemoContent } from "./Memo"; import Only from "./common/OnlyWhen"; +import { formatMemoContent } from "./Memo"; import "../less/daily-memo.less"; interface DailyMemo extends Memo { diff --git a/web/src/components/Dialog.tsx b/web/src/components/Dialog.tsx index 5c6e0847..b2af2314 100644 --- a/web/src/components/Dialog.tsx +++ b/web/src/components/Dialog.tsx @@ -1,7 +1,7 @@ import { createRoot } from "react-dom/client"; +import { ANIMATION_DURATION } from "../helpers/consts"; import { Provider } from "react-redux"; import store from "../store"; -import { ANIMATION_DURATION } from "../helpers/consts"; import "../less/dialog.less"; interface DialogConfig { diff --git a/web/src/components/Memo.tsx b/web/src/components/Memo.tsx index 6d15730b..955c25bc 100644 --- a/web/src/components/Memo.tsx +++ b/web/src/components/Memo.tsx @@ -1,14 +1,14 @@ import { memo, useEffect, useRef, useState } from "react"; import { escape, indexOf } from "lodash-es"; import { IMAGE_URL_REG, LINK_REG, MEMO_LINK_REG, TAG_REG, UNKNOWN_ID } from "../helpers/consts"; -import { DONE_BLOCK_REG, parseMarkedToHtml, TODO_BLOCK_REG } from "../helpers/marked"; import * as utils from "../helpers/utils"; +import { DONE_BLOCK_REG, parseMarkedToHtml, TODO_BLOCK_REG } from "../helpers/marked"; import { editorStateService, locationService, memoService, userService } from "../services"; import Only from "./common/OnlyWhen"; +import toastHelper from "./Toast"; import Image from "./Image"; import showMemoCardDialog from "./MemoCardDialog"; import showShareMemoImageDialog from "./ShareMemoImageDialog"; -import toastHelper from "./Toast"; import "../less/memo.less"; const MAX_MEMO_CONTAINER_HEIGHT = 384; diff --git a/web/src/components/MemoCardDialog.tsx b/web/src/components/MemoCardDialog.tsx index c8785faa..3ec66932 100644 --- a/web/src/components/MemoCardDialog.tsx +++ b/web/src/components/MemoCardDialog.tsx @@ -3,11 +3,11 @@ import { IMAGE_URL_REG, MEMO_LINK_REG, UNKNOWN_ID } from "../helpers/consts"; import * as utils from "../helpers/utils"; import { editorStateService, memoService } from "../services"; import { parseHtmlToRawText } from "../helpers/marked"; -import { formatMemoContent } from "./Memo"; +import Only from "./common/OnlyWhen"; import toastHelper from "./Toast"; import { showDialog } from "./Dialog"; -import Only from "./common/OnlyWhen"; import Image from "./Image"; +import { formatMemoContent } from "./Memo"; import "../less/memo-card-dialog.less"; import "../less/memo-content.less"; diff --git a/web/src/components/MemoEditor.tsx b/web/src/components/MemoEditor.tsx index 9da0d341..8feeb4d1 100644 --- a/web/src/components/MemoEditor.tsx +++ b/web/src/components/MemoEditor.tsx @@ -1,7 +1,7 @@ import React, { useCallback, useEffect, useMemo, useRef } from "react"; +import { UNKNOWN_ID } from "../helpers/consts"; import { editorStateService, locationService, memoService, resourceService } from "../services"; import { useAppSelector } from "../store"; -import { UNKNOWN_ID } from "../helpers/consts"; import * as storage from "../helpers/storage"; import useToggle from "../hooks/useToggle"; import toastHelper from "./Toast"; diff --git a/web/src/components/MemoList.tsx b/web/src/components/MemoList.tsx index 17a9b9e7..ed4a83b4 100644 --- a/web/src/components/MemoList.tsx +++ b/web/src/components/MemoList.tsx @@ -4,8 +4,8 @@ import { useAppSelector } from "../store"; import { IMAGE_URL_REG, LINK_REG, MEMO_LINK_REG, TAG_REG } from "../helpers/consts"; import * as utils from "../helpers/utils"; import { checkShouldShowMemoWithFilters } from "../helpers/filter"; -import Memo from "./Memo"; import toastHelper from "./Toast"; +import Memo from "./Memo"; import "../less/memo-list.less"; interface Props {} diff --git a/web/src/components/MenuBtnsPopup.tsx b/web/src/components/MenuBtnsPopup.tsx index 697aec47..16bf94d9 100644 --- a/web/src/components/MenuBtnsPopup.tsx +++ b/web/src/components/MenuBtnsPopup.tsx @@ -1,8 +1,8 @@ import { useEffect, useRef } from "react"; import * as api from "../helpers/api"; import { locationService, userService } from "../services"; -import showAboutSiteDialog from "./AboutSiteDialog"; import toastHelper from "./Toast"; +import showAboutSiteDialog from "./AboutSiteDialog"; import "../less/menu-btns-popup.less"; interface Props { diff --git a/web/src/components/ShareMemoImageDialog.tsx b/web/src/components/ShareMemoImageDialog.tsx index f4569e8e..0474dfc2 100644 --- a/web/src/components/ShareMemoImageDialog.tsx +++ b/web/src/components/ShareMemoImageDialog.tsx @@ -4,9 +4,9 @@ import toImage from "../labs/html2image"; import { ANIMATION_DURATION, IMAGE_URL_REG } from "../helpers/consts"; import * as utils from "../helpers/utils"; import { showDialog } from "./Dialog"; -import { formatMemoContent } from "./Memo"; import Only from "./common/OnlyWhen"; import toastHelper from "./Toast"; +import { formatMemoContent } from "./Memo"; import "../less/share-memo-image-dialog.less"; interface Props extends DialogProps { diff --git a/web/src/components/Sidebar.tsx b/web/src/components/Sidebar.tsx index 01ecd0a2..3b6c6498 100644 --- a/web/src/components/Sidebar.tsx +++ b/web/src/components/Sidebar.tsx @@ -1,5 +1,6 @@ import { useAppSelector } from "../store"; import * as utils from "../helpers/utils"; +import { userService } from "../services"; import showDailyReviewDialog from "./DailyReviewDialog"; import showSettingDialog from "./SettingDialog"; import showArchivedMemoDialog from "./ArchivedMemoDialog"; @@ -7,7 +8,6 @@ import UserBanner from "./UserBanner"; import UsageHeatMap from "./UsageHeatMap"; import ShortcutList from "./ShortcutList"; import TagList from "./TagList"; -import { userService } from "../services"; import "../less/siderbar.less"; interface Props {} diff --git a/web/src/components/TagList.tsx b/web/src/components/TagList.tsx index 522bfec0..7232e178 100644 --- a/web/src/components/TagList.tsx +++ b/web/src/components/TagList.tsx @@ -1,9 +1,9 @@ import { useEffect, useState } from "react"; +import * as utils from "../helpers/utils"; import { useAppSelector } from "../store"; import { locationService, memoService, userService } from "../services"; import useToggle from "../hooks/useToggle"; import Only from "./common/OnlyWhen"; -import * as utils from "../helpers/utils"; import "../less/tag-list.less"; interface Tag { diff --git a/web/src/components/UserBanner.tsx b/web/src/components/UserBanner.tsx index f9e54f4a..656422b1 100644 --- a/web/src/components/UserBanner.tsx +++ b/web/src/components/UserBanner.tsx @@ -1,10 +1,10 @@ -import * as api from "../helpers/api"; import { useCallback, useEffect, useState } from "react"; -import MenuBtnsPopup from "./MenuBtnsPopup"; +import * as api from "../helpers/api"; import { getUserIdFromPath } from "../services/userService"; import { locationService } from "../services"; -import toastHelper from "./Toast"; import { useAppSelector } from "../store"; +import toastHelper from "./Toast"; +import MenuBtnsPopup from "./MenuBtnsPopup"; import "../less/user-banner.less"; interface Props {} diff --git a/web/src/less/app.less b/web/src/less/app.less deleted file mode 100644 index b68edb83..00000000 --- a/web/src/less/app.less +++ /dev/null @@ -1,4 +0,0 @@ -@import "./mixin.less"; - -#root { -} diff --git a/web/src/main.tsx b/web/src/main.tsx index 791e8079..c2d46193 100644 --- a/web/src/main.tsx +++ b/web/src/main.tsx @@ -3,8 +3,8 @@ import { Provider } from "react-redux"; import store from "./store"; import { updateStateWithLocation } from "./store/modules/location"; import App from "./App"; -import "./helpers/polyfill"; import "./less/global.less"; +import "./helpers/polyfill"; import "./css/index.css"; const container = document.getElementById("root");