Skip to content

Commit 1da2139

Browse files
authored
Avoid invalidConfigPath for function values
Pass `validateConfigPath` if a type of value equals to `function`. The purpose of this commit is to avoid unwanted warnings when we define theme values as functions in tailwind.config.js, which, for example, are required to define theme colors with opacity enabled. tailwindlabs/tailwindcss#2206 (comment)
1 parent 43cfe83 commit 1da2139

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,11 @@ function validateConfigPath(
9090
typeof value === 'number' ||
9191
value instanceof String ||
9292
value instanceof Number ||
93-
Array.isArray(value)
93+
Array.isArray(value) ||
94+
typeof value === 'function'
9495
)
9596
) {
96-
let reason = `'${pathToString(path)}' was found but does not resolve to a string.`
97+
let reason = `'${pathToString(path)}' was found but does not resolve to a string, number, array or function.`
9798

9899
if (isObject(value)) {
99100
let validKeys = Object.keys(value).filter(

0 commit comments

Comments
 (0)