-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy patheslint.config.mjs
More file actions
97 lines (91 loc) · 2.39 KB
/
eslint.config.mjs
File metadata and controls
97 lines (91 loc) · 2.39 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// ESLint Flat Config for iiif-processor
// Migrated from .eslintrc and .eslintignore; no Standard config.
import js from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint";
export default [
// Ignored paths (migrated from .eslintignore and common generated dirs)
{
ignores: [
"examples/**",
"dist/**",
"coverage/**",
"node_modules/**"
]
},
// Base JS rules and environment
{
files: ["**/*.js"],
languageOptions: {
ecmaVersion: 2022,
sourceType: "commonjs",
globals: {
...globals.node
}
},
rules: {
// Core style rules (from previous .eslintrc)
"brace-style": ["error", "1tbs"],
"comma-dangle": ["error", "never"],
"indent": ["error", 2, { SwitchCase: 1 }],
"key-spacing": "off",
"max-len": "off",
"max-lines-per-function": [
"warn",
{ max: 30, skipBlankLines: true, skipComments: true }
],
"no-unused-vars": [
"warn",
{ vars: "all", args: "after-used", ignoreRestSiblings: false }
],
"no-var": "warn",
"object-curly-spacing": ["error", "always"],
"prefer-const": [
"warn",
{ destructuring: "any", ignoreReadBeforeAssign: true }
],
"semi": ["error", "always"],
"space-in-parens": ["error", "never"],
// Complexity warning (slightly strict, per prior comment)
complexity: ["warn", 6]
}
},
// Recommended JS best practices
js.configs.recommended,
// TypeScript support and rules
...tseslint.configs.recommended,
{
files: ["**/*.ts"],
languageOptions: {
ecmaVersion: 2022,
globals: {
...globals.node
}
},
rules: {
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" }
],
"@typescript-eslint/no-explicit-any": "warn",
// Match JS style expectations where applicable
"object-curly-spacing": ["error", "always"],
"semi": ["error", "always"]
}
},
// Jest globals for test files (no plugin needed)
{
files: ["**/*.{test,spec}.{js,ts}", "tests/**/*.{js,ts,tsx,jsx}"],
languageOptions: {
globals: {
...globals.jest
}
},
rules: {
// Relax strict style rules in test code
semi: "off",
"object-curly-spacing": "off",
"prefer-const": "off"
}
}
];