Merge pull request #230345 from microsoft/dev/eslint-9

Eslint 9 migration
This commit is contained in:
Matt Bierner 2024-10-07 09:15:12 -07:00 коммит произвёл GitHub
Родитель 8ec84d0814 7d10ec0123
Коммит e2e048ded8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
77 изменённых файлов: 2207 добавлений и 1974 удалений

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

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

@ -12,7 +12,8 @@ export = new class ApiProviderNaming implements eslint.Rule.RuleModule {
readonly meta: eslint.Rule.RuleMetaData = {
messages: {
amdX: 'Use `import type` for import declarations, use `amdX#importAMDNodeModule` for import expressions'
}
},
schema: false,
};
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

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

@ -8,7 +8,8 @@ import * as eslint from 'eslint';
export = new class DeclareServiceBrand implements eslint.Rule.RuleModule {
readonly meta: eslint.Rule.RuleMetaData = {
fixable: 'code'
fixable: 'code',
schema: false,
};
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

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

@ -13,7 +13,8 @@ export = new class EnsureNoDisposablesAreLeakedInTestSuite implements eslint.Rul
messages: {
ensure: 'Suites should include a call to `ensureNoDisposablesAreLeakedInTestSuite()` to ensure no disposables are leaked in tests.'
},
fixable: 'code'
fixable: 'code',
schema: false,
};
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

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

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as eslint from 'eslint';
import { TSESTree } from '@typescript-eslint/experimental-utils';
import { TSESTree } from '@typescript-eslint/utils';
import * as path from 'path';
import minimatch from 'minimatch';
import { createImportRuleListener } from './utils';
@ -50,7 +50,8 @@ export = new class implements eslint.Rule.RuleModule {
},
docs: {
url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization'
}
},
schema: false,
};
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

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

@ -20,7 +20,18 @@ export = new class implements eslint.Rule.RuleModule {
},
docs: {
url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization'
}
},
schema: [
{
type: 'object',
additionalProperties: {
type: 'array',
items: {
type: 'string'
}
}
}
]
};
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

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

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as eslint from 'eslint';
import { TSESTree } from '@typescript-eslint/experimental-utils';
import { TSESTree } from '@typescript-eslint/utils';
const VALID_USES = new Set<TSESTree.AST_NODE_TYPES | undefined>([
TSESTree.AST_NODE_TYPES.AwaitExpression,
@ -12,6 +12,9 @@ const VALID_USES = new Set<TSESTree.AST_NODE_TYPES | undefined>([
]);
export = new class MustUseResults implements eslint.Rule.RuleModule {
readonly meta: eslint.Rule.RuleMetaData = {
schema: false
}
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

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

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as eslint from 'eslint';
import { TSESTree } from '@typescript-eslint/experimental-utils';
import { TSESTree } from '@typescript-eslint/utils';
export = new class NoDangerousTypeAssertions implements eslint.Rule.RuleModule {

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

@ -10,7 +10,8 @@ export = new class ApiProviderNaming implements eslint.Rule.RuleModule {
readonly meta: eslint.Rule.RuleMetaData = {
messages: {
slow: 'Native private fields are much slower and should only be used when needed. Ignore this warning if you know what you are doing, use compile-time private otherwise. See https://github.com/microsoft/vscode/issues/185991#issuecomment-1614468158 for details',
}
},
schema: false,
};
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

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

@ -12,7 +12,8 @@ export = new class NoNlsInStandaloneEditorRule implements eslint.Rule.RuleModule
readonly meta: eslint.Rule.RuleMetaData = {
messages: {
noNls: 'Not allowed to import vs/nls in standalone editor modules. Use standaloneStrings.ts'
}
},
schema: false,
};
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

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

@ -15,7 +15,8 @@ export = new class NoNlsInStandaloneEditorRule implements eslint.Rule.RuleModule
},
docs: {
url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization'
}
},
schema: false,
};
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

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

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as eslint from 'eslint';
import { TSESTree } from '@typescript-eslint/experimental-utils';
import { TSESTree } from '@typescript-eslint/utils';
/**
* WORKAROUND for https://github.com/evanw/esbuild/issues/3823
@ -15,7 +15,7 @@ export = new class implements eslint.Rule.RuleModule {
function checkProperty(inNode: any) {
const classDeclaration = context.getAncestors().find(node => node.type === 'ClassDeclaration');
const classDeclaration = context.sourceCode.getAncestors(inNode).find(node => node.type === 'ClassDeclaration');
const propertyDefinition = <TSESTree.PropertyDefinition>inNode;
if (!classDeclaration || !classDeclaration.id?.name) {
@ -33,7 +33,7 @@ export = new class implements eslint.Rule.RuleModule {
}
const name = classDeclaration.id.name;
const valueText = context.getSourceCode().getText(<any>propertyDefinition.value)
const valueText = context.sourceCode.getText(<any>propertyDefinition.value)
if (valueText.includes(name + '.')) {

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

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { TSESTree } from '@typescript-eslint/experimental-utils';
import { TSESTree } from '@typescript-eslint/utils';
import * as eslint from 'eslint';
function isCallExpression(node: TSESTree.Node): node is TSESTree.CallExpression {

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

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as eslint from 'eslint';
import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/experimental-utils';
import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/utils';
function isStringLiteral(node: TSESTree.Node | null | undefined): node is TSESTree.StringLiteral {
return !!node && node.type === AST_NODE_TYPES.Literal && typeof node.value === 'string';
@ -24,7 +24,8 @@ export = new class NoUnexternalizedStrings implements eslint.Rule.RuleModule {
badKey: 'The key \'{{key}}\' doesn\'t conform to a valid localize identifier.',
duplicateKey: 'Duplicate key \'{{key}}\' with different message value.',
badMessage: 'Message argument to \'{{message}}\' must be a string literal.'
}
},
schema: false,
};
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

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

@ -12,7 +12,7 @@
*/
import * as eslint from 'eslint';
import { TSESTree } from '@typescript-eslint/experimental-utils';
import { TSESTree } from '@typescript-eslint/utils';
import * as ESTree from 'estree';
//------------------------------------------------------------------------------
@ -141,7 +141,7 @@ module.exports = {
return {
ExpressionStatement(node: TSESTree.ExpressionStatement) {
if (!isValidExpression(node.expression) && !isDirective(node, <TSESTree.Node[]>context.getAncestors())) {
if (!isValidExpression(node.expression) && !isDirective(node, <TSESTree.Node[]>context.sourceCode.getAncestors(node))) {
context.report({ node: <ESTree.Node>node, message: `Expected an assignment or function call and instead saw an expression. ${node.expression}` });
}
}

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

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as eslint from 'eslint';
import { TSESTree } from '@typescript-eslint/experimental-utils';
import { TSESTree } from '@typescript-eslint/utils';
/**
* Enforces that all parameter properties have an explicit access modifier (public, protected, private).

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

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as eslint from 'eslint';
import { TSESTree } from '@typescript-eslint/experimental-utils';
import { TSESTree } from '@typescript-eslint/utils';
import { readFileSync } from 'fs';
import { createImportRuleListener } from './utils';
@ -16,7 +16,8 @@ export = new class TranslationRemind implements eslint.Rule.RuleModule {
readonly meta: eslint.Rule.RuleMetaData = {
messages: {
missing: 'Please add \'{{resource}}\' to ./build/lib/i18n.resources.json file to use translations here.'
}
},
schema: false,
};
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

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

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

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

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

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as eslint from 'eslint';
import { TSESTree } from '@typescript-eslint/experimental-utils';
import { TSESTree } from '@typescript-eslint/utils';
export function createImportRuleListener(validateImport: (node: TSESTree.Literal, value: string) => any): eslint.Rule.RuleListener {

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

@ -4,14 +4,15 @@
*--------------------------------------------------------------------------------------------*/
import * as eslint from 'eslint';
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/experimental-utils';
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
export = new class ApiProviderNaming implements eslint.Rule.RuleModule {
readonly meta: eslint.Rule.RuleMetaData = {
messages: {
noToken: 'Function lacks a cancellation token, preferable as last argument',
}
},
schema: false,
};
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

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

@ -4,13 +4,14 @@
*--------------------------------------------------------------------------------------------*/
import * as eslint from 'eslint';
import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/experimental-utils';
import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/utils';
export = new class ApiLiteralOrTypes implements eslint.Rule.RuleModule {
readonly meta: eslint.Rule.RuleMetaData = {
docs: { url: 'https://github.com/microsoft/vscode/wiki/Extension-API-guidelines#creating-objects' },
messages: { sync: '`createXYZ`-functions are constructor-replacements and therefore must return sync', }
messages: { sync: '`createXYZ`-functions are constructor-replacements and therefore must return sync', },
schema: false,
};
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

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

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as eslint from 'eslint';
import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/experimental-utils';
import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/utils';
export = new class ApiEventNaming implements eslint.Rule.RuleModule {
@ -19,7 +19,8 @@ export = new class ApiEventNaming implements eslint.Rule.RuleModule {
verb: 'Unknown verb \'{{verb}}\' - is this really a verb? Iff so, then add this verb to the configuration',
subject: 'Unknown subject \'{{subject}}\' - This subject has not been used before but it should refer to something in the API',
unknown: 'UNKNOWN event declaration, lint-rule needs tweaking'
}
},
schema: false,
};
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

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

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as eslint from 'eslint';
import { TSESTree } from '@typescript-eslint/experimental-utils';
import { TSESTree } from '@typescript-eslint/utils';
export = new class ApiInterfaceNaming implements eslint.Rule.RuleModule {
@ -13,7 +13,8 @@ export = new class ApiInterfaceNaming implements eslint.Rule.RuleModule {
readonly meta: eslint.Rule.RuleMetaData = {
messages: {
naming: 'Interfaces must not be prefixed with uppercase `I`',
}
},
schema: false,
};
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

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

@ -4,13 +4,14 @@
*--------------------------------------------------------------------------------------------*/
import * as eslint from 'eslint';
import { TSESTree } from '@typescript-eslint/experimental-utils';
import { TSESTree } from '@typescript-eslint/utils';
export = new class ApiLiteralOrTypes implements eslint.Rule.RuleModule {
readonly meta: eslint.Rule.RuleMetaData = {
docs: { url: 'https://github.com/microsoft/vscode/wiki/Extension-API-guidelines#enums' },
messages: { useEnum: 'Use enums, not literal-or-types', }
messages: { useEnum: 'Use enums, not literal-or-types', },
schema: false,
};
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

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

@ -4,14 +4,15 @@
*--------------------------------------------------------------------------------------------*/
import * as eslint from 'eslint';
import { TSESTree } from '@typescript-eslint/experimental-utils';
import { TSESTree } from '@typescript-eslint/utils';
export = new class ApiProviderNaming implements eslint.Rule.RuleModule {
readonly meta: eslint.Rule.RuleMetaData = {
messages: {
naming: 'A provider should only have functions like provideXYZ or resolveXYZ',
}
},
schema: false,
};
private static _providerFunctionNames = /^(provide|resolve|prepare).+/;

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

@ -10,7 +10,8 @@ export = new class ApiEventNaming implements eslint.Rule.RuleModule {
readonly meta: eslint.Rule.RuleMetaData = {
messages: {
comment: 'region comments should start with a camel case identifier, `:`, then either a GH issue link or owner, e.g #region myProposalName: https://github.com/microsoft/vscode/issues/<number>',
}
},
schema: false,
};
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

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

@ -4,21 +4,21 @@
*--------------------------------------------------------------------------------------------*/
import * as eslint from 'eslint';
import { TSESTree } from '@typescript-eslint/experimental-utils';
import { TSESTree } from '@typescript-eslint/utils';
export = new class ApiTypeDiscrimination implements eslint.Rule.RuleModule {
readonly meta: eslint.Rule.RuleMetaData = {
docs: { url: 'https://github.com/microsoft/vscode/wiki/Extension-API-guidelines' },
messages: {
noTypeDiscrimination: 'Do not use type descrimination properties'
}
noTypeDiscrimination: 'Do not use type discrimination properties'
},
schema: false,
};
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
return {
['TSPropertySignature[optional=undefined] TSTypeAnnotation TSLiteralType Literal']: (node: any) => {
['TSPropertySignature[optional=false] TSTypeAnnotation TSLiteralType Literal']: (node: any) => {
const raw = String((<TSESTree.Literal>node).raw)
if (/^('|").*\1$/.test(raw)) {

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

@ -10,7 +10,8 @@ export = new class ApiEventNaming implements eslint.Rule.RuleModule {
readonly meta: eslint.Rule.RuleMetaData = {
messages: {
usage: 'Use the Thenable-type instead of the Promise type',
}
},
schema: false,
};
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

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

@ -11,7 +11,8 @@ export = new class ApiVsCodeInComments implements eslint.Rule.RuleModule {
readonly meta: eslint.Rule.RuleMetaData = {
messages: {
comment: `Don't use the term 'vs code' in comments`
}
},
schema: false,
};
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

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

3
.vscode/settings.json поставляемый
Просмотреть файл

@ -168,5 +168,6 @@
},
"css.format.spaceAroundSelectorSeparator": true,
"typescript.enablePromptUseWorkspaceTsdk": true,
"chat.commandCenter.enabled": true
"chat.commandCenter.enabled": true,
"eslint.useFlatConfig": true
}

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

@ -193,7 +193,7 @@ extends:
eslint:
enabled: true
enableExclusions: true
exclusionsFilePath: $(Build.SourcesDirectory)/.eslintignore
exclusionsFilePath: $(Build.SourcesDirectory)/.eslint-ignore
sourceAnalysisPool: 1es-windows-2022-x64
createAdoIssuesForJustificationsForDisablement: false
containers:

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

@ -195,11 +195,13 @@ module.exports.tsFormattingFilter = [
module.exports.eslintFilter = [
'**/*.js',
'**/*.cjs',
'**/*.mjs',
'**/*.ts',
...readFileSync(join(__dirname, '../.eslintignore'))
.toString().split(/\r\n|\n/)
.filter(line => !line.startsWith('#'))
.filter(line => !!line)
...readFileSync(join(__dirname, '..', '.eslint-ignore'))
.toString()
.split(/\r\n|\n/)
.filter(line => line && !line.startsWith('#'))
.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(

1394
eslint.config.js Normal file

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

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

@ -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"
}
};

1246
package-lock.json сгенерированный

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

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

@ -71,6 +71,7 @@
"@microsoft/1ds-core-js": "^3.2.13",
"@microsoft/1ds-post-js": "^3.2.13",
"@parcel/watcher": "2.1.0",
"@types/semver": "^7.5.8",
"@vscode/deviceid": "^0.1.1",
"@vscode/iconv-lite-umd": "0.7.0",
"@vscode/policy-watcher": "^1.1.8",
@ -112,9 +113,11 @@
},
"devDependencies": {
"@playwright/test": "^1.46.1",
"@stylistic/eslint-plugin-ts": "^2.8.0",
"@swc/core": "1.3.62",
"@types/cookie": "^0.3.3",
"@types/debug": "^4.1.5",
"@types/eslint": "^8.56.10",
"@types/eslint": "^9.6.1",
"@types/gulp-svgmin": "^1.2.1",
"@types/http-proxy-agent": "^2.0.1",
"@types/kerberos": "^1.1.2",
@ -131,9 +134,7 @@
"@types/winreg": "^1.2.30",
"@types/yauzl": "^2.10.0",
"@types/yazl": "^2.4.2",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/experimental-utils": "^5.57.0",
"@typescript-eslint/parser": "^6.21.0",
"@typescript-eslint/utils": "^8.8.0",
"@vscode/gulp-electron": "^1.36.0",
"@vscode/l10n-dev": "0.0.35",
"@vscode/telemetry-extractor": "^1.10.2",
@ -153,10 +154,11 @@
"debounce": "^1.0.0",
"deemon": "^1.8.0",
"electron": "32.1.2",
"eslint": "8.36.0",
"eslint": "^9.11.1",
"eslint-formatter-compact": "^8.40.0",
"eslint-plugin-header": "3.1.1",
"eslint-plugin-jsdoc": "^46.5.0",
"eslint-plugin-local": "^1.0.0",
"eslint-plugin-jsdoc": "^50.3.1",
"eslint-plugin-local": "^6.0.0",
"event-stream": "3.3.4",
"fancy-log": "^1.3.3",
"file-loader": "^6.2.0",
@ -211,6 +213,7 @@
"tsec": "0.2.7",
"tslib": "^2.6.3",
"typescript": "^5.7.0-dev.20240927",
"typescript-eslint": "^8.8.0",
"util": "^0.12.4",
"webpack": "^5.94.0",
"webpack-cli": "^5.1.4",

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

@ -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;
}
}

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

@ -196,7 +196,7 @@ export function validateConstraint(arg: unknown, constraint: TypeConstraint | un
* This can be used to make sure the argument correctly conforms to the subtype while still being able to pass it
* to contexts that expects the supertype.
*/
export function upcast<Base, Sub extends Base>(x: Sub): Base {
export function upcast<Base, Sub extends Base = Base>(x: Sub): Base {
return x;
}

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

@ -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,
_: []

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

@ -24,11 +24,11 @@ export interface IExtensionSignatureVerificationService {
/**
* Verifies an extension file (.vsix) against a signature archive file.
* @param { string } extensionId The extension identifier.
* @param { string } version The extension version.
* @param { string } vsixFilePath The extension file path.
* @param { string } signatureArchiveFilePath The signature archive file path.
* @returns { Promise<IExtensionSignatureVerificationResult | undefined> } returns the verification result or undefined if the verification was not executed.
* @param extensionId The extension identifier.
* @param version The extension version.
* @param vsixFilePath The extension file path.
* @param signatureArchiveFilePath The signature archive file path.
* @returns returns the verification result or undefined if the verification was not executed.
*/
verify(extensionId: string, version: string, vsixFilePath: string, signatureArchiveFilePath: string, clientTargetPlatform?: TargetPlatform): Promise<IExtensionSignatureVerificationResult | undefined>;
}

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

@ -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);
}

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

@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { Event } from '../../../base/common/event.js';
import { upcast } from '../../../base/common/types.js';
import { createDecorator } from '../../instantiation/common/instantiation.js';
export interface IUpdate {
@ -73,12 +74,12 @@ export type Ready = { type: StateType.Ready; update: IUpdate };
export type State = Uninitialized | Disabled | Idle | CheckingForUpdates | AvailableForDownload | Downloading | Downloaded | Updating | Ready;
export const State = {
Uninitialized: { type: StateType.Uninitialized } as Uninitialized,
Disabled: (reason: DisablementReason) => ({ type: StateType.Disabled, reason }) as Disabled,
Idle: (updateType: UpdateType, error?: string) => ({ type: StateType.Idle, updateType, error }) as Idle,
Uninitialized: upcast<Uninitialized>({ type: StateType.Uninitialized }),
Disabled: (reason: DisablementReason): Disabled => ({ type: StateType.Disabled, reason }),
Idle: (updateType: UpdateType, error?: string): Idle => ({ type: StateType.Idle, updateType, error }),
CheckingForUpdates: (explicit: boolean): CheckingForUpdates => ({ type: StateType.CheckingForUpdates, explicit }),
AvailableForDownload: (update: IUpdate): AvailableForDownload => ({ type: StateType.AvailableForDownload, update }),
Downloading: { type: StateType.Downloading } as Downloading,
Downloading: upcast<Downloading>({ type: StateType.Downloading }),
Downloaded: (update: IUpdate): Downloaded => ({ type: StateType.Downloaded, update }),
Updating: (update: IUpdate): Updating => ({ type: StateType.Updating, update }),
Ready: (update: IUpdate): Ready => ({ type: StateType.Ready, update }),

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

@ -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';

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

@ -1,20 +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"] }
],
"comma-dangle": ["warn", "only-multiline"]
}
}

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

@ -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);
}

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

@ -1,20 +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"] }
],
"comma-dangle": ["warn", "only-multiline"]
}
}

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

@ -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;

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

@ -31,7 +31,7 @@ declare module 'vscode' {
* a cell execution or another NotebookExecution is created while another is still active.
*
* This should be used to indicate the {@link NotebookController notebook controller} is busy even though user may not have executed any cell though the UI.
* @param {NotebookDocument} notebook
* @param notebook
* @returns A notebook execution.
*/
createNotebookExecution(notebook: NotebookDocument): NotebookExecution;