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>
pull/1078/head
Aditya Mathur 2025-03-29 04:48:02 +05:30 committed by GitHub
parent 8d663e4f9b
commit 0d6c13b1a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 3508 additions and 4388 deletions

View File

@ -0,0 +1,9 @@
---
'@hono/eslint-config': minor
---
feat: updated `@hono/eslint-config` package
- upgrading eslint plugins
- removing @eslint/eslintrc and the legacy FlatCompat
- cleanup migration to typescript-eslint

17
.github/workflows/ci-lint.yml vendored 100644
View File

@ -0,0 +1,17 @@
name: ci-lint
on:
push:
branches: [main]
pull_request:
branches: ['*']
jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
- run: yarn install
- run: yarn lint

View File

@ -1,8 +1,6 @@
import { defineConfig, globalIgnores } from 'eslint/config'
import baseConfig from './packages/eslint-config/index.js' import baseConfig from './packages/eslint-config/index.js'
export default [ export default defineConfig(globalIgnores(['.yarn', '**/dist']), {
...baseConfig, extends: baseConfig,
{ })
ignores: ['**/dist/*'],
},
]

View File

@ -1,110 +1,103 @@
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { FlatCompat } from '@eslint/eslintrc'
import js from '@eslint/js' import js from '@eslint/js'
import typescriptEslint from '@typescript-eslint/eslint-plugin' import prettier from 'eslint-config-prettier/flat'
import tsParser from '@typescript-eslint/parser'
import importX from 'eslint-plugin-import-x' import importX from 'eslint-plugin-import-x'
import nodePlugin from 'eslint-plugin-n'
const __filename = fileURLToPath(import.meta.url) import tseslint from 'typescript-eslint'
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})
export default [ export default [
...compat.extends( js.configs.recommended,
'eslint:recommended', nodePlugin.configs["flat/recommended"],
'plugin:n/recommended', tseslint.configs.recommended,
'plugin:@typescript-eslint/recommended', {
'prettier' plugins: {
), '@typescript-eslint': tseslint.plugin,
{ 'import-x': importX,
plugins: { },
'@typescript-eslint': typescriptEslint, languageOptions: {
'import-x': importX, globals: {
}, fetch: false,
Response: false,
Request: false,
addEventListener: false,
},
languageOptions: { ecmaVersion: 2021,
globals: { sourceType: 'module',
fetch: false, },
Response: false,
Request: false,
addEventListener: false,
},
parser: tsParser, rules: {
ecmaVersion: 2021, curly: ['error', 'all'],
sourceType: 'module', quotes: ['error', 'single'],
}, semi: ['error', 'never'],
'no-debugger': ['error'],
rules: { 'no-empty': [
curly: ['error', 'all'], 'warn',
quotes: ['error', 'single'], {
semi: ['error', 'never'], allowEmptyCatch: true,
'no-debugger': ['error'], },
],
'no-empty': [ 'no-process-exit': 'off',
'warn', 'no-useless-escape': 'off',
{
allowEmptyCatch: true,
},
],
'no-process-exit': 'off', 'prefer-const': [
'no-useless-escape': 'off', 'warn',
{
destructuring: 'all',
},
],
'prefer-const': [ 'import-x/consistent-type-specifier-style': ['error', 'prefer-top-level'],
'warn', 'import-x/order': [
{ 'error',
destructuring: 'all', {
}, groups: [
], 'external',
'builtin',
'internal',
'parent',
'sibling',
'index',
],
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
'import-x/no-duplicates': 'error',
'import-x/consistent-type-specifier-style': ['error', 'prefer-top-level'], 'n/no-missing-import': 'off',
'import-x/order': [ 'n/no-missing-require': 'off',
'error', 'n/no-deprecated-api': 'off',
{ 'n/no-unpublished-import': 'off',
groups: ['external', 'builtin', 'internal', 'parent', 'sibling', 'index'], 'n/no-unpublished-require': 'off',
alphabetize: { 'n/no-unsupported-features/es-syntax': 'off',
order: 'asc', 'n/no-unsupported-features/node-builtins': 'off',
caseInsensitive: true,
},
},
],
'import-x/no-duplicates': 'error',
'n/no-missing-import': 'off', '@typescript-eslint/consistent-type-imports': [
'n/no-missing-require': 'off', 'error',
'n/no-deprecated-api': 'off', {
'n/no-unpublished-import': 'off', prefer: 'type-imports',
'n/no-unpublished-require': 'off', },
'n/no-unsupported-features/es-syntax': 'off', ],
'n/no-unsupported-features/node-builtins': 'off', '@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-unsafe-function-type': 'off',
'@typescript-eslint/consistent-type-imports': [ '@typescript-eslint/no-empty-function': [
'error', 'error',
{ {
prefer: 'type-imports', allow: ['arrowFunctions'],
}, },
], ],
'@typescript-eslint/no-empty-object-type': 'off', '@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-unsafe-function-type': 'off', '@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-empty-function': [ '@typescript-eslint/no-explicit-any': 'warn',
'error', '@typescript-eslint/no-inferrable-types': 'off',
{ '@typescript-eslint/no-require-imports': 'off',
allow: ['arrowFunctions'], '@typescript-eslint/no-unused-vars': 'warn',
}, '@typescript-eslint/no-var-requires': 'off',
], },
'@typescript-eslint/no-unused-expressions': 'off', },
'@typescript-eslint/no-empty-interface': 'off', prettier,
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-var-requires': 'off',
},
},
] ]

View File

@ -24,17 +24,14 @@
"dependencies": { "dependencies": {
"@eslint/eslintrc": "^3.1.0", "@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.10.0", "@eslint/js": "^9.10.0",
"@typescript-eslint/eslint-plugin": "^8.7.0", "eslint-config-prettier": "^10.1.1",
"@typescript-eslint/parser": "^8.7.0", "eslint-import-resolver-typescript": "^4.2.2",
"eslint-config-prettier": "^9.1.0",
"eslint-define-config": "^2.1.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import-x": "^4.1.1", "eslint-plugin-import-x": "^4.1.1",
"eslint-plugin-n": "^17.10.2" "eslint-plugin-n": "^17.10.2",
"typescript-eslint": "^8.27.0"
}, },
"devDependencies": { "devDependencies": {
"@types/eslint": "^8", "eslint": "^9.23.0",
"eslint": "^9.10.0",
"typescript": "^5.3.3" "typescript": "^5.3.3"
} }
} }

View File

@ -23,7 +23,7 @@ const queryPaginationSchema = type({
}) })
const querySortSchema = type({ const querySortSchema = type({
// eslint-disable-next-line quotes
order: "'asc'|'desc'", order: "'asc'|'desc'",
}) })

View File

@ -53,6 +53,7 @@
}, },
"devDependencies": { "devDependencies": {
"@arethetypeswrong/cli": "^0.17.4", "@arethetypeswrong/cli": "^0.17.4",
"@ryoppippi/unplugin-typia": "^2.1.4",
"hono": "^3.11.7", "hono": "^3.11.7",
"publint": "^0.3.9", "publint": "^0.3.9",
"tsup": "^8.4.0", "tsup": "^8.4.0",

7657
yarn.lock

File diff suppressed because it is too large Load Diff