Skip to content

Commit 3458d37

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/intersections-as-valid-types-for-template-literal-placeholders
# Conflicts: # tests/baselines/reference/templateLiteralTypesPatterns.errors.txt
2 parents 2877ff5 + 21bb216 commit 3458d37

File tree

41,975 files changed

+235014
-106602
lines changed

Some content is hidden

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

41,975 files changed

+235014
-106602
lines changed

.c8rc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"reporter": ["lcovonly", "cobertura"],
3+
"src": "src",
4+
"include": ["src/**", "built/local/**"],
5+
"exclude": ["**/node_modules/**"],
6+
"mergeAsync": true
7+
}

.eslintrc.json

Lines changed: 100 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@
1010
"node": true,
1111
"es6": true
1212
},
13+
"extends": [
14+
"eslint:recommended",
15+
"plugin:@typescript-eslint/recommended",
16+
"plugin:@typescript-eslint/stylistic"
17+
],
1318
"plugins": [
14-
"@typescript-eslint", "no-null", "import", "eslint-plugin-local", "simple-import-sort"
19+
"@typescript-eslint", "no-null", "eslint-plugin-local", "simple-import-sort"
1520
],
1621
"ignorePatterns": [
1722
"**/node_modules/**",
@@ -25,16 +30,42 @@
2530
"/coverage/**"
2631
],
2732
"rules": {
28-
"simple-import-sort/imports": "error",
29-
"simple-import-sort/exports": "error",
30-
31-
"@typescript-eslint/adjacent-overload-signatures": "error",
32-
"@typescript-eslint/array-type": "error",
33-
"@typescript-eslint/no-array-constructor": "error",
33+
// eslint
34+
"dot-notation": "error",
35+
"eqeqeq": "error",
36+
"no-caller": "error",
37+
"no-constant-condition": ["error", { "checkLoops": false }],
38+
"no-eval": "error",
39+
"no-extra-bind": "error",
40+
"no-new-func": "error",
41+
"no-new-wrappers": "error",
42+
"no-return-await": "error",
43+
"no-restricted-globals": [
44+
"error",
45+
{ "name": "setTimeout" },
46+
{ "name": "clearTimeout" },
47+
{ "name": "setInterval" },
48+
{ "name": "clearInterval" },
49+
{ "name": "setImmediate" },
50+
{ "name": "clearImmediate" }
51+
],
52+
"no-template-curly-in-string": "error",
53+
"no-throw-literal": "error",
54+
"no-undef-init": "error",
55+
"no-var": "error",
56+
"object-shorthand": "error",
57+
"prefer-const": "error",
58+
"prefer-object-spread": "error",
59+
"unicode-bom": ["error", "never"],
3460

35-
"brace-style": "off",
36-
"@typescript-eslint/brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
61+
// Enabled in eslint:recommended, but not applicable here
62+
"no-extra-boolean-cast": "off",
63+
"no-case-declarations": "off",
64+
"no-cond-assign": "off",
65+
"no-control-regex": "off",
66+
"no-inner-declarations": "off",
3767

68+
// @typescript-eslint/eslint-plugin
3869
"@typescript-eslint/naming-convention": [
3970
"error",
4071
{ "selector": "typeLike", "format": ["PascalCase"], "filter": { "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", "match": false } },
@@ -48,110 +79,85 @@
4879
{ "selector": "property", "format": null }
4980
],
5081

51-
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
52-
"@typescript-eslint/consistent-type-assertions": ["error", { "assertionStyle": "as" }],
53-
54-
"max-statements-per-line": ["error", { "max": 1 }],
55-
56-
"no-duplicate-imports": "off",
57-
"@typescript-eslint/no-duplicate-imports": "error",
58-
59-
"@typescript-eslint/no-inferrable-types": "error",
60-
"@typescript-eslint/no-misused-new": "error",
61-
"@typescript-eslint/no-this-alias": "error",
62-
63-
"no-unused-expressions": "off",
64-
"@typescript-eslint/no-unused-expressions": ["error", { "allowTernary": true }],
65-
66-
"@typescript-eslint/prefer-for-of": "error",
67-
"@typescript-eslint/prefer-function-type": "error",
68-
"@typescript-eslint/prefer-namespace-keyword": "error",
69-
"@typescript-eslint/prefer-as-const": "error",
70-
71-
"quotes": "off",
72-
"@typescript-eslint/quotes": ["error", "double", { "avoidEscape": true, "allowTemplateLiterals": true }],
73-
74-
"semi": "off",
75-
"@typescript-eslint/semi": "error",
76-
"@typescript-eslint/no-extra-semi": "error",
77-
78-
"space-before-function-paren": "off",
79-
"@typescript-eslint/space-before-function-paren": ["error", {
80-
"asyncArrow": "always",
81-
"anonymous": "always",
82-
"named": "never"
83-
}],
82+
// Rules enabled in typescript-eslint configs that are not applicable here
83+
"@typescript-eslint/ban-ts-comment": "off",
84+
"@typescript-eslint/class-literal-property-style": "off",
85+
"@typescript-eslint/consistent-indexed-object-style": "off",
86+
"@typescript-eslint/no-duplicate-enum-values": "off",
87+
"@typescript-eslint/no-empty-function": "off",
88+
"@typescript-eslint/no-namespace": "off",
89+
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
90+
"@typescript-eslint/no-var-requires": "off",
91+
"@typescript-eslint/no-empty-interface": "off",
92+
"@typescript-eslint/no-explicit-any": "off",
93+
"@typescript-eslint/ban-types": [
94+
"error",
95+
{
96+
"extendDefaults": true,
97+
"types": {
98+
// This is theoretically good, but ts-eslint appears to mistake our declaration of Symbol for the global Symbol type.
99+
// See: https://github.com/typescript-eslint/typescript-eslint/issues/7306
100+
"Symbol": false,
101+
"{}": false // {} is a totally useful and valid type.
102+
}
103+
}
104+
],
84105

85-
"@typescript-eslint/triple-slash-reference": "error",
86-
"@typescript-eslint/type-annotation-spacing": "error",
87-
"@typescript-eslint/unified-signatures": "error",
106+
// Todo: For each of these, investigate whether we want to enable them ✨
107+
"no-useless-escape": "off",
108+
"prefer-rest-params": "off",
109+
"prefer-spread": "off",
110+
"@typescript-eslint/no-unused-vars": "off",
88111

89-
"@typescript-eslint/no-extra-non-null-assertion": "error",
112+
// Pending https://github.com/typescript-eslint/typescript-eslint/issues/4820
113+
"@typescript-eslint/prefer-optional-chain": "off",
90114

91115
// scripts/eslint/rules
92-
"local/object-literal-surrounding-space": "error",
93-
"local/no-type-assertion-whitespace": "error",
94-
"local/type-operator-spacing": "error",
95-
"local/only-arrow-functions": ["error", {
96-
"allowNamedFunctions": true ,
97-
"allowDeclarations": true
98-
}],
99-
"local/no-double-space": "error",
116+
"local/only-arrow-functions": [
117+
"error",
118+
{
119+
"allowNamedFunctions": true ,
120+
"allowDeclarations": true
121+
}
122+
],
100123
"local/argument-trivia": "error",
101124
"local/no-in-operator": "error",
102-
"local/simple-indent": "error",
103125
"local/debug-assert": "error",
104126
"local/no-keywords": "error",
105127
"local/jsdoc-format": "error",
106128

107-
// eslint-plugin-import
108-
"import/no-extraneous-dependencies": ["error", { "optionalDependencies": false }],
109-
110129
// eslint-plugin-no-null
111130
"no-null/no-null": "error",
112131

113-
// eslint
114-
"constructor-super": "error",
132+
// eslint-plugin-simple-import-sort
133+
"simple-import-sort/imports": "error",
134+
"simple-import-sort/exports": "error",
135+
136+
// Formatting rules; remove once a formatter enforces these.
115137
"curly": ["error", "multi-line"],
116-
"dot-notation": "error",
117-
"eqeqeq": "error",
118138
"linebreak-style": ["error", "windows"],
139+
"max-statements-per-line": ["error", { "max": 1 }],
119140
"new-parens": "error",
120-
"no-caller": "error",
121-
"no-duplicate-case": "error",
122-
"no-empty": "error",
123-
"no-eval": "error",
124-
"no-extra-bind": "error",
125-
"no-fallthrough": "error",
126-
"no-new-func": "error",
127-
"no-new-wrappers": "error",
128-
"no-return-await": "error",
129-
"no-restricted-globals": ["error",
130-
{ "name": "setTimeout" },
131-
{ "name": "clearTimeout" },
132-
{ "name": "setInterval" },
133-
{ "name": "clearInterval" },
134-
{ "name": "setImmediate" },
135-
{ "name": "clearImmediate" }
136-
],
137-
"no-sparse-arrays": "error",
138-
"no-template-curly-in-string": "error",
139-
"no-throw-literal": "error",
140141
"no-trailing-spaces": "error",
141-
"no-undef-init": "error",
142-
"no-unsafe-finally": "error",
143-
"no-unused-labels": "error",
144-
"no-var": "error",
145-
"object-shorthand": "error",
146-
"prefer-const": "error",
147-
"prefer-object-spread": "error",
148142
"quote-props": ["error", "consistent-as-needed"],
149143
"space-in-parens": "error",
150-
"unicode-bom": ["error", "never"],
151-
"use-isnan": "error",
152-
"no-prototype-builtins": "error",
153-
"no-self-assign": "error",
154-
"no-dupe-else-if": "error"
144+
"@typescript-eslint/brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
145+
"@typescript-eslint/no-extra-semi": "error",
146+
"@typescript-eslint/quotes": ["error", "double", { "avoidEscape": true, "allowTemplateLiterals": true }],
147+
"@typescript-eslint/semi": "error",
148+
"@typescript-eslint/space-before-function-paren": [
149+
"error",
150+
{
151+
"asyncArrow": "always",
152+
"anonymous": "always",
153+
"named": "never"
154+
}
155+
],
156+
"local/object-literal-surrounding-space": "error",
157+
"local/no-type-assertion-whitespace": "error",
158+
"local/type-operator-spacing": "error",
159+
"local/no-double-space": "error",
160+
"local/simple-indent": "error"
155161
},
156162
"overrides": [
157163
// By default, the ESLint CLI only looks at .js files. But, it will also look at

.github/ISSUE_TEMPLATE/Bug_report.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,16 @@ Please keep and fill in the line that best applies:
4343
### ⏯ Playground Link
4444

4545
<!--
46-
A link to a TypeScript Playground "Share" link which shows this behavior
47-
48-
The TypeScript Workbench can be used for more complex setups, try
49-
https://www.typescriptlang.org/dev/bug-workbench/
46+
A link to a TypeScript Playground "Share" link which shows this behavior.
47+
This should have the same code as the code snippet below, and use whichever settings are relevant to your report.
5048
5149
As a last resort, you can link to a repo, but these will be slower for us to investigate.
5250
-->
5351
[Playground link with relevant code](https://www.typescriptlang.org/play?#code/PTAEFkE9QYwewCYFNQHM5IM6gBZIE5JA)
5452

5553
### 💻 Code
5654

57-
<!-- Please post the relevant code sample here as well-->
55+
<!-- Please post the relevant code sample here as well. This code and the Playground code should be the same, do not use separate examples -->
5856
```ts
5957
// We can quickly address your report if:
6058
// - The code sample is short. Nearly all TypeScript bugs can be demonstrated in 20-30 lines of code!
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Module Resolution
2+
description: Report a problem with module resolution
3+
title: "Module Resolution:"
4+
labels: []
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Module resolution can be very difficult to configure correctly!
10+
11+
Be sure you've read the docs and asked for help in other places before filling out this form.
12+
13+
Most module resolution bug reports are actually misconfigurations, so we require a thorough pre-investigation before we can look into any potential issues.
14+
15+
Let's make sure you're ready to file a module resolution bug.
16+
17+
- type: markdown
18+
attributes:
19+
value: |
20+
A module resolution bug requires five things:
21+
22+
1. A module that's trying to import some target module
23+
2. That target module
24+
3. The configuration of the importing module
25+
4. The configuration of the target module
26+
5. A difference in runtime behavior
27+
28+
You will also be required to post a cloneable repository.
29+
This repo must involve running `tsc`, not a third-party tool (e.g. vue-tsc, ngc, expo, ...)
30+
31+
- type: input
32+
id: repo-url
33+
attributes:
34+
label: Demo Repo
35+
description: Post a cloneable repo that reproduces the issue. We will run `npm`, `yarn`, or `pnpm` here, but will not invoke more complex build scripts or other build tools.
36+
placeholder: https://github.com/ghost/myrepro
37+
validations:
38+
required: true
39+
40+
- type: dropdown
41+
id: defect-kind
42+
attributes:
43+
label: Which of the following problems are you reporting?
44+
options:
45+
- The module specifier resolves at runtime, but not at build time
46+
- The module specifier resolves at build time, but shouldn't because it doesn't at runtime
47+
- The module specifier resolves, but to the wrong file
48+
- The module specifier resolves to the right file, but something about the types are wrong
49+
- Something else more complicated which I'll explain in more detail
50+
validations:
51+
required: true
52+
53+
- type: textarea
54+
id: code-proof
55+
attributes:
56+
label: Demonstrate the defect described above with a code sample.
57+
description: This should be at most four lines of code, and come from your demo repo.
58+
placeholder: import * as foo from "./bar"; // Should not resolve
59+
validations:
60+
required: true
61+
62+
- type: textarea
63+
id: config
64+
attributes:
65+
label: Run `tsc --showConfig` and paste its output here
66+
description: Repros that depend on running within external tools (yarn, pnpm, esbuild, etc.) are not TypeScript defects and will not be investigated.
67+
placeholder: "> tsc --showConfig"
68+
validations:
69+
required: true
70+
71+
- type: textarea
72+
id: traceResolution
73+
attributes:
74+
label: Run `tsc --traceResolution` and paste its output here
75+
description: Run `tsc --traceResolution` and paste the output here.
76+
placeholder: "> tsc --traceResolution"
77+
validations:
78+
required: true
79+
80+
- type: textarea
81+
id: import-package-json
82+
attributes:
83+
label: Paste the `package.json` of the *importing* module, if it exists
84+
placeholder: "my_project/package.json"
85+
validations:
86+
required: true
87+
88+
- type: textarea
89+
id: export-package-json
90+
attributes:
91+
label: Paste the `package.json` of the *target* module, if it exists
92+
placeholder: "node_modules/somepkg/package.json"
93+
validations:
94+
required: true
95+
96+
- type: textarea
97+
id: comments
98+
attributes:
99+
label: Any other comments can go here
100+
placeholder: "Have a nice day!"
101+
validations:
102+
required: true

0 commit comments

Comments
 (0)