-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.js
More file actions
105 lines (104 loc) · 3.31 KB
/
Copy patheslint.config.js
File metadata and controls
105 lines (104 loc) · 3.31 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
// Flat config: lint .astro files for parse-level issues (the main thing
// we want — catching stray template characters, unclosed braces, broken
// JSX in frontmatter). Stylistic rules intentionally not enforced.
import js from "@eslint/js";
import tseslint from "typescript-eslint";
import astro from "eslint-plugin-astro";
export default [
js.configs.recommended,
...tseslint.configs.recommended,
...astro.configs.recommended,
{
rules: {
// Astro inline scripts are vanilla JS, often use `any` for pb records
// and DOM event targets. Don't fight the type system in this codebase.
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_", caughtErrorsIgnorePattern: "^_" },
],
// Frontmatter consts used only in JSX are picked up as "unused" by
// TS but consumed by the Astro compiler.
"no-unused-vars": "off",
},
},
{
ignores: [
"**/dist/**",
"**/.astro/**",
"**/node_modules/**",
"**/plugins/**",
"vault/internal/validation/models.js",
],
},
// PB JSVM globals — available at runtime but not at lint time.
// Hook modules intentionally use PocketBase JSVM/CommonJS conventions
// (triple-slash local d.ts references, require/module.exports, empty catch
// probes), so keep those rules relaxed only for PB hook files.
{
files: [
"vault/pb_hooks/**/*.js",
"packs/*/hooks/**/*.pb.js",
"packs/*/migrations/*.js",
],
languageOptions: {
globals: {
$app: "readonly",
$template: "readonly",
$os: "readonly",
$apis: "readonly",
$dbx: "readonly",
$security: "readonly",
$filesystem: "readonly",
$http: "readonly",
$mails: "readonly",
routerAdd: "readonly",
routerUse: "readonly",
onBootstrap: "readonly",
onServe: "readonly",
onRecordBeforeCreateRequest: "readonly",
onRecordAfterCreateSuccess: "readonly",
onRecordAfterUpdateSuccess: "readonly",
onRecordAfterDeleteSuccess: "readonly",
cronAdd: "readonly",
cronRemove: "readonly",
console: "readonly",
require: "readonly",
module: "readonly",
Record: "readonly",
Collection: "readonly",
migrate: "readonly",
unmarshal: "readonly",
},
},
rules: {
"@typescript-eslint/triple-slash-reference": "off",
"@typescript-eslint/no-require-imports": "off",
"no-empty": "off",
},
},
// Node scripts (scripts/*.mjs, root config) — shebang + Node globals.
// Without this, `console`/`process`/`Buffer` etc. trip no-undef because
// they are runtime globals provided by Node, not declared in this file.
{
files: ["scripts/**/*.mjs", "*.mjs", "models.config.mjs"],
languageOptions: {
globals: {
console: "readonly",
process: "readonly",
Buffer: "readonly",
setTimeout: "readonly",
clearTimeout: "readonly",
setInterval: "readonly",
clearInterval: "readonly",
__dirname: "readonly",
__filename: "readonly",
URL: "readonly",
fetch: "readonly",
AbortSignal: "readonly",
TextEncoder: "readonly",
TextDecoder: "readonly",
},
},
},
];