Skip to content

Commit

Permalink
chore: format all files (#3369)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Sep 3, 2024
1 parent 2d534c8 commit 3bffc94
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 49 deletions.
2 changes: 1 addition & 1 deletion e2e/cases/css/css-assets/rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { pluginReact } from '@rsbuild/plugin-react';

export default defineConfig({
plugins: [pluginReact()],
output: {}
output: {},
});
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>custom template</title>
</head>

<head>
<meta charset="utf-8">
<title>custom template</title>
</head>

<body>
<div id="test-template">test</div>
<div id="root" />
</body>

<body>
<div id="test-template">test</div>
<div id="root" />
</body>
</html>
2 changes: 1 addition & 1 deletion e2e/cases/server/ssr/template.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
10 changes: 5 additions & 5 deletions e2e/cases/vue/jsx-hmr/src/Script.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<script lang="jsx">
import { defineComponent, ref } from 'vue'
import { defineComponent, ref } from 'vue';
export default defineComponent(() => {
const count = ref(4)
const inc = () => count.value++
const count = ref(4);
const inc = () => count.value++;
return () => (
<button class="script" onClick={inc}>
script {count.value}
</button>
)
})
);
});
</script>
4 changes: 2 additions & 2 deletions e2e/cases/vue/jsx-hmr/src/TsImport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
</template>

<script setup lang="tsx">
import { foo } from './TsImportFile'
import { foo } from './TsImportFile';
const Bar = () => (
<div class="bar">
<p>Bar</p>
</div>
)
);
</script>
10 changes: 5 additions & 5 deletions e2e/cases/vue/jsx-hmr/src/setup-syntax-jsx.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<script setup lang="jsx">
import { ref } from 'vue'
let count = ref(100)
import { ref } from 'vue';
let count = ref(100);
const increment = () => {
count.value++
}
count.value++;
};
const Render = () => (
<div>
<button onClick={increment}> click!!! </button>
</div>
)
);
</script>

<template>
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"sort-package-json": "npx sort-package-json \"./package.json\" \"packages/*/package.json\" \"packages/compat/*/package.json\"",
"test": "pnpm run ut",
"ut": "vitest run",
"ut:watch": "vitest"
"ut:watch": "vitest",
"format": "prettier --write ."
},
"simple-git-hooks": {
"pre-commit": "npx nano-staged"
Expand Down
12 changes: 8 additions & 4 deletions packages/core/src/plugins/rsdoctor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ type RsdoctorExports = {
RsdoctorWebpackPlugin: { new (): BundlerPluginInstance };
};

type MaybeRsdoctorPlugin = Configuration['plugins'] & { isRsdoctorPlugin?: boolean };
type MaybeRsdoctorPlugin = Configuration['plugins'] & {
isRsdoctorPlugin?: boolean;
};

export const pluginRsdoctor = (): RsbuildPlugin => ({
name: 'rsbuild:rsdoctor',
Expand Down Expand Up @@ -50,12 +52,14 @@ export const pluginRsdoctor = (): RsbuildPlugin => ({

let isAutoRegister = false;

const isRsdoctorPlugin = (plugin: MaybeRsdoctorPlugin) => plugin?.isRsdoctorPlugin === true || plugin?.constructor?.name === pluginName;
const isRsdoctorPlugin = (plugin: MaybeRsdoctorPlugin) =>
plugin?.isRsdoctorPlugin === true ||
plugin?.constructor?.name === pluginName;

for (const config of bundlerConfigs) {
// If user has added the Rsdoctor plugin to the config file, it will return.
const registered = config.plugins?.some(
(plugin) => isRsdoctorPlugin(plugin as unknown as MaybeRsdoctorPlugin),
const registered = config.plugins?.some((plugin) =>
isRsdoctorPlugin(plugin as unknown as MaybeRsdoctorPlugin),
);

if (registered) {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-assets-retry/src/AsyncChunkRetryPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class AsyncChunkRetryPlugin implements Rspack.RspackPluginInstance {
)
.replaceAll(
'__RUNTIME_GLOBALS_GET_MINI_CSS_EXTRACT_FILENAME__',
'__webpack_require__.miniCssF'
'__webpack_require__.miniCssF',
)
.replaceAll('__RUNTIME_GLOBALS_PUBLIC_PATH__', RuntimeGlobals.publicPath)
.replaceAll('__RUNTIME_GLOBALS_LOAD_SCRIPT__', RuntimeGlobals.loadScript)
Expand Down
9 changes: 3 additions & 6 deletions website/docs/en/config/plugins.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,12 @@ Rsbuild also supports adding nested plugins. You can pass in an array containing

```ts title="rsbuild.config.ts"
function myPlugin() {
return [
fooPlugin(),
barPlugin()
];
return [fooPlugin(), barPlugin()];
}

export default {
plugins: [myPlugin()]
}
plugins: [myPlugin()],
};
```

## Local Plugins
Expand Down
4 changes: 1 addition & 3 deletions website/docs/en/guide/basic/unocss.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ You can register the `unocss` PostCSS plugin through [postcss.config.mjs](https:
import UnoCSS from '@unocss/postcss';

export default {
plugins: [
UnoCSS(),
],
plugins: [UnoCSS()],
};
```

Expand Down
9 changes: 3 additions & 6 deletions website/docs/zh/config/plugins.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,12 @@ Rsbuild 还支持添加嵌套插件,你可以传入一个包含多个插件的

```ts title="rsbuild.config.ts"
function myPlugin() {
return [
fooPlugin(),
barPlugin()
];
return [fooPlugin(), barPlugin()];
}

export default {
plugins: [myPlugin()]
}
plugins: [myPlugin()],
};
```

## 本地插件
Expand Down
4 changes: 1 addition & 3 deletions website/docs/zh/guide/basic/unocss.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ import { PackageManagerTabs } from '@theme';
import UnoCSS from '@unocss/postcss';

export default {
plugins: [
UnoCSS(),
],
plugins: [UnoCSS()],
};
```

Expand Down

0 comments on commit 3bffc94

Please sign in to comment.