зеркало из https://github.com/mozilla/treeherder.git
Bug 1505758 - Fix/enable ESLint 'no-restricted-globals'
https://eslint.org/docs/rules/no-restricted-globals
This commit is contained in:
Родитель
714e8260c5
Коммит
dd0165c0e0
|
@ -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',
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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',
|
||||
});
|
||||
|
||||
|
|
|
@ -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') {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
|
|
|
@ -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 = [];
|
||||
|
|
|
@ -26,10 +26,19 @@ export default class AutoclassifyToolbar extends React.Component {
|
|||
|
||||
return (
|
||||
<div className="autoclassify-toolbar th-context-navbar navbar-right">
|
||||
{status === 'ready' && <div>
|
||||
{autoclassifyStatus === 'cross_referenced' && <span>Autoclassification pending</span>}
|
||||
{autoclassifyStatus === 'failed' && <span>Autoclassification failed</span>}
|
||||
</div>}
|
||||
{
|
||||
// TODO: This is broken (bug 1504711)
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
status === 'ready' && (
|
||||
<div>
|
||||
{autoclassifyStatus === 'cross_referenced' && (
|
||||
<span>Autoclassification pending</span>
|
||||
)}
|
||||
{autoclassifyStatus === 'failed' && (
|
||||
<span>Autoclassification failed</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<button
|
||||
className="btn btn-view-nav btn-sm nav-menu-btn"
|
||||
|
|
|
@ -181,7 +181,7 @@ class LineOption extends React.Component {
|
|||
suggestion={errorLine.data.bug_suggestions}
|
||||
suggestions={[errorLine.data.bug_suggestions]}
|
||||
fullLog={logUrl}
|
||||
parsedLog={`${location.origin}/${getLogViewerUrl(selectedJob.id, repoName)}`}
|
||||
parsedLog={`${window.location.origin}/${getLogViewerUrl(selectedJob.id, repoName)}`}
|
||||
reftestUrl={isReftest(selectedJob) ? getReftestUrl(logUrl) : ''}
|
||||
successCallback={this.bugFilerCallback}
|
||||
jobGroupName={selectedJob.job_group_name}
|
||||
|
|
|
@ -78,6 +78,8 @@ export default class JobButtonComponent extends React.Component {
|
|||
const resultStatus = state === 'completed' ? result : state;
|
||||
const runnable = state === 'runnable';
|
||||
const btnClass = getBtnClass(resultStatus, failure_classification_id);
|
||||
// TODO: This is broken (bug 1504713)
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
let title = `${resultStatus} | ${job_type_name} - ${status}`;
|
||||
|
||||
if (state === 'completed') {
|
||||
|
|
|
@ -80,7 +80,7 @@ class PushActionMenu extends React.PureComponent {
|
|||
}
|
||||
|
||||
let times = parseInt(window.prompt('Enter number of instances to have for each talos job', 6), 10);
|
||||
while (times < 1 || times > 6 || isNaN(times)) {
|
||||
while (times < 1 || times > 6 || Number.isNaN(times)) {
|
||||
times = window.prompt('We only allow instances of each talos job to be between 1 to 6 times. Enter again', 6);
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ class PushJobs extends React.Component {
|
|||
jobId,
|
||||
).then((data) => {
|
||||
if (data.logs.length > 0) {
|
||||
window.open(`${location.origin}/${
|
||||
window.open(`${window.location.origin}/${
|
||||
getLogViewerUrl(jobId, repoName)}`);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -14,7 +14,7 @@ treeherder.filter('getRevisionUrl', function () {
|
|||
|
||||
treeherder.filter('displayNumber', ['$filter', function ($filter) {
|
||||
return function (input) {
|
||||
if (isNaN(input)) {
|
||||
if (Number.isNaN(input)) {
|
||||
return 'N/A';
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ export default class FilterModel {
|
|||
* will get updates.
|
||||
*/
|
||||
push() {
|
||||
location.hash = `#/jobs?${this.getFilterQueryString()}`;
|
||||
window.location.hash = `#/jobs?${this.getFilterQueryString()}`;
|
||||
}
|
||||
|
||||
setOnlySuperseded() {
|
||||
|
|
|
@ -15,7 +15,7 @@ class Groups extends React.Component {
|
|||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.filterStr = new URLSearchParams(location.search).get('filter') || '';
|
||||
this.filterStr = new URLSearchParams(window.location.search).get('filter') || '';
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче