chore: bump prettier v3 and format all code (#12111)

* chore: bump prettier v3 and format all code

* chore: mjs config

* chore: revert

* chore: revert

* chore: update lock
This commit is contained in:
neverland
2023-07-22 14:14:14 +08:00
committed by GitHub
parent b601ca1e0b
commit 3dcc92a5c0
209 changed files with 565 additions and 543 deletions
@@ -38,9 +38,9 @@ export async function compileBundles() {
build(
await mergeCustomViteConfig(
getViteConfigForPackage(config),
'production'
)
)
)
'production',
),
),
),
);
}
@@ -10,7 +10,7 @@ const { readFileSync, removeSync, outputFileSync } = fse;
export async function compileScript(
filePath: string,
format: Format
format: Format,
): Promise<void> {
if (filePath.includes('.d.ts')) {
return;
@@ -127,7 +127,7 @@ export async function compileSfc(filePath: string): Promise<any> {
}
outputFile(scriptFilePath, script).then(resolve);
})
}),
);
}
@@ -150,7 +150,7 @@ export async function compileSfc(filePath: string): Promise<any> {
// }
return outputFile(cssFilePath, styleSource);
})
}),
);
return Promise.all(tasks);
@@ -31,13 +31,13 @@ export async function compileSite(production = false) {
if (production) {
const config = await mergeCustomViteConfig(
getViteConfigForSiteProd(),
'production'
'production',
);
await build(config);
} else {
const config = await mergeCustomViteConfig(
getViteConfigForSiteDev(),
'development'
'development',
);
const server = await createServer(config);
await server.listen(config.server?.port);
@@ -81,7 +81,7 @@ function genEntry(params: {
}
export function genComponentStyle(
options: { cache: boolean } = { cache: true }
options: { cache: boolean } = { cache: true },
) {
if (!options.cache) {
const require = createRequire(import.meta.url);
@@ -20,7 +20,7 @@ function getPathByName(name: string, pathResolver?: PathResolver) {
function genImports(
names: string[],
pathResolver?: PathResolver,
namedExport?: boolean
namedExport?: boolean,
): string {
return names
.map((name) => {
@@ -36,7 +36,7 @@ function genImports(
function genExports(
names: string[],
pathResolver?: PathResolver,
namedExport?: boolean
namedExport?: boolean,
): string {
if (namedExport) {
const exports = names
@@ -38,7 +38,7 @@ function genConfig(demos: DemoItem[]) {
function demoFilter(nav: any[]) {
return nav.filter((group) => {
group.items = group.items.filter((item: any) =>
demoNames.includes(item.path)
demoNames.includes(item.path),
);
return group.items.length;
});
@@ -106,13 +106,13 @@ export async function genStyleDepsMap() {
Object.keys(map).forEach((key) => {
map[key] = map[key].sort(
(a, b) => sequence.indexOf(a) - sequence.indexOf(b)
(a, b) => sequence.indexOf(a) - sequence.indexOf(b),
);
});
smartOutputFile(
STYLE_DEPS_JSON_FILE,
JSON.stringify({ map, sequence }, null, 2)
JSON.stringify({ map, sequence }, null, 2),
);
resolve();
+2 -3
View File
@@ -105,7 +105,7 @@ export function getDeps(filePath: string) {
export function replaceScriptImportExt(
code: string,
filePath: string,
ext: string
ext: string,
) {
const imports = [...matchImports(code), ...matchExportFroms(code)];
@@ -132,7 +132,6 @@ export function replaceScriptImportExt(
return;
}
const pathInfo = getPathByImport(line, filePath);
if (pathInfo) {
@@ -141,7 +140,7 @@ export function replaceScriptImportExt(
if (pathInfo.isIndex) {
const newLine = line.replace(
relativePath,
`${relativePath}/index${ext}`
`${relativePath}/index${ext}`,
);
updateImport(index, newLine);
@@ -77,7 +77,7 @@ function findTag(vueTags: VueTag[], name: string) {
export function formatter(
vueTags: VueTag[],
articles: Articles,
tagPrefix = ''
tagPrefix = '',
) {
if (!articles.length) {
return;
@@ -36,7 +36,7 @@ export async function parseAndWrite(options: Options) {
const webTypes = genWebTypes(vueTags, options);
fse.outputFileSync(
join(options.outputDir, 'web-types.json'),
JSON.stringify(webTypes)
JSON.stringify(webTypes),
);
}
@@ -2,7 +2,7 @@
export function toKebabCase(input: string): string {
return input.replace(
/[A-Z]/g,
(val, index) => (index === 0 ? '' : '-') + val.toLowerCase()
(val, index) => (index === 0 ? '' : '-') + val.toLowerCase(),
);
}