diff --git a/.eslintrc.js b/.eslintrc.js index c058e9b35..e8bacee66 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -33,7 +33,6 @@ module.exports = { 'no-continue': 'off', 'no-param-reassign': 'off', 'no-plusplus': 'off', - 'no-restricted-globals': 'off', 'no-restricted-syntax': 'off', 'no-shadow': 'off', 'no-underscore-dangle': 'off', diff --git a/tests/ui/unit/models/filter.tests.js b/tests/ui/unit/models/filter.tests.js index 92790c914..d044f8e00 100644 --- a/tests/ui/unit/models/filter.tests.js +++ b/tests/ui/unit/models/filter.tests.js @@ -1,16 +1,16 @@ import FilterModel from '../../../../ui/models/filter'; describe('FilterModel', () => { - const oldHash = location.hash; + const oldHash = window.location.hash; afterEach(() => { - location.hash = oldHash; + window.location.hash = oldHash; }); describe('parsing an old url', () => { it('should parse the repo with defaults', () => { - location.hash = '?repo=mozilla-inbound'; + window.location.hash = '?repo=mozilla-inbound'; const urlParams = FilterModel.getUrlParamsWithDefaults(); expect(urlParams).toEqual({ @@ -22,7 +22,7 @@ describe('FilterModel', () => { }); it('should parse resultStatus params', () => { - location.hash = '?repo=mozilla-inbound&filter-resultStatus=testfailed&' + + window.location.hash = '?repo=mozilla-inbound&filter-resultStatus=testfailed&' + 'filter-resultStatus=busted&filter-resultStatus=exception&' + 'filter-resultStatus=success&filter-resultStatus=retry' + '&filter-resultStatus=runnable'; @@ -37,7 +37,7 @@ describe('FilterModel', () => { }); it('should parse searchStr params with tier and groupState intact', () => { - location.hash = '?repo=mozilla-inbound&filter-searchStr=Linux%20x64%20debug%20build-linux64-base-toolchains%2Fdebug%20(Bb)&filter-tier=1&group_state=expanded'; + window.location.hash = '?repo=mozilla-inbound&filter-searchStr=Linux%20x64%20debug%20build-linux64-base-toolchains%2Fdebug%20(Bb)&filter-tier=1&group_state=expanded'; const urlParams = FilterModel.getUrlParamsWithDefaults(); expect(urlParams).toEqual({ @@ -51,7 +51,7 @@ describe('FilterModel', () => { }); it('should parse job field filters', () => { - location.hash = '?repo=mozilla-inbound&filter-job_type_name=mochi'; + window.location.hash = '?repo=mozilla-inbound&filter-job_type_name=mochi'; const urlParams = FilterModel.getUrlParamsWithDefaults(); expect(urlParams).toEqual({ @@ -66,7 +66,7 @@ describe('FilterModel', () => { describe('parsing a new url', () => { it('should parse resultStatus and searchStr', () => { - location.hash = '?repo=mozilla-inbound&resultStatus=testfailed,busted,exception,success,retry,runnable&' + + window.location.hash = '?repo=mozilla-inbound&resultStatus=testfailed,busted,exception,success,retry,runnable&' + 'searchStr=linux,x64,debug,build-linux64-base-toolchains%2Fdebug,(bb)'; const urlParams = FilterModel.getUrlParamsWithDefaults(); @@ -80,7 +80,7 @@ describe('FilterModel', () => { }); it('should preserve the case in email addresses', () => { - location.hash = '?repo=mozilla-inbound&author=VYV03354@nifty.ne.jp'; + window.location.hash = '?repo=mozilla-inbound&author=VYV03354@nifty.ne.jp'; const urlParams = FilterModel.getUrlParamsWithDefaults(); expect(urlParams).toEqual({ diff --git a/ui/helpers/auth.js b/ui/helpers/auth.js index 7edb02210..b8f8f18c3 100644 --- a/ui/helpers/auth.js +++ b/ui/helpers/auth.js @@ -8,7 +8,7 @@ export const webAuth = new WebAuth({ domain: 'auth.mozilla.auth0.com', responseType: 'id_token token', audience: 'login.taskcluster.net', - redirectUri: `${location.protocol}//${location.host}${loginCallbackUrl}`, + redirectUri: `${window.location.protocol}//${window.location.host}${loginCallbackUrl}`, scope: 'taskcluster-credentials openid profile email', }); diff --git a/ui/helpers/location.js b/ui/helpers/location.js index 2d15750a7..97e7668ab 100644 --- a/ui/helpers/location.js +++ b/ui/helpers/location.js @@ -2,7 +2,7 @@ import { thDefaultRepo } from './constants'; import { createQueryParams } from './url'; export const getQueryString = function getQueryString() { - return location.hash.split('?')[1]; + return window.location.hash.split('?')[1]; }; export const getAllUrlParams = function getAllUrlParams() { @@ -18,7 +18,7 @@ export const getRepo = function getRepo() { }; export const setLocation = function setLocation(params, hashPrefix = '/jobs') { - location.hash = `#${hashPrefix}${createQueryParams(params)}`; + window.location.hash = `#${hashPrefix}${createQueryParams(params)}`; }; export const setUrlParam = function setUrlParam(field, value, hashPrefix = '/jobs') { diff --git a/ui/intermittent-failures/helpers.js b/ui/intermittent-failures/helpers.js index 240e85c8e..afe0a5f9b 100644 --- a/ui/intermittent-failures/helpers.js +++ b/ui/intermittent-failures/helpers.js @@ -113,7 +113,7 @@ export const validateQueryParams = function validateQueryParams(params, bugRequi if (!params.endday || params.endday.search(dateFormat) === -1) { messages.push(prettyErrorMessages.endday); } - if (bugRequired && (!params.bug || isNaN(params.bug))) { + if (bugRequired && (!params.bug || Number.isNaN(params.bug))) { messages.push(prettyErrorMessages.bug_ui); } return messages; diff --git a/ui/job-view/context/Pushes.jsx b/ui/job-view/context/Pushes.jsx index f4a2f4043..14e5cd25d 100644 --- a/ui/job-view/context/Pushes.jsx +++ b/ui/job-view/context/Pushes.jsx @@ -268,7 +268,7 @@ export class PushesClass extends React.Component { if (!defaulting && cachedReloadTriggerParams && !isEqual(newReloadTriggerParams, cachedReloadTriggerParams) && !this.skipNextPageReload) { - location.reload(); + window.location.reload(); } else { this.setState({ cachedReloadTriggerParams: newReloadTriggerParams }); } diff --git a/ui/job-view/details/DetailsPanel.jsx b/ui/job-view/details/DetailsPanel.jsx index f041b4967..1a15d3a3f 100644 --- a/ui/job-view/details/DetailsPanel.jsx +++ b/ui/job-view/details/DetailsPanel.jsx @@ -187,7 +187,7 @@ class DetailsPanel extends React.Component { } const logViewerUrl = getLogViewerUrl(selectedJob.id, repoName); - const logViewerFullUrl = `${location.origin}/${logViewerUrl}`; + const logViewerFullUrl = `${window.location.origin}/${logViewerUrl}`; const reftestUrl = jobLogUrls.length ? getReftestUrl(jobLogUrls[0].url) : ''; const performanceData = Object.values(results[3]).reduce((a, b) => [...a, ...b], []); let perfJobDetail = []; diff --git a/ui/job-view/details/tabs/autoclassify/AutoclassifyToolbar.jsx b/ui/job-view/details/tabs/autoclassify/AutoclassifyToolbar.jsx index 859dc37ea..15796aa39 100644 --- a/ui/job-view/details/tabs/autoclassify/AutoclassifyToolbar.jsx +++ b/ui/job-view/details/tabs/autoclassify/AutoclassifyToolbar.jsx @@ -26,10 +26,19 @@ export default class AutoclassifyToolbar extends React.Component { return (
- {status === 'ready' &&
- {autoclassifyStatus === 'cross_referenced' && Autoclassification pending} - {autoclassifyStatus === 'failed' && Autoclassification failed} -
} + { + // TODO: This is broken (bug 1504711) + // eslint-disable-next-line no-restricted-globals + status === 'ready' && ( +
+ {autoclassifyStatus === 'cross_referenced' && ( + Autoclassification pending + )} + {autoclassifyStatus === 'failed' && ( + Autoclassification failed + )} +
+ )}