diff --git a/babel.config.js b/babel.config.js index 883da3058bcd..8232b1240be3 100644 --- a/babel.config.js +++ b/babel.config.js @@ -505,8 +505,8 @@ function pluginToggleBooleanFlag({ types: t }, { name, value }) { return arg.unrelated ? res.unrelated() : arg.replacement - ? res.replacement(t.unaryExpression("!", arg.replacement)) - : res.value(!arg.value); + ? res.replacement(t.unaryExpression("!", arg.replacement)) + : res.value(!arg.value); } if (test.isLogicalExpression({ operator: "||" })) { diff --git a/package.json b/package.json index 4a30f6b411d8..731cb06d39b2 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "jest-worker": "^30.0.0-alpha.1", "lint-staged": "^14.0.1", "mergeiterator": "^1.4.4", - "prettier": "^3.0.3", + "prettier": "^3.1.0", "rollup": "^3.28.1", "rollup-plugin-dts": "^6.0.0", "rollup-plugin-dts-5": "npm:rollup-plugin-dts@^5.3.1", diff --git a/packages/babel-cli/src/babel/watcher.ts b/packages/babel-cli/src/babel/watcher.ts index 7249bda10580..4ad07e5f75b6 100644 --- a/packages/babel-cli/src/babel/watcher.ts +++ b/packages/babel-cli/src/babel/watcher.ts @@ -154,8 +154,8 @@ function requireChokidar(): any { return process.env.BABEL_8_BREAKING ? require("chokidar") : parseInt(process.versions.node) >= 8 - ? require("chokidar") - : require("@nicolo-ribaudo/chokidar-2"); + ? require("chokidar") + : require("@nicolo-ribaudo/chokidar-2"); } catch (err) { console.error( "The optional dependency chokidar failed to install and is required for " + diff --git a/packages/babel-generator/src/printer.ts b/packages/babel-generator/src/printer.ts index b7ffb28a1862..da5523588d15 100644 --- a/packages/babel-generator/src/printer.ts +++ b/packages/babel-generator/src/printer.ts @@ -1186,8 +1186,8 @@ class Printer { i === 0 ? COMMENT_SKIP_NEWLINE.LEADING : i === len - 1 - ? COMMENT_SKIP_NEWLINE.TRAILING - : COMMENT_SKIP_NEWLINE.DEFAULT, + ? COMMENT_SKIP_NEWLINE.TRAILING + : COMMENT_SKIP_NEWLINE.DEFAULT, ); } else { this._printComment(comment, COMMENT_SKIP_NEWLINE.DEFAULT); diff --git a/packages/babel-helper-fixtures/src/index.ts b/packages/babel-helper-fixtures/src/index.ts index d2a8e97aa70e..a110ae6efd04 100644 --- a/packages/babel-helper-fixtures/src/index.ts +++ b/packages/babel-helper-fixtures/src/index.ts @@ -207,8 +207,8 @@ function pushTask( filename: !loc ? undefined : fileName === true - ? suiteName + "/" + taskName + "/" + path.basename(loc) - : fileName || undefined, + ? suiteName + "/" + taskName + "/" + path.basename(loc) + : fileName || undefined, }; } diff --git a/packages/babel-helper-string-parser/src/index.ts b/packages/babel-helper-string-parser/src/index.ts index 1e02846e7038..b2abe830caa5 100644 --- a/packages/babel-helper-string-parser/src/index.ts +++ b/packages/babel-helper-string-parser/src/index.ts @@ -338,10 +338,10 @@ export function readInt( radix === 16 ? isAllowedNumericSeparatorSibling.hex : radix === 10 - ? isAllowedNumericSeparatorSibling.dec - : radix === 8 - ? isAllowedNumericSeparatorSibling.oct - : isAllowedNumericSeparatorSibling.bin; + ? isAllowedNumericSeparatorSibling.dec + : radix === 8 + ? isAllowedNumericSeparatorSibling.oct + : isAllowedNumericSeparatorSibling.bin; let invalid = false; let total = 0; diff --git a/packages/babel-helpers/src/helpers/applyDecs2301.js b/packages/babel-helpers/src/helpers/applyDecs2301.js index eabb5362f449..245d90d2dda6 100644 --- a/packages/babel-helpers/src/helpers/applyDecs2301.js +++ b/packages/babel-helpers/src/helpers/applyDecs2301.js @@ -136,8 +136,8 @@ function applyDecs2301Factory() { get && set ? { get: get, set: set, has: has } : get - ? { get: get, has: has } - : { set: set, has: has }; + ? { get: get, has: has } + : { set: set, has: has }; try { return dec(value, ctx); diff --git a/packages/babel-helpers/src/helpers/applyDecs2305.js b/packages/babel-helpers/src/helpers/applyDecs2305.js index f31cd51af0a2..bc4ee1a44076 100644 --- a/packages/babel-helpers/src/helpers/applyDecs2305.js +++ b/packages/babel-helpers/src/helpers/applyDecs2305.js @@ -137,8 +137,8 @@ function memberDec( get && set ? { get: get, set: set, has: has } : get - ? { get: get, has: has } - : { set: set, has: has }; + ? { get: get, has: has } + : { set: set, has: has }; try { return dec.call(thisArg, value, ctx); diff --git a/packages/babel-parser/src/parse-error.ts b/packages/babel-parser/src/parse-error.ts index 94de04e96e2a..cbf65e119e8d 100644 --- a/packages/babel-parser/src/parse-error.ts +++ b/packages/babel-parser/src/parse-error.ts @@ -139,8 +139,8 @@ export function ParseErrorEnum(a: TemplateStringsArray): < ? Parameters[0] : {} : T[K] extends ToMessage - ? Parameters[0] - : {} + ? Parameters[0] + : {} >; }; @@ -154,8 +154,8 @@ export function ParseErrorEnum( ? Parameters[0] : {} : T[K] extends ToMessage - ? Parameters[0] - : {} + ? Parameters[0] + : {} >; }; @@ -200,8 +200,8 @@ export function ParseErrorEnum( typeof template === "string" ? { message: () => template } : typeof template === "function" - ? { message: template } - : template; + ? { message: template } + : template; const toMessage = typeof message === "string" ? () => message : message; ParseErrorConstructors[reasonCode] = toParseErrorConstructor({ diff --git a/packages/babel-parser/src/parser/expression.ts b/packages/babel-parser/src/parser/expression.ts index 0a59fa7a7ae7..5ccaaef747be 100644 --- a/packages/babel-parser/src/parser/expression.ts +++ b/packages/babel-parser/src/parser/expression.ts @@ -2835,8 +2835,8 @@ export default abstract class ExpressionParser extends LValParser { const reservedTest = !this.state.strict ? isReservedWord : isBinding - ? isStrictBindReservedWord - : isStrictReservedWord; + ? isStrictBindReservedWord + : isStrictReservedWord; if (reservedTest(word, this.inModule)) { this.raise(Errors.UnexpectedReservedWord, { diff --git a/packages/babel-parser/src/parser/statement.ts b/packages/babel-parser/src/parser/statement.ts index ec16aafec027..62a776499dc4 100644 --- a/packages/babel-parser/src/parser/statement.ts +++ b/packages/babel-parser/src/parser/statement.ts @@ -452,8 +452,8 @@ export default abstract class StatementParser extends ExpressionParser { this.state.strict ? Errors.StrictFunction : this.options.annexB - ? Errors.SloppyFunctionAnnexB - : Errors.SloppyFunction, + ? Errors.SloppyFunctionAnnexB + : Errors.SloppyFunction, { at: this.state.startLoc }, ); } @@ -1276,8 +1276,8 @@ export default abstract class StatementParser extends ExpressionParser { const kind = tokenIsLoop(this.state.type) ? "loop" : this.match(tt._switch) - ? "switch" - : null; + ? "switch" + : null; for (let i = this.state.labels.length - 1; i >= 0; i--) { const label = this.state.labels[i]; if (label.statementStart === node.start) { @@ -1536,8 +1536,8 @@ export default abstract class StatementParser extends ExpressionParser { decl.init = !this.eat(tt.eq) ? null : isFor - ? this.parseMaybeAssignDisallowIn() - : this.parseMaybeAssignAllowIn(); + ? this.parseMaybeAssignDisallowIn() + : this.parseMaybeAssignAllowIn(); if (decl.init === null && !allowMissingInitializer) { if ( @@ -2228,10 +2228,10 @@ export default abstract class StatementParser extends ExpressionParser { ? ClassElementType.STATIC_GETTER : ClassElementType.INSTANCE_GETTER : node.kind === "set" - ? node.static - ? ClassElementType.STATIC_SETTER - : ClassElementType.INSTANCE_SETTER - : ClassElementType.OTHER; + ? node.static + ? ClassElementType.STATIC_SETTER + : ClassElementType.INSTANCE_SETTER + : ClassElementType.OTHER; this.declareClassPrivateMethodInScope(node, kind); } diff --git a/packages/babel-parser/src/plugins/flow/index.ts b/packages/babel-parser/src/plugins/flow/index.ts index 1d675ea794d2..a22f5b744212 100644 --- a/packages/babel-parser/src/plugins/flow/index.ts +++ b/packages/babel-parser/src/plugins/flow/index.ts @@ -3407,8 +3407,8 @@ export default (superClass: typeof Parser) => !enumContext.explicitType ? FlowErrors.EnumInvalidMemberInitializerUnknownType : enumContext.explicitType === "symbol" - ? FlowErrors.EnumInvalidMemberInitializerSymbolType - : FlowErrors.EnumInvalidMemberInitializerPrimaryType, + ? FlowErrors.EnumInvalidMemberInitializerSymbolType + : FlowErrors.EnumInvalidMemberInitializerPrimaryType, { at: loc, ...enumContext, diff --git a/packages/babel-parser/src/plugins/typescript/index.ts b/packages/babel-parser/src/plugins/typescript/index.ts index 0dc493919a84..e7e2cabbbac1 100644 --- a/packages/babel-parser/src/plugins/typescript/index.ts +++ b/packages/babel-parser/src/plugins/typescript/index.ts @@ -1282,8 +1282,8 @@ export default (superClass: ClassWithMixin) => type === tt._void ? "TSVoidKeyword" : type === tt._null - ? "TSNullKeyword" - : keywordTypeFromName(this.state.value); + ? "TSNullKeyword" + : keywordTypeFromName(this.state.value); if ( nodeType !== undefined && this.lookaheadCharCode() !== charCodes.dot @@ -1378,10 +1378,10 @@ export default (superClass: ClassWithMixin) => return isTypeOperator ? this.tsParseTypeOperator() : this.isContextual(tt._infer) - ? this.tsParseInferType() - : this.tsInAllowConditionalTypesContext(() => - this.tsParseArrayTypeOrHigher(), - ); + ? this.tsParseInferType() + : this.tsInAllowConditionalTypesContext(() => + this.tsParseArrayTypeOrHigher(), + ); } tsParseUnionOrIntersectionType( @@ -2377,8 +2377,8 @@ export default (superClass: ClassWithMixin) => type === "FunctionDeclaration" ? "TSDeclareFunction" : type === "ClassMethod" || type === "ClassPrivateMethod" - ? "TSDeclareMethod" - : undefined; + ? "TSDeclareMethod" + : undefined; if (bodilessType && !this.match(tt.braceL) && this.isLineTerminator()) { return this.finishNode(node, bodilessType); } diff --git a/packages/babel-parser/src/tokenizer/state.ts b/packages/babel-parser/src/tokenizer/state.ts index 728058a7d94d..426d8b69b35f 100644 --- a/packages/babel-parser/src/tokenizer/state.ts +++ b/packages/babel-parser/src/tokenizer/state.ts @@ -39,8 +39,8 @@ export default class State { strictMode === false ? false : strictMode === true - ? true - : sourceType === "module"; + ? true + : sourceType === "module"; this.curLine = startLine; this.lineStart = -startColumn; diff --git a/packages/babel-plugin-transform-async-generator-functions/src/index.ts b/packages/babel-plugin-transform-async-generator-functions/src/index.ts index 3cb1c7c6df6a..9dff74452cd1 100644 --- a/packages/babel-plugin-transform-async-generator-functions/src/index.ts +++ b/packages/babel-plugin-transform-async-generator-functions/src/index.ts @@ -101,9 +101,9 @@ export default declare(api => { inherits: USE_ESM ? undefined : IS_STANDALONE - ? undefined - : // eslint-disable-next-line no-restricted-globals - require("@babel/plugin-syntax-async-generators").default, + ? undefined + : // eslint-disable-next-line no-restricted-globals + require("@babel/plugin-syntax-async-generators").default, visitor: { Program(path, state) { diff --git a/packages/babel-plugin-transform-block-scoping/src/index.ts b/packages/babel-plugin-transform-block-scoping/src/index.ts index f7f3b2a558d3..29e41d9ee66d 100644 --- a/packages/babel-plugin-transform-block-scoping/src/index.ts +++ b/packages/babel-plugin-transform-block-scoping/src/index.ts @@ -43,8 +43,8 @@ export default declare((api, opts: Options) => { const headPath = isForStatement ? path.get("init") : path.isForXStatement() - ? path.get("left") - : null; + ? path.get("left") + : null; let needsBodyWrap = false; const markNeedsBodyWrap = () => { diff --git a/packages/babel-plugin-transform-block-scoping/src/loop.ts b/packages/babel-plugin-transform-block-scoping/src/loop.ts index 5e9088b1593e..1fb2655ec2e8 100644 --- a/packages/babel-plugin-transform-block-scoping/src/loop.ts +++ b/packages/babel-plugin-transform-block-scoping/src/loop.ts @@ -47,8 +47,8 @@ export function getUsageInBody(binding: Binding, loopPath: NodePath) { const id = path.isUpdateExpression() ? path.get("argument") : path.isAssignmentExpression() - ? path.get("left") - : null; + ? path.get("left") + : null; if (id) seen.add(id.node); return id as NodePath | null; }); diff --git a/packages/babel-plugin-transform-class-static-block/src/index.ts b/packages/babel-plugin-transform-class-static-block/src/index.ts index 0c1f511f8b39..5d9b7004518e 100644 --- a/packages/babel-plugin-transform-class-static-block/src/index.ts +++ b/packages/babel-plugin-transform-class-static-block/src/index.ts @@ -36,9 +36,9 @@ export default declare(({ types: t, template, assertVersion }) => { inherits: USE_ESM ? undefined : IS_STANDALONE - ? undefined - : // eslint-disable-next-line no-restricted-globals - require("@babel/plugin-syntax-class-static-block").default, + ? undefined + : // eslint-disable-next-line no-restricted-globals + require("@babel/plugin-syntax-class-static-block").default, pre() { // Enable this in @babel/helper-create-class-features-plugin, so that it diff --git a/packages/babel-plugin-transform-dynamic-import/src/index.ts b/packages/babel-plugin-transform-dynamic-import/src/index.ts index 727bc6daaed0..f88e980e3ebb 100644 --- a/packages/babel-plugin-transform-dynamic-import/src/index.ts +++ b/packages/babel-plugin-transform-dynamic-import/src/index.ts @@ -27,9 +27,9 @@ export default declare(api => { inherits: USE_ESM ? undefined : IS_STANDALONE - ? undefined - : // eslint-disable-next-line no-restricted-globals - require("@babel/plugin-syntax-dynamic-import").default, + ? undefined + : // eslint-disable-next-line no-restricted-globals + require("@babel/plugin-syntax-dynamic-import").default, pre() { // We keep using the old name, for compatibility with older diff --git a/packages/babel-plugin-transform-export-namespace-from/src/index.ts b/packages/babel-plugin-transform-export-namespace-from/src/index.ts index 22ba9f6520af..fd9181a5adea 100644 --- a/packages/babel-plugin-transform-export-namespace-from/src/index.ts +++ b/packages/babel-plugin-transform-export-namespace-from/src/index.ts @@ -13,9 +13,9 @@ export default declare(api => { inherits: USE_ESM ? undefined : IS_STANDALONE - ? undefined - : // eslint-disable-next-line no-restricted-globals - require("@babel/plugin-syntax-export-namespace-from").default, + ? undefined + : // eslint-disable-next-line no-restricted-globals + require("@babel/plugin-syntax-export-namespace-from").default, visitor: { ExportNamedDeclaration(path) { diff --git a/packages/babel-plugin-transform-json-strings/src/index.ts b/packages/babel-plugin-transform-json-strings/src/index.ts index dbec1732dc7b..82a0a2de07e6 100644 --- a/packages/babel-plugin-transform-json-strings/src/index.ts +++ b/packages/babel-plugin-transform-json-strings/src/index.ts @@ -24,9 +24,9 @@ export default declare(api => { inherits: USE_ESM ? undefined : IS_STANDALONE - ? undefined - : // eslint-disable-next-line no-restricted-globals - require("@babel/plugin-syntax-json-strings").default, + ? undefined + : // eslint-disable-next-line no-restricted-globals + require("@babel/plugin-syntax-json-strings").default, visitor: { "DirectiveLiteral|StringLiteral"({ diff --git a/packages/babel-plugin-transform-logical-assignment-operators/src/index.ts b/packages/babel-plugin-transform-logical-assignment-operators/src/index.ts index 598fe2430605..b984ca822dce 100644 --- a/packages/babel-plugin-transform-logical-assignment-operators/src/index.ts +++ b/packages/babel-plugin-transform-logical-assignment-operators/src/index.ts @@ -13,9 +13,9 @@ export default declare(api => { inherits: USE_ESM ? undefined : IS_STANDALONE - ? undefined - : // eslint-disable-next-line no-restricted-globals - require("@babel/plugin-syntax-logical-assignment-operators").default, + ? undefined + : // eslint-disable-next-line no-restricted-globals + require("@babel/plugin-syntax-logical-assignment-operators").default, visitor: { AssignmentExpression(path) { diff --git a/packages/babel-plugin-transform-nullish-coalescing-operator/src/index.ts b/packages/babel-plugin-transform-nullish-coalescing-operator/src/index.ts index b89b492f1025..c5e04dcaf462 100644 --- a/packages/babel-plugin-transform-nullish-coalescing-operator/src/index.ts +++ b/packages/babel-plugin-transform-nullish-coalescing-operator/src/index.ts @@ -18,9 +18,9 @@ export default declare((api, { loose = false }: Options) => { inherits: USE_ESM ? undefined : IS_STANDALONE - ? undefined - : // eslint-disable-next-line no-restricted-globals - require("@babel/plugin-syntax-nullish-coalescing-operator").default, + ? undefined + : // eslint-disable-next-line no-restricted-globals + require("@babel/plugin-syntax-nullish-coalescing-operator").default, visitor: { LogicalExpression(path) { diff --git a/packages/babel-plugin-transform-numeric-separator/src/index.ts b/packages/babel-plugin-transform-numeric-separator/src/index.ts index c207491b5c78..bfd796a43727 100644 --- a/packages/babel-plugin-transform-numeric-separator/src/index.ts +++ b/packages/babel-plugin-transform-numeric-separator/src/index.ts @@ -29,9 +29,9 @@ export default declare(api => { inherits: USE_ESM ? undefined : IS_STANDALONE - ? undefined - : // eslint-disable-next-line no-restricted-globals - require("@babel/plugin-syntax-numeric-separator").default, + ? undefined + : // eslint-disable-next-line no-restricted-globals + require("@babel/plugin-syntax-numeric-separator").default, visitor: { NumericLiteral: remover, diff --git a/packages/babel-plugin-transform-object-rest-spread/src/index.ts b/packages/babel-plugin-transform-object-rest-spread/src/index.ts index 0de6c4ef63fe..44e324202f11 100644 --- a/packages/babel-plugin-transform-object-rest-spread/src/index.ts +++ b/packages/babel-plugin-transform-object-rest-spread/src/index.ts @@ -291,9 +291,9 @@ export default declare((api, opts: Options) => { inherits: USE_ESM ? undefined : IS_STANDALONE - ? undefined - : // eslint-disable-next-line no-restricted-globals - require("@babel/plugin-syntax-object-rest-spread").default, + ? undefined + : // eslint-disable-next-line no-restricted-globals + require("@babel/plugin-syntax-object-rest-spread").default, visitor: { // function a({ b, ...c }) {} diff --git a/packages/babel-plugin-transform-optional-catch-binding/src/index.ts b/packages/babel-plugin-transform-optional-catch-binding/src/index.ts index d547a8a0b905..3f2e394935eb 100644 --- a/packages/babel-plugin-transform-optional-catch-binding/src/index.ts +++ b/packages/babel-plugin-transform-optional-catch-binding/src/index.ts @@ -12,9 +12,9 @@ export default declare(api => { inherits: USE_ESM ? undefined : IS_STANDALONE - ? undefined - : // eslint-disable-next-line no-restricted-globals - require("@babel/plugin-syntax-optional-catch-binding").default, + ? undefined + : // eslint-disable-next-line no-restricted-globals + require("@babel/plugin-syntax-optional-catch-binding").default, visitor: { CatchClause(path) { diff --git a/packages/babel-plugin-transform-optional-chaining/src/index.ts b/packages/babel-plugin-transform-optional-chaining/src/index.ts index b40f7bd26245..3109765d227e 100644 --- a/packages/babel-plugin-transform-optional-chaining/src/index.ts +++ b/packages/babel-plugin-transform-optional-chaining/src/index.ts @@ -22,9 +22,9 @@ export default declare((api, options: Options) => { inherits: USE_ESM ? undefined : IS_STANDALONE - ? undefined - : // eslint-disable-next-line no-restricted-globals - require("@babel/plugin-syntax-optional-chaining").default, + ? undefined + : // eslint-disable-next-line no-restricted-globals + require("@babel/plugin-syntax-optional-chaining").default, visitor: { "OptionalCallExpression|OptionalMemberExpression"( diff --git a/packages/babel-plugin-transform-private-property-in-object/src/index.ts b/packages/babel-plugin-transform-private-property-in-object/src/index.ts index 8bbefdef8d8e..f5ce6a99a0a2 100644 --- a/packages/babel-plugin-transform-private-property-in-object/src/index.ts +++ b/packages/babel-plugin-transform-private-property-in-object/src/index.ts @@ -119,9 +119,9 @@ export default declare((api, opt: Options) => { inherits: USE_ESM ? undefined : IS_STANDALONE - ? undefined - : // eslint-disable-next-line no-restricted-globals - require("@babel/plugin-syntax-private-property-in-object").default, + ? undefined + : // eslint-disable-next-line no-restricted-globals + require("@babel/plugin-syntax-private-property-in-object").default, pre() { // Enable this in @babel/helper-create-class-features-plugin, so that it // can be handled by the private fields and methods transform. diff --git a/packages/babel-plugin-transform-react-jsx/src/create-plugin.ts b/packages/babel-plugin-transform-react-jsx/src/create-plugin.ts index 74d421782d37..6567238958c5 100644 --- a/packages/babel-plugin-transform-react-jsx/src/create-plugin.ts +++ b/packages/babel-plugin-transform-react-jsx/src/create-plugin.ts @@ -77,8 +77,8 @@ export default function createPlugin({ runtime: RUNTIME_DEFAULT = process.env.BABEL_8_BREAKING ? "automatic" : development - ? "automatic" - : "classic", + ? "automatic" + : "classic", importSource: IMPORT_SOURCE_DEFAULT = DEFAULT.importSource, pragma: PRAGMA_DEFAULT = DEFAULT.pragma, @@ -793,8 +793,8 @@ You can set \`throwIfNamespace: false\` to bypass this warning.`, !t.isObjectExpression(props[0].argument) ? props[0].argument : props.length > 0 - ? t.objectExpression(props) - : t.nullLiteral(); + ? t.objectExpression(props) + : t.nullLiteral(); } }); diff --git a/packages/babel-plugin-transform-runtime/src/polyfills.ts b/packages/babel-plugin-transform-runtime/src/polyfills.ts index 581baa67f224..330c1610b1eb 100644 --- a/packages/babel-plugin-transform-runtime/src/polyfills.ts +++ b/packages/babel-plugin-transform-runtime/src/polyfills.ts @@ -132,10 +132,10 @@ export function createBasePolyfillsPlugin( createRegeneratorPlugin(polyfillOpts, useRuntimeRegenerator), ) : corejsVersion === 3 - ? createCorejsPlugin( - pluginCorejs3, - { version: 3, proposals, ...polyfillOpts }, - createRegeneratorPlugin(polyfillOpts, useRuntimeRegenerator), - ) - : createRegeneratorPlugin(polyfillOpts, useRuntimeRegenerator); + ? createCorejsPlugin( + pluginCorejs3, + { version: 3, proposals, ...polyfillOpts }, + createRegeneratorPlugin(polyfillOpts, useRuntimeRegenerator), + ) + : createRegeneratorPlugin(polyfillOpts, useRuntimeRegenerator); } diff --git a/packages/babel-plugin-transform-typescript/src/index.ts b/packages/babel-plugin-transform-typescript/src/index.ts index 904a283c6ae4..a4d1d75dc32a 100644 --- a/packages/babel-plugin-transform-typescript/src/index.ts +++ b/packages/babel-plugin-transform-typescript/src/index.ts @@ -671,9 +671,9 @@ export default declare((api, opts: Options) => { but allows loading unbundled plugin (which cannot obviously import the bundled `@babel/core` version). */ - api.types.tsInstantiationExpression - ? "TSNonNullExpression|TSInstantiationExpression" - : "TSNonNullExpression"]( + api.types.tsInstantiationExpression + ? "TSNonNullExpression|TSInstantiationExpression" + : "TSNonNullExpression"]( path: NodePath, ) { path.replaceWith(path.node.expression); diff --git a/packages/babel-runtime-corejs3/test/index.spec.js b/packages/babel-runtime-corejs3/test/index.spec.js index 88af741b9b43..6660571c5896 100644 --- a/packages/babel-runtime-corejs3/test/index.spec.js +++ b/packages/babel-runtime-corejs3/test/index.spec.js @@ -3,27 +3,23 @@ describe("babel-runtime", () => { describe("instance methods entries", () => { it("at, exists", () => { - expect( - require("../core-js/instance/at")("").call("a", 0), - ).toEqual("a"); + expect(require("../core-js/instance/at")("").call("a", 0)).toEqual("a"); }); it("at, missing", () => { - expect( - require("../core-js/instance/at")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/at")({})).toEqual(undefined); }); it("bind, exists", () => { expect( - require("../core-js/instance/bind")(() => {}).call(function () { return this; }, 42)(), + require("../core-js/instance/bind")(() => {}).call(function () { + return this; + }, 42)(), ).toEqual(42); }); it("bind, missing", () => { - expect( - require("../core-js/instance/bind")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/bind")({})).toEqual(undefined); }); it("codePointAt, exists", () => { @@ -33,9 +29,9 @@ describe("babel-runtime", () => { }); it("codePointAt, missing", () => { - expect( - require("../core-js/instance/code-point-at")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/code-point-at")({})).toEqual( + undefined, + ); }); it("codePoints, exists", () => { @@ -45,9 +41,7 @@ describe("babel-runtime", () => { }); it("codePoints, missing", () => { - expect( - require("../core-js/instance/code-points")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/code-points")({})).toEqual(undefined); }); it("concat, exists", () => { @@ -57,9 +51,7 @@ describe("babel-runtime", () => { }); it("concat, missing", () => { - expect( - require("../core-js/instance/concat")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/concat")({})).toEqual(undefined); }); it("copyWithin, exists", () => { @@ -69,9 +61,7 @@ describe("babel-runtime", () => { }); it("copyWithin, missing", () => { - expect( - require("../core-js/instance/copy-within")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/copy-within")({})).toEqual(undefined); }); it("endsWith, exists", () => { @@ -81,9 +71,7 @@ describe("babel-runtime", () => { }); it("endsWith, missing", () => { - expect( - require("../core-js/instance/ends-with")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/ends-with")({})).toEqual(undefined); }); it("entries, exists", () => { @@ -93,21 +81,20 @@ describe("babel-runtime", () => { }); it("entries, missing", () => { - expect( - require("../core-js/instance/entries")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/entries")({})).toEqual(undefined); }); it("every, exists", () => { expect( - require("../core-js/instance/every")([]).call([1, 2, 3], it => typeof it === "number"), + require("../core-js/instance/every")([]).call( + [1, 2, 3], + it => typeof it === "number", + ), ).toEqual(true); }); it("every, missing", () => { - expect( - require("../core-js/instance/every")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/every")({})).toEqual(undefined); }); it("fill, exists", () => { @@ -117,69 +104,65 @@ describe("babel-runtime", () => { }); it("fill, missing", () => { - expect( - require("../core-js/instance/fill")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/fill")({})).toEqual(undefined); }); it("filter, exists", () => { expect( - require("../core-js/instance/filter")([]).call([1, 2, 3], it => it % 2).length, + require("../core-js/instance/filter")([]).call([1, 2, 3], it => it % 2) + .length, ).toEqual(2); }); it("filter, missing", () => { - expect( - require("../core-js/instance/filter")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/filter")({})).toEqual(undefined); }); it("find, exists", () => { expect( - require("../core-js/instance/find")([]).call([1, 2, 3], it => !(it % 2)), + require("../core-js/instance/find")([]).call( + [1, 2, 3], + it => !(it % 2), + ), ).toEqual(2); }); it("find, missing", () => { - expect( - require("../core-js/instance/find")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/find")({})).toEqual(undefined); }); it("findIndex, exists", () => { expect( - require("../core-js/instance/find-index")([]).call([1, 2, 3], it => !(it % 2)), + require("../core-js/instance/find-index")([]).call( + [1, 2, 3], + it => !(it % 2), + ), ).toEqual(1); }); it("findIndex, missing", () => { - expect( - require("../core-js/instance/find-index")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/find-index")({})).toEqual(undefined); }); it("flags, exists", () => { - expect( - require("../core-js/instance/flags")(/./gim), - ).toEqual("gim"); + expect(require("../core-js/instance/flags")(/./gim)).toEqual("gim"); }); it("flags, missing", () => { - expect( - require("../core-js/instance/flags")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/flags")({})).toEqual(undefined); }); it("flatMap, exists", () => { expect( - require("../core-js/instance/flat-map")([]).call([1, 2, [3, 4]], it => it).length, + require("../core-js/instance/flat-map")([]).call( + [1, 2, [3, 4]], + it => it, + ).length, ).toEqual(4); }); it("flatMap, missing", () => { - expect( - require("../core-js/instance/flat-map")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/flat-map")({})).toEqual(undefined); }); it("flat, exists", () => { @@ -189,21 +172,17 @@ describe("babel-runtime", () => { }); it("flat, missing", () => { - expect( - require("../core-js/instance/flat")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/flat")({})).toEqual(undefined); }); it("forEach, exists", () => { - expect( - typeof require("../core-js/instance/for-each")([]), - ).toEqual("function"); + expect(typeof require("../core-js/instance/for-each")([])).toEqual( + "function", + ); }); it("forEach, missing", () => { - expect( - require("../core-js/instance/for-each")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/for-each")({})).toEqual(undefined); }); it("includes, array", () => { @@ -219,9 +198,7 @@ describe("babel-runtime", () => { }); it("includes, missing", () => { - expect( - require("../core-js/instance/includes")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/includes")({})).toEqual(undefined); }); it("indexOf, exists", () => { @@ -231,9 +208,7 @@ describe("babel-runtime", () => { }); it("indexOf, missing", () => { - expect( - require("../core-js/instance/index-of")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/index-of")({})).toEqual(undefined); }); it("keys, exists", () => { @@ -243,9 +218,7 @@ describe("babel-runtime", () => { }); it("keys, missing", () => { - expect( - require("../core-js/instance/keys")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/keys")({})).toEqual(undefined); }); it("lastIndexOf, exists", () => { @@ -255,45 +228,43 @@ describe("babel-runtime", () => { }); it("lastIndexOf, missing", () => { - expect( - require("../core-js/instance/last-index-of")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/last-index-of")({})).toEqual( + undefined, + ); }); it("map, exists", () => { expect( - require("../core-js/instance/map")([]).call([1, 2, 3], it => it * it)[2], + require("../core-js/instance/map")([]).call( + [1, 2, 3], + it => it * it, + )[2], ).toEqual(9); }); it("map, missing", () => { - expect( - require("../core-js/instance/map")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/map")({})).toEqual(undefined); }); it("matchAll, exists", () => { expect( - typeof require("../core-js/instance/match-all")("").call("qwe", /./g).next, + typeof require("../core-js/instance/match-all")("").call("qwe", /./g) + .next, ).toEqual("function"); }); it("matchAll, missing", () => { - expect( - require("../core-js/instance/match-all")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/match-all")({})).toEqual(undefined); }); it("padEnd, exists", () => { - expect( - require("../core-js/instance/pad-end")("").call("qwe", 6), - ).toEqual("qwe "); + expect(require("../core-js/instance/pad-end")("").call("qwe", 6)).toEqual( + "qwe ", + ); }); it("padEnd, missing", () => { - expect( - require("../core-js/instance/pad-end")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/pad-end")({})).toEqual(undefined); }); it("padStart, exists", () => { @@ -303,45 +274,45 @@ describe("babel-runtime", () => { }); it("padStart, missing", () => { - expect( - require("../core-js/instance/pad-start")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/pad-start")({})).toEqual(undefined); }); it("reduce, exists", () => { expect( - require("../core-js/instance/reduce")([]).call([1, 2, 3], (a, b) => a + b), + require("../core-js/instance/reduce")([]).call( + [1, 2, 3], + (a, b) => a + b, + ), ).toEqual(6); }); it("reduce, missing", () => { - expect( - require("../core-js/instance/reduce")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/reduce")({})).toEqual(undefined); }); it("reduceRight, exists", () => { expect( - require("../core-js/instance/reduce-right")([]).call([1, 2, 3], (a, b) => a + b), + require("../core-js/instance/reduce-right")([]).call( + [1, 2, 3], + (a, b) => a + b, + ), ).toEqual(6); }); it("reduceRight, missing", () => { - expect( - require("../core-js/instance/reduce-right")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/reduce-right")({})).toEqual( + undefined, + ); }); it("repeat, exists", () => { - expect( - require("../core-js/instance/repeat")("").call("q", 6), - ).toEqual("qqqqqq"); + expect(require("../core-js/instance/repeat")("").call("q", 6)).toEqual( + "qqqqqq", + ); }); it("repeat, missing", () => { - expect( - require("../core-js/instance/repeat")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/repeat")({})).toEqual(undefined); }); it("replaceAll, exists", () => { @@ -351,21 +322,17 @@ describe("babel-runtime", () => { }); it("replaceAll, missing", () => { - expect( - require("../core-js/instance/replace-all")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/replace-all")({})).toEqual(undefined); }); it("reverse, exists", () => { expect( - require("../core-js/instance/reverse")([]).call([1, 2, 3]).join(''), + require("../core-js/instance/reverse")([]).call([1, 2, 3]).join(""), ).toEqual("321"); }); it("reverse, missing", () => { - expect( - require("../core-js/instance/reverse")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/reverse")({})).toEqual(undefined); }); it("slice, exists", () => { @@ -375,45 +342,40 @@ describe("babel-runtime", () => { }); it("slice, missing", () => { - expect( - require("../core-js/instance/slice")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/slice")({})).toEqual(undefined); }); it("some, exists", () => { expect( - require("../core-js/instance/some")([]).call([1, 2, 3], it => typeof it === "number"), + require("../core-js/instance/some")([]).call( + [1, 2, 3], + it => typeof it === "number", + ), ).toEqual(true); }); it("some, missing", () => { - expect( - require("../core-js/instance/some")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/some")({})).toEqual(undefined); }); it("sort, exists", () => { - expect( - typeof require("../core-js/instance/sort")([]), - ).toEqual("function"); + expect(typeof require("../core-js/instance/sort")([])).toEqual( + "function", + ); }); it("sort, missing", () => { - expect( - require("../core-js/instance/sort")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/sort")({})).toEqual(undefined); }); it("splice, exists", () => { - expect( - typeof require("../core-js/instance/splice")([]), - ).toEqual("function"); + expect(typeof require("../core-js/instance/splice")([])).toEqual( + "function", + ); }); it("splice, missing", () => { - expect( - require("../core-js/instance/splice")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/splice")({})).toEqual(undefined); }); it("startsWith, exists", () => { @@ -423,21 +385,17 @@ describe("babel-runtime", () => { }); it("startsWith, missing", () => { - expect( - require("../core-js/instance/starts-with")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/starts-with")({})).toEqual(undefined); }); it("trim, exists", () => { - expect( - require("../core-js/instance/trim")("").call(" qwe "), - ).toEqual("qwe"); + expect(require("../core-js/instance/trim")("").call(" qwe ")).toEqual( + "qwe", + ); }); it("trim, missing", () => { - expect( - require("../core-js/instance/trim")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/trim")({})).toEqual(undefined); }); it("trimEnd, exists", () => { @@ -447,9 +405,7 @@ describe("babel-runtime", () => { }); it("trimEnd, missing", () => { - expect( - require("../core-js/instance/trim-end")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/trim-end")({})).toEqual(undefined); }); it("trimLeft, exists", () => { @@ -459,9 +415,7 @@ describe("babel-runtime", () => { }); it("trimLeft, missing", () => { - expect( - require("../core-js/instance/trim-left")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/trim-left")({})).toEqual(undefined); }); it("trimRight, exists", () => { @@ -471,9 +425,7 @@ describe("babel-runtime", () => { }); it("trimRight, missing", () => { - expect( - require("../core-js/instance/trim-right")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/trim-right")({})).toEqual(undefined); }); it("trimStart, exists", () => { @@ -483,9 +435,7 @@ describe("babel-runtime", () => { }); it("trimStart, missing", () => { - expect( - require("../core-js/instance/trim-start")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/trim-start")({})).toEqual(undefined); }); it("values, exists", () => { @@ -495,9 +445,7 @@ describe("babel-runtime", () => { }); it("values, missing", () => { - expect( - require("../core-js/instance/values")({}), - ).toEqual(undefined); + expect(require("../core-js/instance/values")({})).toEqual(undefined); }); }); }); diff --git a/packages/babel-traverse/src/path/family.ts b/packages/babel-traverse/src/path/family.ts index a0396a79ce34..e740fc202ed7 100644 --- a/packages/babel-traverse/src/path/family.ts +++ b/packages/babel-traverse/src/path/family.ts @@ -364,8 +364,8 @@ type Trav< type ToNodePath = T extends Array ? Array> : T extends t.Node | null | undefined - ? NodePath - : never; + ? NodePath + : never; function get( this: NodePath, @@ -374,8 +374,8 @@ function get( ): T[K] extends Array ? Array> : T[K] extends t.Node | null | undefined - ? NodePath - : never; + ? NodePath + : never; function get( this: NodePath, diff --git a/packages/babel-traverse/src/path/generated/asserts.d.ts b/packages/babel-traverse/src/path/generated/asserts.d.ts index 49aa405625bb..4a2802867802 100644 --- a/packages/babel-traverse/src/path/generated/asserts.d.ts +++ b/packages/babel-traverse/src/path/generated/asserts.d.ts @@ -9,8 +9,8 @@ type Opts = Partial<{ [Prop in keyof Obj]: Obj[Prop] extends t.Node ? t.Node : Obj[Prop] extends t.Node[] - ? t.Node[] - : Obj[Prop]; + ? t.Node[] + : Obj[Prop]; }>; export interface NodePathAssertions { diff --git a/packages/babel-traverse/src/path/generated/validators.d.ts b/packages/babel-traverse/src/path/generated/validators.d.ts index 0be11609fa67..6a5ed1472e27 100644 --- a/packages/babel-traverse/src/path/generated/validators.d.ts +++ b/packages/babel-traverse/src/path/generated/validators.d.ts @@ -10,8 +10,8 @@ type Opts = Partial<{ [Prop in keyof Obj]: Obj[Prop] extends t.Node ? t.Node : Obj[Prop] extends t.Node[] - ? t.Node[] - : Obj[Prop]; + ? t.Node[] + : Obj[Prop]; }>; interface BaseNodePathValidators { diff --git a/packages/babel-traverse/src/path/lib/virtual-types-validator.ts b/packages/babel-traverse/src/path/lib/virtual-types-validator.ts index 010019f81b88..174927fb6dde 100644 --- a/packages/babel-traverse/src/path/lib/virtual-types-validator.ts +++ b/packages/babel-traverse/src/path/lib/virtual-types-validator.ts @@ -30,8 +30,8 @@ type Opts = Partial<{ [Prop in keyof Obj]: Obj[Prop] extends t.Node ? t.Node : Obj[Prop] extends t.Node[] - ? t.Node[] - : Obj[Prop]; + ? t.Node[] + : Obj[Prop]; }>; export interface VirtualTypeNodePathValidators { diff --git a/packages/babel-types/src/validators/generated/index.ts b/packages/babel-types/src/validators/generated/index.ts index bb8e068674ad..240bdc05b955 100644 --- a/packages/babel-types/src/validators/generated/index.ts +++ b/packages/babel-types/src/validators/generated/index.ts @@ -13,8 +13,8 @@ type Opts = Partial<{ [Prop in keyof Obj]: Obj[Prop] extends t.Node ? t.Node : Obj[Prop] extends t.Node[] - ? t.Node[] - : Obj[Prop]; + ? t.Node[] + : Obj[Prop]; }>; export function isArrayExpression( diff --git a/scripts/parser-tests/typescript/index.js b/scripts/parser-tests/typescript/index.js index 96fb1fc5a659..163dc587405a 100644 --- a/scripts/parser-tests/typescript/index.js +++ b/scripts/parser-tests/typescript/index.js @@ -117,8 +117,8 @@ function splitTwoslashCodeInfoFiles(code, defaultFileName, root = "") { const newFileName = BracketedFileRegExp.test(line) ? line.match(BracketedFileRegExp)[1] : AtFileRegExp.test(line) - ? line.match(AtFileRegExp)[1] - : false; + ? line.match(AtFileRegExp)[1] + : false; if (newFileName) { fileMap.push([root + nameForFile, currentFileContent]); nameForFile = newFileName; diff --git a/scripts/rollup-plugin-babel-source.js b/scripts/rollup-plugin-babel-source.js index 09b06e02031e..c7fc28c1f00c 100644 --- a/scripts/rollup-plugin-babel-source.js +++ b/scripts/rollup-plugin-babel-source.js @@ -96,8 +96,8 @@ export default function () { const filename = internal ? `src/${internal}` : typeof packageJson["browser"] === "string" - ? packageJson["browser"] - : packageJson["main"]; + ? packageJson["browser"] + : packageJson["main"]; let asJS = path.normalize( path.join( diff --git a/yarn.lock b/yarn.lock index 0ac6ab280ceb..9290b5c014e4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6803,7 +6803,7 @@ __metadata: jest-worker: ^30.0.0-alpha.1 lint-staged: ^14.0.1 mergeiterator: ^1.4.4 - prettier: ^3.0.3 + prettier: ^3.1.0 rollup: ^3.28.1 rollup-plugin-dts: ^6.0.0 rollup-plugin-dts-5: "npm:rollup-plugin-dts@^5.3.1" @@ -13976,12 +13976,12 @@ __metadata: languageName: node linkType: hard -"prettier@npm:^3.0.3": - version: 3.0.3 - resolution: "prettier@npm:3.0.3" +"prettier@npm:^3.1.0": + version: 3.1.0 + resolution: "prettier@npm:3.1.0" bin: prettier: bin/prettier.cjs - checksum: e10b9af02b281f6c617362ebd2571b1d7fc9fb8a3bd17e371754428cda992e5e8d8b7a046e8f7d3e2da1dcd21aa001e2e3c797402ebb6111b5cd19609dd228e0 + checksum: 44b556bd56f74d7410974fbb2418bb4e53a894d3e7b42f6f87779f69f27a6c272fa7fc27cec0118cd11730ef3246478052e002cbd87e9a253f9cd04a56aa7d9b languageName: node linkType: hard