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
+7
View File
@@ -40,6 +40,13 @@ jobs:
access: public access: public
token: ${{ secrets.NPM_TOKEN }} token: ${{ secrets.NPM_TOKEN }}
registry: https://registry.npmjs.org registry: https://registry.npmjs.org
- name: Publish effect-fc
uses: JS-DevTools/npm-publish@v4
with:
package: packages/effect-fc
access: public
token: ${{ secrets.NPM_TOKEN }}
registry: https://registry.npmjs.org
- name: Clean before Docker build - name: Clean before Docker build
run: | run: |
+3 -3
View File
@@ -44,16 +44,16 @@ Effect View components:
npm install --save-dev @effect-view/vite-plugin 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" ```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 react from "@vitejs/plugin-react"
import { defineConfig } from "vite" import { defineConfig } from "vite"
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
effectViewPlugin(), effectView(),
react(), react(),
], ],
}) })
+2 -2
View File
@@ -1,6 +1,6 @@
import { tanstackRouter } from "@tanstack/router-plugin/vite" import { tanstackRouter } from "@tanstack/router-plugin/vite"
import react from "@vitejs/plugin-react" 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 path from "node:path"
import { defineConfig } from "vite" import { defineConfig } from "vite"
@@ -8,7 +8,7 @@ import { defineConfig } from "vite"
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
effectViewPlugin(), effectView(),
tanstackRouter({ tanstackRouter({
target: "react", target: "react",
autoCodeSplitting: true, autoCodeSplitting: true,
+2 -2
View File
@@ -3,13 +3,13 @@
Experimental Vite Fast Refresh support for Effect View components. Experimental Vite Fast Refresh support for Effect View components.
```ts ```ts
import { effectViewPlugin } from "@effect-view/vite-plugin" import { effectView } from "@effect-view/vite-plugin"
import react from "@vitejs/plugin-react" import react from "@vitejs/plugin-react"
import { defineConfig } from "vite" import { defineConfig } from "vite"
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
effectViewPlugin(), effectView(),
react(), 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`. * Place this plugin before `@vitejs/plugin-react`.
*/ */
export function effectViewPlugin( export function effectView(
options: EffectViewRefreshOptions = {}, options: EffectViewRefreshOptions = {},
): Plugin { ): Plugin {
const include = options.include ?? defaultInclude const include = options.include ?? defaultInclude
+4 -4
View File
@@ -1,7 +1,7 @@
import path from "node:path" import path from "node:path"
import type { Plugin } from "vite" import type { Plugin } from "vite"
import { describe, expect, it } from "vitest" import { describe, expect, it } from "vitest"
import { effectViewPlugin } from "./index.js" import { effectView } from "./index.js"
type TransformHook = Extract< type TransformHook = Extract<
@@ -31,9 +31,9 @@ const runTransform = async (
const transform = ( const transform = (
code: string, code: string,
id = path.join(process.cwd(), "src/View.tsx"), 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 () => { it("wraps a const Effect View descriptor", async () => {
const result = await transform(` const result = await transform(`
import { Component } from "effect-view" import { Component } from "effect-view"
@@ -109,7 +109,7 @@ export function View() {
}) })
it("keeps instrumenting a module when all Effect Views are removed", async () => { 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") const id = path.join(process.cwd(), "src/Removed.tsx")
await runTransform(plugin, ` await runTransform(plugin, `
+1 -1
View File
@@ -133,7 +133,7 @@ Ship a Vite plugin, `@effect-view/vite-plugin`, placed before `react()`:
```ts ```ts
plugins: [ plugins: [
effectViewPlugin(), effectView(),
react(), react(),
] ]
``` ```