Skip to content

Commit 800f90c

Browse files
committed
chore: update eslint to use new config
1 parent 00c0ecd commit 800f90c

File tree

3 files changed

+138
-0
lines changed

3 files changed

+138
-0
lines changed

eslint.config.mjs

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
2+
import globals from "globals";
3+
import tsParser from "@typescript-eslint/parser";
4+
import path from "node:path";
5+
import { fileURLToPath } from "node:url";
6+
import js from "@eslint/js";
7+
import { FlatCompat } from "@eslint/eslintrc";
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 [{
18+
ignores: ["**/locales/", "**/dist/", "**/scripts/"],
19+
}, ...compat.extends(
20+
"eslint:recommended",
21+
"plugin:@typescript-eslint/eslint-recommended",
22+
"plugin:@typescript-eslint/recommended",
23+
), {
24+
plugins: {
25+
"@typescript-eslint": typescriptEslint,
26+
},
27+
28+
languageOptions: {
29+
globals: {
30+
...globals.node,
31+
},
32+
33+
parser: tsParser,
34+
ecmaVersion: 2022,
35+
sourceType: "module",
36+
},
37+
38+
rules: {
39+
"arrow-spacing": ["warn", {
40+
before: true,
41+
after: true,
42+
}],
43+
44+
"brace-style": ["error", "1tbs", {
45+
allowSingleLine: true,
46+
}],
47+
48+
"comma-dangle": ["error", "always-multiline"],
49+
"comma-spacing": "error",
50+
"comma-style": "error",
51+
curly: ["error", "multi-line", "consistent"],
52+
"dot-location": ["error", "property"],
53+
"handle-callback-err": "off",
54+
"keyword-spacing": "error",
55+
56+
"max-nested-callbacks": ["error", {
57+
max: 4,
58+
}],
59+
60+
"max-statements-per-line": ["error", {
61+
max: 2,
62+
}],
63+
64+
"no-console": "off",
65+
"no-empty-function": "error",
66+
"no-floating-decimal": "error",
67+
"no-inline-comments": "error",
68+
"no-lonely-if": "error",
69+
"no-multi-spaces": "error",
70+
71+
"no-multiple-empty-lines": ["error", {
72+
max: 2,
73+
maxEOF: 1,
74+
maxBOF: 0,
75+
}],
76+
77+
"no-return-await": "error",
78+
"no-shadow": "off",
79+
"no-trailing-spaces": ["error"],
80+
"no-var": "error",
81+
"object-curly-spacing": ["error", "always"],
82+
"prefer-const": "error",
83+
84+
quotes: ["error", "single", {
85+
avoidEscape: true,
86+
allowTemplateLiterals: false,
87+
}],
88+
89+
semi: ["error", "always"],
90+
"space-before-blocks": "error",
91+
92+
"space-before-function-paren": ["error", {
93+
anonymous: "never",
94+
named: "never",
95+
asyncArrow: "always",
96+
}],
97+
98+
"space-in-parens": "error",
99+
"space-infix-ops": "error",
100+
"space-unary-ops": "error",
101+
"spaced-comment": "error",
102+
yoda: "error",
103+
104+
"@typescript-eslint/no-shadow": ["error", {
105+
allow: ["err", "resolve", "reject"],
106+
}],
107+
108+
"@typescript-eslint/explicit-function-return-type": ["error", {
109+
allowTypedFunctionExpressions: false,
110+
}],
111+
112+
"@typescript-eslint/consistent-type-imports": ["error"],
113+
114+
"@typescript-eslint/no-unused-vars": ["error", {
115+
argsIgnorePattern: "^_",
116+
varsIgnorePattern: "^_",
117+
caughtErrorsIgnorePattern: "^_",
118+
}],
119+
},
120+
}];

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
]
5454
},
5555
"devDependencies": {
56+
"@eslint/eslintrc": "^3.1.0",
57+
"@eslint/js": "^9.9.0",
5658
"@jest/types": "^30.0.0-alpha.6",
5759
"@swc/core": "^1.7.11",
5860
"@swc/jest": "^0.2.36",
@@ -62,6 +64,7 @@
6264
"@typescript-eslint/eslint-plugin": "^8.1.0",
6365
"@typescript-eslint/parser": "^8.1.0",
6466
"eslint": "^9.9.0",
67+
"globals": "^15.9.0",
6568
"jest": "^30.0.0-alpha.5",
6669
"prettier": "^3.3.3",
6770
"rimraf": "^6.0.1",

pnpm-lock.yaml

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)