Skip to content

Commit

Permalink
fix: linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rush committed Jul 11, 2024
1 parent 6c53619 commit c2cb963
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 0 additions & 2 deletions playground/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import React from 'react'
import { Outlet } from 'react-router-dom'



export default function Component() {
return (
<>
Expand Down
21 changes: 12 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ import { buildRoutesMap } from './utils/build-route-maps'

let server: ViteDevServer

const routesCode = (imports: string | undefined, routesObject: string) => `
${imports}
function moduleFactory(module) {
const { default: Component, clientLoader: loader, actionLoader: action, loader: _loader, action: _action, Component: _Component, ...rest } = module;
return { Component, loader, action, ...rest };
}
function routesCode(imports: string | undefined, routesObject: string) {
return `
${imports}
function moduleFactory(module) {
const { default: Component, clientLoader: loader, actionLoader: action, loader: _loader, action: _action, Component: _Component, ...rest } = module;
return { Component, loader, action, ...rest };
}
export const routes = ${routesObject}
`
export const routes = ${routesObject}
`
}

export function invalidateVirtualModule(server: ViteDevServer): void {
const { moduleGraph, ws } = server
Expand Down Expand Up @@ -71,6 +73,7 @@ export const unpluginFactory: UnpluginFactory<Options | undefined> = options =>
.replace(/SpreadEnd"/g, ')')
// console.log(JSON.stringify(routesObject, null, 2))

// eslint-disable-next-line no-console
console.log(`
[Warn] You are using unplugin-remix-router v2.
you should export Component as default, loader as clientLoader and action as clientAction.
Expand Down

0 comments on commit c2cb963

Please sign in to comment.