Skip to content

Commit 3ae0fa4

Browse files
committed
Merge remote-tracking branch 'origin/main' into iife-used-before-def
2 parents afa5273 + c3c5abb commit 3ae0fa4

File tree

889 files changed

+40493
-38010
lines changed

Some content is hidden

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

889 files changed

+40493
-38010
lines changed

.dprint.jsonc

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"indentWidth": 4,
3+
"lineWidth": 1000,
4+
"newLineKind": "auto",
5+
"useTabs": false,
6+
"typescript": {
7+
"newLineKind": "crlf",
8+
"semiColons": "always",
9+
"quoteStyle": "preferDouble",
10+
"quoteProps": "consistent",
11+
"useBraces": "whenNotSingleLine",
12+
"bracePosition": "sameLineUnlessHanging",
13+
"singleBodyPosition": "sameLine",
14+
"nextControlFlowPosition": "nextLine", // Stroustrup style braces.
15+
"trailingCommas": "onlyMultiLine",
16+
"preferHanging": false,
17+
"operatorPosition": "maintain",
18+
19+
"arrowFunction.useParentheses": "preferNone",
20+
"conditionalExpression.linePerExpression": false, // Keep our "match/case"-ish conditionals.
21+
"functionExpression.spaceAfterFunctionKeyword": true,
22+
"importDeclaration.forceMultiLine": true,
23+
"constructorType.spaceAfterNewKeyword": true,
24+
"constructSignature.spaceAfterNewKeyword": true,
25+
26+
// Let eslint-plugin-simple-import-sort handle this.
27+
"module.sortImportDeclarations": "maintain",
28+
"module.sortExportDeclarations": "maintain",
29+
"exportDeclaration.sortNamedExports": "maintain",
30+
"importDeclaration.sortNamedImports": "maintain"
31+
},
32+
"prettier": {
33+
"associations": [
34+
"**/*.{yaml,yml}"
35+
],
36+
"yml.tabWidth": 2,
37+
"yaml.tabWidth": 2,
38+
"yml.singleQuote": true,
39+
"yaml.singleQuote": true
40+
},
41+
"excludes": [
42+
"**/node_modules",
43+
"**/*-lock.json",
44+
"coverage/**",
45+
"lib/**",
46+
"built/**",
47+
"tests/**",
48+
"internal/**",
49+
"**/*.generated.*",
50+
"scripts/*.d.*"
51+
],
52+
"plugins": [
53+
"https://plugins.dprint.dev/typescript-0.86.1.wasm",
54+
"https://plugins.dprint.dev/prettier-0.27.0.json@3557a62b4507c55a47d8cde0683195b14d13c41dda66d0f0b0e111aed107e2fe"
55+
]
56+
}

.eslintplugin.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ const path = require("path");
33

44
const rulesDir = path.join(__dirname, "scripts", "eslint", "rules");
55
const ext = ".cjs";
6-
const ruleFiles = fs.readdirSync(rulesDir).filter((p) => p.endsWith(ext));
6+
const ruleFiles = fs.readdirSync(rulesDir).filter(p => p.endsWith(ext));
77

88
module.exports = {
9-
rules: Object.fromEntries(ruleFiles.map((p) => {
9+
rules: Object.fromEntries(ruleFiles.map(p => {
1010
return [p.slice(0, -ext.length), require(path.join(rulesDir, p))];
1111
})),
12-
}
12+
};

.eslintrc.json

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@
104104
],
105105

106106
// Todo: For each of these, investigate whether we want to enable them ✨
107-
"prefer-rest-params": "off",
108-
"prefer-spread": "off",
109107
"@typescript-eslint/no-unused-vars": "off",
110108

111109
// Pending https://github.com/typescript-eslint/typescript-eslint/issues/4820
@@ -130,33 +128,7 @@
130128

131129
// eslint-plugin-simple-import-sort
132130
"simple-import-sort/imports": "error",
133-
"simple-import-sort/exports": "error",
134-
135-
// Formatting rules; remove once a formatter enforces these.
136-
"curly": ["error", "multi-line"],
137-
"linebreak-style": ["error", "windows"],
138-
"max-statements-per-line": ["error", { "max": 1 }],
139-
"new-parens": "error",
140-
"no-trailing-spaces": "error",
141-
"quote-props": ["error", "consistent-as-needed"],
142-
"space-in-parens": "error",
143-
"@typescript-eslint/brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
144-
"@typescript-eslint/no-extra-semi": "error",
145-
"@typescript-eslint/quotes": ["error", "double", { "avoidEscape": true, "allowTemplateLiterals": true }],
146-
"@typescript-eslint/semi": "error",
147-
"@typescript-eslint/space-before-function-paren": [
148-
"error",
149-
{
150-
"asyncArrow": "always",
151-
"anonymous": "always",
152-
"named": "never"
153-
}
154-
],
155-
"local/object-literal-surrounding-space": "error",
156-
"local/no-type-assertion-whitespace": "error",
157-
"local/type-operator-spacing": "error",
158-
"local/no-double-space": "error",
159-
"local/simple-indent": "error"
131+
"simple-import-sort/exports": "error"
160132
},
161133
"overrides": [
162134
// By default, the ESLint CLI only looks at .js files. But, it will also look at

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ b6c053882696af8ddd94a600429f30584d303d7f
66
9a0b85ce2a3f85f498ab2c05474b4c0b96b111c9
77
# Generated module conversion step - unindent
88
94724a8c2e68a4c7e267072ca79971f317c45e4a
9+
# dprint
10+
5e8c261b6ab746213f19ee3501eb8c48a6215dd7

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
1-
name: "Bug report"
2-
description: "Create a report to help us improve TypeScript"
1+
name: 'Bug report'
2+
description: 'Create a report to help us improve TypeScript'
33
body:
44
- type: markdown
55
attributes:
66
value: Please fill in each section completely. Thank you!
77
- type: textarea
88
id: search_terms
99
attributes:
10-
label: "🔎 Search Terms"
10+
label: '🔎 Search Terms'
1111
description: |
1212
What search terms did you use when trying to find an existing bug report?
1313
1414
List them here so people in the future can find this one more easily.
15+
placeholder: |
16+
List of keywords you searched for before creating this issue.
17+
Write them down here so that others can find this bug more easily and help provide feedback.
18+
19+
e.g. "function inference any", "jsx attribute spread", "move to file duplicate imports", "discriminated union inference", "ts2822"
1520
validations:
1621
required: true
1722
- type: textarea
1823
id: version_info
1924
attributes:
20-
label: "🕗 Version & Regression Information"
25+
label: '🕗 Version & Regression Information'
2126
description: |
2227
When did you start seeing this bug occur?
2328
@@ -28,7 +33,7 @@ body:
2833
If possible, please try testing the nightly version of TS to see if it's already been fixed. For npm: `typescript@next`
2934
3035
This is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly
31-
36+
3237
3338
Note: The TypeScript Playground can be used to try older versions of TypeScript.
3439
@@ -51,7 +56,7 @@ body:
5156
5257
5358
As a last resort, you can link to a repo, but these will be slower for us to investigate.
54-
placeholder: "Playground link with relevant code: https://www.typescriptlang.org/play?#code/PTAEFkE9QYwewCYFNQHM5IM6gBZIE5JA"
59+
placeholder: 'Playground link with relevant code: https://www.typescriptlang.org/play?#code/PTAEFkE9QYwewCYFNQHM5IM6gBZIE5JA'
5560
validations:
5661
required: false
5762
- type: textarea
@@ -72,13 +77,17 @@ body:
7277
- We have to pare too much extraneous code.
7378
- We have to clone a large repo and validate that the problem isn't elsewhere.
7479
- The sample is confusing or doesn't clearly demonstrate what's wrong.
80+
value: |
81+
```ts
82+
// Your code here
83+
```
7584
validations:
7685
required: false
7786
- type: textarea
7887
id: actual_behavior
7988
attributes:
8089
label: 🙁 Actual behavior
81-
description: "What happened, and why it was wrong."
90+
description: 'What happened, and why it was wrong.'
8291
validations:
8392
required: true
8493
- type: textarea
@@ -88,3 +97,7 @@ body:
8897
description: What you expected to happen instead, and why
8998
validations:
9099
required: true
100+
- type: textarea
101+
id: additional_info
102+
attributes:
103+
label: Additional information about the issue

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
1-
---
1+
---
22
blank_issues_enabled: false
3-
contact_links:
4-
-
5-
about: "Please ask and answer usage questions on Stack Overflow."
3+
contact_links:
4+
- about: 'Please ask and answer usage questions on Stack Overflow.'
65
name: Question
7-
url: "https://stackoverflow.com/questions/tagged/typescript"
8-
-
9-
about: "Alternatively, you can use the TypeScript Community Discord."
6+
url: 'https://stackoverflow.com/questions/tagged/typescript'
7+
- about: 'Alternatively, you can use the TypeScript Community Discord.'
108
name: Chat
11-
url: "https://discord.gg/typescript"
12-
-
13-
about: "Please check the FAQ before filing new issues"
14-
name: "TypeScript FAQ"
15-
url: "https://github.com/microsoft/TypeScript/wiki/FAQ"
16-
-
17-
about: "Please raise issues about the site on its own repo."
9+
url: 'https://discord.gg/typescript'
10+
- about: 'Please check the FAQ before filing new issues'
11+
name: 'TypeScript FAQ'
12+
url: 'https://github.com/microsoft/TypeScript/wiki/FAQ'
13+
- about: 'Please raise issues about the site on its own repo.'
1814
name: Website
19-
url: "https://github.com/microsoft/TypeScript-Website/issues/new"
15+
url: 'https://github.com/microsoft/TypeScript-Website/issues/new'

.github/ISSUE_TEMPLATE/feature_request.yml

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,67 @@
1-
name: "Feature request"
2-
description: "Suggest an idea"
1+
name: 'Feature request'
2+
description: 'Suggest an idea'
33
body:
44
- type: markdown
55
attributes:
6-
value: "Please fill in each section completely. Thank you!"
6+
value: 'Please fill in each section completely. Thank you!'
77
- type: textarea
88
id: search_terms
99
attributes:
10-
label: "🔍 Search Terms"
10+
label: '🔍 Search Terms'
1111
description: |
12-
💡 Did you know? TypeScript has over 2,000 open suggestions!
12+
💡 Did you know? TypeScript has over 2,000 open suggestions!
1313
14-
🔎 Please search thoroughly before logging new feature requests as most common ideas already have a proposal in progress.
14+
🔎 Please search thoroughly before logging new feature requests as most common ideas already have a proposal in progress.
1515
16-
The "Common Feature Requests" section of the FAQ lists many popular requests: https://github.com/Microsoft/TypeScript/wiki/FAQ#common-feature-requests
16+
The "Common Feature Requests" section of the FAQ lists many popular requests: https://github.com/Microsoft/TypeScript/wiki/FAQ#common-feature-requests
1717
placeholder: |
1818
List of keywords you searched for before creating this issue.
1919
Write them down here so that others can find this suggestion more easily and help provide feedback.
20+
21+
e.g. "isArray readonly", "regex string types", "json const assertion import"
2022
validations:
2123
required: true
2224
- type: checkboxes
2325
id: viability_checklist
2426
attributes:
25-
label: "✅ Viability Checklist"
27+
label: '✅ Viability Checklist'
2628
description: |
2729
Suggestions that don't meet all these criteria are very, very unlikely to be accepted.
2830
We always recommend reviewing the TypeScript design goals before investing time writing
2931
a proposal for ideas outside the scope of the project.
3032
3133
My suggestion meets the following guidelines.
3234
options:
33-
- label: This wouldn't be a breaking change in existing TypeScript/JavaScript code
34-
required: true
35-
- label: This wouldn't change the runtime behavior of existing JavaScript code
36-
required: true
37-
- label: This could be implemented without emitting different JS based on the types of the expressions
38-
required: true
39-
- label: This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
40-
required: true
41-
- label: "This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals"
42-
required: true
35+
- label: This wouldn't be a breaking change in existing TypeScript/JavaScript code
36+
required: true
37+
- label: This wouldn't change the runtime behavior of existing JavaScript code
38+
required: true
39+
- label: This could be implemented without emitting different JS based on the types of the expressions
40+
required: true
41+
- label: This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
42+
required: true
43+
- label: 'This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals'
44+
required: true
4345
- type: textarea
4446
id: suggestion_summary
4547
attributes:
46-
label: "⭐ Suggestion"
48+
label: '⭐ Suggestion'
4749
description: "A summary of what you'd like to see added or changed"
4850
validations:
4951
required: true
5052
- type: textarea
5153
id: motivating_example
5254
attributes:
53-
label: "📃 Motivating Example"
55+
label: '📃 Motivating Example'
5456
description: |
55-
If you were announcing this feature in a blog post, what's a short
56-
explanation that shows a developer why this feature improves the language?
57+
If you were announcing this feature in a blog post, what's a short
58+
explanation that shows a developer why this feature improves the language?
5759
validations:
5860
required: true
5961
- type: textarea
6062
id: use_cases
6163
attributes:
62-
label: "💻 Use Cases"
64+
label: '💻 Use Cases'
6365
value: |
6466
1. What do you want to use this for?
6567
2. What shortcomings exist with current approaches?

.github/ISSUE_TEMPLATE/lib_change.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: "Library change"
2-
description: "Fix or improve issues with built-in type definitions like `lib.dom.d.ts`, `lib.es6.d.ts`, etc."
1+
name: 'Library change'
2+
description: 'Fix or improve issues with built-in type definitions like `lib.dom.d.ts`, `lib.es6.d.ts`, etc.'
33
body:
44
- type: markdown
55
attributes:
@@ -18,45 +18,45 @@ body:
1818
- type: markdown
1919
attributes:
2020
value: |
21-
If you're missing common new methods like `Array.includes`, you may have a misconfigured project.
22-
Try setting `lib: "es2020"` and checking whether the type you want is present.
23-
You can diagnose further by running `tsc` with `--listFilesOnly` or `--showConfig`.
21+
If you're missing common new methods like `Array.includes`, you may have a misconfigured project.
22+
Try setting `lib: "es2020"` and checking whether the type you want is present.
23+
You can diagnose further by running `tsc` with `--listFilesOnly` or `--showConfig`.
2424
25-
Conversely, if you are seeing built-in methods you expect to *not* see, check your 'lib' setting or review your dependencies for lib/reference directives that might be polluting
26-
your global scope. This is common when using the 'node' type library. See https://github.com/microsoft/TypeScript/issues/40184
25+
Conversely, if you are seeing built-in methods you expect to *not* see, check your 'lib' setting or review your dependencies for lib/reference directives that might be polluting
26+
your global scope. This is common when using the 'node' type library. See https://github.com/microsoft/TypeScript/issues/40184
2727
- type: input
2828
id: compilation_target
2929
attributes:
30-
label: "⚙ Compilation target"
30+
label: '⚙ Compilation target'
3131
description: "What's your compilation target (e.g.: `ES2015`)?"
3232
validations:
3333
required: true
3434
- type: input
3535
id: current_lib
3636
attributes:
37-
label: "⚙ Library"
37+
label: '⚙ Library'
3838
description: "What's the current library you're using?"
3939
validations:
4040
required: true
4141
- type: textarea
4242
id: incorrect_definition
4343
attributes:
44-
label: "Missing / Incorrect Definition"
45-
description: "What property, method, function, etc. is missing or incorrect?"
44+
label: 'Missing / Incorrect Definition'
45+
description: 'What property, method, function, etc. is missing or incorrect?'
4646
validations:
4747
required: true
4848
- type: textarea
4949
id: sample_code
5050
attributes:
51-
label: "Sample Code"
51+
label: 'Sample Code'
5252
description: "What's some code using this that should work, but doesn't?"
5353
render: TypeScript
5454
validations:
5555
required: true
5656
- type: textarea
5757
id: documentation_link
5858
attributes:
59-
label: "Documentation Link"
59+
label: 'Documentation Link'
6060
description: |
6161
Link to relevant documentation (e.g. MDN, W3C, ECMAScript Spec) to consult for this property.
6262
Note that lib.dom.d.ts intentionally does not include browser-specific extensions or early experimental features.

0 commit comments

Comments
 (0)