Skip to content

Commit 0ace61c

Browse files
committed
Merge branch 'master' into fix32484-2
2 parents 3d8a9c8 + f807b57 commit 0ace61c

File tree

1,576 files changed

+98919
-25630
lines changed

Some content is hidden

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

1,576 files changed

+98919
-25630
lines changed

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"simple-indent": "error",
5555
"debug-assert": "error",
5656
"no-keywords": "error",
57+
"one-namespace-per-file": "error",
5758

5859
// eslint-plugin-import
5960
"import/no-extraneous-dependencies": ["error", { "optionalDependencies": false }],

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ contact_links:
55
about: Please ask and answer questions here.
66
- name: TypeScript FAQ
77
url: https://github.com/microsoft/TypeScript/wiki/FAQ
8-
about: Please check the FAQ before filing new issues
8+
about: Please check the FAQ before filing new issues
9+
- name: Website
10+
url: https://github.com/microsoft/TypeScript-Website/issues/new
11+
about: Please raise issues about the site on it's own repo.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter
9090
tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter
9191
tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter
9292
tests/cases/user/create-react-app/create-react-app
93+
tests/cases/user/fp-ts/fp-ts
9394
tests/cases/user/webpack/webpack
9495
tests/cases/user/puppeteer/puppeteer
9596
tests/cases/user/axios-src/axios-src

CONTRIBUTING.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,27 +63,27 @@ TypeScript is currently accepting contributions in the form of bug fixes. A bug
6363

6464
## Contributing features
6565

66-
Features (things that add new or improved functionality to TypeScript) may be accepted, but will need to first be approved ([labelled "help wanted"](https://github.com/Microsoft/TypeScript/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22 or in the "Backlog" milestone) by a TypeScript project maintainer) in the suggestion issue. Features with language design impact, or that are adequately satisfied with external tools, will not be accepted.
66+
Features (things that add new or improved functionality to TypeScript) may be accepted, but will need to first be approved (labelled ["help wanted"](https://github.com/Microsoft/TypeScript/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) or in the "Backlog" milestone) by a TypeScript project maintainer) in the suggestion issue. Features with language design impact, or that are adequately satisfied with external tools, will not be accepted.
6767

6868
Design changes will not be accepted at this time. If you have a design change proposal, please log a suggestion issue.
6969

7070
## Legal
7171

7272
You will need to complete a Contributor License Agreement (CLA). Briefly, this agreement testifies that you are granting us permission to use the submitted change according to the terms of the project's license, and that the work being submitted is under appropriate copyright.
7373

74-
Please submit a Contributor License Agreement (CLA) before submitting a pull request. You may visit https://cla.microsoft.com to sign digitally. Alternatively, download the agreement ([Microsoft Contribution License Agreement.pdf](https://opensource.microsoft.com/pdf/microsoft-contribution-license-agreement.pdf)), sign, scan, and email it back to <[email protected]>. Be sure to include your GitHub user name along with the agreement. Once we have received the signed CLA, we'll review the request.
74+
Please submit a Contributor License Agreement (CLA) before submitting a pull request. You may visit https://cla.microsoft.com to sign digitally. Alternatively, download the agreement ([Microsoft Contribution License Agreement.pdf](https://opensource.microsoft.com/pdf/microsoft-contribution-license-agreement.pdf)), sign, scan, and email it back to <[email protected]>. Be sure to include your GitHub user name along with the agreement. Once we have received the signed CLA, we'll review the request.
7575

7676
## Housekeeping
7777

78-
Your pull request should:
78+
Your pull request should:
7979

8080
* Include a description of what your change intends to do
81-
* Be a child commit of a reasonably recent commit in the **master** branch
81+
* Be a child commit of a reasonably recent commit in the **master** branch
8282
* Requests need not be a single commit, but should be a linear sequence of commits (i.e. no merge commits in your PR)
8383
* It is desirable, but not necessary, for the tests to pass at each commit
84-
* Have clear commit messages
84+
* Have clear commit messages
8585
* e.g. "Minor refactor in goToTypeDefinition", "Fix iterated type in for-await-of", "Add test for preserveWatchOutput on command line"
86-
* Include adequate tests
86+
* Include adequate tests
8787
* At least one test should fail in the absence of your non-test code changes. If your PR does not match this criteria, please specify why
8888
* Tests should include reasonable permutations of the target fix/change
8989
* Include baseline changes with your change
@@ -133,7 +133,7 @@ e.g. to run all compiler baseline tests:
133133
gulp runtests --tests=compiler
134134
```
135135

136-
or to run a specific test: `tests\cases\compiler\2dArrays.ts`
136+
or to run a specific test: `tests\cases\compiler\2dArrays.ts`
137137

138138
```Shell
139139
gulp runtests --tests=2dArrays

Gulpfile.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,6 @@ task("runtests-parallel").flags = {
477477
" --workers=<number>": "The number of parallel workers to use.",
478478
" --timeout=<ms>": "Overrides the default test timeout.",
479479
" --built": "Compile using the built version of the compiler.",
480-
" --skipPercent=<number>": "Skip expensive tests with <percent> chance to miss an edit. Default 5%.",
481480
" --shards": "Total number of shards running tests (default: 1)",
482481
" --shardId": "1-based ID of this shard (default: 1)",
483482
};
@@ -588,15 +587,15 @@ task("generate-spec").description = "Generates a Markdown version of the Languag
588587
task("clean", series(parallel(cleanTasks), cleanBuilt));
589588
task("clean").description = "Cleans build outputs";
590589

591-
const configureNightly = () => exec(process.execPath, ["scripts/configurePrerelease.js", "dev", "package.json", "src/compiler/core.ts"]);
590+
const configureNightly = () => exec(process.execPath, ["scripts/configurePrerelease.js", "dev", "package.json", "src/compiler/corePublic.ts"]);
592591
task("configure-nightly", series(buildScripts, configureNightly));
593592
task("configure-nightly").description = "Runs scripts/configurePrerelease.ts to prepare a build for nightly publishing";
594593

595-
const configureInsiders = () => exec(process.execPath, ["scripts/configurePrerelease.js", "insiders", "package.json", "src/compiler/core.ts"]);
594+
const configureInsiders = () => exec(process.execPath, ["scripts/configurePrerelease.js", "insiders", "package.json", "src/compiler/corePublic.ts"]);
596595
task("configure-insiders", series(buildScripts, configureInsiders));
597596
task("configure-insiders").description = "Runs scripts/configurePrerelease.ts to prepare a build for insiders publishing";
598597

599-
const configureExperimental = () => exec(process.execPath, ["scripts/configurePrerelease.js", "experimental", "package.json", "src/compiler/core.ts"]);
598+
const configureExperimental = () => exec(process.execPath, ["scripts/configurePrerelease.js", "experimental", "package.json", "src/compiler/corePublic.ts"]);
600599
task("configure-experimental", series(buildScripts, configureExperimental));
601600
task("configure-experimental").description = "Runs scripts/configurePrerelease.ts to prepare a build for experimental publishing";
602601

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@
9292
"prex": "^0.4.3",
9393
"q": "latest",
9494
"remove-internal": "^2.9.2",
95-
"simple-git": "^1.113.0",
9695
"source-map-support": "latest",
9796
"through2": "latest",
9897
"travis-fold": "latest",
@@ -117,8 +116,7 @@
117116
"lint:ci": "gulp lint --ci",
118117
"lint:compiler": "gulp lint-compiler",
119118
"lint:scripts": "gulp lint-scripts",
120-
"setup-hooks": "node scripts/link-hooks.js",
121-
"update-costly-tests": "node scripts/costly-tests.js"
119+
"setup-hooks": "node scripts/link-hooks.js"
122120
},
123121
"browser": {
124122
"fs": false,

scripts/build/options.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@ const os = require("os");
44

55
/** @type {CommandLineOptions} */
66
module.exports = minimist(process.argv.slice(2), {
7-
boolean: ["debug", "dirty", "inspect", "light", "colors", "lint", "lkg", "soft", "fix", "failed", "keepFailed", "force", "built"],
8-
string: ["browser", "tests", "host", "reporter", "stackTraceLimit", "timeout", "shards", "shardId"],
7+
boolean: ["debug", "dirty", "light", "colors", "lint", "lkg", "soft", "fix", "failed", "keepFailed", "force", "built"],
8+
string: ["browser", "tests", "inspect", "host", "reporter", "stackTraceLimit", "timeout", "shards", "shardId"],
99
alias: {
1010
"b": "browser",
11-
"d": "debug", "debug-brk": "debug",
12-
"i": "inspect", "inspect-brk": "inspect",
13-
"t": "tests", "test": "tests",
14-
"ru": "runners", "runner": "runners",
11+
"d": ["debug", "debug-brk"],
12+
"i": ["inspect", "inspect-brk"],
13+
"t": ["tests", "test"],
14+
"ru": ["runners", "runner"],
1515
"r": "reporter",
16-
"c": "colors", "color": "colors",
17-
"skip-percent": "skipPercent",
16+
"c": ["colors", "color"],
1817
"skippercent": "skipPercent",
1918
"w": "workers",
2019
"f": "fix"
@@ -50,7 +49,6 @@ if (module.exports.built) {
5049
* @typedef TypedOptions
5150
* @property {boolean} debug
5251
* @property {boolean} dirty
53-
* @property {boolean} inspect
5452
* @property {boolean} light
5553
* @property {boolean} colors
5654
* @property {boolean} lint
@@ -60,6 +58,7 @@ if (module.exports.built) {
6058
* @property {boolean} fix
6159
* @property {string} browser
6260
* @property {string} tests
61+
* @property {string} inspect
6362
* @property {string} runners
6463
* @property {string|number} workers
6564
* @property {string} host

scripts/build/tests.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ async function runConsoleTests(runJs, defaultReporter, runInParallel, watchMode,
3131
const inspect = cmdLineOptions.inspect;
3232
const runners = cmdLineOptions.runners;
3333
const light = cmdLineOptions.light;
34-
const skipPercent = process.env.CI === "true" ? 0 : cmdLineOptions.skipPercent;
3534
const stackTraceLimit = cmdLineOptions.stackTraceLimit;
3635
const testConfigFile = "test.config";
3736
const failed = cmdLineOptions.failed;
@@ -65,8 +64,8 @@ async function runConsoleTests(runJs, defaultReporter, runInParallel, watchMode,
6564
testTimeout = 400000;
6665
}
6766

68-
if (tests || runners || light || testTimeout || taskConfigsFolder || keepFailed || skipPercent !== undefined || shards || shardId) {
69-
writeTestConfigFile(tests, runners, light, skipPercent, taskConfigsFolder, workerCount, stackTraceLimit, testTimeout, keepFailed, shards, shardId);
67+
if (tests || runners || light || testTimeout || taskConfigsFolder || keepFailed || shards || shardId) {
68+
writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, testTimeout, keepFailed, shards, shardId);
7069
}
7170

7271
const colors = cmdLineOptions.colors;
@@ -90,11 +89,13 @@ async function runConsoleTests(runJs, defaultReporter, runInParallel, watchMode,
9089
else {
9190
args.push("--no-colors");
9291
}
93-
if (inspect) {
94-
args.unshift("--inspect-brk");
92+
if (inspect !== undefined) {
93+
args.unshift(inspect == "" ? "--inspect-brk" : "--inspect-brk="+inspect);
94+
args.push("-t", "0");
9595
}
9696
else if (debug) {
9797
args.unshift("--debug-brk");
98+
args.push("-t", "0");
9899
}
99100
else {
100101
args.push("-t", "" + testTimeout);
@@ -161,7 +162,6 @@ exports.cleanTestDirs = cleanTestDirs;
161162
* @param {string} tests
162163
* @param {string} runners
163164
* @param {boolean} light
164-
* @param {string} skipPercent
165165
* @param {string} [taskConfigsFolder]
166166
* @param {string | number} [workerCount]
167167
* @param {string} [stackTraceLimit]
@@ -170,12 +170,11 @@ exports.cleanTestDirs = cleanTestDirs;
170170
* @param {number | undefined} [shards]
171171
* @param {number | undefined} [shardId]
172172
*/
173-
function writeTestConfigFile(tests, runners, light, skipPercent, taskConfigsFolder, workerCount, stackTraceLimit, timeout, keepFailed, shards, shardId) {
173+
function writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, timeout, keepFailed, shards, shardId) {
174174
const testConfigContents = JSON.stringify({
175175
test: tests ? [tests] : undefined,
176176
runners: runners ? runners.split(",") : undefined,
177177
light,
178-
skipPercent,
179178
workerCount,
180179
stackTraceLimit,
181180
taskConfigsFolder,

scripts/costly-tests.js

Lines changed: 0 additions & 103 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { AST_NODE_TYPES, TSESTree } from "@typescript-eslint/experimental-utils";
2+
import { createRule } from "./utils";
3+
4+
export = createRule({
5+
name: "one-namespace-per-file",
6+
meta: {
7+
docs: {
8+
description: `Limits each file to having at most one top-level namespace declaration`,
9+
category: "Possible Errors",
10+
recommended: "error",
11+
},
12+
messages: {
13+
excessNamespaceError: `All but one of these namespaces should be moved into seperate files.`,
14+
},
15+
schema: [],
16+
type: "problem",
17+
},
18+
defaultOptions: [],
19+
20+
create(context) {
21+
const isNamespaceDeclaration = (node: TSESTree.Node): node is TSESTree.TSModuleDeclaration => node.type === AST_NODE_TYPES.TSModuleDeclaration;
22+
23+
const checkSourceFile = (node: TSESTree.Program) => {
24+
if (context.getFilename().endsWith(".d.ts")) {
25+
return;
26+
}
27+
const members = node.body;
28+
const namespaces = members.filter(isNamespaceDeclaration);
29+
if (namespaces.length <= 1) {
30+
return;
31+
}
32+
33+
namespaces.forEach(n => {
34+
context.report({
35+
messageId: "excessNamespaceError", node: n
36+
});
37+
});
38+
};
39+
40+
return {
41+
Program: checkSourceFile,
42+
};
43+
},
44+
});

scripts/hooks/post-checkout

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#!/bin/sh
2-
npm run gulp -- generate-diagnostics
1+
#!/bin/sh
2+
npm run gulp -- generate-diagnostics

scripts/post-vsts-artifact-comment.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async function main() {
3333
// so that the playgrounds deployment process can find these comments.
3434

3535
await gh.issues.createComment({
36-
number: +process.env.SOURCE_ISSUE,
36+
issue_number: +process.env.SOURCE_ISSUE,
3737
owner: "Microsoft",
3838
repo: "TypeScript",
3939
body: `Hey @${process.env.REQUESTING_USER}, I've packed this into [an installable tgz](${link}). You can install it for testing by referencing it in your \`package.json\` like so:
@@ -50,8 +50,7 @@ and then running \`npm install\`.
5050

5151
// Temporarily disable until we get access controls set up right
5252
// Send a ping to https://github.com/orta/make-monaco-builds#pull-request-builds
53-
// await gh.request("POST /repos/orta/make-monaco-builds/dispatches",
54-
// { event_type: +process.env.SOURCE_ISSUE, headers: { "Accept": "application/vnd.github.everest-preview+json" }})
53+
await gh.request("POST /repos/orta/make-monaco-builds/dispatches", { event_type: process.env.SOURCE_ISSUE, headers: { Accept: "application/vnd.github.everest-preview+json" }});
5554
}
5655

5756
main().catch(async e => {

0 commit comments

Comments
 (0)