添加引入排序自动格式化插件
添加了一个代码自动格式化小工具 prettier-plugin-sort-imports
react和vue 模板都已配置
格式化前:
js
import React, { FC, useEffect, useRef, ChangeEvent, KeyboardEvent } from "react"
import { logger } from "@core/logger"
import { reduce, debounce } from "lodash"
import { Message } from "../Message"
import { createServer } from "@server/node"
import { Alert } from "@ui/Alert"
import { repeat, filter, add } from "../utils"
import { initializeApp } from "@core/app"
import { Popup } from "@ui/Popup"
import { createConnection } from "@server/database"
- 格式化后
js
import { debounce, reduce } from "lodash"
import React, { ChangeEvent, FC, KeyboardEvent, useEffect, useRef } from "react"
import { createConnection } from "@server/database"
import { createServer } from "@server/node"
import { initializeApp } from "@core/app"
import { logger } from "@core/logger"
import { Alert } from "@ui/Alert"
import { Popup } from "@ui/Popup"
import { Message } from "../Message"
import { add, filter, repeat } from "../utils"
- 插件配置位置:.prettierrc.cjs