@@ -0,0 +1,15 @@
|
||||
---
|
||||
'@backstage/backend-common': patch
|
||||
'@backstage/core-app-api': patch
|
||||
'@backstage/core-components': patch
|
||||
'@backstage/version-bridge': patch
|
||||
'@backstage/plugin-analytics-module-ga': patch
|
||||
'@backstage/plugin-catalog': patch
|
||||
'@backstage/plugin-cloudbuild': patch
|
||||
'@backstage/plugin-gcp-projects': patch
|
||||
'@backstage/plugin-github-actions': patch
|
||||
'@backstage/plugin-graphiql': patch
|
||||
'@backstage/plugin-techdocs': patch
|
||||
---
|
||||
|
||||
Internal fixes to avoid implicit usage of globals
|
||||
+174
@@ -50,5 +50,179 @@ module.exports = {
|
||||
'testing-library/no-await-sync-query': 'error',
|
||||
'testing-library/prefer-wait-for': 'error',
|
||||
'testing-library/no-dom-import': 'error',
|
||||
'no-restricted-globals': [
|
||||
'error',
|
||||
'postMessage',
|
||||
'blur',
|
||||
'focus',
|
||||
'close',
|
||||
'frames',
|
||||
'self',
|
||||
'parent',
|
||||
'opener',
|
||||
'top',
|
||||
'length',
|
||||
'closed',
|
||||
'location',
|
||||
'origin',
|
||||
'name',
|
||||
'locationbar',
|
||||
'menubar',
|
||||
'personalbar',
|
||||
'scrollbars',
|
||||
'statusbar',
|
||||
'toolbar',
|
||||
'status',
|
||||
'frameElement',
|
||||
'navigator',
|
||||
'customElements',
|
||||
'external',
|
||||
'screen',
|
||||
'innerWidth',
|
||||
'innerHeight',
|
||||
'scrollX',
|
||||
'pageXOffset',
|
||||
'scrollY',
|
||||
'pageYOffset',
|
||||
'screenX',
|
||||
'screenY',
|
||||
'outerWidth',
|
||||
'outerHeight',
|
||||
'devicePixelRatio',
|
||||
'clientInformation',
|
||||
'screenLeft',
|
||||
'screenTop',
|
||||
'defaultStatus',
|
||||
'defaultstatus',
|
||||
'styleMedia',
|
||||
'onanimationend',
|
||||
'onanimationiteration',
|
||||
'onanimationstart',
|
||||
'onsearch',
|
||||
'ontransitionend',
|
||||
'onwebkitanimationend',
|
||||
'onwebkitanimationiteration',
|
||||
'onwebkitanimationstart',
|
||||
'onwebkittransitionend',
|
||||
'isSecureContext',
|
||||
'onabort',
|
||||
'onblur',
|
||||
'oncancel',
|
||||
'oncanplay',
|
||||
'oncanplaythrough',
|
||||
'onchange',
|
||||
'onclick',
|
||||
'onclose',
|
||||
'oncontextmenu',
|
||||
'oncuechange',
|
||||
'ondblclick',
|
||||
'ondrag',
|
||||
'ondragend',
|
||||
'ondragenter',
|
||||
'ondragleave',
|
||||
'ondragover',
|
||||
'ondragstart',
|
||||
'ondrop',
|
||||
'ondurationchange',
|
||||
'onemptied',
|
||||
'onended',
|
||||
'onerror',
|
||||
'onfocus',
|
||||
'oninput',
|
||||
'oninvalid',
|
||||
'onkeydown',
|
||||
'onkeypress',
|
||||
'onkeyup',
|
||||
'onload',
|
||||
'onloadeddata',
|
||||
'onloadedmetadata',
|
||||
'onloadstart',
|
||||
'onmousedown',
|
||||
'onmouseenter',
|
||||
'onmouseleave',
|
||||
'onmousemove',
|
||||
'onmouseout',
|
||||
'onmouseover',
|
||||
'onmouseup',
|
||||
'onmousewheel',
|
||||
'onpause',
|
||||
'onplay',
|
||||
'onplaying',
|
||||
'onprogress',
|
||||
'onratechange',
|
||||
'onreset',
|
||||
'onresize',
|
||||
'onscroll',
|
||||
'onseeked',
|
||||
'onseeking',
|
||||
'onselect',
|
||||
'onstalled',
|
||||
'onsubmit',
|
||||
'onsuspend',
|
||||
'ontimeupdate',
|
||||
'ontoggle',
|
||||
'onvolumechange',
|
||||
'onwaiting',
|
||||
'onwheel',
|
||||
'onauxclick',
|
||||
'ongotpointercapture',
|
||||
'onlostpointercapture',
|
||||
'onpointerdown',
|
||||
'onpointermove',
|
||||
'onpointerup',
|
||||
'onpointercancel',
|
||||
'onpointerover',
|
||||
'onpointerout',
|
||||
'onpointerenter',
|
||||
'onpointerleave',
|
||||
'onafterprint',
|
||||
'onbeforeprint',
|
||||
'onbeforeunload',
|
||||
'onhashchange',
|
||||
'onlanguagechange',
|
||||
'onmessage',
|
||||
'onmessageerror',
|
||||
'onoffline',
|
||||
'ononline',
|
||||
'onpagehide',
|
||||
'onpageshow',
|
||||
'onpopstate',
|
||||
'onrejectionhandled',
|
||||
'onstorage',
|
||||
'onunhandledrejection',
|
||||
'onunload',
|
||||
'performance',
|
||||
'stop',
|
||||
'open',
|
||||
'print',
|
||||
'captureEvents',
|
||||
'releaseEvents',
|
||||
'getComputedStyle',
|
||||
'matchMedia',
|
||||
'moveTo',
|
||||
'moveBy',
|
||||
'resizeTo',
|
||||
'resizeBy',
|
||||
'getSelection',
|
||||
'find',
|
||||
'createImageBitmap',
|
||||
'scroll',
|
||||
'scrollTo',
|
||||
'scrollBy',
|
||||
'onappinstalled',
|
||||
'onbeforeinstallprompt',
|
||||
'crypto',
|
||||
'ondevicemotion',
|
||||
'ondeviceorientation',
|
||||
'ondeviceorientationabsolute',
|
||||
'indexedDB',
|
||||
'webkitStorageInfo',
|
||||
'chrome',
|
||||
'visualViewport',
|
||||
'speechSynthesis',
|
||||
'webkitRequestFileSystem',
|
||||
'webkitResolveLocalFileSystemURL',
|
||||
'openDatabase',
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -126,6 +126,7 @@ github
|
||||
Gitiles
|
||||
gitlab
|
||||
GitLab
|
||||
globals
|
||||
Gource
|
||||
Grafana
|
||||
graphql
|
||||
|
||||
@@ -179,7 +179,7 @@ export class Git {
|
||||
});
|
||||
} catch (ex) {
|
||||
this.config.logger?.error(
|
||||
`Failed to fetch repo {dir=${dir},origin=${origin}}`,
|
||||
`Failed to fetch repo {dir=${dir},remote=${remote}}`,
|
||||
);
|
||||
if (ex.data) {
|
||||
throw new Error(`${ex.message} {data=${JSON.stringify(ex.data)}}`);
|
||||
|
||||
@@ -89,6 +89,6 @@ describe('AppIdentityProxy', () => {
|
||||
});
|
||||
|
||||
await proxy.signOut();
|
||||
expect(location.href).toBe('/foo');
|
||||
expect(window.location.href).toBe('/foo');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -124,6 +124,6 @@ export class AppIdentityProxy implements IdentityApi {
|
||||
|
||||
async signOut(): Promise<void> {
|
||||
await this.waitForTarget.then(target => target.signOut());
|
||||
location.href = this.signOutTargetUrl;
|
||||
window.location.href = this.signOutTargetUrl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ export class DefaultAuthConnector<AuthSession>
|
||||
const scope = this.joinScopesFunc(scopes);
|
||||
const popupUrl = await this.buildUrl('/start', {
|
||||
scope,
|
||||
origin: location.origin,
|
||||
origin: window.location.origin,
|
||||
});
|
||||
|
||||
const payload = await showLoginPopup({
|
||||
|
||||
+2
-2
@@ -155,7 +155,7 @@ function useScrollDistance(
|
||||
return [scrollLeft, scrollRight];
|
||||
}
|
||||
|
||||
// Used to animate scrolling. Returns a single setScrollTarger function, when called with e.g. 200,
|
||||
// Used to animate scrolling. Returns a single setScrollTarget function, when called with e.g. 200,
|
||||
// the element pointer to by the ref will be scrolled 200px forwards over time.
|
||||
function useSmoothScroll(
|
||||
ref: React.MutableRefObject<HTMLElement | undefined>,
|
||||
@@ -169,7 +169,7 @@ function useSmoothScroll(
|
||||
return;
|
||||
}
|
||||
|
||||
const startTime = performance.now();
|
||||
const startTime = window.performance.now();
|
||||
const id = requestAnimationFrame(frameTime => {
|
||||
if (!ref.current) {
|
||||
return;
|
||||
|
||||
@@ -19,7 +19,9 @@ function getGlobalObject() {
|
||||
if (typeof window !== 'undefined' && window.Math === Math) {
|
||||
return window;
|
||||
}
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
if (typeof self !== 'undefined' && self.Math === Math) {
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
return self;
|
||||
}
|
||||
// eslint-disable-next-line no-new-func
|
||||
|
||||
+1
-1
@@ -241,7 +241,7 @@ export class GoogleAnalytics implements AnalyticsApi {
|
||||
* Simple hash function; relies on web cryptography + the sha-256 algorithm.
|
||||
*/
|
||||
private async hash(value: string): Promise<string> {
|
||||
const digest = await crypto.subtle.digest(
|
||||
const digest = await window.crypto.subtle.digest(
|
||||
'sha-256',
|
||||
new TextEncoder().encode(value),
|
||||
);
|
||||
|
||||
@@ -89,7 +89,7 @@ export function EntityContextMenu(props: EntityContextMenuProps) {
|
||||
const alertApi = useApi(alertApiRef);
|
||||
|
||||
const copyToClipboard = useCallback(() => {
|
||||
navigator.clipboard
|
||||
window.navigator.clipboard
|
||||
.writeText(window.location.toString())
|
||||
.then(() => alertApi.post({ message: 'Copied!', severity: 'info' }));
|
||||
}, [alertApi]);
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import {
|
||||
Box,
|
||||
|
||||
@@ -61,7 +61,9 @@ const DetailsPage = () => {
|
||||
const classes = useStyles();
|
||||
|
||||
const [{ status, result: details, error }, { execute }] = useAsync(async () =>
|
||||
api.getProject(decodeURIComponent(location.search.split('projectId=')[1])),
|
||||
api.getProject(
|
||||
decodeURIComponent(window.location.search.split('projectId=')[1]),
|
||||
),
|
||||
);
|
||||
|
||||
useMountEffect(execute);
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { readGithubIntegrationConfigs } from '@backstage/integration';
|
||||
import {
|
||||
@@ -43,7 +44,6 @@ import { WorkflowRunStatus } from '../WorkflowRunStatus';
|
||||
import { useWorkflowRunJobs } from './useWorkflowRunJobs';
|
||||
import { useWorkflowRunsDetails } from './useWorkflowRunsDetails';
|
||||
import { WorkflowRunLogs } from '../WorkflowRunLogs';
|
||||
|
||||
import { configApiRef, useApi } from '@backstage/core-plugin-api';
|
||||
import { Breadcrumbs, Link } from '@backstage/core-components';
|
||||
|
||||
@@ -116,8 +116,6 @@ const JobListItem = ({
|
||||
<Accordion TransitionProps={{ unmountOnExit: true }} className={className}>
|
||||
<AccordionSummary
|
||||
expandIcon={<ExpandMoreIcon />}
|
||||
aria-controls={`panel-${name}-content`}
|
||||
id={`panel-${name}-header`}
|
||||
IconButtonProps={{
|
||||
className: classes.button,
|
||||
}}
|
||||
|
||||
@@ -105,8 +105,6 @@ export const WorkflowRunLogs = ({
|
||||
<Accordion TransitionProps={{ unmountOnExit: true }} disabled={inProgress}>
|
||||
<AccordionSummary
|
||||
expandIcon={<ExpandMoreIcon />}
|
||||
aria-controls={`panel-${name}-content`}
|
||||
id={`panel-${name}-header`}
|
||||
IconButtonProps={{
|
||||
className: classes.button,
|
||||
}}
|
||||
|
||||
@@ -47,7 +47,7 @@ export class StorageBucket implements Storage {
|
||||
private readonly bucket: string,
|
||||
) {}
|
||||
|
||||
[name: string]: any;
|
||||
[itemName: string]: any;
|
||||
|
||||
get length(): number {
|
||||
throw new Error('Method not implemented.');
|
||||
|
||||
@@ -59,7 +59,7 @@ describe('TextSize', () => {
|
||||
|
||||
expect(slider).toHaveTextContent('115%');
|
||||
|
||||
let style = getComputedStyle(getByText('TEST_CONTENT'));
|
||||
let style = window.getComputedStyle(getByText('TEST_CONTENT'));
|
||||
|
||||
expect(style.getPropertyValue('--md-typeset-font-size')).toBe('18.4px');
|
||||
|
||||
@@ -73,7 +73,7 @@ describe('TextSize', () => {
|
||||
|
||||
expect(slider).toHaveTextContent('100%');
|
||||
|
||||
style = getComputedStyle(getByText('TEST_CONTENT'));
|
||||
style = window.getComputedStyle(getByText('TEST_CONTENT'));
|
||||
|
||||
expect(style.getPropertyValue('--md-typeset-font-size')).toBe('16px');
|
||||
});
|
||||
@@ -105,7 +105,7 @@ describe('TextSize', () => {
|
||||
|
||||
expect(slider).toHaveTextContent('115%');
|
||||
|
||||
let style = getComputedStyle(getByText('TEST_CONTENT'));
|
||||
let style = window.getComputedStyle(getByText('TEST_CONTENT'));
|
||||
|
||||
expect(style.getPropertyValue('--md-typeset-font-size')).toBe('18.4px');
|
||||
|
||||
@@ -117,7 +117,7 @@ describe('TextSize', () => {
|
||||
|
||||
expect(slider).toHaveTextContent('100%');
|
||||
|
||||
style = getComputedStyle(getByText('TEST_CONTENT'));
|
||||
style = window.getComputedStyle(getByText('TEST_CONTENT'));
|
||||
|
||||
expect(style.getPropertyValue('--md-typeset-font-size')).toBe('16px');
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@ import { lightTheme } from '@backstage/theme';
|
||||
import { waitFor } from '@testing-library/react';
|
||||
|
||||
const clipboardSpy = jest.fn();
|
||||
Object.defineProperty(navigator, 'clipboard', {
|
||||
Object.defineProperty(window.navigator, 'clipboard', {
|
||||
value: {
|
||||
writeText: clipboardSpy,
|
||||
},
|
||||
|
||||
@@ -49,7 +49,7 @@ const CopyToClipboardButton = ({ text }: CopyToClipboardButtonProps) => {
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
const handleClick = useCallback(() => {
|
||||
navigator.clipboard.writeText(text);
|
||||
window.navigator.clipboard.writeText(text);
|
||||
setOpen(true);
|
||||
}, [text]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user