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'
export default [
...baseConfig,
{
ignores: ['**/dist/*'],
},
]
export default defineConfig(globalIgnores(['.yarn', '**/dist']), {
extends: baseConfig,
})

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

View File

@ -24,17 +24,14 @@
"dependencies": {
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.10.0",
"@typescript-eslint/eslint-plugin": "^8.7.0",
"@typescript-eslint/parser": "^8.7.0",
"eslint-config-prettier": "^9.1.0",
"eslint-define-config": "^2.1.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-config-prettier": "^10.1.1",
"eslint-import-resolver-typescript": "^4.2.2",
"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": {
"@types/eslint": "^8",
"eslint": "^9.10.0",
"eslint": "^9.23.0",
"typescript": "^5.3.3"
}
}

View File

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

View File

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

7657
yarn.lock

File diff suppressed because it is too large Load Diff