Skip to content

Commit c7062cd

Browse files
committed
Don’t show diagnostic for @tailwind utilities source(…)
1 parent dba6024 commit c7062cd

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

packages/tailwindcss-language-service/src/diagnostics/getInvalidTailwindDirectiveDiagnostics.ts

+19
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,25 @@ function validateLayerName(
7575
state: State,
7676
layerName: string,
7777
): { message: string; suggestions: string[] } | null {
78+
if (state.v4) {
79+
// `@tailwind utilities` is valid
80+
if (layerName === 'utilities') {
81+
return null
82+
}
83+
84+
let parts = layerName.split(/\s+/)
85+
86+
// `@tailwind utilities source(…)` is valid
87+
if (parts[0] === 'utilities' && parts[1]?.startsWith('source(')) {
88+
return null
89+
}
90+
91+
return {
92+
message: `'${layerName}' is not a valid value.`,
93+
suggestions: [],
94+
}
95+
}
96+
7897
let valid = ['utilities', 'components', 'screens']
7998

8099
if (semver.gte(state.version, '1.0.0-beta.1')) {

0 commit comments

Comments
 (0)