diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..544edd99 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +.eslintrc.cjs \ No newline at end of file diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 1a72e8c6..8c7b1356 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,3 +1,9 @@ module.exports = { extends: ['@hono/eslint-config'], + rules: { + '@typescript-eslint/unbound-method': 'error', + }, + parserOptions: { + project: ['./tsconfig.json', './runtime_tests/tsconfig.json'], + }, } diff --git a/deno_dist/helper/css/index.ts b/deno_dist/helper/css/index.ts index 555638d6..9b737e77 100644 --- a/deno_dist/helper/css/index.ts +++ b/deno_dist/helper/css/index.ts @@ -101,6 +101,7 @@ export const createCssContext = ({ id }: { id: Readonly }) => { ;(className as HtmlEscapedString).callbacks = [addClassNameToContext] const promise = Promise.resolve(className) Object.assign(promise, cssClassName) + // eslint-disable-next-line @typescript-eslint/unbound-method promise.toString = cssJsxDomObject.toString return promise } diff --git a/deno_dist/jsx/dom/css.ts b/deno_dist/jsx/dom/css.ts index 913fb0df..29917d72 100644 --- a/deno_dist/jsx/dom/css.ts +++ b/deno_dist/jsx/dom/css.ts @@ -133,6 +133,7 @@ export const createCssContext = ({ id }: { id: Readonly }) => { const [cssObject, Style] = createCssJsxDomObjects({ id }) const newCssClassNameObject = (cssClassName: CssClassName): string => { + // eslint-disable-next-line @typescript-eslint/unbound-method cssClassName.toString = cssObject.toString return cssClassName as unknown as string } diff --git a/runtime_tests/tsconfig.json b/runtime_tests/tsconfig.json new file mode 100644 index 00000000..6a9a5d7f --- /dev/null +++ b/runtime_tests/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../tsconfig.json", + "include": [ + "**/*.ts", + "**/*.tsx" + ] +} \ No newline at end of file diff --git a/src/helper/css/index.ts b/src/helper/css/index.ts index cbb00986..a7734683 100644 --- a/src/helper/css/index.ts +++ b/src/helper/css/index.ts @@ -101,6 +101,7 @@ export const createCssContext = ({ id }: { id: Readonly }) => { ;(className as HtmlEscapedString).callbacks = [addClassNameToContext] const promise = Promise.resolve(className) Object.assign(promise, cssClassName) + // eslint-disable-next-line @typescript-eslint/unbound-method promise.toString = cssJsxDomObject.toString return promise } diff --git a/src/helper/ssg/ssg.test.tsx b/src/helper/ssg/ssg.test.tsx index 31510360..6f8bb819 100644 --- a/src/helper/ssg/ssg.test.tsx +++ b/src/helper/ssg/ssg.test.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/unbound-method */ import { beforeEach, describe, expect, it } from 'vitest' import { Hono } from '../../hono' // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/src/jsx/dom/css.ts b/src/jsx/dom/css.ts index 6edcabb8..4629ef9c 100644 --- a/src/jsx/dom/css.ts +++ b/src/jsx/dom/css.ts @@ -133,6 +133,7 @@ export const createCssContext = ({ id }: { id: Readonly }) => { const [cssObject, Style] = createCssJsxDomObjects({ id }) const newCssClassNameObject = (cssClassName: CssClassName): string => { + // eslint-disable-next-line @typescript-eslint/unbound-method cssClassName.toString = cssObject.toString return cssClassName as unknown as string }