File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import fs from "node:fs" ;
22import path from "node:path" ;
3- import PrettierPluginOxc from "@prettier/plugin-oxc" ;
43import PrettierPluginXml from "@prettier/plugin-xml" ;
54import editorconfig from "editorconfig" ;
65import { ESLint as EsLint } from "eslint" ;
@@ -103,12 +102,23 @@ const DEFAULT_ESLINT_CONFIG_JAVASCRIPT = import.meta.resolve( "#resources/eslint
103102 DEFAULT_ESLINT_CONFIG_VUE = import . meta. resolve ( "#resources/eslint.config.vue.js" ) ,
104103 DEFAULT_ESLINT_CONFIG_TYPESCRIPT = import . meta. resolve ( "#resources/eslint.config.typescript.js" ) ;
105104
105+ var PrettierPluginOxc ,
106+ PRETTIER_JS_PARSER = "babel" ,
107+ PRETTIER_TS_PARSER = "typescript" ;
108+
109+ try {
110+ PrettierPluginOxc = await import ( "@prettier/plugin-oxc" ) ;
111+ PRETTIER_JS_PARSER = "oxc" ;
112+ PRETTIER_TS_PARSER = "oxc-ts" ;
113+ }
114+ catch { }
115+
106116const USE_PRETTIER_FOR_JS = true ,
107117 TYPES = {
108118 "text/javascript" : {
109119 "prettier" : {
110120 "parser" : USE_PRETTIER_FOR_JS
111- ? "oxc"
121+ ? PRETTIER_JS_PARSER
112122 : null ,
113123 } ,
114124 "eslint" : {
@@ -130,7 +140,7 @@ const USE_PRETTIER_FOR_JS = true,
130140 "application/x-typescript" : {
131141 "prettier" : {
132142 "parser" : USE_PRETTIER_FOR_JS
133- ? "oxc-ts"
143+ ? PRETTIER_TS_PARSER
134144 : null ,
135145 } ,
136146 "eslint" : {
You can’t perform that action at this time.
0 commit comments