This commit is contained in:
Matt Bierner 2024-10-02 17:22:33 -07:00
Родитель 489c180f25
Коммит f22a1167e4
32 изменённых файлов: 145 добавлений и 1337 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -194,6 +194,8 @@ module.exports.tsFormattingFilter = [
module.exports.eslintFilter = [
'**/*.js',
'**/*.cjs',
'**/*.mjs',
'**/*.ts',
...require(join(__dirname, '..', '.eslintignore.json'))
.map(line => line.startsWith('!') ? line.slice(1) : `!${line}`)

Просмотреть файл

@ -15,7 +15,7 @@ const fancyLog = require('fancy-log');
* @returns {stream} gulp file stream
*/
function eslint(action) {
const linter = new ESLint();
const linter = new ESLint({});
const formatter = linter.loadFormatter('compact');
const results = [];

Просмотреть файл

@ -411,7 +411,6 @@ function createTscCompileTask(watch) {
/** @type {NodeJS.ReadWriteStream | undefined} */
let report;
// eslint-disable-next-line no-control-regex
const magic = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g; // https://stackoverflow.com/questions/25245716/remove-all-ansi-colors-styles-from-strings
child.stdout.on('data', data => {

Просмотреть файл

@ -62,6 +62,7 @@ function hygiene(some, linting = true) {
}
}
// Please do not add symbols that resemble ASCII letters!
// eslint-disable-next-line no-misleading-character-class
const m = /([^\t\n\r\x20-\x7E⊃⊇✔✓🎯⚠🛑🔴🚗🚙🚕🎉✨❗⇧⌥⌘×÷¦⋯…↑↓→→←↔⟷·•●◆▼⟪⟫┌└├⏎↩√φ]+)/g.exec(line);
if (m) {
console.error(

Просмотреть файл

@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
//@ts-check
const fs = require('fs');
const path = require('path');
@ -15,41 +14,26 @@ pluginHeader.rules.header.meta.schema = false;
const ignores = JSON.parse(fs.readFileSync(path.join(__dirname, '.eslintignore.json'), 'utf8').toString());
module.exports = tseslint.config(
// Global ignores
{
// Global ignores
ignores,
},
{
files: [
'src/**/*.ts',
'**/*.ts',
],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
project: path.join(__dirname, 'src', 'tsconfig.json'),
}
},
plugins: {
'@stylistic/ts': stylisticTs,
'@typescript-eslint': tseslint.plugin,
'local': require('eslint-plugin-local'),
'header': pluginHeader,
'jsdoc': require('eslint-plugin-jsdoc'),
},
rules: {
'@stylistic/ts/semi': 'warn',
'@stylistic/ts/member-delimiter-style': 'warn',
'@typescript-eslint/naming-convention': [
'warn',
{
'selector': 'class',
'format': [
'PascalCase'
]
}
],
'local/code-no-unused-expressions': [
'warn',
{
@ -61,6 +45,34 @@ module.exports = tseslint.config(
}
},
{
files: [
'src/**/*.ts',
],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: path.join(__dirname, 'src', 'tsconfig.json'),
}
},
plugins: {
'@typescript-eslint': tseslint.plugin,
},
rules: {
'@typescript-eslint/naming-convention': [
'warn',
{
'selector': 'class',
'format': [
'PascalCase'
]
}
]
}
},
{
languageOptions: {
parser: tseslint.parser,
},
plugins: {
'local': require('eslint-plugin-local'),
'header': pluginHeader,
@ -90,7 +102,6 @@ module.exports = tseslint.config(
'no-throw-literal': 'warn',
'no-unsafe-finally': 'warn',
'no-unused-labels': 'warn',
'no-control-regex': 'warn',
'no-misleading-character-class': 'warn',
'no-restricted-globals': [
'warn',
@ -380,6 +391,10 @@ module.exports = tseslint.config(
'selector': `BinaryExpression[operator='instanceof'][right.name=/^HTML\\w+/]`,
'message': 'Use DOM.isHTMLElement() and related methods to support multi-window scenarios.'
},
{
'selector': `BinaryExpression[operator='instanceof'][right.name=/^SVG\\w+/]`,
'message': 'Use DOM.isSVGElement() and related methods to support multi-window scenarios.'
},
{
'selector': `BinaryExpression[operator='instanceof'][right.name='KeyboardEvent']`,
'message': 'Use DOM.isKeyboardEvent() to support multi-window scenarios.'
@ -1313,5 +1328,82 @@ module.exports = tseslint.config(
}
]
}
},
// Terminal
{
files: [
'src/vs/workbench/contrib/terminal/**/*.ts'
],
languageOptions: {
parser: tseslint.parser,
},
rules: {
'@typescript-eslint/naming-convention': [
'warn',
// variableLike
{ 'selector': 'variable', 'format': ['camelCase', 'UPPER_CASE', 'PascalCase'] },
{ 'selector': 'variable', 'filter': '^I.+Service$', 'format': ['PascalCase'], 'prefix': ['I'] },
// memberLike
{ 'selector': 'memberLike', 'modifiers': ['private'], 'format': ['camelCase'], 'leadingUnderscore': 'require' },
{ 'selector': 'memberLike', 'modifiers': ['protected'], 'format': ['camelCase'], 'leadingUnderscore': 'require' },
{ 'selector': 'enumMember', 'format': ['PascalCase'] },
// memberLike - Allow enum-like objects to use UPPER_CASE
{ 'selector': 'method', 'modifiers': ['public'], 'format': ['camelCase', 'UPPER_CASE'] },
// typeLike
{ 'selector': 'typeLike', 'format': ['PascalCase'] },
{ 'selector': 'interface', 'format': ['PascalCase'] }
]
}
},
// markdown-language-features
{
files: [
'extensions/markdown-language-features/**/*.ts',
],
languageOptions: {
parser: tseslint.parser,
},
plugins: {
'@typescript-eslint': tseslint.plugin,
},
rules: {
'@typescript-eslint/naming-convention': [
'warn',
{
'selector': 'default',
'modifiers': ['private'],
'format': null,
'leadingUnderscore': 'require'
},
{
'selector': 'default',
'modifiers': ['public'],
'format': null,
'leadingUnderscore': 'forbid'
}
]
}
},
// typescript-language-features
{
files: [
'extensions/typescript-language-features/**/*.ts',
],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: [
'extensions/typescript-language-features/tsconfig.json',
'extensions/typescript-language-features/web/tsconfig.json'
],
}
},
plugins: {
'@typescript-eslint': tseslint.plugin,
},
rules: {
'@typescript-eslint/prefer-optional-chain': 'warn',
'@typescript-eslint/prefer-readonly': 'warn',
}
}
);

Просмотреть файл

@ -1 +0,0 @@
server/

Просмотреть файл

@ -1,19 +0,0 @@
{
"rules": {
"@typescript-eslint/naming-convention": [
"warn",
{
"selector": "default",
"modifiers": ["private"],
"format": null,
"leadingUnderscore": "require"
},
{
"selector": "default",
"modifiers": ["public"],
"format": null,
"leadingUnderscore": "forbid"
}
]
}
}

Просмотреть файл

@ -1,10 +0,0 @@
module.exports = {
"parserOptions": {
"tsconfigRootDir": __dirname,
"project": "./tsconfig.json"
},
"rules": {
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/prefer-readonly": "warn"
}
};

Просмотреть файл

@ -9,7 +9,6 @@ export function equals(one: any, other: any): boolean {
if (one === other) {
return true;
}
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
if (one === null || one === undefined || other === null || other === undefined) {
return false;
}

Просмотреть файл

@ -1,10 +0,0 @@
module.exports = {
"parserOptions": {
"tsconfigRootDir": __dirname,
"project": "./tsconfig.json"
},
"rules": {
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/prefer-readonly": "warn"
}
};

Просмотреть файл

@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable no-restricted-globals */
(function () {
type ISandboxConfiguration = import('vs/base/parts/sandbox/common/sandboxTypes.js').ISandboxConfiguration;

Просмотреть файл

@ -70,10 +70,8 @@ class AMDModuleImporter {
(globalThis as any).define.amd = true;
if (this._isRenderer) {
// eslint-disable-next-line no-restricted-globals
this._amdPolicy = (globalThis as any)._VSCODE_WEB_PACKAGE_TTP ?? window.trustedTypes?.createPolicy('amdLoader', {
createScriptURL(value) {
// eslint-disable-next-line no-restricted-globals
if (value.startsWith(window.location.origin)) {
return value;
}
@ -162,7 +160,6 @@ class AMDModuleImporter {
scriptSrc = this._amdPolicy.createScriptURL(scriptSrc) as any as string;
}
scriptElement.setAttribute('src', scriptSrc);
// eslint-disable-next-line no-restricted-globals
window.document.getElementsByTagName('head')[0].appendChild(scriptElement);
});
}

Просмотреть файл

@ -307,7 +307,6 @@ export class BugIndicatingError extends Error {
// Because we know for sure only buggy code throws this,
// we definitely want to break here and fix the bug.
// eslint-disable-next-line no-debugger
// debugger;
}
}

Просмотреть файл

@ -553,6 +553,7 @@ export class ChannelClient implements IChannelClient, IDisposable {
getChannel<T extends IChannel>(channelName: string): T {
const that = this;
// eslint-disable-next-line local/code-no-dangerous-type-assertions
return {
call(command: string, arg?: any, cancellationToken?: CancellationToken) {
if (that.isDisposed) {
@ -845,6 +846,7 @@ export class IPCServer<TContext = string> implements IChannelServer<TContext>, I
getChannel<T extends IChannel>(channelName: string, routerOrClientFilter: IClientRouter<TContext> | ((client: Client<TContext>) => boolean)): T {
const that = this;
// eslint-disable-next-line local/code-no-dangerous-type-assertions
return {
call(command: string, arg?: any, cancellationToken?: CancellationToken): Promise<T> {
let connectionPromise: Promise<Client<TContext>>;
@ -994,6 +996,7 @@ export class IPCClient<TContext = string> implements IChannelClient, IChannelSer
}
export function getDelayedChannel<T extends IChannel>(promise: Promise<T>): T {
// eslint-disable-next-line local/code-no-dangerous-type-assertions
return {
call(command: string, arg?: any, cancellationToken?: CancellationToken): Promise<T> {
return promise.then(c => c.call<T>(command, arg, cancellationToken));
@ -1010,6 +1013,7 @@ export function getDelayedChannel<T extends IChannel>(promise: Promise<T>): T {
export function getNextTickChannel<T extends IChannel>(channel: T): T {
let didTick = false;
// eslint-disable-next-line local/code-no-dangerous-type-assertions
return {
call<T>(command: string, arg?: any, cancellationToken?: CancellationToken): Promise<T> {
if (didTick) {

Просмотреть файл

@ -3,7 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// eslint-disable-next-line local/code-import-patterns
import { getNLSLanguage, getNLSMessages } from './nls.messages.js';
// eslint-disable-next-line local/code-import-patterns
export { getNLSLanguage, getNLSMessages } from './nls.messages.js';
const isPseudo = getNLSLanguage() === 'pseudo' || (typeof document !== 'undefined' && document.location && typeof document.location.hash === 'string' && document.location.hash.indexOf('pseudo=true') >= 0);

Просмотреть файл

@ -272,6 +272,7 @@ export function parseArgs<T>(args: string[], options: OptionDescriptions<T>, err
const newArgs = args.filter(a => a !== firstArg);
const reporter = errorReporter.getSubcommandReporter ? errorReporter.getSubcommandReporter(firstArg) : undefined;
const subcommandOptions = parseArgs(newArgs, options, reporter);
// eslint-disable-next-line local/code-no-dangerous-type-assertions
return <T>{
[firstArg]: subcommandOptions,
_: []

Просмотреть файл

@ -30,8 +30,6 @@ import { TestParcelWatcher } from './parcelWatcher.test.js';
// mocha but generally). as such they will run only on demand
// whenever we update the watcher library.
/* eslint-disable local/code-ensure-no-disposables-leak-in-test */
suite.skip('File Watcher (node.js)', function () {
this.timeout(10000);

Просмотреть файл

@ -65,8 +65,6 @@ export class TestParcelWatcher extends ParcelWatcher {
// mocha but generally). as such they will run only on demand
// whenever we update the watcher library.
/* eslint-disable local/code-ensure-no-disposables-leak-in-test */
suite.skip('File Watcher (parcel)', function () {
this.timeout(10000);

Просмотреть файл

@ -1146,6 +1146,7 @@ function workbenchTreeDataPreamble<T, TFilterData, TOptions extends IAbstractTre
return {
getTypeNavigationMode,
disposable,
// eslint-disable-next-line local/code-no-dangerous-type-assertions
options: {
// ...options, // TODO@Joao why is this not splatted here?
keyboardSupport: false,

Просмотреть файл

@ -44,6 +44,7 @@ export class CommandDetectionCapability extends Disposable implements ICommandDe
// TODO: as is unsafe here and it duplicates behavor of executingCommand
get executingCommandObject(): ITerminalCommand | undefined {
if (this._currentCommand.commandStartMarker) {
// eslint-disable-next-line local/code-no-dangerous-type-assertions
return { marker: this._currentCommand.commandStartMarker } as ITerminalCommand;
}
return undefined;
@ -430,6 +431,7 @@ export class CommandDetectionCapability extends Disposable implements ICommandDe
this._currentCommand.commandStartX = e.startX;
this._currentCommand.promptStartMarker = e.promptStartLine !== undefined ? this._terminal.registerMarker(e.promptStartLine - (buffer.baseY + buffer.cursorY)) : undefined;
this._cwd = e.cwd;
// eslint-disable-next-line local/code-no-dangerous-type-assertions
this._onCommandStarted.fire({ marker } as ITerminalCommand);
continue;
}
@ -511,6 +513,7 @@ class UnixPtyHeuristics extends Disposable {
}
this._hooks.commandMarkers.length = 0;
// eslint-disable-next-line local/code-no-dangerous-type-assertions
this._hooks.onCommandStartedEmitter.fire({ marker: options?.marker || currentCommand.commandStartMarker, markProperties: options?.markProperties } as ITerminalCommand);
this._logService.debug('CommandDetectionCapability#handleCommandStart', currentCommand.commandStartX, currentCommand.commandStartMarker?.line);
}
@ -770,6 +773,7 @@ class WindowsPtyHeuristics extends Disposable {
this._capability.currentCommand.commandStartLineContent = line.translateToString(true);
}
}
// eslint-disable-next-line local/code-no-dangerous-type-assertions
this._hooks.onCommandStartedEmitter.fire({ marker: this._capability.currentCommand.commandStartMarker } as ITerminalCommand);
this._logService.debug('CommandDetectionCapability#_handleCommandStartWindows', this._capability.currentCommand.commandStartX, this._capability.currentCommand.commandStartMarker?.line);
}

Просмотреть файл

@ -44,6 +44,7 @@ export class EditSessionsDataViews extends Disposable {
treeView.dataProvider = this.instantiationService.createInstance(EditSessionDataViewDataProvider);
const viewsRegistry = Registry.as<IViewsRegistry>(Extensions.ViewsRegistry);
// eslint-disable-next-line local/code-no-dangerous-type-assertions
viewsRegistry.registerViews([<ITreeViewDescriptor>{
id: viewId,
name: EDIT_SESSIONS_TITLE,

Просмотреть файл

@ -105,6 +105,7 @@ export class DebugExtensionsContribution extends Disposable implements IWorkbenc
location: ProgressLocation.Notification,
title: nls.localize('debugExtensionHost.progress', "Attaching Debugger To Extension Host"),
}, async p => {
// eslint-disable-next-line local/code-no-dangerous-type-assertions
await this._debugService.startDebugging(undefined, {
type: 'node',
name: nls.localize('debugExtensionHost.launch.name', "Attach Extension Host"),

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -2,6 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable local/code-no-dangerous-type-assertions */
import './media/keybindingsEditor.css';
import { localize } from '../../../../nls.js';

Просмотреть файл

@ -463,6 +463,7 @@ export class ListSettingWidget<TListDataItem extends IListDataItem> extends Abst
}
protected getEmptyItem(): TListDataItem {
// eslint-disable-next-line local/code-no-dangerous-type-assertions
return {
value: {
type: 'string',
@ -624,6 +625,7 @@ export class ListSettingWidget<TListDataItem extends IListDataItem> extends Abst
const updatedInputBoxItem = (): TListDataItem => {
const inputBox = valueInput as InputBox;
// eslint-disable-next-line local/code-no-dangerous-type-assertions
return {
value: {
type: 'string',
@ -633,6 +635,7 @@ export class ListSettingWidget<TListDataItem extends IListDataItem> extends Abst
} as TListDataItem;
};
const updatedSelectBoxItem = (selectedValue: string): TListDataItem => {
// eslint-disable-next-line local/code-no-dangerous-type-assertions
return {
value: {
type: 'enum',

Просмотреть файл

@ -1,19 +0,0 @@
{
"rules": {
"@typescript-eslint/naming-convention": [
"warn",
// variableLike
{ "selector": "variable", "format": ["camelCase", "UPPER_CASE", "PascalCase"] },
{ "selector": "variable", "filter": "^I.+Service$", "format": ["PascalCase"], "prefix": ["I"] },
// memberLike
{ "selector": "memberLike", "modifiers": ["private"], "format": ["camelCase"], "leadingUnderscore": "require" },
{ "selector": "memberLike", "modifiers": ["protected"], "format": ["camelCase"], "leadingUnderscore": "require" },
{ "selector": "enumMember", "format": ["PascalCase"] },
// memberLike - Allow enum-like objects to use UPPER_CASE
{ "selector": "method", "modifiers": ["public"], "format": ["camelCase", "UPPER_CASE"] },
// typeLike
{ "selector": "typeLike", "format": ["PascalCase"] },
{ "selector": "interface", "format": ["PascalCase"] }
]
}
}

Просмотреть файл

@ -42,6 +42,7 @@ export type ITerminalContributionDescription = { readonly id: string } & (
export function registerTerminalContribution<Services extends BrandedService[]>(id: string, ctor: { new(ctx: ITerminalContributionContext, ...services: Services): ITerminalContribution }, canRunInDetachedTerminals?: false): void;
export function registerTerminalContribution<Services extends BrandedService[]>(id: string, ctor: { new(ctx: IDetachedCompatibleTerminalContributionContext, ...services: Services): ITerminalContribution }, canRunInDetachedTerminals: true): void;
export function registerTerminalContribution<Services extends BrandedService[]>(id: string, ctor: { new(ctx: any, ...services: Services): ITerminalContribution }, canRunInDetachedTerminals: boolean = false): void {
// eslint-disable-next-line local/code-no-dangerous-type-assertions
TerminalContributionRegistry.INSTANCE.registerTerminalContribution({ id, ctor, canRunInDetachedTerminals } as ITerminalContributionDescription);
}

Просмотреть файл

@ -273,6 +273,7 @@ export class KeybindingsEditorModel extends EditorModel {
const extensionId = keybindingItem.extensionId ?? (keybindingItem.resolvedKeybinding ? undefined : menuCommand?.source?.id);
source = extensionId ? extensions.get(extensionId) ?? SOURCE_EXTENSION : SOURCE_SYSTEM;
}
// eslint-disable-next-line local/code-no-dangerous-type-assertions
return <IKeybindingItem>{
keybinding: keybindingItem.resolvedKeybinding,
keybindingItem,

9
src/vscode-dts/vscode.d.ts поставляемый
Просмотреть файл

@ -3655,6 +3655,7 @@ declare module 'vscode' {
*
* @param document The document in which the command was invoked.
* @param position The position at which the command was invoked.
* @param context Additional information about the references request.
* @param token A cancellation token.
*
* @returns An array of locations or a thenable that resolves to such. The lack of a result can be
@ -7505,7 +7506,7 @@ declare module 'vscode' {
* must be activated. Check whether {@link TerminalShellExecution.exitCode} is rejected to
* verify whether it was successful.
*
* @param command A command to run.
* @param executable A command to run.
* @param args Arguments to launch the executable with which will be automatically escaped
* based on the executable type.
*
@ -11693,8 +11694,8 @@ declare module 'vscode' {
*
* Extensions should fire {@link TreeDataProvider.onDidChangeTreeData onDidChangeTreeData} for any elements that need to be refreshed.
*
* @param dataTransfer The data transfer items of the source of the drag.
* @param target The target tree element that the drop is occurring on. When undefined, the target is the root.
* @param dataTransfer The data transfer items of the source of the drag.
* @param token A cancellation token indicating that the drop has been cancelled.
*/
handleDrop?(target: T | undefined, dataTransfer: DataTransfer, token: CancellationToken): Thenable<void> | void;
@ -17780,7 +17781,7 @@ declare module 'vscode' {
* runs which may still be ongoing, will be marked as outdated and deprioritized
* in the editor's UI.
*
* @param item Item to mark as outdated. If undefined, all the controller's items are marked outdated.
* @param items Item to mark as outdated. If undefined, all the controller's items are marked outdated.
*/
invalidateTestResults(items?: TestItem | readonly TestItem[]): void;
@ -18966,7 +18967,9 @@ declare module 'vscode' {
export interface ChatFollowupProvider {
/**
* Provide followups for the given result.
*
* @param result This object has the same properties as the result returned from the participant callback, including `metadata`, but is not the same instance.
* @param context Extra context passed to a participant.
* @param token A cancellation token.
*/
provideFollowups(result: ChatResult, context: ChatContext, token: CancellationToken): ProviderResult<ChatFollowup[]>;

Просмотреть файл

@ -353,6 +353,7 @@ declare module 'vscode' {
}
export interface ChatEditorAction {
// eslint-disable-next-line local/vscode-dts-string-type-literals
kind: 'editor';
accepted: boolean;
}

Просмотреть файл

@ -12,11 +12,13 @@ declare module 'vscode' {
}
export interface ConversationRequest {
// eslint-disable-next-line local/vscode-dts-string-type-literals
readonly type: 'request';
readonly message: string;
}
export interface ConversationResponse {
// eslint-disable-next-line local/vscode-dts-string-type-literals
readonly type: 'response';
readonly message: string;
readonly result?: ChatResult;