Skip to content

Commit

Permalink
Merge pull request #448 from RomanNikitenko/align-with-upstream
Browse files Browse the repository at this point in the history
chore: Align with upstream
  • Loading branch information
RomanNikitenko authored Nov 13, 2024
2 parents 865494c + 511e4ca commit 25fd414
Show file tree
Hide file tree
Showing 1,108 changed files with 35,131 additions and 29,378 deletions.
1 change: 0 additions & 1 deletion code/.eslintignore → code/.eslint-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
**/src/vs/base/test/common/filters.perf.data.js
**/src/vs/loader.js
**/test/unit/assert.js
**/test/unit/assert-esm.js
**/test/automation/out/**
**/typings/**
!.vscode
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -249,7 +250,7 @@ export = new class implements eslint.Rule.RuleModule {
const relativeFilename = getRelativeFilename(context);
importPath = path.posix.join(path.posix.dirname(relativeFilename), importPath);
if (/^src\/vs\//.test(importPath)) {
// resolve using AMD base url
// resolve using base url
importPath = importPath.substring('src/'.length);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
*--------------------------------------------------------------------------------------------*/

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,
TSESTree.AST_NODE_TYPES.VariableDeclarator,
]);

export = new class MustUseResults implements eslint.Rule.RuleModule {
readonly meta: eslint.Rule.RuleMetaData = {
schema: false
}

create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand All @@ -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 + '.')) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

//------------------------------------------------------------------------------
Expand Down Expand Up @@ -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}` });
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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 {
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions code/.eslint-plugin-local/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "commonjs"
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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).+/;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading

0 comments on commit 25fd414

Please sign in to comment.