From e79520dbdd197d0a656af8912a6ae292ffbbec25 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Tue, 20 Aug 2019 07:42:54 -0700 Subject: [PATCH] Don't allow global access to all of window We had a bug where `stop()` was undefined but it fell back to the function on window which was inplicitly in the global scope. This should reduce that kind of thing. --- .eslintrc | 23 ++++++++++++++++++++--- js/__tests__/baseline.integration-test.js | 1 + 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.eslintrc b/.eslintrc index a6a31f00..5d08d033 100644 --- a/.eslintrc +++ b/.eslintrc @@ -28,15 +28,32 @@ } }, "env": { - "browser": true, "node": true, "amd": true, "es6": true, "jest": true }, + // TODO: Consider removing some of these. + // https://github.com/facebook/create-react-app/pull/1840 + // Create React App and "Standard" only allow the following: + // * document + // * window + // * console + // * navigator "globals": { - "page": true, - "browser": true + "window": true, + "document": true, + "console": true, + "navigator": true, + "alert": true, + "Blob": true, + "fetch": true, + "FileReader": true, + "Element": true, + "AudioNode": true, + "MutationObserver": true, + "Image": true, + "location": true }, "rules": { "no-multiple-empty-lines": [ diff --git a/js/__tests__/baseline.integration-test.js b/js/__tests__/baseline.integration-test.js index 38dafff7..ef457e81 100644 --- a/js/__tests__/baseline.integration-test.js +++ b/js/__tests__/baseline.integration-test.js @@ -1,3 +1,4 @@ +/* global page */ const { toMatchImageSnapshot } = require("jest-image-snapshot"); expect.extend({ toMatchImageSnapshot });