Skip to content

Commit fd63cf6

Browse files
authored
Merge branch 'main' into singleLineDeindent
2 parents a99fb2c + b2ab524 commit fd63cf6

File tree

2,708 files changed

+152815
-96731
lines changed

Some content is hidden

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

2,708 files changed

+152815
-96731
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
2+
# Reference: https://github.com/microsoft/vscode/wiki/How-to-Contribute
3+
properties:
4+
resources:
5+
- resource: Microsoft.WinGet.DSC/WinGetPackage
6+
directives:
7+
description: Install Git
8+
allowPrerelease: true
9+
settings:
10+
id: Git.Git
11+
source: winget
12+
- resource: Microsoft.WinGet.DSC/WinGetPackage
13+
id: npm
14+
directives:
15+
description: Install NodeJS version >=16.17.x and <17
16+
allowPrerelease: true
17+
settings:
18+
id: OpenJS.NodeJS.LTS
19+
version: "16.20.0"
20+
source: winget
21+
- resource: NpmDsc/NpmPackage
22+
id: yarn
23+
dependsOn:
24+
- npm
25+
directives:
26+
description: Install Yarn
27+
allowPrerelease: true
28+
settings:
29+
Name: 'yarn'
30+
Global: true
31+
PackageDirectory: '${WinGetConfigRoot}\..\'
32+
- resource: Microsoft.WinGet.DSC/WinGetPackage
33+
directives:
34+
description: Install Python 3.10
35+
allowPrerelease: true
36+
settings:
37+
id: Python.Python.3.10
38+
source: winget
39+
- resource: Microsoft.WinGet.DSC/WinGetPackage
40+
id: vsPackage
41+
directives:
42+
description: Install Visual Studio 2022 (any edition is OK)
43+
allowPrerelease: true
44+
settings:
45+
id: Microsoft.VisualStudio.2022.BuildTools
46+
source: winget
47+
- resource: Microsoft.VisualStudio.DSC/VSComponents
48+
dependsOn:
49+
- vsPackage
50+
directives:
51+
description: Install required VS workloads
52+
allowPrerelease: true
53+
settings:
54+
productId: Microsoft.VisualStudio.Product.BuildTools
55+
channelId: VisualStudio.17.Release
56+
includeRecommended: true
57+
components:
58+
- Microsoft.VisualStudio.Workload.VCTools
59+
- resource: YarnDsc/YarnInstall
60+
dependsOn:
61+
- npm
62+
directives:
63+
description: Install dependencies
64+
allowPrerelease: true
65+
settings:
66+
PackageDirectory: '${WinGetConfigRoot}\..\'
67+
configurationVersion: 0.2.0

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "VS Code",
2+
"name": "Code - OSS with X11/Wayland",
33
"build": {
44
"dockerfile": "Dockerfile"
55
},

.devcontainer/prebuilt/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "Code - OSS",
2+
"name": "Code - OSS with VNC",
33

44
// Image contents: https://github.com/microsoft/vscode-dev-containers/blob/master/repository-containers/images/github.com/microsoft/vscode/.devcontainer/base.Dockerfile
55
"image": "mcr.microsoft.com/vscode/devcontainers/repos/microsoft/vscode:branch-main",
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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 { join } from 'path';
8+
9+
10+
export = new class ApiProviderNaming implements eslint.Rule.RuleModule {
11+
12+
readonly meta: eslint.Rule.RuleMetaData = {
13+
messages: {
14+
amdX: 'Use `import type` for import declarations, use `amdX#importAMDNodeModule` for import expressions'
15+
}
16+
};
17+
18+
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
19+
20+
const modules = new Set<string>();
21+
22+
try {
23+
const { dependencies, optionalDependencies } = require(join(__dirname, '../package.json'));
24+
const all = Object.keys(dependencies).concat(Object.keys(optionalDependencies));
25+
for (const key of all) {
26+
modules.add(key);
27+
}
28+
29+
} catch (e) {
30+
console.error(e);
31+
throw e;
32+
}
33+
34+
35+
const checkImport = (node: any) => {
36+
37+
if (node.type !== 'Literal' || typeof node.value !== 'string') {
38+
return;
39+
}
40+
41+
if (node.parent.importKind === 'type') {
42+
return;
43+
}
44+
45+
if (!modules.has(node.value)) {
46+
return;
47+
}
48+
49+
context.report({
50+
node,
51+
messageId: 'amdX'
52+
});
53+
}
54+
55+
return {
56+
['ImportExpression Literal']: checkImport,
57+
['ImportDeclaration Literal']: checkImport
58+
};
59+
}
60+
};

.eslintplugin/code-import-patterns.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface ConditionalPattern {
1818

1919
interface RawImportPatternsConfig {
2020
target: string;
21-
layer?: 'common' | 'worker' | 'browser' | 'electron-sandbox' | 'node' | 'electron-browser' | 'electron-main';
21+
layer?: 'common' | 'worker' | 'browser' | 'electron-sandbox' | 'node' | 'electron-main';
2222
test?: boolean;
2323
restrictions: string | (string | ConditionalPattern)[];
2424
}
@@ -77,7 +77,7 @@ export = new class implements eslint.Rule.RuleModule {
7777
return this._optionsCache.get(options)!;
7878
}
7979

80-
type Layer = 'common' | 'worker' | 'browser' | 'electron-sandbox' | 'node' | 'electron-browser' | 'electron-main';
80+
type Layer = 'common' | 'worker' | 'browser' | 'electron-sandbox' | 'node' | 'electron-main';
8181

8282
interface ILayerRule {
8383
layer: Layer;
@@ -96,7 +96,6 @@ export = new class implements eslint.Rule.RuleModule {
9696
{ layer: 'browser', deps: orSegment(['common', 'browser']), isBrowser: true },
9797
{ layer: 'electron-sandbox', deps: orSegment(['common', 'browser', 'electron-sandbox']), isBrowser: true },
9898
{ layer: 'node', deps: orSegment(['common', 'node']), isNode: true },
99-
{ layer: 'electron-browser', deps: orSegment(['common', 'browser', 'node', 'electron-sandbox', 'electron-browser']), isBrowser: true, isNode: true },
10099
{ layer: 'electron-main', deps: orSegment(['common', 'node', 'electron-main']), isNode: true },
101100
];
102101

@@ -181,8 +180,9 @@ export = new class implements eslint.Rule.RuleModule {
181180
const restrictions = (typeof option.restrictions === 'string' ? [option.restrictions] : option.restrictions).slice(0);
182181

183182
if (targetIsVS) {
184-
// Always add "vs/nls"
183+
// Always add "vs/nls" and "vs/amdX"
185184
restrictions.push('vs/nls');
185+
restrictions.push('vs/amdX'); // TODO@jrieken remove after ESM is real
186186
}
187187

188188
if (targetIsVS && option.layer) {
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
export = new class ApiProviderNaming implements eslint.Rule.RuleModule {
9+
10+
readonly meta: eslint.Rule.RuleMetaData = {
11+
messages: {
12+
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',
13+
}
14+
};
15+
16+
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
17+
18+
return {
19+
['PropertyDefinition PrivateIdentifier']: (node: any) => {
20+
context.report({
21+
node,
22+
messageId: 'slow'
23+
});
24+
},
25+
['MethodDefinition PrivateIdentifier']: (node: any) => {
26+
context.report({
27+
node,
28+
messageId: 'slow'
29+
});
30+
}
31+
};
32+
}
33+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
export = new class ApiTypeDiscrimination implements eslint.Rule.RuleModule {
10+
11+
readonly meta: eslint.Rule.RuleMetaData = {
12+
docs: { url: 'https://github.com/microsoft/vscode/wiki/Extension-API-guidelines' },
13+
messages: {
14+
noTypeDiscrimination: 'Do not use type descrimination properties'
15+
}
16+
};
17+
18+
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
19+
return {
20+
['TSPropertySignature[optional=undefined] TSTypeAnnotation TSLiteralType Literal']: (node: any) => {
21+
22+
const raw = String((<TSESTree.Literal>node).raw)
23+
24+
if (/^('|").*\1$/.test(raw)) {
25+
26+
context.report({
27+
node: node,
28+
messageId: 'noTypeDiscrimination'
29+
});
30+
}
31+
}
32+
}
33+
}
34+
};

0 commit comments

Comments
 (0)