Repository navigation
Expand file tree
/
Copy patheslint.config.js
More file actions
53 lines (52 loc) · 1.77 KB
/
Copy patheslint.config.js
File metadata and controls
53 lines (52 loc) · 1.77 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
// Lints the Playwright suite, the only JavaScript this repository owns.
// templates/ ships vendored assets and is deliberately not covered.
const browserGlobals = {
document: 'readonly',
window: 'readonly',
navigator: 'readonly',
localStorage: 'readonly',
sessionStorage: 'readonly',
getComputedStyle: 'readonly',
};
export default [
{
files: ['playwright/**/*.js'],
languageOptions: {
// Import attributes (`with { type: 'json' }`) need the newest grammar
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
console: 'readonly',
process: 'readonly',
URL: 'readonly',
URLSearchParams: 'readonly',
setTimeout: 'readonly',
clearTimeout: 'readonly',
Buffer: 'readonly',
fetch: 'readonly',
...browserGlobals,
},
},
rules: {
// A typo'd global is always a bug, so it fails the run.
'no-undef': 'error',
// A computed-but-unused value in a spec is almost always an assertion
// that was never made, so it fails the run like an undefined global.
'no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'no-empty': ['error', { allowEmptyCatch: true }],
},
},
{
// The tools are CommonJS scripts run directly by node
files: ['playwright/tools/**/*.js'],
languageOptions: {
sourceType: 'commonjs',
globals: {
require: 'readonly',
module: 'writable',
__dirname: 'readonly',
...browserGlobals,
},
},
},
];