Skip to content

Commit f6f759b

Browse files
committed
Merge remote-tracking branch 'origin/main' into infer-from-filterin-mapped-types
2 parents e8676f2 + 1a68590 commit f6f759b

File tree

2,792 files changed

+142799
-55036
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,792 files changed

+142799
-55036
lines changed

.c8rc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
"include": ["src/**", "built/local/**"],
55
"exclude": ["**/node_modules/**"],
66
"mergeAsync": true
7-
}
7+
}

.devcontainer/Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.154.0/containers/javascript-node/.devcontainer/base.Dockerfile
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/blob/v0.245.2/containers/javascript-node/.devcontainer/base.Dockerfile
22

3-
# [Choice] Node.js version: 14, 12, 10
4-
ARG VARIANT="14-buster"
3+
# [Choice] Node.js version: 18, 16, 14
4+
ARG VARIANT="18-buster"
55
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
66

77
RUN sudo -u node npm install -g hereby

.devcontainer/devcontainer.json

+16-11
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,25 @@
33
"build": {
44
"dockerfile": "Dockerfile",
55
"args": {
6-
"VARIANT": "14"
6+
"VARIANT": "18"
77
}
88
},
9-
"settings": {
10-
"terminal.integrated.defaultProfile.linux": "bash",
11-
"terminal.integrated.profiles.linux": {
12-
"bash": {
13-
"path": "/bin/bash",
14-
"icon": "terminal-bash",
9+
"customizations": {
10+
"vscode": {
11+
"settings": {
12+
"terminal.integrated.defaultProfile.linux": "bash",
13+
"terminal.integrated.profiles.linux": {
14+
"bash": {
15+
"path": "/bin/bash",
16+
"icon": "terminal-bash"
17+
}
18+
}
1519
},
16-
},
20+
"extensions": [
21+
"dbaeumer.vscode-eslint",
22+
"dprint.dprint"
23+
]
24+
}
1725
},
18-
"extensions": [
19-
"dbaeumer.vscode-eslint"
20-
],
2126
"remoteUser": "node"
2227
}

.dprint.jsonc

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
// Note: if adding new languages, make sure settings.template.json is updated too.
53+
"plugins": [
54+
"https://plugins.dprint.dev/typescript-0.87.1.wasm",
55+
"https://plugins.dprint.dev/prettier-0.27.0.json@3557a62b4507c55a47d8cde0683195b14d13c41dda66d0f0b0e111aed107e2fe",
56+
"https://plugins.dprint.dev/json-0.17.4.wasm"
57+
]
58+
}

.eslintplugin.js

+3-3
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

+83-102
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,16 @@
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",
20+
"no-null",
21+
"eslint-plugin-local",
22+
"simple-import-sort"
1523
],
1624
"ignorePatterns": [
1725
"**/node_modules/**",
@@ -25,16 +33,42 @@
2533
"/coverage/**"
2634
],
2735
"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",
36+
// eslint
37+
"dot-notation": "error",
38+
"eqeqeq": "error",
39+
"no-caller": "error",
40+
"no-constant-condition": ["error", { "checkLoops": false }],
41+
"no-eval": "error",
42+
"no-extra-bind": "error",
43+
"no-new-func": "error",
44+
"no-new-wrappers": "error",
45+
"no-return-await": "error",
46+
"no-restricted-globals": [
47+
"error",
48+
{ "name": "setTimeout" },
49+
{ "name": "clearTimeout" },
50+
{ "name": "setInterval" },
51+
{ "name": "clearInterval" },
52+
{ "name": "setImmediate" },
53+
{ "name": "clearImmediate" }
54+
],
55+
"no-template-curly-in-string": "error",
56+
"no-throw-literal": "error",
57+
"no-undef-init": "error",
58+
"no-var": "error",
59+
"object-shorthand": "error",
60+
"prefer-const": "error",
61+
"prefer-object-spread": "error",
62+
"unicode-bom": ["error", "never"],
3463

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

71+
// @typescript-eslint/eslint-plugin
3872
"@typescript-eslint/naming-convention": [
3973
"error",
4074
{ "selector": "typeLike", "format": ["PascalCase"], "filter": { "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", "match": false } },
@@ -48,115 +82,61 @@
4882
{ "selector": "property", "format": null }
4983
],
5084

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-
}],
85+
// Rules enabled in typescript-eslint configs that are not applicable here
86+
"@typescript-eslint/ban-ts-comment": "off",
87+
"@typescript-eslint/class-literal-property-style": "off",
88+
"@typescript-eslint/consistent-indexed-object-style": "off",
89+
"@typescript-eslint/no-duplicate-enum-values": "off",
90+
"@typescript-eslint/no-empty-function": "off",
91+
"@typescript-eslint/no-namespace": "off",
92+
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
93+
"@typescript-eslint/no-var-requires": "off",
94+
"@typescript-eslint/no-empty-interface": "off",
95+
"@typescript-eslint/no-explicit-any": "off",
96+
"@typescript-eslint/ban-types": [
97+
"error",
98+
{
99+
"extendDefaults": true,
100+
"types": {
101+
// This is theoretically good, but ts-eslint appears to mistake our declaration of Symbol for the global Symbol type.
102+
// See: https://github.com/typescript-eslint/typescript-eslint/issues/7306
103+
"Symbol": false,
104+
"{}": false // {} is a totally useful and valid type.
105+
}
106+
}
107+
],
84108

85-
"@typescript-eslint/triple-slash-reference": "error",
86-
"@typescript-eslint/type-annotation-spacing": "error",
87-
"@typescript-eslint/unified-signatures": "error",
109+
// Todo: For each of these, investigate whether we want to enable them ✨
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",
115-
"curly": ["error", "multi-line"],
116-
"dot-notation": "error",
117-
"eqeqeq": "error",
118-
"linebreak-style": ["error", "windows"],
119-
"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",
140-
"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",
148-
"quote-props": ["error", "consistent-as-needed"],
149-
"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"
132+
// eslint-plugin-simple-import-sort
133+
"simple-import-sort/imports": "error",
134+
"simple-import-sort/exports": "error"
155135
},
156136
"overrides": [
157137
// By default, the ESLint CLI only looks at .js files. But, it will also look at
158138
// any files which are referenced in an override config. Most users of typescript-eslint
159-
// get this behavior by default by extending a recommended typescript-eslint config, which
139+
// get this behavior by default by extending a recommended typescript-eslint config, which
160140
// just so happens to override some core ESLint rules. We don't extend from any config, so
161141
// explicitly reference TS files here so the CLI picks them up.
162142
//
@@ -169,7 +149,8 @@
169149
"files": ["*.mjs", "*.mts"],
170150
"rules": {
171151
// These globals don't exist outside of CJS files.
172-
"no-restricted-globals": ["error",
152+
"no-restricted-globals": [
153+
"error",
173154
{ "name": "__filename" },
174155
{ "name": "__dirname" },
175156
{ "name": "require" },

.git-blame-ignore-revs

+2
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

0 commit comments

Comments
 (0)