0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-21 18:18:57 +01:00

chore(eslint): enable @typescript-eslint/unbound-method (#2622)

* chore(eslint): enable `@typescript-eslint/unbound-method`

* denoify
This commit is contained in:
Yusuke Wada 2024-05-06 17:38:34 +09:00 committed by GitHub
parent cb2416042c
commit 0fafd7aa8b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 19 additions and 0 deletions

1
.eslintignore Normal file
View File

@ -0,0 +1 @@
.eslintrc.cjs

View File

@ -1,3 +1,9 @@
module.exports = {
extends: ['@hono/eslint-config'],
rules: {
'@typescript-eslint/unbound-method': 'error',
},
parserOptions: {
project: ['./tsconfig.json', './runtime_tests/tsconfig.json'],
},
}

View File

@ -101,6 +101,7 @@ export const createCssContext = ({ id }: { id: Readonly<string> }) => {
;(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
}

View File

@ -133,6 +133,7 @@ export const createCssContext = ({ id }: { id: Readonly<string> }) => {
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
}

View File

@ -0,0 +1,7 @@
{
"extends": "../tsconfig.json",
"include": [
"**/*.ts",
"**/*.tsx"
]
}

View File

@ -101,6 +101,7 @@ export const createCssContext = ({ id }: { id: Readonly<string> }) => {
;(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
}

View File

@ -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

View File

@ -133,6 +133,7 @@ export const createCssContext = ({ id }: { id: Readonly<string> }) => {
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
}