Skip to content

Commit 0d6c13b

Browse files
feat: updated @hono/eslint-config package (#1031)
* chore(eslint-config): update dependencies and improve configuration * chore(eslint-config): replace @typescript-eslint packages with typescript-eslint * chore: completed changes suggested by @BarryThePenguin * chore: updated the repo eslint config * chore: updated the lockfile * feat: added ci and minor changes * chore: updated the eslint version in package.json * chore: updated the lockfile * add changeset * `@ryoppippi/unplugin-typia` as devDependencies --------- Co-authored-by: Yusuke Wada <yusuke@kamawada.com>
1 parent 8d663e4 commit 0d6c13b

File tree

8 files changed

+3510
-4390
lines changed

8 files changed

+3510
-4390
lines changed

.changeset/chilly-tips-repeat.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@hono/eslint-config': minor
3+
---
4+
5+
feat: updated `@hono/eslint-config` package
6+
7+
- upgrading eslint plugins
8+
- removing @eslint/eslintrc and the legacy FlatCompat
9+
- cleanup migration to typescript-eslint

.github/workflows/ci-lint.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: ci-lint
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
branches: ['*']
7+
8+
jobs:
9+
eslint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: 20.x
16+
- run: yarn install
17+
- run: yarn lint

eslint.config.mjs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1+
import { defineConfig, globalIgnores } from 'eslint/config'
12
import baseConfig from './packages/eslint-config/index.js'
23

3-
export default [
4-
...baseConfig,
5-
{
6-
ignores: ['**/dist/*'],
7-
},
8-
]
4+
export default defineConfig(globalIgnores(['.yarn', '**/dist']), {
5+
extends: baseConfig,
6+
})

packages/eslint-config/index.js

Lines changed: 90 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,103 @@
1-
import path from 'node:path'
2-
import { fileURLToPath } from 'node:url'
3-
import { FlatCompat } from '@eslint/eslintrc'
41
import js from '@eslint/js'
5-
import typescriptEslint from '@typescript-eslint/eslint-plugin'
6-
import tsParser from '@typescript-eslint/parser'
2+
import prettier from 'eslint-config-prettier/flat'
73
import importX from 'eslint-plugin-import-x'
8-
9-
const __filename = fileURLToPath(import.meta.url)
10-
const __dirname = path.dirname(__filename)
11-
const compat = new FlatCompat({
12-
baseDirectory: __dirname,
13-
recommendedConfig: js.configs.recommended,
14-
allConfig: js.configs.all,
15-
})
4+
import nodePlugin from 'eslint-plugin-n'
5+
import tseslint from 'typescript-eslint'
166

177
export default [
18-
...compat.extends(
19-
'eslint:recommended',
20-
'plugin:n/recommended',
21-
'plugin:@typescript-eslint/recommended',
22-
'prettier'
23-
),
24-
{
25-
plugins: {
26-
'@typescript-eslint': typescriptEslint,
27-
'import-x': importX,
28-
},
29-
30-
languageOptions: {
31-
globals: {
32-
fetch: false,
33-
Response: false,
34-
Request: false,
35-
addEventListener: false,
36-
},
8+
js.configs.recommended,
9+
nodePlugin.configs["flat/recommended"],
10+
tseslint.configs.recommended,
11+
{
12+
plugins: {
13+
'@typescript-eslint': tseslint.plugin,
14+
'import-x': importX,
15+
},
16+
languageOptions: {
17+
globals: {
18+
fetch: false,
19+
Response: false,
20+
Request: false,
21+
addEventListener: false,
22+
},
3723

38-
parser: tsParser,
39-
ecmaVersion: 2021,
40-
sourceType: 'module',
41-
},
24+
ecmaVersion: 2021,
25+
sourceType: 'module',
26+
},
4227

43-
rules: {
44-
curly: ['error', 'all'],
45-
quotes: ['error', 'single'],
46-
semi: ['error', 'never'],
47-
'no-debugger': ['error'],
28+
rules: {
29+
curly: ['error', 'all'],
30+
quotes: ['error', 'single'],
31+
semi: ['error', 'never'],
32+
'no-debugger': ['error'],
4833

49-
'no-empty': [
50-
'warn',
51-
{
52-
allowEmptyCatch: true,
53-
},
54-
],
34+
'no-empty': [
35+
'warn',
36+
{
37+
allowEmptyCatch: true,
38+
},
39+
],
5540

56-
'no-process-exit': 'off',
57-
'no-useless-escape': 'off',
41+
'no-process-exit': 'off',
42+
'no-useless-escape': 'off',
5843

59-
'prefer-const': [
60-
'warn',
61-
{
62-
destructuring: 'all',
63-
},
64-
],
44+
'prefer-const': [
45+
'warn',
46+
{
47+
destructuring: 'all',
48+
},
49+
],
6550

66-
'import-x/consistent-type-specifier-style': ['error', 'prefer-top-level'],
67-
'import-x/order': [
68-
'error',
69-
{
70-
groups: ['external', 'builtin', 'internal', 'parent', 'sibling', 'index'],
71-
alphabetize: {
72-
order: 'asc',
73-
caseInsensitive: true,
74-
},
75-
},
76-
],
77-
'import-x/no-duplicates': 'error',
51+
'import-x/consistent-type-specifier-style': ['error', 'prefer-top-level'],
52+
'import-x/order': [
53+
'error',
54+
{
55+
groups: [
56+
'external',
57+
'builtin',
58+
'internal',
59+
'parent',
60+
'sibling',
61+
'index',
62+
],
63+
alphabetize: {
64+
order: 'asc',
65+
caseInsensitive: true,
66+
},
67+
},
68+
],
69+
'import-x/no-duplicates': 'error',
7870

79-
'n/no-missing-import': 'off',
80-
'n/no-missing-require': 'off',
81-
'n/no-deprecated-api': 'off',
82-
'n/no-unpublished-import': 'off',
83-
'n/no-unpublished-require': 'off',
84-
'n/no-unsupported-features/es-syntax': 'off',
85-
'n/no-unsupported-features/node-builtins': 'off',
71+
'n/no-missing-import': 'off',
72+
'n/no-missing-require': 'off',
73+
'n/no-deprecated-api': 'off',
74+
'n/no-unpublished-import': 'off',
75+
'n/no-unpublished-require': 'off',
76+
'n/no-unsupported-features/es-syntax': 'off',
77+
'n/no-unsupported-features/node-builtins': 'off',
8678

87-
'@typescript-eslint/consistent-type-imports': [
88-
'error',
89-
{
90-
prefer: 'type-imports',
91-
},
92-
],
93-
'@typescript-eslint/no-empty-object-type': 'off',
94-
'@typescript-eslint/no-unsafe-function-type': 'off',
95-
'@typescript-eslint/no-empty-function': [
96-
'error',
97-
{
98-
allow: ['arrowFunctions'],
99-
},
100-
],
101-
'@typescript-eslint/no-unused-expressions': 'off',
102-
'@typescript-eslint/no-empty-interface': 'off',
103-
'@typescript-eslint/no-explicit-any': 'warn',
104-
'@typescript-eslint/no-inferrable-types': 'off',
105-
'@typescript-eslint/no-require-imports': 'off',
106-
'@typescript-eslint/no-unused-vars': 'warn',
107-
'@typescript-eslint/no-var-requires': 'off',
108-
},
109-
},
79+
'@typescript-eslint/consistent-type-imports': [
80+
'error',
81+
{
82+
prefer: 'type-imports',
83+
},
84+
],
85+
'@typescript-eslint/no-empty-object-type': 'off',
86+
'@typescript-eslint/no-unsafe-function-type': 'off',
87+
'@typescript-eslint/no-empty-function': [
88+
'error',
89+
{
90+
allow: ['arrowFunctions'],
91+
},
92+
],
93+
'@typescript-eslint/no-unused-expressions': 'off',
94+
'@typescript-eslint/no-empty-interface': 'off',
95+
'@typescript-eslint/no-explicit-any': 'warn',
96+
'@typescript-eslint/no-inferrable-types': 'off',
97+
'@typescript-eslint/no-require-imports': 'off',
98+
'@typescript-eslint/no-unused-vars': 'warn',
99+
'@typescript-eslint/no-var-requires': 'off',
100+
},
101+
},
102+
prettier,
110103
]

packages/eslint-config/package.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,14 @@
2424
"dependencies": {
2525
"@eslint/eslintrc": "^3.1.0",
2626
"@eslint/js": "^9.10.0",
27-
"@typescript-eslint/eslint-plugin": "^8.7.0",
28-
"@typescript-eslint/parser": "^8.7.0",
29-
"eslint-config-prettier": "^9.1.0",
30-
"eslint-define-config": "^2.1.0",
31-
"eslint-import-resolver-typescript": "^3.6.3",
27+
"eslint-config-prettier": "^10.1.1",
28+
"eslint-import-resolver-typescript": "^4.2.2",
3229
"eslint-plugin-import-x": "^4.1.1",
33-
"eslint-plugin-n": "^17.10.2"
30+
"eslint-plugin-n": "^17.10.2",
31+
"typescript-eslint": "^8.27.0"
3432
},
3533
"devDependencies": {
36-
"@types/eslint": "^8",
37-
"eslint": "^9.10.0",
34+
"eslint": "^9.23.0",
3835
"typescript": "^5.3.3"
3936
}
4037
}

packages/standard-validator/src/__schemas__/arktype.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const queryPaginationSchema = type({
2323
})
2424

2525
const querySortSchema = type({
26-
// eslint-disable-next-line quotes
26+
2727
order: "'asc'|'desc'",
2828
})
2929

packages/typia-validator/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
},
5454
"devDependencies": {
5555
"@arethetypeswrong/cli": "^0.17.4",
56+
"@ryoppippi/unplugin-typia": "^2.1.4",
5657
"hono": "^3.11.7",
5758
"publint": "^0.3.9",
5859
"tsup": "^8.4.0",

0 commit comments

Comments
 (0)