Skip to content

Commit

Permalink
feat: detect @unocss/eslint-plugin for unocss option
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Jan 27, 2025
1 parent 85cf2ee commit 3e260c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/env.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import process from 'node:process'
import { isPackageExists } from 'local-pkg'

export const hasTypeScript: boolean = isPackageExists('typescript')
export const hasVue: boolean =
export const hasTypeScript = (): boolean => isPackageExists('typescript')
export const hasVue = (): boolean =>
isPackageExists('vue') ||
isPackageExists('nuxt') ||
isPackageExists('vitepress') ||
isPackageExists('@slidev/cli')
export const hasUnocss: boolean =
export const hasUnocss = (): boolean =>
isPackageExists('unocss') ||
isPackageExists('@unocss/webpack') ||
isPackageExists('@unocss/nuxt')
isPackageExists('@unocss/nuxt') ||
isPackageExists('@unocss/eslint-plugin')

export function isInEditorEnv(): boolean {
if (process.env.CI) return false
Expand Down
4 changes: 2 additions & 2 deletions src/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ export async function sxzz(
command: enableCommand = true,
markdown: enableMarkdown = true,
prettier: enablePrettier = true,
unocss: enableUnocss = hasUnocss,
vue: enableVue = hasVue,
unocss: enableUnocss = hasUnocss(),
vue: enableVue = hasVue(),
}: Partial<{
/** Vue support. Auto-enable if detected. */
vue: boolean
Expand Down

0 comments on commit 3e260c0

Please sign in to comment.