forked from ArtyMcLabin/Gmail-MCP-Server
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheslint.config.js
More file actions
135 lines (129 loc) · 4.63 KB
/
Copy patheslint.config.js
File metadata and controls
135 lines (129 loc) · 4.63 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// ESLint v10 flat config.
// Type-aware rules: requires `parserOptions.projectService: true` (TS 5+).
import js from "@eslint/js";
import tseslint from "typescript-eslint";
import promise from "eslint-plugin-promise";
import importX from "eslint-plugin-import-x";
import unicorn from "eslint-plugin-unicorn";
import jsonc from "eslint-plugin-jsonc";
import prettier from "eslint-config-prettier";
const __dirname = import.meta.dirname;
export default tseslint.config(
{
ignores: [
"dist/",
"coverage/",
"node_modules/",
"test/",
"src/evals/",
"scripts/",
"*.mjs",
"*.config.*",
// package-lock.json is npm-managed; linting it would just churn
// on every dependency update for no practical benefit.
"package-lock.json",
],
},
// Type-aware rules + JS recommended only fire on TS/JS source — the
// type-checked tseslint configs require `parserOptions.projectService`
// and the TS parser, neither of which can handle `.json` / `.jsonc`.
// Keeping this block scoped lets the JSON files fall through to the
// jsonc preset below.
{
files: ["**/*.{ts,mts,cts,tsx,js,mjs,cjs}"],
extends: [
js.configs.recommended,
...tseslint.configs.strictTypeChecked,
promise.configs["flat/recommended"],
importX.flatConfigs.recommended,
importX.flatConfigs.typescript,
unicorn.configs["flat/recommended"],
],
rules: {
// eslint-plugin-unicorn adoption pass 1. See klodr/eslint-plugin-security-mcp#41 for policy.
"unicorn/prevent-abbreviations": [
"error",
{
replacements: {
args: false,
arg: false,
opts: false,
msg: false,
err: false,
res: false,
val: false,
tmp: false,
env: false,
pkg: false,
obj: false,
params: false,
ext: false,
},
allowList: {
e164: true,
E164: true,
isValidE164: true,
},
},
],
"unicorn/no-null": "off",
"unicorn/no-array-reduce": "off",
"unicorn/no-process-exit": "off",
"unicorn/import-style": "off",
"unicorn/prefer-top-level-await": "off",
},
},
// JSON / JSONC / JSON5 linting via eslint-plugin-jsonc — `recommended-with-jsonc`
// applies the JSONC parser to plain `.json` too, so trailing commas in tsconfig
// and similar tooling files don't trip the strict JSON parser.
...jsonc.configs["flat/recommended-with-jsonc"],
prettier,
{
// Scope the type-aware project options + project rules to TS source
// only — these settings only make sense for files the TS compiler
// actually owns. The block above already restricts the rule set
// itself; this block scopes the language options accordingly.
files: ["**/*.{ts,mts,cts,tsx}"],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: __dirname,
},
},
rules: {
// High-value additions over `recommendedTypeChecked`:
eqeqeq: ["error", "always"],
"no-console": ["warn", { allow: ["error", "warn"] }],
// TS already resolves imports via the compiler — if a path is
// wrong, `tsc --noEmit` and vitest both fail. `import-x` cannot
// follow `exports` maps with `./*` wildcards (the MCP SDK uses
// them for `./server/mcp.js`), so disable to avoid false reports.
"import-x/no-unresolved": "off",
// The recommendedTypeChecked preset already enables:
// - @typescript-eslint/no-floating-promises
// - @typescript-eslint/await-thenable
// - @typescript-eslint/no-misused-promises
// - @typescript-eslint/no-unsafe-* (relaxed below where needed)
// Relax for our codebase:
"@typescript-eslint/no-unsafe-assignment": "off", // too noisy with JSON.parse outputs
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/restrict-template-expressions": "off",
// Honour the conventional `_`-prefix to mark intentionally
// unused destructured fields (e.g. when stripping read-only
// keys from a Mercury response before re-POSTing it).
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
},
},
);