-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy patheslint.config.mjs
More file actions
78 lines (77 loc) · 2.72 KB
/
Copy patheslint.config.mjs
File metadata and controls
78 lines (77 loc) · 2.72 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
// Flat ESLint config for the playground's browser-side JavaScript.
//
// These files run in the browser (no bundler, no module system) and lean on a
// handful of globals provided by the page or by third-party scripts loaded via
// <script> tags (xterm.js, the WASI shim) and by build-generated files
// (/wasm/commands.js, /wasm/version.js). They are declared below so that
// no-undef stays useful without flagging those.
//
// Run locally with: npm run lint (or: npx eslint static/js)
import js from "@eslint/js";
export default [
js.configs.recommended,
{
// Shared settings for every playground script.
files: ["static/js/**/*.js"],
languageOptions: {
ecmaVersion: 2022,
sourceType: "script",
globals: {
// Browser environment
window: "readonly",
document: "readonly",
navigator: "readonly",
location: "readonly",
console: "readonly",
fetch: "readonly",
setTimeout: "readonly",
clearTimeout: "readonly",
URL: "readonly",
URLSearchParams: "readonly",
CustomEvent: "readonly",
TextEncoder: "readonly",
TextDecoder: "readonly",
WebAssembly: "readonly",
SharedArrayBuffer: "readonly",
// Third-party globals loaded via <script> on the playground page
Terminal: "readonly",
FitAddon: "readonly",
WebLinksAddon: "readonly",
// Generated at build time and injected before these scripts: command
// list from /wasm/commands.js, locale and version strings from
// /wasm/version.js. Absent in local dev (the code guards with typeof).
WASM_COMMANDS: "readonly",
WASM_LOCALES: "readonly",
UUTILS_WASM_VERSION: "readonly",
UUTILS_GREP_VERSION: "readonly",
UUTILS_FINDUTILS_VERSION: "readonly",
UUTILS_DIFFUTILS_VERSION: "readonly",
UUTILS_SED_VERSION: "readonly",
SITE_VERSION: "readonly",
},
},
rules: {
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
},
},
{
// playground.js drives the page and calls into the terminal API that
// wasm-terminal.js exposes on `window` (loaded as a separate <script>).
// These live here rather than in the shared block so they don't clash with
// their own definitions in wasm-terminal.js (no-redeclare).
files: ["static/js/playground.js"],
languageOptions: {
globals: {
initPlayground: "readonly",
runInTerminal: "readonly",
loadProgram: "readonly",
isProgramLoaded: "readonly",
programSize: "readonly",
uutilsPrograms: "readonly",
getLastCommand: "readonly",
setLocale: "readonly",
uutilsExecute: "readonly",
},
},
},
];