Skip to content

Commit 1fd8ebf

Browse files
feat(eslint-config): enable linting with type information (#1098)
1 parent 9f3027a commit 1fd8ebf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+153
-293
lines changed

Diff for: .changeset/fifty-aliens-rhyme.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@hono/eslint-config': major
3+
---
4+
5+
Includes `typescript-eslint` presets for typed linting
6+
7+
- [`strict-type-checked`](https://typescript-eslint.io/users/configs#strict-type-checked)
8+
- [`stylistic-type-checked`](https://typescript-eslint.io/users/configs#stylistic-type-checked)
9+
10+
See [Linting with Type Information](https://typescript-eslint.io/getting-started/typed-linting) for more information

Diff for: eslint.config.mjs

+57-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,62 @@
11
import baseConfig from '@hono/eslint-config'
22
import { defineConfig, globalIgnores } from 'eslint/config'
33

4-
export default defineConfig(globalIgnores(['.yarn', '**/dist']), {
4+
export default defineConfig(globalIgnores(['.yarn', '**/coverage', '**/dist']), {
55
extends: baseConfig,
6+
7+
languageOptions: {
8+
parserOptions: {
9+
projectService: true,
10+
tsconfigRootDir: import.meta.dirname,
11+
},
12+
},
13+
14+
linterOptions: {
15+
reportUnusedDisableDirectives: 'error',
16+
reportUnusedInlineConfigs: 'error',
17+
},
18+
19+
rules: {
20+
'@typescript-eslint/array-type': 'off',
21+
'@typescript-eslint/await-thenable': 'off',
22+
'@typescript-eslint/consistent-indexed-object-style': 'off',
23+
'@typescript-eslint/consistent-type-definitions': 'off',
24+
'@typescript-eslint/dot-notation': 'off',
25+
'@typescript-eslint/no-base-to-string': 'off',
26+
'@typescript-eslint/no-confusing-void-expression': 'off',
27+
'@typescript-eslint/no-deprecated': 'off',
28+
'@typescript-eslint/no-duplicate-type-constituents': 'off',
29+
'@typescript-eslint/no-dynamic-delete': 'off',
30+
'@typescript-eslint/no-floating-promises': 'off',
31+
'@typescript-eslint/no-invalid-void-type': 'off',
32+
'@typescript-eslint/no-misused-promises': 'off',
33+
'@typescript-eslint/no-non-null-assertion': 'off',
34+
'@typescript-eslint/no-redundant-type-constituents': 'off',
35+
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'off',
36+
'@typescript-eslint/no-unnecessary-condition': 'off',
37+
'@typescript-eslint/no-unnecessary-template-expression': 'off',
38+
'@typescript-eslint/no-unnecessary-type-arguments': 'off',
39+
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
40+
'@typescript-eslint/no-unnecessary-type-parameters': 'off',
41+
'@typescript-eslint/no-unsafe-argument': 'off',
42+
'@typescript-eslint/no-unsafe-assignment': 'off',
43+
'@typescript-eslint/no-unsafe-call': 'off',
44+
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
45+
'@typescript-eslint/no-unsafe-member-access': 'off',
46+
'@typescript-eslint/no-unsafe-return': 'off',
47+
'@typescript-eslint/no-useless-constructor': 'off',
48+
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
49+
'@typescript-eslint/only-throw-error': 'off',
50+
'@typescript-eslint/prefer-function-type': 'off',
51+
'@typescript-eslint/prefer-includes': 'off',
52+
'@typescript-eslint/prefer-nullish-coalescing': 'off',
53+
'@typescript-eslint/prefer-optional-chain': 'off',
54+
'@typescript-eslint/prefer-regexp-exec': 'off',
55+
'@typescript-eslint/prefer-return-this-type': 'off',
56+
'@typescript-eslint/require-await': 'off',
57+
'@typescript-eslint/restrict-plus-operands': 'off',
58+
'@typescript-eslint/restrict-template-expressions': 'off',
59+
'@typescript-eslint/unbound-method': 'off',
60+
'@typescript-eslint/unified-signatures': 'off',
61+
},
662
})

Diff for: package.json

+3-5
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,13 @@
3232
"@cloudflare/workers-types": "^4.20230307.0",
3333
"@hono/eslint-config": "workspace:*",
3434
"@ryoppippi/unplugin-typia": "^1.2.0",
35+
"@types/bun": "^1.0.0",
3536
"@types/node": "^20.17.28",
3637
"@types/ws": "^8.18.0",
37-
"@typescript-eslint/eslint-plugin": "^8.7.0",
38-
"@typescript-eslint/parser": "^8.7.0",
3938
"@vitest/coverage-istanbul": "^3.0.8",
40-
"eslint": "^9.17.0",
39+
"eslint": "^9.23.0",
4140
"hono": "^4.7.5",
42-
"npm-run-all2": "^6.2.2",
43-
"prettier": "^2.7.1",
41+
"prettier": "^3.5.3",
4442
"tsup": "^8.4.0",
4543
"typescript": "^5.8.2",
4644
"vitest": "^3.0.8"

Diff for: packages/ajv-validator/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/ajv-validator",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/arktype-validator/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/arktype-validator",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/auth-js/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"noEmit": true,
66
"jsx": "react"
77
},
8-
"include": ["**/*.test.ts"],
8+
"include": ["**/*.test.ts", "vitest.config.ts"],
99
"references": [
1010
{
1111
"path": "./tsconfig.build.json"

Diff for: packages/bun-transpiler/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
},
4545
"devDependencies": {
4646
"@arethetypeswrong/cli": "^0.17.4",
47-
"@types/bun": "^1.0.0",
4847
"publint": "^0.3.9",
4948
"tsup": "^8.4.0",
5049
"typescript": "^5.8.2",

Diff for: packages/bun-transpiler/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/bun-transpiler",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/casbin/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/casbin",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts", "vitest.setup.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/class-validator/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/class-validator",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/clerk-auth/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/clerk-auth",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/cloudflare-access/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/cloudflare-access",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/conform-validator/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/conform-validator",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/effect-validator/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/effect-validator",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/esbuild-transpiler/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/esbuild-transpiler",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/eslint-config/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import tseslint from 'typescript-eslint'
77
export default [
88
js.configs.recommended,
99
nodePlugin.configs['flat/recommended'],
10-
...tseslint.configs.recommended,
10+
...tseslint.configs.strictTypeChecked,
11+
...tseslint.configs.stylisticTypeChecked,
1112
{
1213
plugins: {
1314
'@typescript-eslint': tseslint.plugin,

Diff for: packages/eslint-config/package.json

-4
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,5 @@
2828
"eslint-plugin-import-x": "^4.1.1",
2929
"eslint-plugin-n": "^17.10.2",
3030
"typescript-eslint": "^8.27.0"
31-
},
32-
"devDependencies": {
33-
"eslint": "^9.23.0",
34-
"typescript": "^5.3.3"
3531
}
3632
}

Diff for: packages/event-emitter/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/event-emitter",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/firebase-auth/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
"@arethetypeswrong/cli": "^0.17.4",
5353
"firebase-tools": "^13.29.1",
5454
"miniflare": "^3.20240208.0",
55-
"prettier": "^3.2.5",
5655
"publint": "^0.3.9",
5756
"tsup": "^8.4.0",
5857
"typescript": "^5.8.2",

Diff for: packages/firebase-auth/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/firebase-auth",
55
"noEmit": true
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/graphql-server/tsconfig.bun.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"outDir": "../../dist/out-tsc/packages/graphql-server",
5+
"types": ["bun"]
6+
},
7+
"exclude": ["src/**/*.test.ts"],
8+
"include": ["bun_test", "vitest.config.ts"],
9+
"references": [
10+
{
11+
"path": "./tsconfig.build.json"
12+
}
13+
]
14+
}

Diff for: packages/graphql-server/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
{
77
"path": "./tsconfig.build.json"
88
},
9+
{
10+
"path": "./tsconfig.bun.json"
11+
},
912
{
1013
"path": "./tsconfig.spec.json"
1114
}

Diff for: packages/graphql-server/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"types": ["vitest/globals"]
66
},
77
"exclude": ["bun_test"],
8-
8+
"include": ["**/*.test.ts", "vitest.config.ts"],
99
"references": [
1010
{
1111
"path": "./tsconfig.build.json"

Diff for: packages/hello/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/hello",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/medley-router/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/medley-router",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/node-ws/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/node-ws",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/oauth-providers/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/oauth-providers",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["mocks.ts", "**/*.test.ts"],
7+
"include": ["mocks.ts", "**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/oidc-auth/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/oidc-auth",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/otel/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/oidc-auth",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/prometheus/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/prometheus",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/react-renderer/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"outDir": "../../dist/out-tsc/packages/react-renderer",
99
"types": ["vitest/globals"]
1010
},
11-
"include": ["**/*.test.tsx"],
11+
"include": ["**/*.test.tsx", "vitest.config.ts"],
1212
"references": [
1313
{
1414
"path": "./tsconfig.build.json"

Diff for: packages/sentry/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/sentry",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/standard-validator/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/standard-validator",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/swagger-editor/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/swagger-editor",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

Diff for: packages/swagger-ui/src/option-renderer.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/*eslint quotes: ["off", "single"]*/
2-
31
import type { DistSwaggerUIOptions } from './swagger/renderer'
42
import { renderSwaggerUIOptions } from './swagger/renderer'
53

Diff for: packages/swagger-ui/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "../../dist/out-tsc/packages/swagger-ui",
55
"types": ["vitest/globals"]
66
},
7-
"include": ["**/*.test.ts"],
7+
"include": ["**/*.test.ts", "vitest.config.ts"],
88
"references": [
99
{
1010
"path": "./tsconfig.build.json"

0 commit comments

Comments
 (0)