forked from elizaOS/eliza
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
71 lines (69 loc) · 2.27 KB
/
eslint.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import eslint from "@eslint/js";
import tseslint from "@typescript-eslint/eslint-plugin";
import typescript from "@typescript-eslint/parser";
import prettier from "eslint-config-prettier";
import vitest from "@vitest/eslint-plugin"; // Add Vitest plugin
export default [
// JavaScript and TypeScript files
{
files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"],
languageOptions: {
parser: typescript,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
project: "./tsconfig.json", // Make sure your tsconfig includes @types/node
},
globals: {
// Add Node.js globals
NodeJS: "readonly",
console: "readonly",
process: "readonly",
Buffer: "readonly",
__dirname: "readonly",
__filename: "readonly",
module: "readonly",
require: "readonly",
},
},
plugins: {
"@typescript-eslint": tseslint,
},
rules: {
...eslint.configs.recommended.rules,
...tseslint.configs.recommended.rules,
"prefer-const": "warn",
"no-constant-binary-expression": "error",
// Disable no-undef as TypeScript handles this better
"no-undef": "off",
"@typescript-eslint/no-unsafe-function-type": "off",
// Customize TypeScript rules
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
},
},
// Vitest configuration
{
files: [
"src/**/*.test.js",
"src/**/*.test.ts",
"src/**/*.spec.js",
"src/**/*.spec.ts",
],
plugins: {
vitest, // Register Vitest plugin
},
rules: {
...vitest.configs.recommended.rules,
},
},
// Add prettier as the last config to override other formatting rules
prettier,
];