-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.mjs
More file actions
49 lines (43 loc) · 1.51 KB
/
Copy patheslint.config.mjs
File metadata and controls
49 lines (43 loc) · 1.51 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
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
export default tseslint.config(
eslint.configs.recommended,
tseslint.configs.recommendedTypeChecked,
tseslint.configs.stylisticTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
{
// Specific rules for redundant type definitions
rules: {
// Disallow explicit type annotations when they can be inferred
"@typescript-eslint/no-inferrable-types": "error",
// Prefer using type parameter on Array<T> vs T[] (stylistic)
// "@typescript-eslint/array-type": ["error", { default: "generic" }],
// Enforce using 'as const' instead of literal type annotations
"@typescript-eslint/prefer-as-const": "error",
// No redundant type constituents (e.g., `string | never`)
"@typescript-eslint/no-redundant-type-constituents": "error",
// No useless template expressions (`` `${string}` `` → just use string)
"@typescript-eslint/no-unnecessary-template-expression": "error",
// Allow unused variables prefixed with underscore
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
},
},
{
// Ignore non-TS files and build outputs
ignores: ["**/node_modules/**", "**/dist/**", "**/*.js", "**/*.mjs", "**/*.cjs"],
},
);