-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
108 lines (105 loc) · 3.21 KB
/
Copy patheslint.config.js
File metadata and controls
108 lines (105 loc) · 3.21 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
106
107
108
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (C) 2026 Joakim Langkilde
//
// Flat ESLint config. Core rules only (no plugins), so CI can run it with a bare
// `npx eslint` — matching the project's no-build ethos. Catches bug-class issues;
// formatting is Prettier's job (see .prettierrc.json).
'use strict';
// Browser globals the classic scripts share (they run in one global scope).
const browser = {
window: 'readonly',
self: 'readonly',
document: 'readonly',
navigator: 'readonly',
console: 'readonly',
location: 'readonly',
fetch: 'readonly',
localStorage: 'readonly',
setTimeout: 'readonly',
clearTimeout: 'readonly',
setInterval: 'readonly',
clearInterval: 'readonly',
requestAnimationFrame: 'readonly',
cancelAnimationFrame: 'readonly',
performance: 'readonly',
getComputedStyle: 'readonly',
matchMedia: 'readonly',
Blob: 'readonly',
File: 'readonly',
FileReader: 'readonly',
URL: 'readonly',
Image: 'readonly',
Audio: 'readonly',
Event: 'readonly',
CustomEvent: 'readonly',
TextEncoder: 'readonly',
TextDecoder: 'readonly',
structuredClone: 'readonly',
btoa: 'readonly',
atob: 'readonly',
alert: 'readonly',
confirm: 'readonly',
prompt: 'readonly',
requestIdleCallback: 'readonly',
};
const node = {
require: 'readonly',
module: 'writable',
process: 'readonly',
__dirname: 'readonly',
};
const bugRules = {
'no-undef': 'error',
'no-unused-vars': ['error', { args: 'none', caughtErrors: 'none' }],
'no-empty': ['error', { allowEmptyCatch: true }],
'no-redeclare': 'error',
'no-dupe-keys': 'error',
'no-dupe-args': 'error',
'no-unreachable': 'error',
'no-cond-assign': ['error', 'except-parens'],
'no-constant-condition': ['error', { checkLoops: false }],
'no-self-assign': 'error',
'no-fallthrough': 'error',
'use-isnan': 'error',
'valid-typeof': 'error',
};
module.exports = [
{ ignores: ['firmware/**'] },
{
// app.js consumes WebDFU (dfu.js) and the core.js helpers as shared globals.
files: ['app.js'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'script',
globals: {
...browser,
WebDFU: 'readonly',
NOTE_NAMES: 'readonly',
clamp01: 'readonly',
rotFor: 'readonly',
semverGt: 'readonly',
cablePath: 'readonly',
noteName: 'readonly',
describeMidi: 'readonly',
},
},
rules: bugRules,
},
{
// Definition sites: dfu.js defines WebDFU; core.js defines the helpers + a
// CommonJS export guard (so `module` may appear).
files: ['dfu.js', 'core.js'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'script',
globals: { ...browser, module: 'writable' },
},
rules: bugRules,
},
{
// Node contexts: the test suite and this config file.
files: ['test/**/*.js', 'eslint.config.js'],
languageOptions: { ecmaVersion: 2022, sourceType: 'commonjs', globals: node },
rules: bugRules,
},
];