-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheslint.config.js
More file actions
82 lines (71 loc) · 3.37 KB
/
Copy patheslint.config.js
File metadata and controls
82 lines (71 loc) · 3.37 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
import eslint from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import functional from "eslint-plugin-functional";
import promise from "eslint-plugin-promise";
import unicorn from "eslint-plugin-unicorn";
import tseslint from "typescript-eslint";
export default tseslint.config(
// Ignores - must be first
{ ignores: ["node_modules/", "dist/", ".trunk/", "eslint.config.js"] },
// Base configs
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
// Unicorn - 100+ additional quality rules
unicorn.configs.recommended,
// Functional programming (lite preset - not too strict)
functional.configs.lite,
// Promise handling
promise.configs["flat/recommended"],
// TypeScript parser settings for src files
{
files: ["src/**/*.ts", "tests/**/*.ts"],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
// Project-specific rule overrides
{
rules: {
// Relax unicorn rules that conflict with project style
"unicorn/prevent-abbreviations": "off", // Allow common abbreviations
"unicorn/no-null": "off", // Allow null (common in APIs)
"unicorn/filename-case": ["error", { case: "kebabCase" }],
"unicorn/no-process-exit": "off", // Allow in CLI scripts
"unicorn/prefer-top-level-await": "off", // Not always practical
"unicorn/no-array-for-each": "off", // forEach is fine
"unicorn/prefer-string-replace-all": "off", // replaceAll not always available
"unicorn/prefer-string-raw": "off", // Not always clearer
"unicorn/no-nested-ternary": "warn", // Warn instead of error
"unicorn/prefer-at": "warn", // Suggest but don't enforce
"unicorn/import-style": "off", // Allow both named and default imports
// TypeScript - relax some strict rules for existing code
"@typescript-eslint/restrict-template-expressions": [
"error",
{ allowNumber: true, allowBoolean: true },
],
"@typescript-eslint/require-await": "off", // Allow async without await
"@typescript-eslint/no-require-imports": "warn", // Warn for legacy code
"@typescript-eslint/no-unnecessary-condition": "warn", // Warn instead of error
"@typescript-eslint/restrict-plus-operands": "warn", // Warn instead of error
// Functional - these are too strict for existing imperative code
"functional/no-let": "off", // Let is fine
"functional/immutable-data": "off", // Mutations are fine
"functional/no-loop-statements": "off", // Loops are fine
"functional/no-throw-statements": "off", // Throwing is fine
"functional/no-return-void": "off", // Void returns are fine
"functional/no-mixed-types": "off", // Mixed types are fine
"functional/prefer-immutable-types": "off", // Mutable params are fine
// Unicorn - relax some rules
"unicorn/no-array-callback-reference": "off", // Allow passing functions directly
"unicorn/consistent-function-scoping": "off", // Allow nested functions
"unicorn/no-array-sort": "off", // Allow sort() - toSorted not always available
"unicorn/numeric-separators-style": "off", // Don't enforce separator style
"unicorn/no-immediate-mutation": "off", // Allow immediate mutations
},
},
// Must be LAST - disables ESLint rules that conflict with Prettier
eslintConfigPrettier,
);