Skip to content

Commit 122e035

Browse files
committed
Add no-restricted-globals rule
1 parent 659aaa7 commit 122e035

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-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: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,33 @@
11
'use strict';
2+
3+
const globals = require('globals');
4+
5+
const browserGlobals = Object.keys(globals.browser);
6+
const nodeGlobals = Object.keys(globals.node);
7+
const browserOnlyGlobals = browserGlobals.filter(
8+
(key) => !nodeGlobals.includes(key)
9+
);
10+
211
module.exports = {
312
root: true,
413
extends: ['@mongodb-js/eslint-config-compass'],
514
parserOptions: {
615
tsconfigRootDir: __dirname,
7-
project: ['./tsconfig-lint.json'],
16+
project: ['./tsconfig.json'],
817
},
918
overrides: [
1019
{
1120
files: ['**/*.ts'],
1221
rules: {
1322
'no-console': 0,
23+
'no-restricted-globals': ['error', ...browserOnlyGlobals],
24+
},
25+
},
26+
{
27+
// We need to access these in `browser.execute` calls
28+
files: ['tests/**/*.ts', 'helpers/**/*.ts'],
29+
rules: {
30+
'no-restricted-globals': ['warn', ...browserOnlyGlobals],
1431
},
1532
},
1633
],

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.6.1",
5960
"lodash": "^4.17.21",
6061
"mocha": "^10.2.0",

0 commit comments

Comments
 (0)