Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ElMassimo committed Nov 10, 2024
1 parent 932f004 commit cc7c63d
Show file tree
Hide file tree
Showing 16 changed files with 11 additions and 23 deletions.
9 changes: 5 additions & 4 deletions packages/hydration/svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { onDispose } from './hydration'
type Component = any

export default function createIsland (Component: Component, id: string, el: Element, props: Props, slots: Slots | undefined = {}) {
let children = undefined
let $$slots: Record<string, Snippet> & { default?: boolean } | undefined = undefined
let children
let $$slots: Record<string, Snippet> & { default?: boolean } | undefined
let renderFns: Record<string, Snippet> = {}

Object.entries(slots).forEach(([slotName, html]) => {
Expand All @@ -17,12 +17,13 @@ export default function createIsland (Component: Component, id: string, el: Elem
if (slotName === 'default') {
$$slots.default = true
children = renderFns[fnName]
} else {
}
else {
$$slots[fnName] = renderFns[fnName]
}
})

// eslint-disable-next-line no-new, new-cap
const component = mount(Component, {
target: el,
props: {
Expand Down
2 changes: 0 additions & 2 deletions packages/iles/index.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable no-restricted-globals */

// type utils
module.exports.defineConfig = (config) => config

Expand Down
1 change: 0 additions & 1 deletion packages/iles/src/client/app/composables/pageData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const forcePageUpdate = () => { _lastPageChange.value = new Date() }

export const computedInPage = <T>(fn: () => T) => {
return computed<T>(() => {
// eslint-disable-next-line ts/no-unused-expressions
_lastPageChange.value // track dependency to recompute as needed.
return fn()
})
Expand Down
1 change: 0 additions & 1 deletion packages/iles/src/client/app/props.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-restricted-syntax */
import type { RouteLocationNormalizedLoaded, RouteParams } from 'vue-router'
import { shallowRef, watch } from 'vue'
import { computedInPage, pageFromRoute } from './composables/pageData'
Expand Down
1 change: 0 additions & 1 deletion packages/iles/src/client/app/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-restricted-syntax */
export { default as serialize } from '@nuxt/devalue'

export function mapObject<I, O> (obj: Record<string, I>, fn: (i: I, key?: string) => O): Record<string, O> {
Expand Down
1 change: 0 additions & 1 deletion packages/iles/src/node/build/bundle.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-restricted-syntax */
import { promises as fs } from 'fs'
import type { RollupOutput } from 'rollup'
import type { Plugin } from 'vite'
Expand Down
1 change: 0 additions & 1 deletion packages/iles/src/node/build/islands.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-restricted-syntax */
import { promises as fs } from 'fs'
import { relative, resolve } from 'pathe'
import { build as viteBuild, mergeConfig as mergeViteConfig } from 'vite'
Expand Down
1 change: 0 additions & 1 deletion packages/iles/src/node/build/render.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-var-requires */
import { existsSync } from 'fs'
import { join } from 'pathe'
import { renderSSRHead } from '@unhead/ssr'
Expand Down
1 change: 0 additions & 1 deletion packages/iles/src/node/build/write.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-restricted-syntax */
import { promises as fs } from 'fs'
import { join, resolve, dirname } from 'pathe'
import glob from 'fast-glob'
Expand Down
1 change: 0 additions & 1 deletion packages/iles/src/node/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-restricted-syntax */
import { promises as fs, existsSync } from 'fs'
import { join, resolve } from 'pathe'
import pc from 'picocolors'
Expand Down
1 change: 0 additions & 1 deletion packages/iles/src/node/plugin/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-restricted-syntax */
import { promises as fs } from 'fs'
import { basename, resolve, relative } from 'pathe'
import type { PluginOption, ResolvedConfig, ViteDevServer } from 'vite'
Expand Down
2 changes: 1 addition & 1 deletion packages/iles/src/node/plugin/remarkWrapIslands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function importedName (specifier: ImportDeclaration['specifiers'][number]): stri
case 'ImportNamespaceSpecifier': return '*'
default:
if ('name' in specifier.imported) return specifier.imported.name
throw Error(`Unpexected literal in import declaration: ${specifier.imported}`)
throw new Error(`Unpexected literal in import declaration: ${specifier.imported}`)
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/iles/tests/build.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('building docs site', () => {

async function expectFileContent (path: string, transform?: (val: string) => string) {
let content = await fs.readFile(`${vuePoint}/dist/${path}`, 'utf-8')
content = content.replace(/\/assets\/([^.]+)(?:[.-]+)\w+\.(\w+)\b/g, '/assets/$1.$2')
content = content.replace(/\/assets\/([^.]+)(?:[.-])\w+\.(\w+)\b/g, '/assets/$1.$2')
return expect(transform ? transform(content) : content)
}

Expand Down
1 change: 0 additions & 1 deletion packages/iles/types/shared.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-use-before-define */
import type { ResolveFn, UserConfig as ViteOptions, ConfigEnv, PluginOption as VitePluginOption } from 'vite'
import type { GetManualChunk } from 'rollup'
import type { App, Ref, DefineComponent, VNode, AsyncComponentLoader } from 'vue'
Expand Down
2 changes: 0 additions & 2 deletions packages/iles/types/virtual.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable import/no-duplicates */
/* eslint-disable import/order */
declare module '*.vue' {
const comp: import('./shared').PageComponent
export default comp
Expand Down
7 changes: 4 additions & 3 deletions packages/prerender/svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { render } from 'svelte/server'
import type { PrerenderFn } from './prerender'

const renderSvelteComponent: PrerenderFn = async (Component, props, slots, _id) => {
let children = undefined;
let $$slots: Record<string, Snippet> & { default?: boolean } | undefined = undefined
let children;
let $$slots: Record<string, Snippet> & { default?: boolean } | undefined
let renderFns: Record<string, Snippet> = {}

slots && Object.entries(slots).forEach(([slotName, html]) => {
Expand All @@ -15,7 +15,8 @@ const renderSvelteComponent: PrerenderFn = async (Component, props, slots, _id)
if (slotName === 'default') {
$$slots.default = true
children = renderFns[fnName]
} else {
}
else {
$$slots[fnName] = renderFns[fnName]
}
})
Expand Down

0 comments on commit cc7c63d

Please sign in to comment.