Repository navigation
Expand file tree
/
Copy patheslint.config.js
More file actions
82 lines (81 loc) · 2.27 KB
/
Copy patheslint.config.js
File metadata and controls
82 lines (81 loc) · 2.27 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 js from "@eslint/js";
import globals from "globals";
export default [
{
ignores: ["node_modules/", "_dist/", "_tools/lib/", "**/*.min.js", "**/*.meta.js"],
},
// Build/lint tools — Node.js environment
{
files: ["_tools/**/*.mjs"],
languageOptions: {
ecmaVersion: 2020,
sourceType: "module",
globals: { ...globals.node },
},
},
// Userscripts — browser environment
{
files: ["**/*.user.js"],
languageOptions: {
ecmaVersion: 2020,
sourceType: "script",
globals: {
...globals.browser,
// Greasemonkey/Userscript globals
GM: "readonly",
GM_getValue: "readonly",
GM_setValue: "readonly",
GM_deleteValue: "readonly",
GM_listValues: "readonly",
GM_addValueChangeListener: "readonly",
GM_removeValueChangeListener: "readonly",
GM_addElement: "readonly",
GM_addScript: "readonly",
GM_addStyle: "readonly",
GM_download: "readonly",
GM_getResourceText: "readonly",
GM_getResourceURL: "readonly",
GM_info: "readonly",
GM_log: "readonly",
GM_notification: "readonly",
GM_openInTab: "readonly",
GM_popup: "readonly",
GM_registerMenuCommand: "readonly",
GM_unregisterMenuCommand: "readonly",
GM_setClipboard: "readonly",
GM_fetch: "readonly",
GM_xmlhttpRequest: "readonly",
unsafeWindow: "readonly",
exportFunction: "readonly",
cloneInto: "readonly",
// Safari Userscripts
safari: "readonly",
},
},
rules: {
...js.configs.recommended.rules,
curly: ["error", "all"],
eqeqeq: ["error", "always"],
"no-caller": "error",
"no-new-wrappers": "error",
"no-undef": "error",
"no-unused-vars": [
"warn",
{
args: "after-used",
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrors: "none",
},
],
"no-var": "error",
"prefer-const": "warn",
"prefer-arrow-callback": "warn",
"no-console": "off",
"valid-typeof": ["error", { requireStringLiterals: true }],
"no-implicit-coercion": "warn",
"no-with": "error",
"no-eval": "error",
},
},
];