Skip to content

Commit 7d62603

Browse files
feat: add eslint-plugin-better-tailwindcss for Tailwind v4 linting
- Install eslint-plugin-better-tailwindcss with recommended config - Configure entryPoint to design-system CSS for v4 theme resolution - Enable: enforce-canonical-classes, no-deprecated-classes, no-conflicting-classes, no-duplicate-classes, no-unnecessary-whitespace - Disable initially: no-unknown-classes (needs class whitelisting), enforce-consistent-line-wrapping (oxfmt conflict risk), enforce-consistent-class-order (large batch change) - Fix conflicting outline classes in FormDropdownMenuActions Fixes COM-15518 Amp-Thread-ID: https://ampcode.com/threads/T-019c9922-38fa-7628-8723-887d3c8fc386
1 parent aef299c commit 7d62603

File tree

5 files changed

+99
-4
lines changed

5 files changed

+99
-4
lines changed

eslint.config.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
22
import pluginJs from '@eslint/js'
33
import pluginI18n from '@intlify/eslint-plugin-vue-i18n'
4+
import betterTailwindcss from 'eslint-plugin-better-tailwindcss'
45
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript'
56
import { importX } from 'eslint-plugin-import-x'
67
import oxlint from 'eslint-plugin-oxlint'
@@ -111,6 +112,23 @@ export default defineConfig([
111112
tseslintConfigs.recommended,
112113
// Difference in typecheck on CI vs Local
113114
pluginVue.configs['flat/recommended'],
115+
// Tailwind CSS v4 linting (class ordering, duplicates, conflicts, etc.)
116+
betterTailwindcss.configs.recommended,
117+
{
118+
settings: {
119+
'better-tailwindcss': {
120+
entryPoint: 'packages/design-system/src/css/style.css'
121+
}
122+
},
123+
rules: {
124+
// Off: requires whitelisting non-Tailwind classes (PrimeIcons, custom CSS)
125+
'better-tailwindcss/no-unknown-classes': 'off',
126+
// Off: may conflict with oxfmt formatting
127+
'better-tailwindcss/enforce-consistent-line-wrapping': 'off',
128+
// Off: large batch change, enable and apply with `eslint --fix`
129+
'better-tailwindcss/enforce-consistent-class-order': 'off'
130+
}
131+
},
114132
// Disables ESLint rules that conflict with formatters
115133
eslintConfigPrettier,
116134
// @ts-expect-error Type incompatibility between storybook plugin and ESLint config types

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@
146146
"eslint": "catalog:",
147147
"eslint-config-prettier": "catalog:",
148148
"eslint-import-resolver-typescript": "catalog:",
149+
"eslint-plugin-better-tailwindcss": "catalog:",
149150
"eslint-plugin-import-x": "catalog:",
150151
"eslint-plugin-oxlint": "catalog:",
151152
"eslint-plugin-storybook": "catalog:",

pnpm-lock.yaml

Lines changed: 75 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ catalog:
6161
eslint: ^9.39.1
6262
eslint-config-prettier: ^10.1.8
6363
eslint-import-resolver-typescript: ^4.4.4
64+
eslint-plugin-better-tailwindcss: ^4.3.1
6465
eslint-plugin-import-x: ^4.16.1
6566
eslint-plugin-oxlint: 1.25.0
6667
eslint-plugin-storybook: ^10.2.10

src/renderer/extensions/vueNodes/widgets/components/form/dropdown/FormDropdownMenuActions.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const baseModelSelected = defineModel<Set<string>>('baseModelSelected', {
4242
})
4343
4444
const actionButtonStyle = cn(
45-
'h-8 bg-zinc-500/20 rounded-lg outline outline-1 outline-offset-[-1px] outline-node-component-border transition-all duration-150'
45+
'h-8 bg-zinc-500/20 rounded-lg outline-1 -outline-offset-1 outline-node-component-border transition-all duration-150'
4646
)
4747
4848
const layoutSwitchItemStyle =
@@ -157,7 +157,7 @@ function toggleBaseModelSelection(item: FilterOption) {
157157
cn(
158158
'flex flex-col gap-2 p-2 min-w-32',
159159
'bg-component-node-background',
160-
'rounded-lg outline outline-offset-[-1px] outline-component-node-border'
160+
'rounded-lg outline -outline-offset-1 outline-component-node-border'
161161
)
162162
"
163163
>
@@ -219,7 +219,7 @@ function toggleBaseModelSelection(item: FilterOption) {
219219
cn(
220220
'flex flex-col gap-2 p-2 min-w-32',
221221
'bg-component-node-background',
222-
'rounded-lg outline outline-offset-[-1px] outline-component-node-border'
222+
'rounded-lg outline -outline-offset-1 outline-component-node-border'
223223
)
224224
"
225225
>
@@ -281,7 +281,7 @@ function toggleBaseModelSelection(item: FilterOption) {
281281
cn(
282282
'flex flex-col gap-2 p-2 min-w-32',
283283
'bg-component-node-background',
284-
'rounded-lg outline outline-offset-[-1px] outline-component-node-border'
284+
'rounded-lg outline -outline-offset-1 outline-component-node-border'
285285
)
286286
"
287287
>

0 commit comments

Comments
 (0)