Files
vscode/test/unit/electron/preload.js
T
Dmitriy VasyuraandCopilot d4a4a264ec eslint: fix bracket notation in test infrastructure (#334773)
* eslint: enable no bracket notation rule

Enable code-no-bracket-notation-for-identifiers for JavaScript and TypeScript files while grandfathering the 509 files with existing violations in a CODEOWNERS-gated allowlist.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* eslint: update bracket allowlist owners

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* eslint: group bracket notation exclusions

Organize the existing baseline by feature area so cleanup can be tracked and assigned without changing the excluded file set.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* eslint: test no bracket notation rule

Add RuleTester coverage for valid accesses, diagnostics, and autofix edge cases. Preserve escaped string-literal property names by checking their raw source before reporting.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* eslint: fix bracket notation in test infrastructure

Replace identifier-safe bracket notation across test infrastructure and remove the completed group from the temporary allowlist.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-07 14:10:27 +00:00

93 lines
2.0 KiB
JavaScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// @ts-check
(function () {
'use strict';
const { ipcRenderer, webFrame, contextBridge, webUtils } = require('electron');
const globals = {
ipcRenderer: {
send(channel, ...args) {
ipcRenderer.send(channel, ...args);
},
invoke(channel, ...args) {
return ipcRenderer.invoke(channel, ...args);
},
on(channel, listener) {
ipcRenderer.on(channel, listener);
return this;
},
once(channel, listener) {
ipcRenderer.once(channel, listener);
return this;
},
removeListener(channel, listener) {
ipcRenderer.removeListener(channel, listener);
return this;
}
},
webFrame: {
setZoomLevel(level) {
if (typeof level === 'number') {
webFrame.setZoomLevel(level);
}
}
},
webUtils: {
getPathForFile(file) {
return webUtils.getPathForFile(file);
}
},
process: {
get platform() { return process.platform; },
get arch() { return process.arch; },
get env() { return { ...process.env }; },
get versions() { return process.versions; },
get type() { return 'renderer'; },
get execPath() { return process.execPath; },
cwd() {
return process.env.VSCODE_CWD || process.execPath.substr(0, process.execPath.lastIndexOf(process.platform === 'win32' ? '\\' : '/'));
},
getProcessMemoryInfo() {
return process.getProcessMemoryInfo();
},
on(type, callback) {
// @ts-ignore
process.on(type, callback);
}
},
};
if (process.contextIsolated) {
try {
contextBridge.exposeInMainWorld('vscode', globals);
} catch (error) {
console.error(error);
}
} else {
// @ts-ignore
window.vscode = globals;
}
}());