Repository navigation
Expand file tree
/
Copy patheslint.config.js
More file actions
49 lines (48 loc) · 1.62 KB
/
Copy patheslint.config.js
File metadata and controls
49 lines (48 loc) · 1.62 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 js from "@eslint/js"
import tseslint from "@typescript-eslint/eslint-plugin"
import tsParser from "@typescript-eslint/parser"
import globals from "globals"
export default [
{ ignores: ["coverage/**", "dist/**", ".wrangler/**", "worker-configuration.d.ts"] },
{
// src/ is published and read in hosts whose ESLint configs vary. It carries eslint-disable
// directives for hosts that still enable the base no-unused-vars rule on structural callback
// signatures; those are inert here and must not be reported as unused.
linterOptions: { reportUnusedDisableDirectives: "off" }
},
js.configs.recommended,
{
files: ["**/*.ts"],
languageOptions: {
parser: tsParser,
parserOptions: {
project: "./tsconfig.json",
sourceType: "module",
ecmaVersion: "latest"
},
globals: {
...globals.es2022,
...globals.node,
Env: "readonly",
D1Database: "readonly",
D1PreparedStatement: "readonly"
}
},
plugins: { "@typescript-eslint": tseslint },
rules: {
...tseslint.configs.recommended.rules,
// TypeScript already resolves ambient Workers types (ExecutionContext, Env, D1Database).
// ESLint's no-undef cannot see them and only produces false positives in a TS project.
"no-undef": "off",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" }
]
}
},
{
files: ["**/*.js", "**/*.mjs"],
languageOptions: { globals: { ...globals.es2022, ...globals.node } }
}
]