Skip to content

Commit 3e260c0

Browse files
committedJan 27, 2025··
feat: detect @unocss/eslint-plugin for unocss option
1 parent 85cf2ee commit 3e260c0

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed
 

‎src/env.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import process from 'node:process'
22
import { isPackageExists } from 'local-pkg'
33

4-
export const hasTypeScript: boolean = isPackageExists('typescript')
5-
export const hasVue: boolean =
4+
export const hasTypeScript = (): boolean => isPackageExists('typescript')
5+
export const hasVue = (): boolean =>
66
isPackageExists('vue') ||
77
isPackageExists('nuxt') ||
88
isPackageExists('vitepress') ||
99
isPackageExists('@slidev/cli')
10-
export const hasUnocss: boolean =
10+
export const hasUnocss = (): boolean =>
1111
isPackageExists('unocss') ||
1212
isPackageExists('@unocss/webpack') ||
13-
isPackageExists('@unocss/nuxt')
13+
isPackageExists('@unocss/nuxt') ||
14+
isPackageExists('@unocss/eslint-plugin')
1415

1516
export function isInEditorEnv(): boolean {
1617
if (process.env.CI) return false

‎src/presets.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ export async function sxzz(
7575
command: enableCommand = true,
7676
markdown: enableMarkdown = true,
7777
prettier: enablePrettier = true,
78-
unocss: enableUnocss = hasUnocss,
79-
vue: enableVue = hasVue,
78+
unocss: enableUnocss = hasUnocss(),
79+
vue: enableVue = hasVue(),
8080
}: Partial<{
8181
/** Vue support. Auto-enable if detected. */
8282
vue: boolean

0 commit comments

Comments
 (0)
Please sign in to comment.