Compare commits

..

2 Commits

Author SHA1 Message Date
xiaoxian521
97bd47efca chore: add better-tailwindcss/enforce-canonical-classes 2025-12-09 09:59:08 +08:00
xiaoxian521
d794c7965c perf: 根据tailwindcss推荐优化类名 2025-12-08 15:44:00 +08:00
20 changed files with 135 additions and 37 deletions

View File

@@ -5,6 +5,7 @@ import * as parserVue from "vue-eslint-parser";
import configPrettier from "eslint-config-prettier";
import pluginPrettier from "eslint-plugin-prettier";
import { defineConfig, globalIgnores } from "eslint/config";
import eslintPluginBetterTailwindcss from "eslint-plugin-better-tailwindcss";
export default defineConfig([
globalIgnores([
@@ -172,5 +173,20 @@ export default defineConfig([
}
]
}
},
{
files: ["**/*.vue", "**/*.tsx"],
plugins: {
"better-tailwindcss": eslintPluginBetterTailwindcss
},
rules: {
"better-tailwindcss/enforce-consistent-variable-syntax": "warn",
"better-tailwindcss/enforce-canonical-classes": "warn"
},
settings: {
"better-tailwindcss": {
entryPoint: "src/style/tailwind.css"
}
}
}
]);

View File

@@ -141,6 +141,7 @@
"dagre": "^0.8.5",
"eslint": "^9.39.1",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-better-tailwindcss": "4.0.0-beta.6",
"eslint-plugin-prettier": "^5.5.4",
"eslint-plugin-vue": "^10.6.2",
"gradient-string": "^3.0.0",

95
pnpm-lock.yaml generated
View File

@@ -285,6 +285,9 @@ importers:
eslint-config-prettier:
specifier: ^10.1.8
version: 10.1.8(eslint@9.39.1(jiti@2.6.1))
eslint-plugin-better-tailwindcss:
specifier: 4.0.0-beta.6
version: 4.0.0-beta.6(eslint@9.39.1(jiti@2.6.1))(tailwindcss@4.1.17)(typescript@5.9.3)
eslint-plugin-prettier:
specifier: ^5.5.4
version: 5.5.4(eslint-config-prettier@10.1.8(eslint@9.39.1(jiti@2.6.1)))(eslint@9.39.1(jiti@2.6.1))(prettier@3.7.3)
@@ -1053,6 +1056,10 @@ packages:
resolution: {integrity: sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@eslint/css-tree@3.6.8':
resolution: {integrity: sha512-s0f40zY7dlMp8i0Jf0u6l/aSswS0WRAgkhgETgiCJRcxIWb4S/Sp9uScKHWbkM3BnoFLbJbmOYk5AZUDFVxaLA==}
engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0}
'@eslint/eslintrc@3.3.3':
resolution: {integrity: sha512-Kr+LPIUVKz2qkx1HAMH8q1q6azbqBAsXJUxBl/ODDuVPX45Z9DfwB8tPjTi6nNZ8BuM3nbJxC5zCAg5elnBUTQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
@@ -1914,6 +1921,11 @@ packages:
peerDependencies:
'@uppy/core': ^2.3.3
'@valibot/to-json-schema@1.4.0':
resolution: {integrity: sha512-xziHfrrB6al8uoUI876eAYU5x+nZFYifCssYnxS/P7JYe9LjzeKWnqwb8Yno7ulL84Gp0ZNj2GUR+3GXtU8CZQ==}
peerDependencies:
valibot: ^1.2.0
'@vitejs/plugin-vue-jsx@5.1.2':
resolution: {integrity: sha512-3a2BOryRjG/Iih87x87YXz5c8nw27eSlHytvSKYfp8ZIsp5+FgFQoKeA7k2PnqWpjJrv6AoVTMnvmuKUXb771A==}
engines: {node: ^20.19.0 || >=22.12.0}
@@ -2943,6 +2955,13 @@ packages:
peerDependencies:
eslint: '>=7.0.0'
eslint-plugin-better-tailwindcss@4.0.0-beta.6:
resolution: {integrity: sha512-DBtvXwoDLM7xve7/HsT8Y6B1h5DsyUPoUo0eEHRxTCnsXiC7b/CM4JIOHOV7T1lEcQ+KxW6VwYh82w6t0m96sg==}
engines: {node: ^20.19.0 || ^22.12.0 || >=23.0.0}
peerDependencies:
eslint: ^7.0.0 || ^8.0.0 || ^9.0.0
tailwindcss: ^3.3.0 || ^4.1.15
eslint-plugin-prettier@5.5.4:
resolution: {integrity: sha512-swNtI95SToIz05YINMA6Ox5R057IMAmWZ26GqPxusAp1TZzj+IdY9tXNWWD3vkF/wEqydCONcwjTFpxybBqZsg==}
engines: {node: ^14.18.0 || >=16.0.0}
@@ -3970,6 +3989,9 @@ packages:
mdn-data@2.12.2:
resolution: {integrity: sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA==}
mdn-data@2.23.0:
resolution: {integrity: sha512-786vq1+4079JSeu2XdcDjrhi/Ry7BWtjDl9WtGPWLiIHb2T66GvIVflZTBoSNZ5JqTtJGYEVMuFA/lbQlMOyDQ==}
mdn-data@2.25.0:
resolution: {integrity: sha512-T2LPsjgUE/tgMmRXREVmwsux89DwWfNjiynOeXuLd2mX6jphGQ2YE3Ukz7LQ2VOFKiVZU/Ee1GqzHiipZCjymw==}
@@ -4876,6 +4898,10 @@ packages:
resolution: {integrity: sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==}
engines: {node: '>=12'}
strip-bom@3.0.0:
resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==}
engines: {node: '>=4'}
strip-bom@4.0.0:
resolution: {integrity: sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==}
engines: {node: '>=8'}
@@ -5031,6 +5057,10 @@ packages:
resolution: {integrity: sha512-9kY+CygyYM6j02t5YFHbNz2FN5QmYGv9zAjVp4lCDjlCw7amdckXlEt/bjMhUIfj4ThGRE4gCUH5+yGnNuPo5A==}
engines: {node: '>=10.0.0'}
tailwind-csstree@0.1.4:
resolution: {integrity: sha512-FzD187HuFIZEyeR7Xy6sJbJll2d4SybS90satC8SKIuaNRC05CxMvdzN7BUsfDQffcnabckRM5OIcfArjsZ0mg==}
engines: {node: '>=18.18'}
tailwindcss@4.1.17:
resolution: {integrity: sha512-j9Ee2YjuQqYT9bbRTfTZht9W/ytp5H+jJpZKiYdP/bpnXARAuELt9ofP0lPnmHjbga7SNQIxdTAXCmtKVYjN+Q==}
@@ -5097,6 +5127,14 @@ packages:
peerDependencies:
typescript: '>=4.8.4'
tsconfig-paths-webpack-plugin@4.2.0:
resolution: {integrity: sha512-zbem3rfRS8BgeNK50Zz5SIQgXzLafiHjOwUAvk/38/o1jHn/V5QAgVUcz884or7WYcPaH3N2CIfUc2u0ul7UcA==}
engines: {node: '>=10.13.0'}
tsconfig-paths@4.2.0:
resolution: {integrity: sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==}
engines: {node: '>=6'}
tslib@2.3.0:
resolution: {integrity: sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==}
@@ -5226,6 +5264,14 @@ packages:
resolution: {integrity: sha512-FGtKtv3xIpR6BYhvgH8MI/y78oT7d8Au3ww4QIxymrCtZEh5b8gCw2siywE+puhEmuWKDtmfrvF5UlB298ut3w==}
engines: {node: '>=10.12.0'}
valibot@1.2.0:
resolution: {integrity: sha512-mm1rxUsmOxzrwnX5arGS+U4T25RdvpPjPN4yR0u9pUBov9+zGVtO84tif1eY4r6zWxVxu3KzIyknJy3rxfRZZg==}
peerDependencies:
typescript: '>=5'
peerDependenciesMeta:
typescript:
optional: true
vditor@3.11.2:
resolution: {integrity: sha512-8QguQQUPWbBFocnfQmWjz4jiykQnvsmCuhOomGIVVK7vc+dQq2h8w9qQQuEjUTZpnZT5fEdYbj4aLr1NGdAZaA==}
@@ -6217,6 +6263,11 @@ snapshots:
dependencies:
'@types/json-schema': 7.0.15
'@eslint/css-tree@3.6.8':
dependencies:
mdn-data: 2.23.0
source-map-js: 1.2.1
'@eslint/eslintrc@3.3.3':
dependencies:
ajv: 6.12.6
@@ -7122,6 +7173,10 @@ snapshots:
'@uppy/utils': 4.1.3
nanoid: 3.3.11
'@valibot/to-json-schema@1.4.0(valibot@1.2.0(typescript@5.9.3))':
dependencies:
valibot: 1.2.0(typescript@5.9.3)
'@vitejs/plugin-vue-jsx@5.1.2(vite@7.2.4(@types/node@20.19.25)(jiti@2.6.1)(lightningcss@1.30.2)(sass@1.94.2)(yaml@2.8.2))(vue@3.5.25(typescript@5.9.3))':
dependencies:
'@babel/core': 7.28.5
@@ -8368,6 +8423,21 @@ snapshots:
dependencies:
eslint: 9.39.1(jiti@2.6.1)
eslint-plugin-better-tailwindcss@4.0.0-beta.6(eslint@9.39.1(jiti@2.6.1))(tailwindcss@4.1.17)(typescript@5.9.3):
dependencies:
'@eslint/css-tree': 3.6.8
'@valibot/to-json-schema': 1.4.0(valibot@1.2.0(typescript@5.9.3))
enhanced-resolve: 5.18.3
eslint: 9.39.1(jiti@2.6.1)
jiti: 2.6.1
synckit: 0.11.11
tailwind-csstree: 0.1.4
tailwindcss: 4.1.17
tsconfig-paths-webpack-plugin: 4.2.0
valibot: 1.2.0(typescript@5.9.3)
transitivePeerDependencies:
- typescript
eslint-plugin-prettier@5.5.4(eslint-config-prettier@10.1.8(eslint@9.39.1(jiti@2.6.1)))(eslint@9.39.1(jiti@2.6.1))(prettier@3.7.3):
dependencies:
eslint: 9.39.1(jiti@2.6.1)
@@ -9405,7 +9475,7 @@ snapshots:
launch-ide@1.2.1:
dependencies:
chalk: 4.1.1
chalk: 4.1.2
dotenv: 16.6.1
leven@2.1.0: {}
@@ -9603,6 +9673,8 @@ snapshots:
mdn-data@2.12.2: {}
mdn-data@2.23.0: {}
mdn-data@2.25.0: {}
memoize-one@6.0.0: {}
@@ -10466,6 +10538,8 @@ snapshots:
dependencies:
ansi-regex: 6.2.2
strip-bom@3.0.0: {}
strip-bom@4.0.0: {}
strip-final-newline@2.0.0: {}
@@ -10662,6 +10736,8 @@ snapshots:
string-width: 4.2.3
strip-ansi: 6.0.1
tailwind-csstree@0.1.4: {}
tailwindcss@4.1.17: {}
tapable@2.3.0: {}
@@ -10724,6 +10800,19 @@ snapshots:
dependencies:
typescript: 5.9.3
tsconfig-paths-webpack-plugin@4.2.0:
dependencies:
chalk: 4.1.2
enhanced-resolve: 5.18.3
tapable: 2.3.0
tsconfig-paths: 4.2.0
tsconfig-paths@4.2.0:
dependencies:
json5: 2.2.3
minimist: 1.2.8
strip-bom: 3.0.0
tslib@2.3.0: {}
tslib@2.4.0: {}
@@ -10840,6 +10929,10 @@ snapshots:
convert-source-map: 1.9.0
source-map: 0.7.6
valibot@1.2.0(typescript@5.9.3):
optionalDependencies:
typescript: 5.9.3
vditor@3.11.2:
dependencies:
diff-match-patch: 1.0.5

View File

@@ -33,7 +33,7 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();
</script>
<template>
<div class="navbar bg-[#fff] shadow-xs shadow-[rgba(0,21,41,0.08)]">
<div class="navbar bg-white shadow-xs shadow-[rgba(0,21,41,0.08)]">
<LaySidebarTopCollapse
v-if="device === 'mobile'"
class="hamburger-container"

View File

@@ -49,7 +49,7 @@ function hoverDescription(event, description) {
<template>
<div
class="notice-container border-0 border-b-[1px] border-solid border-[#f0f0f0] dark:border-[#303030]"
class="notice-container border-0 border-b border-solid border-[#f0f0f0] dark:border-[#303030]"
>
<el-avatar
v-if="noticeItem.avatar"

View File

@@ -51,7 +51,7 @@ onBeforeUnmount(() => {
<div class="right-panel-background" />
<div ref="target" class="right-panel bg-bg_color">
<div
class="project-configuration border-0 border-b-[1px] border-solid border-[var(--pure-border-color)]"
class="project-configuration border-0 border-b border-solid border-(--pure-border-color)"
>
<h4 class="dark:text-white">
{{ t("panel.pureSystemSet") }}
@@ -78,7 +78,7 @@ onBeforeUnmount(() => {
</el-scrollbar>
<div
class="flex justify-end p-3 border-0 border-t-[1px] border-solid border-[var(--pure-border-color)]"
class="flex justify-end p-3 border-0 border-t border-solid border-(--pure-border-color)"
>
<el-button
v-tippy="{

View File

@@ -416,7 +416,7 @@ onUnmounted(() => removeMatchMedia);
<button
v-else
v-ripple="{ class: 'text-gray-300' }"
class="bg-transparent flex-c w-full h-20 rounded-md border border-[var(--pure-border-color)]"
class="bg-transparent flex-c w-full h-20 rounded-md border border-(--pure-border-color)"
@click="setStretch(!settings.stretch)"
>
<div

View File

@@ -89,7 +89,7 @@ const exportExcel = () => {
</el-link>
</template>
<el-button type="primary" @click="exportExcel">导出Excel</el-button>
<div class="h-[25rem] mt-3">
<div class="h-100 mt-3">
<el-auto-resizer>
<template #default="{ height, width }">
<el-table-v2

View File

@@ -38,10 +38,7 @@ function onClick(item) {
<template>
<div
:class="[
'min-w-[180px]',
deviceDetection() ? 'max-w-[100%]' : 'max-w-[70%]'
]"
:class="['min-w-[180px]', deviceDetection() ? 'max-w-full' : 'max-w-[70%]']"
>
<h3 class="my-8!">账户管理</h3>
<div v-for="(item, index) in list" :key="index">

View File

@@ -33,10 +33,7 @@ function onChange(val, item) {
<template>
<div
:class="[
'min-w-[180px]',
deviceDetection() ? 'max-w-[100%]' : 'max-w-[70%]'
]"
:class="['min-w-[180px]', deviceDetection() ? 'max-w-full' : 'max-w-[70%]']"
>
<h3 class="my-8!">偏好设置</h3>
<div v-for="(item, index) in list" :key="index">

View File

@@ -105,10 +105,7 @@ getMine().then(res => {
<template>
<div
:class="[
'min-w-[180px]',
deviceDetection() ? 'max-w-[100%]' : 'max-w-[70%]'
]"
:class="['min-w-[180px]', deviceDetection() ? 'max-w-full' : 'max-w-[70%]']"
>
<h3 class="my-8!">个人信息</h3>
<el-form

View File

@@ -73,10 +73,7 @@ onMounted(() => {
<template>
<div
:class="[
'min-w-[180px]',
deviceDetection() ? 'max-w-[100%]' : 'max-w-[70%]'
]"
:class="['min-w-[180px]', deviceDetection() ? 'max-w-full' : 'max-w-[70%]']"
>
<h3 class="my-8!">安全日志</h3>
<pure-table

View File

@@ -70,16 +70,16 @@ getMine().then(res => {
<el-container class="h-full">
<el-aside
v-if="isOpen"
class="pure-account-settings overflow-hidden px-2 dark:bg-(--el-bg-color)! border-r-[1px] border-[var(--pure-border-color)]"
class="pure-account-settings overflow-hidden px-2 dark:bg-(--el-bg-color)! border-r border-(--pure-border-color)"
:width="deviceDetection() ? '180px' : '240px'"
>
<el-menu :default-active="witchPane" class="pure-account-settings-menu">
<div
class="h-[50px]! text-[var(--pure-theme-menu-text)] cursor-pointer text-sm transition-all duration-300 ease-in-out hover:scale-105 will-change-transform transform-gpu origin-center hover:text-base! hover:text-[var(--pure-theme-menu-title-hover)]!"
class="h-[50px]! text-(--pure-theme-menu-text) cursor-pointer text-sm transition-all duration-300 ease-in-out hover:scale-105 will-change-transform transform-gpu origin-center hover:text-base! hover:text-(--pure-theme-menu-title-hover)!"
@click="router.go(-1)"
>
<div
class="h-full flex items-center px-[var(--el-menu-base-level-padding)]"
class="h-full flex items-center px-(--el-menu-base-level-padding)"
>
<IconifyIconOffline :icon="leftLine" />
<span class="ml-2">返回</span>

View File

@@ -38,7 +38,7 @@ const handleChange = value => {
<el-row :gutter="24">
<el-col :xl="12" :lg="12" :md="24" :sm="24" :xs="24">
<div class="flex flex-col items-center justify-center">
<span class="text-[var(--el-color-primary)]">
<span class="text-(--el-color-primary)">
1. 二级联动不带全部选项
<el-cascader
v-model="selectedOptions1"
@@ -67,7 +67,7 @@ const handleChange = value => {
</el-col>
<el-col :xl="12" :lg="12" :md="24" :sm="24" :xs="24">
<div class="flex flex-col items-center justify-center mt-3">
<span class="text-[var(--el-color-primary)]">
<span class="text-(--el-color-primary)">
2. 二级联动带有全部选项
<el-cascader
v-model="selectedOptions3"
@@ -96,7 +96,7 @@ const handleChange = value => {
</el-col>
<el-col :xl="12" :lg="12" :md="24" :sm="24" :xs="24">
<div class="flex flex-col items-center justify-center mt-3">
<span class="text-[var(--el-color-primary)]">
<span class="text-(--el-color-primary)">
3. 三级联动不带全部选项
<el-cascader
v-model="selectedOptions2"
@@ -127,7 +127,7 @@ const handleChange = value => {
</el-col>
<el-col :xl="12" :lg="12" :md="24" :sm="24" :xs="24">
<div class="flex flex-col items-center justify-center mt-3">
<span class="text-[var(--el-color-primary)]">
<span class="text-(--el-color-primary)">
4. 三级联动"全部选项"
<el-cascader
v-model="selectedOptions4"

View File

@@ -190,7 +190,7 @@ const onDownload = () => {
class="el-upload-list__item-delete"
@click="handleRemove(file)"
>
<span title="移除" class="hover:text-[var(--el-color-danger)]">
<span title="移除" class="hover:text-(--el-color-danger)">
<IconifyIconOffline
:icon="Delete"
class="hover:scale-125 duration-100"
@@ -222,7 +222,7 @@ const onDownload = () => {
type="info"
class="img-name"
>
<p class="text-[#fff] dark:text-black">
<p class="text-white dark:text-black">
{{ fileList[curOpenImgIndex].name }}
</p>
</div>

View File

@@ -135,7 +135,7 @@ watch(loginDay, value => {
<!-- 国际化 -->
<el-dropdown trigger="click">
<globalization
class="hover:text-primary hover:bg-[transparent]! w-[20px] h-[20px] ml-1.5 cursor-pointer outline-hidden duration-300"
class="hover:text-primary hover:bg-transparent! w-[20px] h-[20px] ml-1.5 cursor-pointer outline-hidden duration-300"
/>
<template #dropdown>
<el-dropdown-menu class="translation">

View File

@@ -103,7 +103,7 @@ const {
<div
v-if="selectedNum > 0"
v-motion-fade
class="bg-[var(--el-fill-color-light)] w-full h-[46px] mb-2 pl-4 flex items-center"
class="bg-(--el-fill-color-light) w-full h-[46px] mb-2 pl-4 flex items-center"
>
<div class="flex-auto">
<span

View File

@@ -103,7 +103,7 @@ const {
<div
v-if="selectedNum > 0"
v-motion-fade
class="bg-[var(--el-fill-color-light)] w-full h-[46px] mb-2 pl-4 flex items-center"
class="bg-(--el-fill-color-light) w-full h-[46px] mb-2 pl-4 flex items-center"
>
<div class="flex-auto">
<span

View File

@@ -95,7 +95,7 @@ const {
<div
v-if="selectedNum > 0"
v-motion-fade
class="bg-[var(--el-fill-color-light)] w-full h-[46px] mb-2 pl-4 flex items-center"
class="bg-(--el-fill-color-light) w-full h-[46px] mb-2 pl-4 flex items-center"
>
<div class="flex-auto">
<span

View File

@@ -128,7 +128,7 @@ const {
<div
v-if="selectedNum > 0"
v-motion-fade
class="bg-[var(--el-fill-color-light)] w-full h-[46px] mb-2 pl-4 flex items-center"
class="bg-(--el-fill-color-light) w-full h-[46px] mb-2 pl-4 flex items-center"
>
<div class="flex-auto">
<span