Skip to content

Commit a52fc4d

Browse files
committed
chore: run format
1 parent 6f3aa49 commit a52fc4d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+941
-945
lines changed

packages/plugin-react-swc/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ npm i -D @vitejs/plugin-react-swc
1414
## Usage
1515

1616
```ts
17-
import { defineConfig } from "vite";
18-
import react from "@vitejs/plugin-react-swc";
17+
import { defineConfig } from 'vite'
18+
import react from '@vitejs/plugin-react-swc'
1919

2020
export default defineConfig({
2121
plugins: [react()],
22-
});
22+
})
2323
```
2424

2525
## Caveats
@@ -43,7 +43,7 @@ Control where the JSX factory is imported from.
4343
`@default` "react"
4444

4545
```ts
46-
react({ jsxImportSource: "@emotion/react" });
46+
react({ jsxImportSource: '@emotion/react' })
4747
```
4848

4949
### tsDecorators
@@ -53,15 +53,15 @@ Enable TypeScript decorators. Requires `experimentalDecorators` in tsconfig.
5353
`@default` false
5454

5555
```ts
56-
react({ tsDecorators: true });
56+
react({ tsDecorators: true })
5757
```
5858

5959
### plugins
6060

6161
Use SWC plugins. Enable SWC at build time.
6262

6363
```ts
64-
react({ plugins: [["@swc/plugin-styled-components", {}]] });
64+
react({ plugins: [['@swc/plugin-styled-components', {}]] })
6565
```
6666

6767
### devTarget
@@ -73,7 +73,7 @@ For production target, see https://vitejs.dev/config/build-options.html#build-ta
7373
`@default` "es2020"
7474

7575
```ts
76-
react({ devTarget: "es2022" });
76+
react({ devTarget: 'es2022' })
7777
```
7878

7979
### parserConfig
@@ -87,10 +87,10 @@ If you want to trigger fast refresh on compiled JS, use `jsx: true`. Exclusion o
8787
```ts
8888
react({
8989
parserConfig(id) {
90-
if (id.endsWith(".res")) return { syntax: "ecmascript", jsx: true };
91-
if (id.endsWith(".ts")) return { syntax: "typescript", tsx: false };
90+
if (id.endsWith('.res')) return { syntax: 'ecmascript', jsx: true }
91+
if (id.endsWith('.ts')) return { syntax: 'typescript', tsx: false }
9292
},
93-
});
93+
})
9494
```
9595

9696
### useAtYourOwnRisk_mutateSwcOptions
@@ -101,10 +101,10 @@ Also debugging why some specific version of decorators with some other unstable/
101101
```ts
102102
react({
103103
useAtYourOwnRisk_mutateSwcOptions(options) {
104-
options.jsc.parser.decorators = true;
105-
options.jsc.transform.decoratorVersion = "2022-03";
104+
options.jsc.parser.decorators = true
105+
options.jsc.transform.decoratorVersion = '2022-03'
106106
},
107-
});
107+
})
108108
```
109109

110110
## Consistent components exports
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import { expect, test } from "@playwright/test";
2-
import { setupDevServer, setupWaitForLogs } from "../../utils.ts";
1+
import { expect, test } from '@playwright/test'
2+
import { setupDevServer, setupWaitForLogs } from '../../utils.ts'
33

4-
test("Base path HMR", async ({ page }) => {
5-
const { testUrl, server, editFile } = await setupDevServer("base-path");
6-
const waitForLogs = await setupWaitForLogs(page);
7-
await page.goto(testUrl);
4+
test('Base path HMR', async ({ page }) => {
5+
const { testUrl, server, editFile } = await setupDevServer('base-path')
6+
const waitForLogs = await setupWaitForLogs(page)
7+
await page.goto(testUrl)
88

9-
const button = page.locator("button");
10-
await button.click();
11-
await expect(button).toHaveText("count is 1");
9+
const button = page.locator('button')
10+
await button.click()
11+
await expect(button).toHaveText('count is 1')
1212

13-
editFile("src/App.tsx", ["{count}", "{count}!"]);
14-
await waitForLogs("[vite] hot updated: /src/App.tsx");
15-
await expect(button).toHaveText("count is 1!");
13+
editFile('src/App.tsx', ['{count}', '{count}!'])
14+
await waitForLogs('[vite] hot updated: /src/App.tsx')
15+
await expect(button).toHaveText('count is 1!')
1616

17-
await server.close();
18-
});
17+
await server.close()
18+
})
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { useState } from "react";
1+
import { useState } from 'react'
22

33
export const App = () => {
4-
const [count, setCount] = useState(0);
4+
const [count, setCount] = useState(0)
55

6-
return <button onClick={() => setCount(count + 1)}>count is {count}</button>;
7-
};
6+
return <button onClick={() => setCount(count + 1)}>count is {count}</button>
7+
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { StrictMode } from "react";
2-
import { createRoot } from "react-dom/client";
3-
import { App } from "./App.tsx";
1+
import { StrictMode } from 'react'
2+
import { createRoot } from 'react-dom/client'
3+
import { App } from './App.tsx'
44

5-
createRoot(document.getElementById("root")!).render(
5+
createRoot(document.getElementById('root')!).render(
66
<StrictMode>
77
<App />
88
</StrictMode>,
9-
);
9+
)
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { defineConfig } from "vite";
2-
import react from "@vitejs/plugin-react-swc";
1+
import { defineConfig } from 'vite'
2+
import react from '@vitejs/plugin-react-swc'
33

44
export default defineConfig({
55
plugins: [react()],
6-
base: "/base-test/",
7-
});
6+
base: '/base-test/',
7+
})
Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
import { expect, test } from "@playwright/test";
2-
import { setupDevServer, setupWaitForLogs } from "../../utils.ts";
1+
import { expect, test } from '@playwright/test'
2+
import { setupDevServer, setupWaitForLogs } from '../../utils.ts'
33

4-
test("Class component HMR", async ({ page }) => {
5-
const { testUrl, server, editFile } =
6-
await setupDevServer("class-components");
7-
const waitForLogs = await setupWaitForLogs(page);
8-
await page.goto(testUrl);
4+
test('Class component HMR', async ({ page }) => {
5+
const { testUrl, server, editFile } = await setupDevServer('class-components')
6+
const waitForLogs = await setupWaitForLogs(page)
7+
await page.goto(testUrl)
98

10-
await expect(page.locator("body")).toHaveText("Hello World");
11-
editFile("src/App.tsx", ["World", "class components"]);
12-
await waitForLogs("[vite] hot updated: /src/App.tsx");
13-
await expect(page.locator("body")).toHaveText("Hello class components");
9+
await expect(page.locator('body')).toHaveText('Hello World')
10+
editFile('src/App.tsx', ['World', 'class components'])
11+
await waitForLogs('[vite] hot updated: /src/App.tsx')
12+
await expect(page.locator('body')).toHaveText('Hello class components')
1413

15-
editFile("src/utils.tsx", ["Hello", "Hi"]);
16-
await waitForLogs("[vite] hot updated: /src/App.tsx");
17-
await expect(page.locator("body")).toHaveText("Hi class components");
14+
editFile('src/utils.tsx', ['Hello', 'Hi'])
15+
await waitForLogs('[vite] hot updated: /src/App.tsx')
16+
await expect(page.locator('body')).toHaveText('Hi class components')
1817

19-
await server.close();
20-
});
18+
await server.close()
19+
})
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { Component } from "react";
2-
import { getGetting } from "./utils.tsx";
1+
import { Component } from 'react'
2+
import { getGetting } from './utils.tsx'
33

44
export class App extends Component {
55
render() {
6-
return <span>{getGetting()} World</span>;
6+
return <span>{getGetting()} World</span>
77
}
88
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { StrictMode } from "react";
2-
import { createRoot } from "react-dom/client";
3-
import { App } from "./App.tsx";
1+
import { StrictMode } from 'react'
2+
import { createRoot } from 'react-dom/client'
3+
import { App } from './App.tsx'
44

5-
createRoot(document.getElementById("root")!).render(
5+
createRoot(document.getElementById('root')!).render(
66
<StrictMode>
77
<App />
88
</StrictMode>,
9-
);
9+
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const getGetting = () => <span>Hello</span>;
1+
export const getGetting = () => <span>Hello</span>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { defineConfig } from "vite";
2-
import react from "@vitejs/plugin-react-swc";
1+
import { defineConfig } from 'vite'
2+
import react from '@vitejs/plugin-react-swc'
33

44
export default defineConfig({
55
plugins: [react()],
6-
});
6+
})

0 commit comments

Comments
 (0)