Files
FastapiAdmin/frontend/web/eslint.config.mjs
T
zhangtao df00863b6c chore: 批量清理冗余样式、优化权限系统与重构业务逻辑
1.  重构权限检查逻辑,移除旧版 auth/roles 自定义指令,统一使用 checkPerm 工具函数
2.  简化角色数据权限配置,移除自定义数据范围功能,简化为3种权限模式
3.  批量删除多处冗余的scoped样式,迁移全局布局与组件样式
4.  优化表单、表格、弹窗等基础组件样式与交互
5.  新增全屏国际化文案与工具类样式
6.  修复通知列表空值兼容、接口调用权限校验等细节问题
7.  更新依赖与自动导入配置,移除未使用的 vue3-cron-plus 包
2026-07-26 09:17:04 +08:00

88 lines
2.3 KiB
JavaScript

// ESLint 配置文件
import fs from "fs";
import path, { dirname } from "path";
import { fileURLToPath } from "url";
// 从 ESLint 插件中导入推荐配置
import pluginJs from "@eslint/js";
import pluginVue from "eslint-plugin-vue";
import globals from "globals";
import tseslint from "typescript-eslint";
// 使用 import.meta.url 获取当前模块的路径
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// 读取 unplugin-auto-import 生成的 ESLint 全局配置(运行时由 vite 生成)
const autoImportConfig = JSON.parse(
fs.readFileSync(path.resolve(__dirname, ".eslintrc-auto-import.json"), "utf-8")
);
export default [
// 忽略文件(flat config 中 ignores 需在最前面)
{
ignores: [
"**/node_modules/**",
"**/dist/**",
"public/**",
".vscode/**",
"src/assets/**",
"src/utils/console.ts",
".eslintrc-auto-import.json",
],
},
// 全局语言环境
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
},
// 基础推荐配置
pluginJs.configs.recommended,
...tseslint.configs.recommended,
...pluginVue.configs["flat/essential"],
// 项目自定义规则
{
files: ["**/*.{js,mjs,cjs,ts,tsx,vue}"],
languageOptions: {
globals: {
...autoImportConfig.globals,
// TypeScript 全局命名空间(global.d.ts 中声明的类型)
Api: "readonly",
OptionType: "readonly",
ApiResponse: "readonly",
UploadFilePath: "readonly",
// unplugin-vue-components 自动注册的组件引用
FaSearchBar: "readonly",
FaSearchBarWithAudit: "readonly",
FaForm: "readonly",
},
},
rules: {
"no-var": "error",
"no-multiple-empty-lines": ["warn", { max: 1 }],
"no-unexpected-multiline": "error",
"@typescript-eslint/no-explicit-any": "off",
"vue/multi-word-component-names": "off",
// Prettier 负责格式化,ESLint 只关注代码质量
},
},
// Vue 文件:使用 TypeScript parser
{
files: ["**/*.vue"],
languageOptions: {
parserOptions: { parser: tseslint.parser },
},
},
// .d.ts 声明文件:放宽规则
{
files: ["**/*.d.ts"],
rules: {
"@typescript-eslint/no-empty-object-type": "off",
},
},
];