Skip to content

Commit 8684b75

Browse files
committed
refactor: migrato to eslint v9
1 parent 6b6941a commit 8684b75

File tree

5 files changed

+310
-53
lines changed

5 files changed

+310
-53
lines changed

.eslintrc.json

Lines changed: 0 additions & 23 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { FlatCompat } from '@eslint/eslintrc';
2+
import js from '@eslint/js';
3+
import typescriptEslint from '@typescript-eslint/eslint-plugin';
4+
import { defineConfig, globalIgnores } from 'eslint/config';
5+
import globals from 'globals';
6+
import path from 'node:path';
7+
import { fileURLToPath } from 'node:url';
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+
});
16+
17+
export default defineConfig([
18+
globalIgnores(['dist/**', 'node_modules/**', '**/generated/**']),
19+
{
20+
files: ['**/*.ts'],
21+
extends: compat.extends(
22+
'eslint:recommended',
23+
'plugin:@typescript-eslint/recommended'
24+
),
25+
26+
plugins: {
27+
'@typescript-eslint': typescriptEslint,
28+
},
29+
30+
languageOptions: {
31+
globals: {
32+
...globals.node,
33+
},
34+
35+
ecmaVersion: 2020,
36+
sourceType: 'module',
37+
38+
parserOptions: {
39+
parser: '@typescript-eslint/parser',
40+
},
41+
},
42+
43+
rules: {
44+
'@typescript-eslint/consistent-type-imports': 'error',
45+
46+
'@typescript-eslint/no-unused-vars': [
47+
'warn',
48+
{
49+
argsIgnorePattern: '^_',
50+
},
51+
],
52+
53+
'guard-for-in': 'error',
54+
'no-prototype-builtins': 'off',
55+
'semi': ['error', 'always'],
56+
},
57+
},
58+
]);

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"start": "cross-env NODE_ENV=production && node dist/index.js",
1010
"dev": "cross-env NODE_ENV=development && tsx src/index.ts",
1111
"dev:hot": "cross-env NODE_ENV=development && tsx watch src/index.ts",
12-
"lint": "prettier --write \"src/**/*.ts\" && eslint --fix . --ext .ts",
12+
"lint": "prettier --write \"src/**/*.ts\" && eslint --fix .",
1313
"lint:prettier": "prettier --write \"src/**/*.ts\"",
14-
"lint:eslint": "eslint . --ext .ts",
14+
"lint:eslint": "eslint .",
1515
"commit": "cz",
1616
"migrate:prod": "prisma migrate deploy",
1717
"test:api": "npm run build && c8 lab -v",
@@ -44,6 +44,8 @@
4444
"devDependencies": {
4545
"@commitlint/cli": "^19.8.1",
4646
"@commitlint/config-conventional": "^19.8.1",
47+
"@eslint/eslintrc": "^3.3.1",
48+
"@eslint/js": "^9.38.0",
4749
"@hapi/code": "^9.0.3",
4850
"@hapi/iron": "^7.0.1",
4951
"@hapi/lab": "^25.3.2",
@@ -58,7 +60,8 @@
5860
"c8": "^10.1.3",
5961
"cz-conventional-changelog": "^3.3.0",
6062
"esbuild": "0.25.2",
61-
"eslint": "^8.57.1",
63+
"eslint": "^9.38.0",
64+
"globals": "^16.4.0",
6265
"husky": "^9.1.7",
6366
"lint-staged": "^15.5.2",
6467
"prettier": "^3.6.2",

0 commit comments

Comments
 (0)