Refactor
Lint / lint (push) Successful in 47s

This commit is contained in:
Julien Valverdé
2026-07-27 03:50:33 +02:00
parent 28695c6a04
commit 8ef8a34d62
7 changed files with 20 additions and 13 deletions
+3 -3
View File
@@ -44,16 +44,16 @@ Effect View components:
npm install --save-dev @effect-view/vite-plugin
```
Add `effectViewPlugin()` before the React plugin in your Vite configuration:
Add `effectView()` before the React plugin in your Vite configuration:
```ts title="vite.config.ts"
import { effectViewPlugin } from "@effect-view/vite-plugin"
import { effectView } from "@effect-view/vite-plugin"
import react from "@vitejs/plugin-react"
import { defineConfig } from "vite"
export default defineConfig({
plugins: [
effectViewPlugin(),
effectView(),
react(),
],
})
+2 -2
View File
@@ -1,6 +1,6 @@
import { tanstackRouter } from "@tanstack/router-plugin/vite"
import react from "@vitejs/plugin-react"
import { effectViewPlugin } from "@effect-view/vite-plugin"
import { effectView } from "@effect-view/vite-plugin"
import path from "node:path"
import { defineConfig } from "vite"
@@ -8,7 +8,7 @@ import { defineConfig } from "vite"
// https://vite.dev/config/
export default defineConfig({
plugins: [
effectViewPlugin(),
effectView(),
tanstackRouter({
target: "react",
autoCodeSplitting: true,
+2 -2
View File
@@ -3,13 +3,13 @@
Experimental Vite Fast Refresh support for Effect View components.
```ts
import { effectViewPlugin } from "@effect-view/vite-plugin"
import { effectView } from "@effect-view/vite-plugin"
import react from "@vitejs/plugin-react"
import { defineConfig } from "vite"
export default defineConfig({
plugins: [
effectViewPlugin(),
effectView(),
react(),
],
})
+1 -1
View File
@@ -342,7 +342,7 @@ const scriptKind = (id: string): ts.ScriptKind => id.endsWith(".tsx")
*
* Place this plugin before `@vitejs/plugin-react`.
*/
export function effectViewPlugin(
export function effectView(
options: EffectViewRefreshOptions = {},
): Plugin {
const include = options.include ?? defaultInclude
+4 -4
View File
@@ -1,7 +1,7 @@
import path from "node:path"
import type { Plugin } from "vite"
import { describe, expect, it } from "vitest"
import { effectViewPlugin } from "./index.js"
import { effectView } from "./index.js"
type TransformHook = Extract<
@@ -31,9 +31,9 @@ const runTransform = async (
const transform = (
code: string,
id = path.join(process.cwd(), "src/View.tsx"),
): Promise<string | undefined> => runTransform(effectViewPlugin(), code, id)
): Promise<string | undefined> => runTransform(effectView(), code, id)
describe("effectViewPlugin", () => {
describe("effectView", () => {
it("wraps a const Effect View descriptor", async () => {
const result = await transform(`
import { Component } from "effect-view"
@@ -109,7 +109,7 @@ export function View() {
})
it("keeps instrumenting a module when all Effect Views are removed", async () => {
const plugin = effectViewPlugin() as Plugin
const plugin = effectView() as Plugin
const id = path.join(process.cwd(), "src/Removed.tsx")
await runTransform(plugin, `