chore(frontend): introduce prettier + eslint and prune unused code
- Add Prettier 3 with prettier-plugin-organize-imports (sorts/removes unused imports) - Add ESLint 10 flat config with typescript-eslint + eslint-plugin-vue + eslint-config-prettier - Add root scripts: format, format:check, lint, lint:fix - Reformat 257 files across admin-web, ops-web, desktop-client, packages - Remove unused locals/exports flagged by --noUnusedLocals/--noUnusedParameters - Fix duplicate localTabLabel key, surrogate-pair regex u-flag, NBSP literal in regex - Skip server/ (Go) and apps/browser-extension/ (deprecated per ADR) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+31
-31
@@ -1,70 +1,70 @@
|
||||
import { fileURLToPath, URL } from "node:url";
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
import { defineConfig, loadEnv, type PluginOption } from "vite";
|
||||
import { compression } from "vite-plugin-compression2";
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { defineConfig, loadEnv, type PluginOption } from 'vite'
|
||||
import { compression } from 'vite-plugin-compression2'
|
||||
|
||||
const r = (path: string) => fileURLToPath(new URL(path, import.meta.url));
|
||||
const r = (path: string) => fileURLToPath(new URL(path, import.meta.url))
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, ".", "");
|
||||
const isProd = mode === "production";
|
||||
const plugins: PluginOption[] = [vue()];
|
||||
const env = loadEnv(mode, '.', '')
|
||||
const isProd = mode === 'production'
|
||||
const plugins: PluginOption[] = [vue()]
|
||||
|
||||
if (isProd) {
|
||||
plugins.push(
|
||||
compression({
|
||||
algorithms: ["gzip", "brotliCompress"],
|
||||
algorithms: ['gzip', 'brotliCompress'],
|
||||
threshold: 1024,
|
||||
}),
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
return {
|
||||
plugins,
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": r("./src"),
|
||||
'@': r('./src'),
|
||||
},
|
||||
},
|
||||
server: {
|
||||
host: "0.0.0.0",
|
||||
host: '0.0.0.0',
|
||||
port: 5174,
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: env.VITE_OPS_API_PROXY_TARGET || "http://localhost:8090",
|
||||
'/api': {
|
||||
target: env.VITE_OPS_API_PROXY_TARGET || 'http://localhost:8090',
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
esbuild: isProd ? { drop: ["console", "debugger"] } : undefined,
|
||||
esbuild: isProd ? { drop: ['console', 'debugger'] } : undefined,
|
||||
build: {
|
||||
target: "es2022",
|
||||
sourcemap: "hidden",
|
||||
target: 'es2022',
|
||||
sourcemap: 'hidden',
|
||||
cssCodeSplit: true,
|
||||
reportCompressedSize: false,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
entryFileNames: "assets/js/[name]-[hash].js",
|
||||
chunkFileNames: "assets/js/[name]-[hash].js",
|
||||
assetFileNames: "assets/[name]-[hash][extname]",
|
||||
entryFileNames: 'assets/js/[name]-[hash].js',
|
||||
chunkFileNames: 'assets/js/[name]-[hash].js',
|
||||
assetFileNames: 'assets/[name]-[hash][extname]',
|
||||
manualChunks(id) {
|
||||
if (!id.includes("node_modules")) return undefined;
|
||||
if (id.includes("/ant-design-vue/") || id.includes("/@ant-design/")) {
|
||||
return "antd";
|
||||
if (!id.includes('node_modules')) return undefined
|
||||
if (id.includes('/ant-design-vue/') || id.includes('/@ant-design/')) {
|
||||
return 'antd'
|
||||
}
|
||||
if (
|
||||
id.includes("/vue/") ||
|
||||
id.includes("/@vue/") ||
|
||||
id.includes("/vue-router/") ||
|
||||
id.includes("/pinia/")
|
||||
id.includes('/vue/') ||
|
||||
id.includes('/@vue/') ||
|
||||
id.includes('/vue-router/') ||
|
||||
id.includes('/pinia/')
|
||||
) {
|
||||
return "vue-vendor";
|
||||
return 'vue-vendor'
|
||||
}
|
||||
return "vendor";
|
||||
return 'vendor'
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user