Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update ESlint #220

Merged
merged 2 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .eslintrc.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.3
bun-version: 1.1.27
- run: bun install
- run: bunx playwright install chromium
- run: bun run test
3 changes: 3 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import baseConfig from '@hono/eslint-config'

export default [...baseConfig]
2 changes: 1 addition & 1 deletion mocks/app/routes/about/[name]/_middleware.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createRoute } from '../../../../../src/factory'
import { createMiddleware } from 'hono/factory'
import { createRoute } from '../../../../../src/factory'

const addHeader = createMiddleware(async (c, next) => {
await next()
Expand Down
2 changes: 1 addition & 1 deletion mocks/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path'
import mdx from '@mdx-js/rollup'
import { defineConfig } from 'vite'
import path from 'path'
import honox from '../src/vite'

export default defineConfig({
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"typecheck": "tsc --noEmit",
"build": "tsup && publint",
"watch": "tsup --watch",
"lint": "eslint --ext js,ts src mocks test-integration test-e2e",
"lint:fix": "eslint --ext js,ts src mocks test-integration test-e2e --fix",
"lint": "eslint src mocks test-integration test-e2e",
"lint:fix": "eslint src mocks test-integration test-e2e --fix",
"format": "prettier --check \"src/**/*.{js,ts}\" \"mocks/**/*.{js,ts}\" \"test-*/**/*.{js,ts}\"",
"format:fix": "prettier --write \"src/**/*.{js,ts}\" \"mocks/**/*.{js,ts}\" \"test-*/**/*.{js,ts}\"",
"prerelease": "bun run test && bun run build",
Expand Down Expand Up @@ -120,13 +120,13 @@
"hono": ">=4.*"
},
"devDependencies": {
"@hono/eslint-config": "^0.0.6",
"@hono/eslint-config": "^1.0.1",
"@mdx-js/rollup": "^3.0.0",
"@playwright/test": "^1.42.0",
"@types/babel__generator": "^7",
"@types/babel__traverse": "^7",
"@types/node": "^20.10.5",
"eslint": "^8.56.0",
"eslint": "^9.10.0",
"glob": "^10.3.10",
"hono": "^4.4.3",
"np": "7.7.0",
Expand All @@ -143,4 +143,4 @@
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "^4.9.6"
}
}
}
2 changes: 1 addition & 1 deletion src/server/context-storage.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { AsyncLocalStorage } from 'node:async_hooks'
import type { Context } from 'hono'
import { AsyncLocalStorage } from 'node:async_hooks'
export const contextStorage = new AsyncLocalStorage<Context>()
6 changes: 3 additions & 3 deletions src/vite/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import path from 'path'
import devServer, { defaultOptions as devServerDefaultOptions } from '@hono/vite-dev-server'
import type { DevServerOptions } from '@hono/vite-dev-server'
import type { PluginOption } from 'vite'
import path from 'path'
import type { ClientOptions } from './client.js'
import client from './client.js'
import { injectImportingIslands } from './inject-importing-islands.js'
import { islandComponents } from './island-components.js'
import type { IslandComponentsOptions } from './island-components.js'
import { restartOnAddUnlink } from './restart-on-add-unlink.js'
import type { ClientOptions } from './client.js'
import client from './client.js'

type Options = {
islands?: boolean
Expand Down
6 changes: 3 additions & 3 deletions src/vite/inject-importing-islands.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { readFile } from 'fs/promises'
import path from 'path'
import _generate from '@babel/generator'
import { parse } from '@babel/parser'
// @ts-expect-error `precinct` is not typed
import precinct from 'precinct'
import { normalizePath } from 'vite'
import type { Plugin } from 'vite'
import { readFile } from 'fs/promises'
import path from 'path'
import { IMPORTING_ISLANDS_ID } from '../constants.js'
import { matchIslandComponentId } from './utils/path.js'

Expand Down Expand Up @@ -59,7 +59,7 @@ export async function injectImportingIslands(
)
deps.push(...childDeps.flat())
return deps
} catch (err) {
} catch {
// file does not exist or is a directory
return deps
}
Expand Down
17 changes: 8 additions & 9 deletions src/vite/island-components.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
import fs from 'fs/promises'
import path from 'path'
import _generate from '@babel/generator'
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const generate = (_generate.default as typeof _generate) ?? _generate
import { parse } from '@babel/parser'
import _traverse from '@babel/traverse'
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const traverse = (_traverse.default as typeof _traverse) ?? _traverse
import {
blockStatement,
conditionalExpression,
Expand All @@ -33,9 +25,16 @@ import {
variableDeclarator,
} from '@babel/types'
import { parse as parseJsonc } from 'jsonc-parser'
// eslint-disable-next-line node/no-extraneous-import
import type { Plugin } from 'vite'
import fs from 'fs/promises'
import path from 'path'
import { isComponentName, matchIslandComponentId } from './utils/path.js'
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const generate = (_generate.default as typeof _generate) ?? _generate
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const traverse = (_traverse.default as typeof _traverse) ?? _traverse

function addSSRCheck(funcName: string, componentName: string, componentExport?: string) {
const isSSR = memberExpression(
Expand Down
2 changes: 1 addition & 1 deletion test-integration/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path'
import mdx from '@mdx-js/rollup'
import { defineConfig } from 'vitest/config'
import path from 'path'
import { injectImportingIslands } from '../src/vite/inject-importing-islands'
import { islandComponents } from '../src/vite/island-components'

Expand Down
Loading