Skip to content

Commit

Permalink
chore(eslint): enable @typescript-eslint/unbound-method (#2622)
Browse files Browse the repository at this point in the history
* chore(eslint): enable `@typescript-eslint/unbound-method`

* denoify
  • Loading branch information
yusukebe committed May 6, 2024
1 parent cb24160 commit 0fafd7a
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.eslintrc.cjs
6 changes: 6 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
module.exports = {
extends: ['@hono/eslint-config'],
rules: {
'@typescript-eslint/unbound-method': 'error',
},
parserOptions: {
project: ['./tsconfig.json', './runtime_tests/tsconfig.json'],
},
}
1 change: 1 addition & 0 deletions deno_dist/helper/css/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions deno_dist/jsx/dom/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
7 changes: 7 additions & 0 deletions runtime_tests/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../tsconfig.json",
"include": [
"**/*.ts",
"**/*.tsx"
]
}
1 change: 1 addition & 0 deletions src/helper/css/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions src/helper/ssg/ssg.test.tsx
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions src/jsx/dom/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 0fafd7a

Please sign in to comment.