Skip to content

Commit b86de5e

Browse files
authored
Merge branch 'microsoft:main' into fix/improve-marker-placements
2 parents 021b605 + 7d0b912 commit b86de5e

File tree

871 files changed

+18064
-12591
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

871 files changed

+18064
-12591
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@
3333
**/test/unit/assert.js
3434
**/test/automation/out/**
3535
**/typings/**
36+
!.vscode
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import * as eslint from 'eslint';
7+
8+
/**
9+
* Checks for potentially unsafe usage of `DisposableStore` / `MutableDisposable`.
10+
*
11+
* These have been the source of leaks in the past.
12+
*/
13+
export = new class implements eslint.Rule.RuleModule {
14+
15+
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
16+
function checkVariableDeclaration(inNode: any) {
17+
context.report({
18+
node: inNode,
19+
message: `Use const for 'DisposableStore' to avoid leaks by accidental reassignment.`
20+
});
21+
}
22+
23+
function checkProperty(inNode: any) {
24+
context.report({
25+
node: inNode,
26+
message: `Use readonly for DisposableStore/MutableDisposable to avoid leaks through accidental reassignment.`
27+
});
28+
}
29+
30+
return {
31+
'VariableDeclaration[kind!="const"] NewExpression[callee.name="DisposableStore"]': checkVariableDeclaration,
32+
33+
'PropertyDefinition[readonly!=true][typeAnnotation.typeAnnotation.typeName.name=/DisposableStore|MutableDisposable/]': checkProperty,
34+
'PropertyDefinition[readonly!=true] NewExpression[callee.name=/DisposableStore|MutableDisposable/]': checkProperty,
35+
};
36+
}
37+
};
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import * as eslint from 'eslint';
7+
import { TSESTree } from '@typescript-eslint/experimental-utils';
8+
9+
/**
10+
* Enforces that all parameter properties have an explicit access modifier (public, protected, private).
11+
*
12+
* This catches a common bug where a service is accidentally made public by simply writing: `readonly prop: Foo`
13+
*/
14+
export = new class implements eslint.Rule.RuleModule {
15+
16+
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
17+
function check(inNode: any) {
18+
const node: TSESTree.TSParameterProperty = inNode;
19+
20+
// For now, only apply to injected services
21+
const firstDecorator = node.decorators?.at(0);
22+
if (
23+
firstDecorator?.expression.type !== 'Identifier'
24+
|| !firstDecorator.expression.name.endsWith('Service')
25+
) {
26+
return;
27+
}
28+
29+
if (!node.accessibility) {
30+
context.report({
31+
node: inNode,
32+
message: 'Parameter properties must have an explicit access modifier.'
33+
});
34+
}
35+
}
36+
37+
return {
38+
['TSParameterProperty']: check,
39+
};
40+
}
41+
};

.eslintrc.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@
7070
],
7171
"local/code-translation-remind": "warn",
7272
"local/code-no-native-private": "warn",
73+
"local/code-parameter-properties-must-have-explicit-accessibility": "warn",
7374
"local/code-no-nls-in-standalone-editor": "warn",
75+
"local/code-no-potentially-unsafe-disposables": "warn",
7476
"local/code-no-standalone-editor": "warn",
7577
"local/code-no-unexternalized-strings": "warn",
7678
"local/code-must-use-super-dispose": "warn",
@@ -856,7 +858,11 @@
856858
}, // TODO@layers
857859
"tas-client-umd", // node module allowed even in /common/
858860
"vscode-textmate", // node module allowed even in /common/
859-
"@vscode/vscode-languagedetection" // node module allowed even in /common/
861+
"@vscode/vscode-languagedetection", // node module allowed even in /common/
862+
{
863+
"when": "hasBrowser",
864+
"pattern": "@xterm/xterm"
865+
} // node module allowed even in /browser/
860866
]
861867
},
862868
{

.vscode/extensions/vscode-selfhost-test-provider/src/coverageProvider.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
/*---------------------------------------------------------
2-
* Copyright (C) Microsoft Corporation. All rights reserved.
3-
*--------------------------------------------------------*/
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
45

56
import { IstanbulCoverageContext } from 'istanbul-to-vscode';
67

.vscode/extensions/vscode-selfhost-test-provider/src/debounce.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
/*---------------------------------------------------------
2-
* Copyright (C) Microsoft Corporation. All rights reserved.
3-
*--------------------------------------------------------*/
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
45

56
/**
67
* Debounces the function call for an interval.

.vscode/extensions/vscode-selfhost-test-provider/src/extension.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
/*---------------------------------------------------------
2-
* Copyright (C) Microsoft Corporation. All rights reserved.
3-
*--------------------------------------------------------*/
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
45

56
import { randomBytes } from 'crypto';
67
import { tmpdir } from 'os';

.vscode/extensions/vscode-selfhost-test-provider/src/failingDeepStrictEqualAssertFixer.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
/*---------------------------------------------------------
2-
* Copyright (C) Microsoft Corporation. All rights reserved.
3-
*--------------------------------------------------------*/
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
45

56
import * as ts from 'typescript';
67
import {
@@ -98,15 +99,15 @@ const formatJsonValue = (value: unknown) => {
9899
context => (node: ts.Node) => {
99100
const visitor = (node: ts.Node): ts.Node =>
100101
ts.isPropertyAssignment(node) &&
101-
ts.isStringLiteralLike(node.name) &&
102-
identifierLikeRe.test(node.name.text)
102+
ts.isStringLiteralLike(node.name) &&
103+
identifierLikeRe.test(node.name.text)
103104
? ts.factory.createPropertyAssignment(
104-
ts.factory.createIdentifier(node.name.text),
105-
ts.visitNode(node.initializer, visitor) as ts.Expression
106-
)
105+
ts.factory.createIdentifier(node.name.text),
106+
ts.visitNode(node.initializer, visitor) as ts.Expression
107+
)
107108
: ts.isStringLiteralLike(node) && node.text === '[undefined]'
108-
? ts.factory.createIdentifier('undefined')
109-
: ts.visitEachChild(node, visitor, context);
109+
? ts.factory.createIdentifier('undefined')
110+
: ts.visitEachChild(node, visitor, context);
110111

111112
return ts.visitNode(node, visitor);
112113
},
@@ -189,7 +190,7 @@ class StrictEqualAssertion {
189190
return undefined;
190191
}
191192

192-
constructor(private readonly expression: ts.CallExpression) {}
193+
constructor(private readonly expression: ts.CallExpression) { }
193194

194195
/** Gets the expected value */
195196
public get expectedValue(): ts.Expression | undefined {

.vscode/extensions/vscode-selfhost-test-provider/src/memoize.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
/*---------------------------------------------------------
2-
* Copyright (C) Microsoft Corporation. All rights reserved.
3-
*--------------------------------------------------------*/
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
45

56
export const memoizeLast = <A, T>(fn: (args: A) => T): ((args: A) => T) => {
67
let last: { arg: A; result: T } | undefined;

.vscode/extensions/vscode-selfhost-test-provider/src/metadata.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
/*---------------------------------------------------------
2-
* Copyright (C) Microsoft Corporation. All rights reserved.
3-
*--------------------------------------------------------*/
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
45
import { TestMessage } from 'vscode';
56

67
export interface TestMessageMetadata {

0 commit comments

Comments
 (0)