Skip to content

Commit 2ac3f32

Browse files
committed
fix: report unknown theme value again
1 parent 230b0b5 commit 2ac3f32

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
"dependencies": {
9898
"cssbeautify": "^0.3.1",
9999
"esbuild": "^0.9.3",
100+
"fast-json-stable-stringify": "^2.1.0",
100101
"match-sorter": "^6.3.0",
101102
"twind": "^0.16.6",
102103
"typescript": "^4.1.0",

src/twind.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { Logger } from 'typescript-template-language-service-decorator'
44
import type * as TS from 'typescript/lib/tsserverlibrary'
55

66
import cssbeautify from 'cssbeautify'
7+
import stringify from 'fast-json-stable-stringify'
78

89
import type {
910
Context,
@@ -405,11 +406,14 @@ export class Twind {
405406
}
406407
}
407408

408-
if (!state.reports.length) {
409-
state.tw(rule)
410-
}
409+
state.tw(rule)
411410

412-
return [...state.reports]
411+
// Remove duplicates
412+
return [
413+
...new Map([
414+
...state.reports.map((report): [string, ReportInfo] => [stringify(report), report]),
415+
]).values(),
416+
]
413417
}
414418

415419
get completions(): Completions {

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ fast-glob@^3.1.1:
606606
micromatch "^4.0.2"
607607
picomatch "^2.2.1"
608608

609-
fast-json-stable-stringify@^2.0.0:
609+
fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0:
610610
version "2.1.0"
611611
resolved "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
612612
integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==

0 commit comments

Comments
 (0)