-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
69 lines (60 loc) · 1.82 KB
/
Copy patheslint.config.mjs
File metadata and controls
69 lines (60 loc) · 1.82 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
import js from "@eslint/js";
import globals from "globals";
import prettier from "eslint-config-prettier";
// Shared globals our own files attach/read across script boundaries
// (see constants.js / reorder.js). Declaring them keeps `no-undef` honest.
const sharedGlobals = {
STORAGE_KEY: "readonly",
ORDER: "readonly",
normalizeOrder: "readonly",
firstMatchingTarget: "readonly",
pushedCommitTargets: "readonly",
applyOrderToTarget: "readonly",
getPageConfig: "readonly",
findChecksBox: "readonly",
getCheckLabels: "readonly",
deriveChecksState: "readonly",
};
export default [
{ ignores: ["node_modules/**", "*.zip", "*.xpi"] },
js.configs.recommended,
// UMD modules: run in the browser (extension) AND under Node (tests),
// so they legitimately reference both `globalThis`/window and module.
{
files: ["constants.js", "reorder.js", "checks.js", "pages.js"],
languageOptions: {
globals: { ...globals.browser, ...globals.node, ...sharedGlobals },
},
},
// Content/popup scripts run in the page/popup with the chrome.* API.
{
files: ["content.js", "popup.js"],
languageOptions: {
globals: { ...globals.browser, chrome: "readonly", ...sharedGlobals },
},
},
// Background service worker (UMD so its logic is testable under Node).
{
files: ["background.js"],
languageOptions: {
globals: { ...globals.serviceworker, ...globals.node, chrome: "readonly" },
},
},
// Node-side tooling.
{
files: ["**/*.mjs"],
languageOptions: {
sourceType: "module",
globals: { ...globals.node },
},
},
// Tests run under Vitest + jsdom: Node plus a browser `document`.
{
files: ["test/**/*.test.mjs"],
languageOptions: {
sourceType: "module",
globals: { ...globals.node, ...globals.browser },
},
},
prettier,
];