Skip to content

Commit 0a1b17f

Browse files
committed
Add no-restricted-globals rule
1 parent 93c8419 commit 0a1b17f

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

package-lock.json

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/compass-e2e-tests/.eslintrc.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,31 @@
11
'use strict';
2+
3+
const globals = require('globals');
4+
5+
const browserGlobals = new Set(Object.keys(globals.browser));
6+
const nodeGlobals = new Set(Object.keys(globals.node));
7+
const domOnlyGlobals = browserGlobals.difference(nodeGlobals);
8+
29
module.exports = {
310
root: true,
411
extends: ['@mongodb-js/eslint-config-compass'],
512
parserOptions: {
613
tsconfigRootDir: __dirname,
7-
project: ['./tsconfig-lint.json'],
14+
project: ['./tsconfig.json'],
815
},
916
overrides: [
1017
{
1118
files: ['**/*.ts'],
1219
rules: {
1320
'no-console': 0,
21+
'no-restricted-globals': ['error', ...domOnlyGlobals],
22+
},
23+
},
24+
{
25+
// We need to access these in `browser.execute` calls
26+
files: ['tests/**/*.ts', 'helpers/**/*.ts'],
27+
rules: {
28+
'no-restricted-globals': ['warn', ...domOnlyGlobals],
1429
},
1530
},
1631
],

packages/compass-e2e-tests/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"electron-to-chromium": "^1.5.76",
5656
"eslint": "^7.25.0",
5757
"glob": "^10.2.5",
58+
"globals": "^15.14.0",
5859
"hadron-build": "^25.5.19",
5960
"lodash": "^4.17.21",
6061
"mocha": "^10.2.0",

0 commit comments

Comments
 (0)