Remove support for tupleAndRecord (#17363)

This commit is contained in:
fisker Cheung authored and GitHub committed 2025-04-17 04:53:05 +08:00
1 parent 4b2db262b7
commit b289ecbb19
77 files changed
+551 -2414

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
#### Removed support for experimental `Records & Tuples` (#17363 by @fisker)
The the ES proposal [JavaScript Records & Tuples Proposal](https://github.com/tc39/proposal-record-tuple) has been withdrawn.
- [Disclaimer about non-standard syntax](https://prettier.io/docs/en/rationale.html#disclaimer-about-non-standard-syntax)
+2 -2
View File
@@ -1,5 +1,5 @@
import { import {
isArrayOrTupleExpression, isArrayExpression,
isNumericLiteral, isNumericLiteral,
isStringLiteral, isStringLiteral,
} from "./utils/index.js"; } from "./utils/index.js";
@@ -145,7 +145,7 @@ function clean(original, cloned, parent) {
] of cloned.expression.arguments[0].properties.entries()) { ] of cloned.expression.arguments[0].properties.entries()) {
switch (astProps[index].key.name) { switch (astProps[index].key.name) {
case "styles": case "styles":
if (isArrayOrTupleExpression(prop.value)) { if (isArrayExpression(prop.value)) {
removeTemplateElementsValue(prop.value.elements[0]); removeTemplateElementsValue(prop.value.elements[0]);
} }
break; break;
@@ -861,9 +861,7 @@ const assignmentLikeNodeTypes = new Set([
]); ]);
const complexExprNodeTypes = new Set([ const complexExprNodeTypes = new Set([
"ObjectExpression", "ObjectExpression",
"RecordExpression",
"ArrayExpression", "ArrayExpression",
"TupleExpression",
"TemplateLiteral", "TemplateLiteral",
"TaggedTemplateExpression", "TaggedTemplateExpression",
"ObjectTypeAnnotation", "ObjectTypeAnnotation",
+2 -2
View File
@@ -1,7 +1,7 @@
import { import {
CommentCheckFlags, CommentCheckFlags,
hasComment, hasComment,
isArrayOrTupleExpression, isArrayExpression,
isObjectProperty, isObjectProperty,
} from "../utils/index.js"; } from "../utils/index.js";
@@ -40,7 +40,7 @@ function isAngularComponentStyles(path) {
return ( return (
path.match( path.match(
isTemplateLiteral, isTemplateLiteral,
(node, name) => isArrayOrTupleExpression(node) && name === "elements", (node, name) => isArrayExpression(node) && name === "elements",
isObjectPropertyNamedStyles, isObjectPropertyNamedStyles,
...angularComponentObjectExpressionPredicates, ...angularComponentObjectExpressionPredicates,
) || ) ||
+5 -5
View File
@@ -6,7 +6,7 @@ import {
getPrecedence, getPrecedence,
hasNakedLeftSide, hasNakedLeftSide,
hasNode, hasNode,
isArrayOrTupleExpression, isArrayExpression,
isBinaryCastExpression, isBinaryCastExpression,
isBitwiseOperator, isBitwiseOperator,
isCallExpression, isCallExpression,
@@ -15,7 +15,7 @@ import {
isMemberExpression, isMemberExpression,
isNullishCoalescing, isNullishCoalescing,
isNumericLiteral, isNumericLiteral,
isObjectOrRecordExpression, isObjectExpression,
isObjectProperty, isObjectProperty,
isUnionType, isUnionType,
shouldFlatten, shouldFlatten,
@@ -946,7 +946,7 @@ function needsParens(path, options) {
(parent.type === "ObjectProperty" && (parent.type === "ObjectProperty" &&
// Preserve parens for compatibility with AngularJS expressions // Preserve parens for compatibility with AngularJS expressions
!node.extra?.parenthesized) || !node.extra?.parenthesized) ||
isArrayOrTupleExpression(parent) || isArrayExpression(parent) ||
(key === "arguments" && isCallExpression(parent)) || (key === "arguments" && isCallExpression(parent)) ||
(key === "right" && parent.type === "NGPipeExpression") || (key === "right" && parent.type === "NGPipeExpression") ||
(key === "property" && parent.type === "MemberExpression") || (key === "property" && parent.type === "MemberExpression") ||
@@ -962,7 +962,7 @@ function needsParens(path, options) {
(key === "left" && (key === "left" &&
parent.type === "BinaryExpression" && parent.type === "BinaryExpression" &&
parent.operator === "<") || parent.operator === "<") ||
(!isArrayOrTupleExpression(parent) && (!isArrayExpression(parent) &&
parent.type !== "ArrowFunctionExpression" && parent.type !== "ArrowFunctionExpression" &&
parent.type !== "AssignmentExpression" && parent.type !== "AssignmentExpression" &&
parent.type !== "AssignmentPattern" && parent.type !== "AssignmentPattern" &&
@@ -1076,7 +1076,7 @@ function includesFunctionTypeInObjectType(node) {
} }
function endsWithRightBracket(node) { function endsWithRightBracket(node) {
return isObjectOrRecordExpression(node); return isObjectExpression(node);
} }
/** /**
-1
View File
@@ -45,7 +45,6 @@ const parseOptions = {
"sourcePhaseImports", "sourcePhaseImports",
"deferredImportEvaluation", "deferredImportEvaluation",
["optionalChainingAssign", { version: "2023-07" }], ["optionalChainingAssign", { version: "2023-07" }],
"recordAndTuple",
], ],
tokens: true, tokens: true,
ranges: true, ranges: true,
+6 -12
View File
@@ -16,9 +16,9 @@ import { locEnd, locStart } from "../loc.js";
import { import {
CommentCheckFlags, CommentCheckFlags,
hasComment, hasComment,
isArrayOrTupleExpression, isArrayExpression,
isNumericLiteral, isNumericLiteral,
isObjectOrRecordExpression, isObjectExpression,
isSignedNumericLiteral, isSignedNumericLiteral,
shouldPrintComma, shouldPrintComma,
} from "../utils/index.js"; } from "../utils/index.js";
@@ -44,7 +44,6 @@ function printEmptyArrayElements(path, options, openBracket, closeBracket) {
/* /*
- `ArrayExpression` - `ArrayExpression`
- `TupleExpression`
- `ArrayPattern` - `ArrayPattern`
- `TSTupleType`(TypeScript) - `TSTupleType`(TypeScript)
- `TupleTypeAnnotation`(Flow) - `TupleTypeAnnotation`(Flow)
@@ -54,7 +53,7 @@ function printArray(path, options, print) {
/** @type{Doc[]} */ /** @type{Doc[]} */
const parts = []; const parts = [];
const openBracket = node.type === "TupleExpression" ? "#[" : "["; const openBracket = "[";
const closeBracket = "]"; const closeBracket = "]";
const elementsProperty = const elementsProperty =
// TODO: Remove `types` when babel changes AST of `TupleTypeAnnotation` // TODO: Remove `types` when babel changes AST of `TupleTypeAnnotation`
@@ -92,10 +91,7 @@ function printArray(path, options, print) {
elements.length > 1 && elements.length > 1 &&
elements.every((element, i, elements) => { elements.every((element, i, elements) => {
const elementType = element?.type; const elementType = element?.type;
if ( if (!isArrayExpression(element) && !isObjectExpression(element)) {
!isArrayOrTupleExpression(element) &&
!isObjectOrRecordExpression(element)
) {
return false; return false;
} }
@@ -104,9 +100,7 @@ function printArray(path, options, print) {
return false; return false;
} }
const itemsKey = isArrayOrTupleExpression(element) const itemsKey = isArrayExpression(element) ? "elements" : "properties";
? "elements"
: "properties";
return element[itemsKey] && element[itemsKey].length > 1; return element[itemsKey] && element[itemsKey].length > 1;
}); });
@@ -161,7 +155,7 @@ function printArray(path, options, print) {
function isConciselyPrintedArray(node, options) { function isConciselyPrintedArray(node, options) {
return ( return (
isArrayOrTupleExpression(node) && isArrayExpression(node) &&
node.elements.length > 1 && node.elements.length > 1 &&
node.elements.every( node.elements.every(
(element) => (element) =>
+4 -4
View File
@@ -20,11 +20,11 @@ import {
getFunctionParameters, getFunctionParameters,
hasComment, hasComment,
hasLeadingOwnLineComment, hasLeadingOwnLineComment,
isArrayOrTupleExpression, isArrayExpression,
isBinaryish, isBinaryish,
isCallLikeExpression, isCallLikeExpression,
isJsxElement, isJsxElement,
isObjectOrRecordExpression, isObjectExpression,
isTemplateOnItsOwnLine, isTemplateOnItsOwnLine,
shouldPrintComma, shouldPrintComma,
startsWithNoLookaheadToken, startsWithNoLookaheadToken,
@@ -226,8 +226,8 @@ function printArrowFunctionSignature(path, options, print, args) {
*/ */
function mayBreakAfterShortPrefix(functionBody, bodyDoc, options) { function mayBreakAfterShortPrefix(functionBody, bodyDoc, options) {
return ( return (
isArrayOrTupleExpression(functionBody) || isArrayExpression(functionBody) ||
isObjectOrRecordExpression(functionBody) || isObjectExpression(functionBody) ||
functionBody.type === "ArrowFunctionExpression" || functionBody.type === "ArrowFunctionExpression" ||
functionBody.type === "DoExpression" || functionBody.type === "DoExpression" ||
functionBody.type === "BlockStatement" || functionBody.type === "BlockStatement" ||
+4 -7
View File
@@ -19,12 +19,12 @@ import {
CommentCheckFlags, CommentCheckFlags,
hasComment, hasComment,
hasLeadingOwnLineComment, hasLeadingOwnLineComment,
isArrayOrTupleExpression, isArrayExpression,
isBinaryish, isBinaryish,
isCallExpression, isCallExpression,
isJsxElement, isJsxElement,
isMemberExpression, isMemberExpression,
isObjectOrRecordExpression, isObjectExpression,
isObjectProperty, isObjectProperty,
shouldFlatten, shouldFlatten,
} from "../utils/index.js"; } from "../utils/index.js";
@@ -359,14 +359,11 @@ function shouldInlineLogicalExpression(node) {
return false; return false;
} }
if ( if (isObjectExpression(node.right) && node.right.properties.length > 0) {
isObjectOrRecordExpression(node.right) &&
node.right.properties.length > 0
) {
return true; return true;
} }
if (isArrayOrTupleExpression(node.right) && node.right.elements.length > 0) { if (isArrayExpression(node.right) && node.right.elements.length > 0) {
return true; return true;
} }
+7 -8
View File
@@ -17,7 +17,7 @@ import {
getCallArgumentSelector, getCallArgumentSelector,
getFunctionParameters, getFunctionParameters,
hasComment, hasComment,
isArrayOrTupleExpression, isArrayExpression,
isBinaryCastExpression, isBinaryCastExpression,
isBinaryish, isBinaryish,
isCallExpression, isCallExpression,
@@ -26,7 +26,7 @@ import {
isJsxElement, isJsxElement,
isLongCurriedCallExpression, isLongCurriedCallExpression,
isNextLineEmpty, isNextLineEmpty,
isObjectOrRecordExpression, isObjectExpression,
isObjectProperty, isObjectProperty,
isRegExpLiteral, isRegExpLiteral,
isSimpleCallArgument, isSimpleCallArgument,
@@ -192,10 +192,9 @@ function printCallArguments(path, options, print) {
function couldExpandArg(arg, arrowChainRecursion = false) { function couldExpandArg(arg, arrowChainRecursion = false) {
return ( return (
(isObjectOrRecordExpression(arg) && (isObjectExpression(arg) &&
(arg.properties.length > 0 || hasComment(arg))) || (arg.properties.length > 0 || hasComment(arg))) ||
(isArrayOrTupleExpression(arg) && (isArrayExpression(arg) && (arg.elements.length > 0 || hasComment(arg))) ||
(arg.elements.length > 0 || hasComment(arg))) ||
(arg.type === "TSTypeAssertion" && couldExpandArg(arg.expression)) || (arg.type === "TSTypeAssertion" && couldExpandArg(arg.expression)) ||
(isBinaryCastExpression(arg) && couldExpandArg(arg.expression)) || (isBinaryCastExpression(arg) && couldExpandArg(arg.expression)) ||
arg.type === "FunctionExpression" || arg.type === "FunctionExpression" ||
@@ -219,8 +218,8 @@ function couldExpandArg(arg, arrowChainRecursion = false) {
(arg.body.type === "BlockStatement" || (arg.body.type === "BlockStatement" ||
(arg.body.type === "ArrowFunctionExpression" && (arg.body.type === "ArrowFunctionExpression" &&
couldExpandArg(arg.body, true)) || couldExpandArg(arg.body, true)) ||
isObjectOrRecordExpression(arg.body) || isObjectExpression(arg.body) ||
isArrayOrTupleExpression(arg.body) || isArrayExpression(arg.body) ||
(!arrowChainRecursion && (!arrowChainRecursion &&
(isCallExpression(arg.body) || (isCallExpression(arg.body) ||
arg.body.type === "ConditionalExpression")) || arg.body.type === "ConditionalExpression")) ||
@@ -251,7 +250,7 @@ function shouldExpandLastArg(args, argDocs, options) {
// useMemo(() => func(), [foo, bar, baz]) // useMemo(() => func(), [foo, bar, baz])
(args.length !== 2 || (args.length !== 2 ||
penultimateArg.type !== "ArrowFunctionExpression" || penultimateArg.type !== "ArrowFunctionExpression" ||
!isArrayOrTupleExpression(lastArg)) && !isArrayExpression(lastArg)) &&
!(args.length > 1 && isConciselyPrintedArray(lastArg, options)) !(args.length > 1 && isConciselyPrintedArray(lastArg, options))
); );
} }
+4 -6
View File
@@ -15,13 +15,13 @@ import { locEnd, locStart } from "../loc.js";
import { import {
CommentCheckFlags, CommentCheckFlags,
hasComment, hasComment,
isArrayOrTupleExpression, isArrayExpression,
isCallExpression, isCallExpression,
isLiteral, isLiteral,
isMemberExpression, isMemberExpression,
isMethod, isMethod,
isNextLineEmpty, isNextLineEmpty,
isObjectOrRecordExpression, isObjectExpression,
needsHardlineAfterDanglingComment, needsHardlineAfterDanglingComment,
startsWithNoLookaheadToken, startsWithNoLookaheadToken,
} from "../utils/index.js"; } from "../utils/index.js";
@@ -117,8 +117,8 @@ function printEstree(path, options, print, args) {
case "ParenthesizedExpression": { case "ParenthesizedExpression": {
const shouldHug = const shouldHug =
!hasComment(node.expression) && !hasComment(node.expression) &&
(isObjectOrRecordExpression(node.expression) || (isObjectExpression(node.expression) ||
isArrayOrTupleExpression(node.expression)); isArrayExpression(node.expression));
if (shouldHug) { if (shouldHug) {
return ["(", print("expression"), ")"]; return ["(", print("expression"), ")"];
} }
@@ -249,7 +249,6 @@ function printEstree(path, options, print, args) {
case "ObjectExpression": case "ObjectExpression":
case "ObjectPattern": case "ObjectPattern":
case "RecordExpression":
return printObject(path, options, print); return printObject(path, options, print);
case "Property": case "Property":
if (isMethod(node)) { if (isMethod(node)) {
@@ -266,7 +265,6 @@ function printEstree(path, options, print, args) {
return ["@", print("expression")]; return ["@", print("expression")];
case "ArrayExpression": case "ArrayExpression":
case "ArrayPattern": case "ArrayPattern":
case "TupleExpression":
return printArray(path, options, print); return printArray(path, options, print);
case "SequenceExpression": { case "SequenceExpression": {
const { parent } = path; const { parent } = path;
+4 -4
View File
@@ -16,10 +16,10 @@ import {
getFunctionParameters, getFunctionParameters,
hasComment, hasComment,
hasRestParameter, hasRestParameter,
isArrayOrTupleExpression, isArrayExpression,
isFlowObjectTypePropertyAFunction, isFlowObjectTypePropertyAFunction,
isNextLineEmpty, isNextLineEmpty,
isObjectOrRecordExpression, isObjectExpression,
isObjectType, isObjectType,
isSimpleType, isSimpleType,
isTestCall, isTestCall,
@@ -185,9 +185,9 @@ function shouldHugTheOnlyFunctionParameter(node) {
(parameter.left.type === "ObjectPattern" || (parameter.left.type === "ObjectPattern" ||
parameter.left.type === "ArrayPattern") && parameter.left.type === "ArrayPattern") &&
(parameter.right.type === "Identifier" || (parameter.right.type === "Identifier" ||
(isObjectOrRecordExpression(parameter.right) && (isObjectExpression(parameter.right) &&
parameter.right.properties.length === 0) || parameter.right.properties.length === 0) ||
(isArrayOrTupleExpression(parameter.right) && (isArrayExpression(parameter.right) &&
parameter.right.elements.length === 0)))) parameter.right.elements.length === 0))))
); );
} }
+4 -5
View File
@@ -30,11 +30,11 @@ import {
CommentCheckFlags, CommentCheckFlags,
hasComment, hasComment,
hasNodeIgnoreComment, hasNodeIgnoreComment,
isArrayOrTupleExpression, isArrayExpression,
isBinaryish, isBinaryish,
isCallExpression, isCallExpression,
isJsxElement, isJsxElement,
isObjectOrRecordExpression, isObjectExpression,
isStringLiteral, isStringLiteral,
} from "../utils/index.js"; } from "../utils/index.js";
@@ -487,7 +487,6 @@ function separatorWithWhitespace(
const NO_WRAP_PARENTS = new Set([ const NO_WRAP_PARENTS = new Set([
"ArrayExpression", "ArrayExpression",
"TupleExpression",
"JSXAttribute", "JSXAttribute",
"JSXElement", "JSXElement",
"JSXExpressionContainer", "JSXExpressionContainer",
@@ -565,8 +564,8 @@ function printJsxExpressionContainer(path, options, print) {
const shouldInline = (node, parent) => const shouldInline = (node, parent) =>
node.type === "JSXEmptyExpression" || node.type === "JSXEmptyExpression" ||
(!hasComment(node) && (!hasComment(node) &&
(isArrayOrTupleExpression(node) || (isArrayExpression(node) ||
isObjectOrRecordExpression(node) || isObjectExpression(node) ||
node.type === "ArrowFunctionExpression" || node.type === "ArrowFunctionExpression" ||
(node.type === "AwaitExpression" && (node.type === "AwaitExpression" &&
(shouldInline(node.argument, node) || (shouldInline(node.argument, node) ||
+1 -2
View File
@@ -107,8 +107,7 @@ function printObject(path, options, print) {
: node.type === "TSInterfaceBody" || node.type === "TSTypeLiteral" : node.type === "TSInterfaceBody" || node.type === "TSTypeLiteral"
? ifBreak(semi, ";") ? ifBreak(semi, ";")
: ","; : ",";
const leftBrace = const leftBrace = node.exact ? "{|" : "{";
node.type === "RecordExpression" ? "#{" : node.exact ? "{|" : "{";
const rightBrace = node.exact ? "|}" : "}"; const rightBrace = node.exact ? "|}" : "}";
/** @type {Doc[]} */ /** @type {Doc[]} */
+4 -4
View File
@@ -8,8 +8,8 @@ import {
} from "../../document/builders.js"; } from "../../document/builders.js";
import UnexpectedNodeError from "../../utils/unexpected-node-error.js"; import UnexpectedNodeError from "../../utils/unexpected-node-error.js";
import { import {
isArrayOrTupleExpression, isArrayExpression,
isObjectOrRecordExpression, isObjectExpression,
shouldPrintComma, shouldPrintComma,
} from "../utils/index.js"; } from "../utils/index.js";
import isTsKeywordType from "../utils/is-ts-keyword-type.js"; import isTsKeywordType from "../utils/is-ts-keyword-type.js";
@@ -75,8 +75,8 @@ function printTypescript(path, options, print) {
return "this"; return "this";
case "TSTypeAssertion": { case "TSTypeAssertion": {
const shouldBreakAfterCast = !( const shouldBreakAfterCast = !(
isArrayOrTupleExpression(node.expression) || isArrayExpression(node.expression) ||
isObjectOrRecordExpression(node.expression) isObjectExpression(node.expression)
); );
const castGroup = group([ const castGroup = group([
@@ -94,6 +94,9 @@ const visitorKeys = Object.fromEntries(
]), ]),
); );
// Babel will remove these in v8 https://github.com/babel/babel/pull/17242
delete visitorKeys.TupleExpression;
delete visitorKeys.RecordExpression;
// Babel will remove this in v8 // Babel will remove this in v8
delete visitorKeys.DecimalLiteral; delete visitorKeys.DecimalLiteral;
// Won't exist since we use `createImportExpressions` when parsing with babel // Won't exist since we use `createImportExpressions` when parsing with babel
+9 -13
View File
@@ -102,15 +102,11 @@ const isExportDeclaration = createTypeCheckFunction([
"DeclareExportAllDeclaration", "DeclareExportAllDeclaration",
]); ]);
const isArrayOrTupleExpression = createTypeCheckFunction([ // These two functions exists because we used support `recordAndTuple`
"ArrayExpression", // Feel free to check `node.type` instead
"TupleExpression", // https://github.com/prettier/prettier/pull/17363
]); const isArrayExpression = createTypeCheckFunction(["ArrayExpression"]);
const isObjectExpression = createTypeCheckFunction(["ObjectExpression"]);
const isObjectOrRecordExpression = createTypeCheckFunction([
"ObjectExpression",
"RecordExpression",
]);
/** /**
* @param {Estree.Node} node * @param {Estree.Node} node
@@ -615,14 +611,14 @@ function isSimpleCallArgument(node, depth = 2) {
); );
} }
if (isObjectOrRecordExpression(node)) { if (isObjectExpression(node)) {
return node.properties.every( return node.properties.every(
(p) => (p) =>
!p.computed && (p.shorthand || (p.value && isChildSimple(p.value))), !p.computed && (p.shorthand || (p.value && isChildSimple(p.value))),
); );
} }
if (isArrayOrTupleExpression(node)) { if (isArrayExpression(node)) {
return node.elements.every((x) => x === null || isChildSimple(x)); return node.elements.every((x) => x === null || isChildSimple(x));
} }
@@ -1091,7 +1087,7 @@ export {
hasNodeIgnoreComment, hasNodeIgnoreComment,
hasRestParameter, hasRestParameter,
identity, identity,
isArrayOrTupleExpression, isArrayExpression,
isBinaryCastExpression, isBinaryCastExpression,
isBinaryish, isBinaryish,
isBitwiseOperator, isBitwiseOperator,
@@ -1113,7 +1109,7 @@ export {
isNextLineEmpty, isNextLineEmpty,
isNullishCoalescing, isNullishCoalescing,
isNumericLiteral, isNumericLiteral,
isObjectOrRecordExpression, isObjectExpression,
isObjectProperty, isObjectProperty,
isObjectType, isObjectType,
isPrettierIgnoreComment, isPrettierIgnoreComment,
@@ -1,5 +1,35 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`array-and-tuple.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
a = [
[1,2],
[1,2],
]
a = [
{a, b},
{a, b},
]
=====================================output=====================================
a = [
[1, 2],
[1, 2],
];
a = [
{ a, b },
{ a, b },
];
================================================================================
`;
exports[`empty.js format 1`] = ` exports[`empty.js format 1`] = `
====================================options===================================== ====================================options=====================================
parsers: ["babel", "flow", "typescript"] parsers: ["babel", "flow", "typescript"]
@@ -1003,112 +1033,3 @@ _ = [
================================================================================ ================================================================================
`; `;
exports[`tuple-and-record.js [acorn] format 1`] = `
"Unexpected character '[' (7:4)
5 |
6 | a = [
> 7 | #[1,2],
| ^
8 | #[1,2],
9 | ]
10 |
Cause: Unexpected character '[' (7:3)"
`;
exports[`tuple-and-record.js [espree] format 1`] = `
"Unexpected character '[' (7:4)
5 |
6 | a = [
> 7 | #[1,2],
| ^
8 | #[1,2],
9 | ]
10 |
Cause: Unexpected character '['"
`;
exports[`tuple-and-record.js [flow] format 1`] = `
"Unexpected token \`#\`, expected an identifier (7:3)
5 |
6 | a = [
> 7 | #[1,2],
| ^
8 | #[1,2],
9 | ]
10 |"
`;
exports[`tuple-and-record.js [meriyah] format 1`] = `
"'#' not followed by identifier (7:3)
5 |
6 | a = [
> 7 | #[1,2],
| ^
8 | #[1,2],
9 | ]
10 |
Cause: [7:2-7:3]: '#' not followed by identifier"
`;
exports[`tuple-and-record.js [typescript] format 1`] = `
"Invalid character. (7:3)
5 |
6 | a = [
> 7 | #[1,2],
| ^
8 | #[1,2],
9 | ]
10 |
Cause: Invalid character."
`;
exports[`tuple-and-record.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
a = [
[1,2],
[1,2],
]
a = [
#[1,2],
#[1,2],
]
a = [
{a, b},
{a, b},
]
a = [
#{a, b},
#{a, b},
]
=====================================output=====================================
a = [
[1, 2],
[1, 2],
];
a = [
#[1, 2],
#[1, 2],
];
a = [
{ a, b },
{ a, b },
];
a = [
#{ a, b },
#{ a, b },
];
================================================================================
`;
@@ -0,0 +1,9 @@
a = [
[1,2],
[1,2],
]
a = [
{a, b},
{a, b},
]
+1 -9
View File
@@ -1,9 +1 @@
const errors = { runFormatTest(import.meta, ["babel", "flow", "typescript"]);
acorn: ["tuple-and-record.js"],
espree: ["tuple-and-record.js"],
meriyah: ["tuple-and-record.js"],
typescript: ["tuple-and-record.js"],
flow: ["tuple-and-record.js"],
};
runFormatTest(import.meta, ["babel", "flow", "typescript"], { errors });
@@ -1,19 +0,0 @@
a = [
[1,2],
[1,2],
]
a = [
#[1,2],
#[1,2],
]
a = [
{a, b},
{a, b},
]
a = [
#{a, b},
#{a, b},
]
@@ -1,5 +1,81 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`array-and-object.js - {"arrowParens":"always"} format 1`] = `
====================================options=====================================
arrowParens: "always"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
const fn12 = (a) => (b) => (c) => (d) => (e) =>
({ foo: bar, bar: baz, baz: foo });
map(() => ([
// comment
foo
]));
map(() => ({
// comment
foo
}));
=====================================output=====================================
const fn12 = (a) => (b) => (c) => (d) => (e) => ({
foo: bar,
bar: baz,
baz: foo,
});
map(() => [
// comment
foo,
]);
map(() => ({
// comment
foo,
}));
================================================================================
`;
exports[`array-and-object.js - {"arrowParens":"avoid"} format 1`] = `
====================================options=====================================
arrowParens: "avoid"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
const fn12 = (a) => (b) => (c) => (d) => (e) =>
({ foo: bar, bar: baz, baz: foo });
map(() => ([
// comment
foo
]));
map(() => ({
// comment
foo
}));
=====================================output=====================================
const fn12 = a => b => c => d => e => ({ foo: bar, bar: baz, baz: foo });
map(() => [
// comment
foo,
]);
map(() => ({
// comment
foo,
}));
================================================================================
`;
exports[`arrow_function_expression.js - {"arrowParens":"always"} format 1`] = ` exports[`arrow_function_expression.js - {"arrowParens":"always"} format 1`] = `
====================================options===================================== ====================================options=====================================
arrowParens: "always" arrowParens: "always"
@@ -4527,229 +4603,3 @@ foo(a => b => (0, 1));
================================================================================ ================================================================================
`; `;
exports[`tuple-and-record.js - {"arrowParens":"always"} [acorn] format 1`] = `
"Identifier 'fn12' has already been declared (4:7)
2 | ({ foo: bar, bar: baz, baz: foo });
3 |
> 4 | const fn12 = (a) => (b) => (c) => (d) => (e) =>
| ^
5 | (#{ foo: bar, bar: baz, baz: foo });
6 |
7 | map(() => ([
Cause: Identifier 'fn12' has already been declared (4:6)"
`;
exports[`tuple-and-record.js - {"arrowParens":"always"} [espree] format 1`] = `
"Identifier 'fn12' has already been declared (4:7)
2 | ({ foo: bar, bar: baz, baz: foo });
3 |
> 4 | const fn12 = (a) => (b) => (c) => (d) => (e) =>
| ^
5 | (#{ foo: bar, bar: baz, baz: foo });
6 |
7 | map(() => ([
Cause: Identifier 'fn12' has already been declared"
`;
exports[`tuple-and-record.js - {"arrowParens":"always"} [meriyah] format 1`] = `
"'#' not followed by identifier (5:4)
3 |
4 | const fn12 = (a) => (b) => (c) => (d) => (e) =>
> 5 | (#{ foo: bar, bar: baz, baz: foo });
| ^
6 |
7 | map(() => ([
8 | // comment
Cause: [5:3-5:4]: '#' not followed by identifier"
`;
exports[`tuple-and-record.js - {"arrowParens":"always"} [typescript] format 1`] = `
"Invalid character. (5:4)
3 |
4 | const fn12 = (a) => (b) => (c) => (d) => (e) =>
> 5 | (#{ foo: bar, bar: baz, baz: foo });
| ^
6 |
7 | map(() => ([
8 | // comment
Cause: Invalid character."
`;
exports[`tuple-and-record.js - {"arrowParens":"always"} format 1`] = `
====================================options=====================================
arrowParens: "always"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
const fn12 = (a) => (b) => (c) => (d) => (e) =>
({ foo: bar, bar: baz, baz: foo });
const fn12 = (a) => (b) => (c) => (d) => (e) =>
(#{ foo: bar, bar: baz, baz: foo });
map(() => ([
// comment
foo
]));
map(() => (#[
// comment
foo
]));
map(() => ({
// comment
foo
}));
map(() => (#{
// comment
foo
}));
=====================================output=====================================
const fn12 = (a) => (b) => (c) => (d) => (e) => ({
foo: bar,
bar: baz,
baz: foo,
});
const fn12 = (a) => (b) => (c) => (d) => (e) => #{
foo: bar,
bar: baz,
baz: foo,
};
map(() => [
// comment
foo,
]);
map(() => #[
// comment
foo,
]);
map(() => ({
// comment
foo,
}));
map(() => #{
// comment
foo,
});
================================================================================
`;
exports[`tuple-and-record.js - {"arrowParens":"avoid"} [acorn] format 1`] = `
"Identifier 'fn12' has already been declared (4:7)
2 | ({ foo: bar, bar: baz, baz: foo });
3 |
> 4 | const fn12 = (a) => (b) => (c) => (d) => (e) =>
| ^
5 | (#{ foo: bar, bar: baz, baz: foo });
6 |
7 | map(() => ([
Cause: Identifier 'fn12' has already been declared (4:6)"
`;
exports[`tuple-and-record.js - {"arrowParens":"avoid"} [espree] format 1`] = `
"Identifier 'fn12' has already been declared (4:7)
2 | ({ foo: bar, bar: baz, baz: foo });
3 |
> 4 | const fn12 = (a) => (b) => (c) => (d) => (e) =>
| ^
5 | (#{ foo: bar, bar: baz, baz: foo });
6 |
7 | map(() => ([
Cause: Identifier 'fn12' has already been declared"
`;
exports[`tuple-and-record.js - {"arrowParens":"avoid"} [meriyah] format 1`] = `
"'#' not followed by identifier (5:4)
3 |
4 | const fn12 = (a) => (b) => (c) => (d) => (e) =>
> 5 | (#{ foo: bar, bar: baz, baz: foo });
| ^
6 |
7 | map(() => ([
8 | // comment
Cause: [5:3-5:4]: '#' not followed by identifier"
`;
exports[`tuple-and-record.js - {"arrowParens":"avoid"} [typescript] format 1`] = `
"Invalid character. (5:4)
3 |
4 | const fn12 = (a) => (b) => (c) => (d) => (e) =>
> 5 | (#{ foo: bar, bar: baz, baz: foo });
| ^
6 |
7 | map(() => ([
8 | // comment
Cause: Invalid character."
`;
exports[`tuple-and-record.js - {"arrowParens":"avoid"} format 1`] = `
====================================options=====================================
arrowParens: "avoid"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
const fn12 = (a) => (b) => (c) => (d) => (e) =>
({ foo: bar, bar: baz, baz: foo });
const fn12 = (a) => (b) => (c) => (d) => (e) =>
(#{ foo: bar, bar: baz, baz: foo });
map(() => ([
// comment
foo
]));
map(() => (#[
// comment
foo
]));
map(() => ({
// comment
foo
}));
map(() => (#{
// comment
foo
}));
=====================================output=====================================
const fn12 = a => b => c => d => e => ({ foo: bar, bar: baz, baz: foo });
const fn12 = a => b => c => d => e => #{ foo: bar, bar: baz, baz: foo };
map(() => [
// comment
foo,
]);
map(() => #[
// comment
foo,
]);
map(() => ({
// comment
foo,
}));
map(() => #{
// comment
foo,
});
================================================================================
`;
@@ -0,0 +1,12 @@
const fn12 = (a) => (b) => (c) => (d) => (e) =>
({ foo: bar, bar: baz, baz: foo });
map(() => ([
// comment
foo
]));
map(() => ({
// comment
foo
}));
+2 -15
View File
@@ -1,15 +1,2 @@
const errors = { runFormatTest(import.meta, ["babel", "typescript"], { arrowParens: "always" });
acorn: ["tuple-and-record.js"], runFormatTest(import.meta, ["babel", "typescript"], { arrowParens: "avoid" });
espree: ["tuple-and-record.js"],
meriyah: ["tuple-and-record.js"],
typescript: ["tuple-and-record.js"],
flow: ["tuple-and-record.js"],
};
runFormatTest(import.meta, ["babel", "typescript"], {
arrowParens: "always",
errors,
});
runFormatTest(import.meta, ["babel", "typescript"], {
arrowParens: "avoid",
errors,
});
@@ -1,25 +0,0 @@
const fn12 = (a) => (b) => (c) => (d) => (e) =>
({ foo: bar, bar: baz, baz: foo });
const fn12 = (a) => (b) => (c) => (d) => (e) =>
(#{ foo: bar, bar: baz, baz: foo });
map(() => ([
// comment
foo
]));
map(() => (#[
// comment
foo
]));
map(() => ({
// comment
foo
}));
map(() => (#{
// comment
foo
}));
@@ -2239,100 +2239,6 @@ class Counter extends HTMLElement {
================================================================================ ================================================================================
`; `;
exports[`record-tuple-record.js [acorn] format 1`] = `
"Unexpected character '{' (1:18)
> 1 | const record1 = #{
| ^
2 | a: 1,
3 | b: 2,
4 | c: 3,
Cause: Unexpected character '{' (1:17)"
`;
exports[`record-tuple-record.js [espree] format 1`] = `
"Unexpected character '{' (1:18)
> 1 | const record1 = #{
| ^
2 | a: 1,
3 | b: 2,
4 | c: 3,
Cause: Unexpected character '{'"
`;
exports[`record-tuple-record.js [meriyah] format 1`] = `
"'#' not followed by identifier (1:17)
> 1 | const record1 = #{
| ^
2 | a: 1,
3 | b: 2,
4 | c: 3,
Cause: [1:16-1:17]: '#' not followed by identifier"
`;
exports[`record-tuple-record.js format 1`] = `
====================================options=====================================
parsers: ["babel", "babel-ts", "babel-flow"]
printWidth: 80
| printWidth
=====================================input======================================
const record1 = #{
a: 1,
b: 2,
c: 3,
};
const record2 = #{...record1, b: 5};
=====================================output=====================================
const record1 = #{
a: 1,
b: 2,
c: 3,
};
const record2 = #{ ...record1, b: 5 };
================================================================================
`;
exports[`record-tuple-tuple.js [acorn] format 1`] = `
"Unexpected character '[' (1:17)
> 1 | const tuple1 = #[1, 2, 3];
| ^
2 |
Cause: Unexpected character '[' (1:16)"
`;
exports[`record-tuple-tuple.js [espree] format 1`] = `
"Unexpected character '[' (1:17)
> 1 | const tuple1 = #[1, 2, 3];
| ^
2 |
Cause: Unexpected character '['"
`;
exports[`record-tuple-tuple.js [meriyah] format 1`] = `
"'#' not followed by identifier (1:16)
> 1 | const tuple1 = #[1, 2, 3];
| ^
2 |
Cause: [1:15-1:16]: '#' not followed by identifier"
`;
exports[`record-tuple-tuple.js format 1`] = `
====================================options=====================================
parsers: ["babel", "babel-ts", "babel-flow"]
printWidth: 80
| printWidth
=====================================input======================================
const tuple1 = #[1, 2, 3];
=====================================output=====================================
const tuple1 = #[1, 2, 3];
================================================================================
`;
exports[`regex-v-flag.js format 1`] = ` exports[`regex-v-flag.js format 1`] = `
====================================options===================================== ====================================options=====================================
parsers: ["babel", "babel-ts", "babel-flow"] parsers: ["babel", "babel-ts", "babel-flow"]
@@ -16,8 +16,6 @@ runFormatTest(import.meta, ["babel", "babel-ts", "babel-flow"], {
"pipeline-operator-fsharp.js", "pipeline-operator-fsharp.js",
"pipeline-operator-minimal.js", "pipeline-operator-minimal.js",
"pipeline-operator-hack.js", "pipeline-operator-hack.js",
"record-tuple-record.js",
"record-tuple-tuple.js",
"throw-expressions.js", "throw-expressions.js",
"typescript.js", "typescript.js",
"v8intrinsic.js", "v8intrinsic.js",
@@ -42,8 +40,6 @@ runFormatTest(import.meta, ["babel", "babel-ts", "babel-flow"], {
"pipeline-operator-fsharp.js", "pipeline-operator-fsharp.js",
"pipeline-operator-minimal.js", "pipeline-operator-minimal.js",
"pipeline-operator-hack.js", "pipeline-operator-hack.js",
"record-tuple-record.js",
"record-tuple-tuple.js",
"throw-expressions.js", "throw-expressions.js",
"typescript.js", "typescript.js",
"v8intrinsic.js", "v8intrinsic.js",
@@ -68,8 +64,6 @@ runFormatTest(import.meta, ["babel", "babel-ts", "babel-flow"], {
"pipeline-operator-fsharp.js", "pipeline-operator-fsharp.js",
"pipeline-operator-minimal.js", "pipeline-operator-minimal.js",
"pipeline-operator-hack.js", "pipeline-operator-hack.js",
"record-tuple-record.js",
"record-tuple-tuple.js",
"throw-expressions.js", "throw-expressions.js",
"typescript.js", "typescript.js",
"v8intrinsic.js", "v8intrinsic.js",
@@ -1,7 +0,0 @@
const record1 = #{
a: 1,
b: 2,
c: 3,
};
const record2 = #{...record1, b: 5};
@@ -1 +0,0 @@
const tuple1 = #[1, 2, 3];
@@ -1,5 +1,66 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`array-and-object.js - {"experimentalOperatorPosition":"start"} format 1`] = `
====================================options=====================================
experimentalOperatorPosition: "start"
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
foo = foo || [
// comment
a,
]
foo = foo || {
// comment
a,
}
=====================================output=====================================
foo = foo || [
// comment
a,
];
foo = foo || {
// comment
a,
};
================================================================================
`;
exports[`array-and-object.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
foo = foo || [
// comment
a,
]
foo = foo || {
// comment
a,
}
=====================================output=====================================
foo = foo || [
// comment
a,
];
foo = foo || {
// comment
a,
};
================================================================================
`;
exports[`arrow.js - {"experimentalOperatorPosition":"start"} format 1`] = ` exports[`arrow.js - {"experimentalOperatorPosition":"start"} format 1`] = `
====================================options===================================== ====================================options=====================================
experimentalOperatorPosition: "start" experimentalOperatorPosition: "start"
@@ -2365,225 +2426,6 @@ foo(
================================================================================ ================================================================================
`; `;
exports[`tuple-and-record.js [acorn] format 1`] = `
"Unexpected character '[' (6:15)
4 | ]
5 |
> 6 | foo = foo || #[
| ^
7 | // comment
8 | a,
9 | ]
Cause: Unexpected character '[' (6:14)"
`;
exports[`tuple-and-record.js [espree] format 1`] = `
"Unexpected character '[' (6:15)
4 | ]
5 |
> 6 | foo = foo || #[
| ^
7 | // comment
8 | a,
9 | ]
Cause: Unexpected character '['"
`;
exports[`tuple-and-record.js [flow] format 1`] = `
"Unexpected token \`#\`, expected an identifier (6:14)
4 | ]
5 |
> 6 | foo = foo || #[
| ^
7 | // comment
8 | a,
9 | ]"
`;
exports[`tuple-and-record.js [meriyah] format 1`] = `
"'#' not followed by identifier (6:14)
4 | ]
5 |
> 6 | foo = foo || #[
| ^
7 | // comment
8 | a,
9 | ]
Cause: [6:13-6:14]: '#' not followed by identifier"
`;
exports[`tuple-and-record.js [typescript] format 1`] = `
"Invalid character. (6:14)
4 | ]
5 |
> 6 | foo = foo || #[
| ^
7 | // comment
8 | a,
9 | ]
Cause: Invalid character."
`;
exports[`tuple-and-record.js - {"experimentalOperatorPosition":"start"} [acorn] format 1`] = `
"Unexpected character '[' (6:15)
4 | ]
5 |
> 6 | foo = foo || #[
| ^
7 | // comment
8 | a,
9 | ]
Cause: Unexpected character '[' (6:14)"
`;
exports[`tuple-and-record.js - {"experimentalOperatorPosition":"start"} [espree] format 1`] = `
"Unexpected character '[' (6:15)
4 | ]
5 |
> 6 | foo = foo || #[
| ^
7 | // comment
8 | a,
9 | ]
Cause: Unexpected character '['"
`;
exports[`tuple-and-record.js - {"experimentalOperatorPosition":"start"} [flow] format 1`] = `
"Unexpected token \`#\`, expected an identifier (6:14)
4 | ]
5 |
> 6 | foo = foo || #[
| ^
7 | // comment
8 | a,
9 | ]"
`;
exports[`tuple-and-record.js - {"experimentalOperatorPosition":"start"} [meriyah] format 1`] = `
"'#' not followed by identifier (6:14)
4 | ]
5 |
> 6 | foo = foo || #[
| ^
7 | // comment
8 | a,
9 | ]
Cause: [6:13-6:14]: '#' not followed by identifier"
`;
exports[`tuple-and-record.js - {"experimentalOperatorPosition":"start"} [typescript] format 1`] = `
"Invalid character. (6:14)
4 | ]
5 |
> 6 | foo = foo || #[
| ^
7 | // comment
8 | a,
9 | ]
Cause: Invalid character."
`;
exports[`tuple-and-record.js - {"experimentalOperatorPosition":"start"} format 1`] = `
====================================options=====================================
experimentalOperatorPosition: "start"
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
foo = foo || [
// comment
a,
]
foo = foo || #[
// comment
a,
]
foo = foo || {
// comment
a,
}
foo = foo || #{
// comment
a,
}
=====================================output=====================================
foo = foo || [
// comment
a,
];
foo = foo || #[
// comment
a,
];
foo = foo || {
// comment
a,
};
foo = foo || #{
// comment
a,
};
================================================================================
`;
exports[`tuple-and-record.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
foo = foo || [
// comment
a,
]
foo = foo || #[
// comment
a,
]
foo = foo || {
// comment
a,
}
foo = foo || #{
// comment
a,
}
=====================================output=====================================
foo = foo || [
// comment
a,
];
foo = foo || #[
// comment
a,
];
foo = foo || {
// comment
a,
};
foo = foo || #{
// comment
a,
};
================================================================================
`;
exports[`unary.js - {"experimentalOperatorPosition":"start"} format 1`] = ` exports[`unary.js - {"experimentalOperatorPosition":"start"} format 1`] = `
====================================options===================================== ====================================options=====================================
experimentalOperatorPosition: "start" experimentalOperatorPosition: "start"
@@ -0,0 +1,9 @@
foo = foo || [
// comment
a,
]
foo = foo || {
// comment
a,
}
@@ -1,13 +1,4 @@
const errors = { runFormatTest(import.meta, ["babel", "flow", "typescript"]);
acorn: ["tuple-and-record.js"],
espree: ["tuple-and-record.js"],
meriyah: ["tuple-and-record.js"],
typescript: ["tuple-and-record.js"],
flow: ["tuple-and-record.js"],
};
runFormatTest(import.meta, ["babel", "flow", "typescript"], { errors });
runFormatTest(import.meta, ["babel", "flow", "typescript"], { runFormatTest(import.meta, ["babel", "flow", "typescript"], {
errors,
experimentalOperatorPosition: "start", experimentalOperatorPosition: "start",
}); });
@@ -1,19 +0,0 @@
foo = foo || [
// comment
a,
]
foo = foo || #[
// comment
a,
]
foo = foo || {
// comment
a,
}
foo = foo || #{
// comment
a,
}
@@ -1,5 +1,23 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`array-and-object.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
class A extends {} {}
class C extends [] {}
=====================================output=====================================
class A extends ({}) {}
class C extends [] {}
================================================================================
`;
exports[`complex.js format 1`] = ` exports[`complex.js format 1`] = `
====================================options===================================== ====================================options=====================================
parsers: ["babel", "flow", "typescript"] parsers: ["babel", "flow", "typescript"]
@@ -173,79 +191,3 @@ x = class extends (++b) {};
================================================================================ ================================================================================
`; `;
exports[`tuple-and-record.js [acorn] format 1`] = `
"Unexpected character '{' (2:18)
1 | class A extends {} {}
> 2 | class B extends #{} {}
| ^
3 |
4 | class C extends [] {}
5 | class D extends #[] {}
Cause: Unexpected character '{' (2:17)"
`;
exports[`tuple-and-record.js [espree] format 1`] = `
"Unexpected character '{' (2:18)
1 | class A extends {} {}
> 2 | class B extends #{} {}
| ^
3 |
4 | class C extends [] {}
5 | class D extends #[] {}
Cause: Unexpected character '{'"
`;
exports[`tuple-and-record.js [flow] format 1`] = `
"Unexpected token \`#\`, expected an identifier (2:17)
1 | class A extends {} {}
> 2 | class B extends #{} {}
| ^
3 |
4 | class C extends [] {}
5 | class D extends #[] {}"
`;
exports[`tuple-and-record.js [meriyah] format 1`] = `
"'#' not followed by identifier (2:17)
1 | class A extends {} {}
> 2 | class B extends #{} {}
| ^
3 |
4 | class C extends [] {}
5 | class D extends #[] {}
Cause: [2:16-2:17]: '#' not followed by identifier"
`;
exports[`tuple-and-record.js [typescript] format 1`] = `
"Invalid character. (2:17)
1 | class A extends {} {}
> 2 | class B extends #{} {}
| ^
3 |
4 | class C extends [] {}
5 | class D extends #[] {}
Cause: Invalid character."
`;
exports[`tuple-and-record.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
class A extends {} {}
class B extends #{} {}
class C extends [] {}
class D extends #[] {}
=====================================output=====================================
class A extends ({}) {}
class B extends #{} {}
class C extends [] {}
class D extends #[] {}
================================================================================
`;
@@ -0,0 +1,3 @@
class A extends {} {}
class C extends [] {}
+1 -9
View File
@@ -1,9 +1 @@
runFormatTest(import.meta, ["babel", "flow", "typescript"], { runFormatTest(import.meta, ["babel", "flow", "typescript"]);
errors: {
acorn: ["tuple-and-record.js"],
espree: ["tuple-and-record.js"],
meriyah: ["tuple-and-record.js"],
typescript: ["tuple-and-record.js"],
flow: ["tuple-and-record.js"],
},
});
@@ -1,5 +0,0 @@
class A extends {} {}
class B extends #{} {}
class C extends [] {}
class D extends #[] {}
@@ -1,5 +1,43 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`array-and-object.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
foo = /** @type A */ ({
// comment
width,
height,
...margins,
});
foo = /** @type A */ ([
// comment
width,
height,
...margins,
]);
=====================================output=====================================
foo = /** @type A */ ({
// comment
width,
height,
...margins,
});
foo = /** @type A */ ([
// comment
width,
height,
...margins,
]);
================================================================================
`;
exports[`binary-expr.js format 1`] = ` exports[`binary-expr.js format 1`] = `
====================================options===================================== ====================================options=====================================
parsers: ["babel"] parsers: ["babel"]
@@ -640,72 +678,6 @@ class Foo extends /** @type {string} */ (Bar) {}
================================================================================ ================================================================================
`; `;
exports[`tuple-and-record.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
foo = /** @type A */ ({
// comment
width,
height,
...margins,
});
foo = /** @type A */ (#{
// comment
width,
height,
...margins,
});
foo = /** @type A */ ([
// comment
width,
height,
...margins,
]);
foo = /** @type A */ (#[
// comment
width,
height,
...margins,
]);
=====================================output=====================================
foo = /** @type A */ ({
// comment
width,
height,
...margins,
});
foo = /** @type A */ (#{
// comment
width,
height,
...margins,
});
foo = /** @type A */ ([
// comment
width,
height,
...margins,
]);
foo = /** @type A */ (#[
// comment
width,
height,
...margins,
]);
================================================================================
`;
exports[`ways-to-specify-type.js format 1`] = ` exports[`ways-to-specify-type.js format 1`] = `
====================================options===================================== ====================================options=====================================
parsers: ["babel"] parsers: ["babel"]
@@ -0,0 +1,13 @@
foo = /** @type A */ ({
// comment
width,
height,
...margins,
});
foo = /** @type A */ ([
// comment
width,
height,
...margins,
]);
@@ -1,27 +0,0 @@
foo = /** @type A */ ({
// comment
width,
height,
...margins,
});
foo = /** @type A */ (#{
// comment
width,
height,
...margins,
});
foo = /** @type A */ ([
// comment
width,
height,
...margins,
]);
foo = /** @type A */ (#[
// comment
width,
height,
...margins,
]);
@@ -366,6 +366,67 @@ else /* foo */ foo.split;
================================================================================ ================================================================================
`; `;
exports[`array-and-object.js - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
semi: false
| printWidth
=====================================input======================================
let object = // Comment
{
key: 'value'
}
let array = // Comment
[
'value'
]
=====================================output=====================================
let object =
// Comment
{
key: "value",
}
let array =
// Comment
["value"]
================================================================================
`;
exports[`array-and-object.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
let object = // Comment
{
key: 'value'
}
let array = // Comment
[
'value'
]
=====================================output=====================================
let object =
// Comment
{
key: "value",
};
let array =
// Comment
["value"];
================================================================================
`;
exports[`arrow.js - {"semi":false} format 1`] = ` exports[`arrow.js - {"semi":false} format 1`] = `
====================================options===================================== ====================================options=====================================
parsers: ["babel", "flow", "typescript"] parsers: ["babel", "flow", "typescript"]
@@ -6464,225 +6525,6 @@ try {
================================================================================ ================================================================================
`; `;
exports[`tuple-and-record.js [acorn] format 1`] = `
"Unexpected character '{' (7:2)
5 |
6 | let record = // Comment
> 7 | #{
| ^
8 | key: 'value'
9 | }
10 |
Cause: Unexpected character '{' (7:1)"
`;
exports[`tuple-and-record.js [espree] format 1`] = `
"Unexpected character '{' (7:2)
5 |
6 | let record = // Comment
> 7 | #{
| ^
8 | key: 'value'
9 | }
10 |
Cause: Unexpected character '{'"
`;
exports[`tuple-and-record.js [flow] format 1`] = `
"Unexpected token \`#\`, expected an identifier (7:1)
5 |
6 | let record = // Comment
> 7 | #{
| ^
8 | key: 'value'
9 | }
10 |"
`;
exports[`tuple-and-record.js [meriyah] format 1`] = `
"'#' not followed by identifier (7:1)
5 |
6 | let record = // Comment
> 7 | #{
| ^
8 | key: 'value'
9 | }
10 |
Cause: [7:0-7:1]: '#' not followed by identifier"
`;
exports[`tuple-and-record.js [typescript] format 1`] = `
"Invalid character. (7:1)
5 |
6 | let record = // Comment
> 7 | #{
| ^
8 | key: 'value'
9 | }
10 |
Cause: Invalid character."
`;
exports[`tuple-and-record.js - {"semi":false} [acorn] format 1`] = `
"Unexpected character '{' (7:2)
5 |
6 | let record = // Comment
> 7 | #{
| ^
8 | key: 'value'
9 | }
10 |
Cause: Unexpected character '{' (7:1)"
`;
exports[`tuple-and-record.js - {"semi":false} [espree] format 1`] = `
"Unexpected character '{' (7:2)
5 |
6 | let record = // Comment
> 7 | #{
| ^
8 | key: 'value'
9 | }
10 |
Cause: Unexpected character '{'"
`;
exports[`tuple-and-record.js - {"semi":false} [flow] format 1`] = `
"Unexpected token \`#\`, expected an identifier (7:1)
5 |
6 | let record = // Comment
> 7 | #{
| ^
8 | key: 'value'
9 | }
10 |"
`;
exports[`tuple-and-record.js - {"semi":false} [meriyah] format 1`] = `
"'#' not followed by identifier (7:1)
5 |
6 | let record = // Comment
> 7 | #{
| ^
8 | key: 'value'
9 | }
10 |
Cause: [7:0-7:1]: '#' not followed by identifier"
`;
exports[`tuple-and-record.js - {"semi":false} [typescript] format 1`] = `
"Invalid character. (7:1)
5 |
6 | let record = // Comment
> 7 | #{
| ^
8 | key: 'value'
9 | }
10 |
Cause: Invalid character."
`;
exports[`tuple-and-record.js - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
semi: false
| printWidth
=====================================input======================================
let object = // Comment
{
key: 'value'
}
let record = // Comment
#{
key: 'value'
}
let array = // Comment
[
'value'
]
let tuple = // Comment
#[
'value'
]
=====================================output=====================================
let object =
// Comment
{
key: "value",
}
let record =
// Comment
#{
key: "value",
}
let array =
// Comment
["value"]
let tuple =
// Comment
#["value"]
================================================================================
`;
exports[`tuple-and-record.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
let object = // Comment
{
key: 'value'
}
let record = // Comment
#{
key: 'value'
}
let array = // Comment
[
'value'
]
let tuple = // Comment
#[
'value'
]
=====================================output=====================================
let object =
// Comment
{
key: "value",
};
let record =
// Comment
#{
key: "value",
};
let array =
// Comment
["value"];
let tuple =
// Comment
#["value"];
================================================================================
`;
exports[`variable_declarator.js - {"semi":false} format 1`] = ` exports[`variable_declarator.js - {"semi":false} format 1`] = `
====================================options===================================== ====================================options=====================================
parsers: ["babel", "flow", "typescript"] parsers: ["babel", "flow", "typescript"]
@@ -0,0 +1,9 @@
let object = // Comment
{
key: 'value'
}
let array = // Comment
[
'value'
]
+2 -13
View File
@@ -6,16 +6,5 @@ const fixtures = {
], ],
}; };
const errors = { runFormatTest(fixtures, ["babel", "flow", "typescript"]);
acorn: ["tuple-and-record.js"], runFormatTest(fixtures, ["babel", "flow", "typescript"], { semi: false });
espree: ["tuple-and-record.js"],
meriyah: ["tuple-and-record.js"],
typescript: ["tuple-and-record.js"],
flow: ["tuple-and-record.js"],
};
runFormatTest(fixtures, ["babel", "flow", "typescript"], { errors });
runFormatTest(fixtures, ["babel", "flow", "typescript"], {
semi: false,
errors,
});
@@ -1,19 +0,0 @@
let object = // Comment
{
key: 'value'
}
let record = // Comment
#{
key: 'value'
}
let array = // Comment
[
'value'
]
let tuple = // Comment
#[
'value'
]
@@ -108,6 +108,62 @@ promise.then(
================================================================================ ================================================================================
`; `;
exports[`array-and-object.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow"]
printWidth: 80
| printWidth
=====================================input======================================
function StatelessFunctionalComponent1({
isActive = true,
onFiltersUpdated = () => null,
onSelect = () => null,
onSubmitAndDeselect = () => null,
onCancel = () => null,
searchFilters = null,
title = '',
items = [],
} = {}) {
}
function StatelessFunctionalComponent3([
isActive = true,
onFiltersUpdated = () => null,
onSelect = () => null,
onSubmitAndDeselect = () => null,
onCancel = () => null,
searchFilters = null,
title = '',
items = [],
] = []) {
}
=====================================output=====================================
function StatelessFunctionalComponent1({
isActive = true,
onFiltersUpdated = () => null,
onSelect = () => null,
onSubmitAndDeselect = () => null,
onCancel = () => null,
searchFilters = null,
title = "",
items = [],
} = {}) {}
function StatelessFunctionalComponent3([
isActive = true,
onFiltersUpdated = () => null,
onSelect = () => null,
onSubmitAndDeselect = () => null,
onCancel = () => null,
searchFilters = null,
title = "",
items = [],
] = []) {}
================================================================================
`;
exports[`object.js format 1`] = ` exports[`object.js format 1`] = `
====================================options===================================== ====================================options=====================================
parsers: ["babel", "flow"] parsers: ["babel", "flow"]
@@ -234,152 +290,3 @@ class C {
================================================================================ ================================================================================
`; `;
exports[`tuple-and-record.js [acorn] format 1`] = `
"Unexpected character '{' (22:6)
20 | title = '',
21 | items = [],
> 22 | } = #{}) {
| ^
23 | }
24 |
25 | function StatelessFunctionalComponent3([
Cause: Unexpected character '{' (22:5)"
`;
exports[`tuple-and-record.js [espree] format 1`] = `
"Unexpected character '{' (22:6)
20 | title = '',
21 | items = [],
> 22 | } = #{}) {
| ^
23 | }
24 |
25 | function StatelessFunctionalComponent3([
Cause: Unexpected character '{'"
`;
exports[`tuple-and-record.js [flow] format 1`] = `
"Unexpected token \`#\`, expected an identifier (22:5)
20 | title = '',
21 | items = [],
> 22 | } = #{}) {
| ^
23 | }
24 |
25 | function StatelessFunctionalComponent3(["
`;
exports[`tuple-and-record.js [meriyah] format 1`] = `
"'#' not followed by identifier (22:5)
20 | title = '',
21 | items = [],
> 22 | } = #{}) {
| ^
23 | }
24 |
25 | function StatelessFunctionalComponent3([
Cause: [22:4-22:5]: '#' not followed by identifier"
`;
exports[`tuple-and-record.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow"]
printWidth: 80
| printWidth
=====================================input======================================
function StatelessFunctionalComponent1({
isActive = true,
onFiltersUpdated = () => null,
onSelect = () => null,
onSubmitAndDeselect = () => null,
onCancel = () => null,
searchFilters = null,
title = '',
items = [],
} = {}) {
}
function StatelessFunctionalComponent2({
isActive = true,
onFiltersUpdated = () => null,
onSelect = () => null,
onSubmitAndDeselect = () => null,
onCancel = () => null,
searchFilters = null,
title = '',
items = [],
} = #{}) {
}
function StatelessFunctionalComponent3([
isActive = true,
onFiltersUpdated = () => null,
onSelect = () => null,
onSubmitAndDeselect = () => null,
onCancel = () => null,
searchFilters = null,
title = '',
items = [],
] = []) {
}
function StatelessFunctionalComponent4([
isActive = true,
onFiltersUpdated = () => null,
onSelect = () => null,
onSubmitAndDeselect = () => null,
onCancel = () => null,
searchFilters = null,
title = '',
items = [],
] = #[]) {
}
=====================================output=====================================
function StatelessFunctionalComponent1({
isActive = true,
onFiltersUpdated = () => null,
onSelect = () => null,
onSubmitAndDeselect = () => null,
onCancel = () => null,
searchFilters = null,
title = "",
items = [],
} = {}) {}
function StatelessFunctionalComponent2({
isActive = true,
onFiltersUpdated = () => null,
onSelect = () => null,
onSubmitAndDeselect = () => null,
onCancel = () => null,
searchFilters = null,
title = "",
items = [],
} = #{}) {}
function StatelessFunctionalComponent3([
isActive = true,
onFiltersUpdated = () => null,
onSelect = () => null,
onSubmitAndDeselect = () => null,
onCancel = () => null,
searchFilters = null,
title = "",
items = [],
] = []) {}
function StatelessFunctionalComponent4([
isActive = true,
onFiltersUpdated = () => null,
onSelect = () => null,
onSubmitAndDeselect = () => null,
onCancel = () => null,
searchFilters = null,
title = "",
items = [],
] = #[]) {}
================================================================================
`;
@@ -0,0 +1,23 @@
function StatelessFunctionalComponent1({
isActive = true,
onFiltersUpdated = () => null,
onSelect = () => null,
onSubmitAndDeselect = () => null,
onCancel = () => null,
searchFilters = null,
title = '',
items = [],
} = {}) {
}
function StatelessFunctionalComponent3([
isActive = true,
onFiltersUpdated = () => null,
onSelect = () => null,
onSubmitAndDeselect = () => null,
onCancel = () => null,
searchFilters = null,
title = '',
items = [],
] = []) {
}
@@ -1,9 +1 @@
const errors = { runFormatTest(import.meta, ["babel", "flow"]);
acorn: ["tuple-and-record.js"],
espree: ["tuple-and-record.js"],
meriyah: ["tuple-and-record.js"],
typescript: ["tuple-and-record.js"],
flow: ["tuple-and-record.js"],
};
runFormatTest(import.meta, ["babel", "flow"], { errors });
@@ -1,47 +0,0 @@
function StatelessFunctionalComponent1({
isActive = true,
onFiltersUpdated = () => null,
onSelect = () => null,
onSubmitAndDeselect = () => null,
onCancel = () => null,
searchFilters = null,
title = '',
items = [],
} = {}) {
}
function StatelessFunctionalComponent2({
isActive = true,
onFiltersUpdated = () => null,
onSelect = () => null,
onSubmitAndDeselect = () => null,
onCancel = () => null,
searchFilters = null,
title = '',
items = [],
} = #{}) {
}
function StatelessFunctionalComponent3([
isActive = true,
onFiltersUpdated = () => null,
onSelect = () => null,
onSubmitAndDeselect = () => null,
onCancel = () => null,
searchFilters = null,
title = '',
items = [],
] = []) {
}
function StatelessFunctionalComponent4([
isActive = true,
onFiltersUpdated = () => null,
onSelect = () => null,
onSubmitAndDeselect = () => null,
onCancel = () => null,
searchFilters = null,
title = '',
items = [],
] = #[]) {
}
@@ -28,6 +28,24 @@ foo(a--).bar().leet();
================================================================================ ================================================================================
`; `;
exports[`array-and-object.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
foo.a().b().c([n, o])
foo.a().b().c({n, o})
=====================================output=====================================
foo.a().b().c([n, o]);
foo.a().b().c({ n, o });
================================================================================
`;
exports[`assignment-lhs.js format 1`] = ` exports[`assignment-lhs.js format 1`] = `
====================================options===================================== ====================================options=====================================
parsers: ["babel", "flow", "typescript"] parsers: ["babel", "flow", "typescript"]
@@ -1565,79 +1583,3 @@ const sel = this.connections
================================================================================ ================================================================================
`; `;
exports[`tuple-and-record.js [acorn] format 1`] = `
"Unexpected character '[' (2:16)
1 | foo.a().b().c([n, o])
> 2 | foo.a().b().c(#[n, o])
| ^
3 |
4 | foo.a().b().c({n, o})
5 | foo.a().b().c(#{n, o})
Cause: Unexpected character '[' (2:15)"
`;
exports[`tuple-and-record.js [espree] format 1`] = `
"Unexpected character '[' (2:16)
1 | foo.a().b().c([n, o])
> 2 | foo.a().b().c(#[n, o])
| ^
3 |
4 | foo.a().b().c({n, o})
5 | foo.a().b().c(#{n, o})
Cause: Unexpected character '['"
`;
exports[`tuple-and-record.js [flow] format 1`] = `
"Unexpected token \`#\`, expected an identifier (2:15)
1 | foo.a().b().c([n, o])
> 2 | foo.a().b().c(#[n, o])
| ^
3 |
4 | foo.a().b().c({n, o})
5 | foo.a().b().c(#{n, o})"
`;
exports[`tuple-and-record.js [meriyah] format 1`] = `
"'#' not followed by identifier (2:15)
1 | foo.a().b().c([n, o])
> 2 | foo.a().b().c(#[n, o])
| ^
3 |
4 | foo.a().b().c({n, o})
5 | foo.a().b().c(#{n, o})
Cause: [2:14-2:15]: '#' not followed by identifier"
`;
exports[`tuple-and-record.js [typescript] format 1`] = `
"Invalid character. (2:15)
1 | foo.a().b().c([n, o])
> 2 | foo.a().b().c(#[n, o])
| ^
3 |
4 | foo.a().b().c({n, o})
5 | foo.a().b().c(#{n, o})
Cause: Invalid character."
`;
exports[`tuple-and-record.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
foo.a().b().c([n, o])
foo.a().b().c(#[n, o])
foo.a().b().c({n, o})
foo.a().b().c(#{n, o})
=====================================output=====================================
foo.a().b().c([n, o]);
foo.a().b().c(#[n, o]);
foo.a().b().c({ n, o });
foo.a().b().c(#{ n, o });
================================================================================
`;
@@ -0,0 +1,3 @@
foo.a().b().c([n, o])
foo.a().b().c({n, o})
+1 -9
View File
@@ -1,9 +1 @@
const errors = { runFormatTest(import.meta, ["babel", "flow", "typescript"]);
acorn: ["tuple-and-record.js"],
espree: ["tuple-and-record.js"],
meriyah: ["tuple-and-record.js"],
typescript: ["tuple-and-record.js"],
flow: ["tuple-and-record.js"],
};
runFormatTest(import.meta, ["babel", "flow", "typescript"], { errors });
@@ -1,5 +0,0 @@
foo.a().b().c([n, o])
foo.a().b().c(#[n, o])
foo.a().b().c({n, o})
foo.a().b().c(#{n, o})
@@ -1,348 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`computed.js [acorn] format 1`] = `
"Unexpected character '{' (2:9)
1 | const key = "a";
> 2 | assert(#{ [key]: 1 } === #{ a: 1 })
| ^
3 | assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 })
4 |
5 | assert(#{ [true]: 1 } === #{ true: 1 })
Cause: Unexpected character '{' (2:8)"
`;
exports[`computed.js [espree] format 1`] = `
"Unexpected character '{' (2:9)
1 | const key = "a";
> 2 | assert(#{ [key]: 1 } === #{ a: 1 })
| ^
3 | assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 })
4 |
5 | assert(#{ [true]: 1 } === #{ true: 1 })
Cause: Unexpected character '{'"
`;
exports[`computed.js [meriyah] format 1`] = `
"'#' not followed by identifier (2:8)
1 | const key = "a";
> 2 | assert(#{ [key]: 1 } === #{ a: 1 })
| ^
3 | assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 })
4 |
5 | assert(#{ [true]: 1 } === #{ true: 1 })
Cause: [2:7-2:8]: '#' not followed by identifier"
`;
exports[`computed.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
const key = "a";
assert(#{ [key]: 1 } === #{ a: 1 })
assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 })
assert(#{ [true]: 1 } === #{ true: 1 })
assert(#{ [true]: 1 } === #{ ["true"]: 1 })
assert(#{ [1 + 1]: "two" } === #{ 2: "two" })
assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" })
=====================================output=====================================
const key = "a";
assert(#{ [key]: 1 } === #{ a: 1 });
assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 });
assert(#{ [true]: 1 } === #{ true: 1 });
assert(#{ [true]: 1 } === #{ ["true"]: 1 });
assert(#{ [1 + 1]: "two" } === #{ 2: "two" });
assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" });
================================================================================
`;
exports[`destructuring.js [acorn] format 1`] = `
"Unexpected character '{' (1:19)
> 1 | const { a, b } = #{ a: 1, b: 2 };
| ^
2 | assert(a === 1);
3 | assert(b === 2);
4 |
Cause: Unexpected character '{' (1:18)"
`;
exports[`destructuring.js [espree] format 1`] = `
"Unexpected character '{' (1:19)
> 1 | const { a, b } = #{ a: 1, b: 2 };
| ^
2 | assert(a === 1);
3 | assert(b === 2);
4 |
Cause: Unexpected character '{'"
`;
exports[`destructuring.js [meriyah] format 1`] = `
"'#' not followed by identifier (1:18)
> 1 | const { a, b } = #{ a: 1, b: 2 };
| ^
2 | assert(a === 1);
3 | assert(b === 2);
4 |
Cause: [1:17-1:18]: '#' not followed by identifier"
`;
exports[`destructuring.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
const { a, b } = #{ a: 1, b: 2 };
assert(a === 1);
assert(b === 2);
const { a, ...rest } = #{ a: 1, b: 2, c: 3 };
assert(a === 1);
assert(typeof rest === "object");
assert(rest.b === 2);
assert(rest.c === 3);
=====================================output=====================================
const { a, b } = #{ a: 1, b: 2 };
assert(a === 1);
assert(b === 2);
const { a, ...rest } = #{ a: 1, b: 2, c: 3 };
assert(a === 1);
assert(typeof rest === "object");
assert(rest.b === 2);
assert(rest.c === 3);
================================================================================
`;
exports[`record.js [acorn] format 1`] = `
"Unexpected character '{' (1:18)
> 1 | const record1 = #{
| ^
2 | a: 1,
3 | b: 2,
4 | c: 3,
Cause: Unexpected character '{' (1:17)"
`;
exports[`record.js [espree] format 1`] = `
"Unexpected character '{' (1:18)
> 1 | const record1 = #{
| ^
2 | a: 1,
3 | b: 2,
4 | c: 3,
Cause: Unexpected character '{'"
`;
exports[`record.js [meriyah] format 1`] = `
"'#' not followed by identifier (1:17)
> 1 | const record1 = #{
| ^
2 | a: 1,
3 | b: 2,
4 | c: 3,
Cause: [1:16-1:17]: '#' not followed by identifier"
`;
exports[`record.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
const record1 = #{
a: 1,
b: 2,
c: 3,
};
const record2 = #{...record1, b: 5};
assert(record1.a === 1);
assert(record1["a"] === 1);
assert(record1 !== record2);
assert(record2 === #{ a: 1, c: 3, b: 5 });
assert(record1?.a === 1);
assert(record1?.d === undefined);
assert(record1?.d ?? 5 === 5);
assert(record1.d?.a === undefined);
=====================================output=====================================
const record1 = #{
a: 1,
b: 2,
c: 3,
};
const record2 = #{ ...record1, b: 5 };
assert(record1.a === 1);
assert(record1["a"] === 1);
assert(record1 !== record2);
assert(record2 === #{ a: 1, c: 3, b: 5 });
assert(record1?.a === 1);
assert(record1?.d === undefined);
assert(record1?.d ?? 5 === 5);
assert(record1.d?.a === undefined);
================================================================================
`;
exports[`shorthand.js [acorn] format 1`] = `
"Unexpected character '{' (2:17)
1 | const url = "https://github.com/tc39/proposal-record-tuple";
> 2 | const record = #{ url }
| ^
3 | console.log(record.url) // https://github.com/tc39/proposal-record-tuple
4 |
Cause: Unexpected character '{' (2:16)"
`;
exports[`shorthand.js [espree] format 1`] = `
"Unexpected character '{' (2:17)
1 | const url = "https://github.com/tc39/proposal-record-tuple";
> 2 | const record = #{ url }
| ^
3 | console.log(record.url) // https://github.com/tc39/proposal-record-tuple
4 |
Cause: Unexpected character '{'"
`;
exports[`shorthand.js [meriyah] format 1`] = `
"'#' not followed by identifier (2:16)
1 | const url = "https://github.com/tc39/proposal-record-tuple";
> 2 | const record = #{ url }
| ^
3 | console.log(record.url) // https://github.com/tc39/proposal-record-tuple
4 |
Cause: [2:15-2:16]: '#' not followed by identifier"
`;
exports[`shorthand.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
const url = "https://github.com/tc39/proposal-record-tuple";
const record = #{ url }
console.log(record.url) // https://github.com/tc39/proposal-record-tuple
=====================================output=====================================
const url = "https://github.com/tc39/proposal-record-tuple";
const record = #{ url };
console.log(record.url); // https://github.com/tc39/proposal-record-tuple
================================================================================
`;
exports[`spread.js [acorn] format 1`] = `
"Unexpected character '{' (1:19)
> 1 | const formData = #{ title: "Implement all the things" }
| ^
2 | const taskNow = #{ id: 42, status: "WIP", ...formData }
3 | const taskLater = #{ ...taskNow, status: "DONE" }
4 |
Cause: Unexpected character '{' (1:18)"
`;
exports[`spread.js [espree] format 1`] = `
"Unexpected character '{' (1:19)
> 1 | const formData = #{ title: "Implement all the things" }
| ^
2 | const taskNow = #{ id: 42, status: "WIP", ...formData }
3 | const taskLater = #{ ...taskNow, status: "DONE" }
4 |
Cause: Unexpected character '{'"
`;
exports[`spread.js [meriyah] format 1`] = `
"'#' not followed by identifier (1:18)
> 1 | const formData = #{ title: "Implement all the things" }
| ^
2 | const taskNow = #{ id: 42, status: "WIP", ...formData }
3 | const taskLater = #{ ...taskNow, status: "DONE" }
4 |
Cause: [1:17-1:18]: '#' not followed by identifier"
`;
exports[`spread.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
const formData = #{ title: "Implement all the things" }
const taskNow = #{ id: 42, status: "WIP", ...formData }
const taskLater = #{ ...taskNow, status: "DONE" }
// A reminder: The ordering of keys in record literals does not affect equality (and is not retained)
assert(taskLater === #{ status: "DONE", title: formData.title, id: 42 })
=====================================output=====================================
const formData = #{ title: "Implement all the things" };
const taskNow = #{ id: 42, status: "WIP", ...formData };
const taskLater = #{ ...taskNow, status: "DONE" };
// A reminder: The ordering of keys in record literals does not affect equality (and is not retained)
assert(taskLater === #{ status: "DONE", title: formData.title, id: 42 });
================================================================================
`;
exports[`syntax.js [acorn] format 1`] = `
"Unexpected character '{' (1:2)
> 1 | #{}
| ^
2 | #{ a: 1, b: 2 }
3 | #{ a: 1, b: #[2, 3, #{ c: 4 }] }
4 |
Cause: Unexpected character '{' (1:1)"
`;
exports[`syntax.js [espree] format 1`] = `
"Unexpected character '{' (1:2)
> 1 | #{}
| ^
2 | #{ a: 1, b: 2 }
3 | #{ a: 1, b: #[2, 3, #{ c: 4 }] }
4 |
Cause: Unexpected character '{'"
`;
exports[`syntax.js [meriyah] format 1`] = `
"'#' not followed by identifier (1:1)
> 1 | #{}
| ^
2 | #{ a: 1, b: 2 }
3 | #{ a: 1, b: #[2, 3, #{ c: 4 }] }
4 |
Cause: [1:0-1:1]: '#' not followed by identifier"
`;
exports[`syntax.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
#{}
#{ a: 1, b: 2 }
#{ a: 1, b: #[2, 3, #{ c: 4 }] }
=====================================output=====================================
#{};
#{ a: 1, b: 2 };
#{ a: 1, b: #[2, 3, #{ c: 4 }] };
================================================================================
`;
-9
View File
@@ -1,9 +0,0 @@
const key = "a";
assert(#{ [key]: 1 } === #{ a: 1 })
assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 })
assert(#{ [true]: 1 } === #{ true: 1 })
assert(#{ [true]: 1 } === #{ ["true"]: 1 })
assert(#{ [1 + 1]: "two" } === #{ 2: "two" })
assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" })
-9
View File
@@ -1,9 +0,0 @@
const { a, b } = #{ a: 1, b: 2 };
assert(a === 1);
assert(b === 2);
const { a, ...rest } = #{ a: 1, b: 2, c: 3 };
assert(a === 1);
assert(typeof rest === "object");
assert(rest.b === 2);
assert(rest.c === 3);
-3
View File
@@ -1,3 +0,0 @@
runFormatTest(import.meta, ["babel"], {
errors: { acorn: true, espree: true, meriyah: true },
});
-16
View File
@@ -1,16 +0,0 @@
const record1 = #{
a: 1,
b: 2,
c: 3,
};
const record2 = #{...record1, b: 5};
assert(record1.a === 1);
assert(record1["a"] === 1);
assert(record1 !== record2);
assert(record2 === #{ a: 1, c: 3, b: 5 });
assert(record1?.a === 1);
assert(record1?.d === undefined);
assert(record1?.d ?? 5 === 5);
assert(record1.d?.a === undefined);
-3
View File
@@ -1,3 +0,0 @@
const url = "https://github.com/tc39/proposal-record-tuple";
const record = #{ url }
console.log(record.url) // https://github.com/tc39/proposal-record-tuple
-6
View File
@@ -1,6 +0,0 @@
const formData = #{ title: "Implement all the things" }
const taskNow = #{ id: 42, status: "WIP", ...formData }
const taskLater = #{ ...taskNow, status: "DONE" }
// A reminder: The ordering of keys in record literals does not affect equality (and is not retained)
assert(taskLater === #{ status: "DONE", title: formData.title, id: 42 })
-3
View File
@@ -1,3 +0,0 @@
#{}
#{ a: 1, b: 2 }
#{ a: 1, b: #[2, 3, #{ c: 4 }] }
@@ -1,263 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`destructuring.js [acorn] format 1`] = `
"Unexpected character '[' (1:17)
> 1 | const [a, b] = #[1, 2];
| ^
2 | assert(a === 1);
3 | assert(b === 2);
4 |
Cause: Unexpected character '[' (1:16)"
`;
exports[`destructuring.js [espree] format 1`] = `
"Unexpected character '[' (1:17)
> 1 | const [a, b] = #[1, 2];
| ^
2 | assert(a === 1);
3 | assert(b === 2);
4 |
Cause: Unexpected character '['"
`;
exports[`destructuring.js [meriyah] format 1`] = `
"'#' not followed by identifier (1:16)
> 1 | const [a, b] = #[1, 2];
| ^
2 | assert(a === 1);
3 | assert(b === 2);
4 |
Cause: [1:15-1:16]: '#' not followed by identifier"
`;
exports[`destructuring.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
const [a, b] = #[1, 2];
assert(a === 1);
assert(b === 2);
const [a, ...rest] = #[1, 2, 3];
assert(a === 1);
assert(Array.isArray(rest));
assert(rest[0] === 2);
assert(rest[1] === 3);
=====================================output=====================================
const [a, b] = #[1, 2];
assert(a === 1);
assert(b === 2);
const [a, ...rest] = #[1, 2, 3];
assert(a === 1);
assert(Array.isArray(rest));
assert(rest[0] === 2);
assert(rest[1] === 3);
================================================================================
`;
exports[`invalid-tuple-holes.js [__babel_estree] format 1`] = `
"Unexpected token ','. (1:4)
> 1 | #[,]
| ^
2 |
Cause: Unexpected token ','. (1:3)"
`;
exports[`invalid-tuple-holes.js [acorn] format 1`] = `
"Unexpected character '[' (1:2)
> 1 | #[,]
| ^
2 |
Cause: Unexpected character '[' (1:1)"
`;
exports[`invalid-tuple-holes.js [babel] format 1`] = `
"Unexpected token ','. (1:4)
> 1 | #[,]
| ^
2 |
Cause: Unexpected token ','. (1:3)"
`;
exports[`invalid-tuple-holes.js [espree] format 1`] = `
"Unexpected character '[' (1:2)
> 1 | #[,]
| ^
2 |
Cause: Unexpected character '['"
`;
exports[`invalid-tuple-holes.js [meriyah] format 1`] = `
"'#' not followed by identifier (1:1)
> 1 | #[,]
| ^
2 |
Cause: [1:0-1:1]: '#' not followed by identifier"
`;
exports[`syntax.js [acorn] format 1`] = `
"Unexpected character '[' (1:2)
> 1 | #[]
| ^
2 | #[1, 2]
3 | #[1, 2, #{ a: 3 }]
4 |
Cause: Unexpected character '[' (1:1)"
`;
exports[`syntax.js [espree] format 1`] = `
"Unexpected character '[' (1:2)
> 1 | #[]
| ^
2 | #[1, 2]
3 | #[1, 2, #{ a: 3 }]
4 |
Cause: Unexpected character '['"
`;
exports[`syntax.js [meriyah] format 1`] = `
"'#' not followed by identifier (1:1)
> 1 | #[]
| ^
2 | #[1, 2]
3 | #[1, 2, #{ a: 3 }]
4 |
Cause: [1:0-1:1]: '#' not followed by identifier"
`;
exports[`syntax.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
#[]
#[1, 2]
#[1, 2, #{ a: 3 }]
=====================================output=====================================
#[];
#[1, 2];
#[1, 2, #{ a: 3 }];
================================================================================
`;
exports[`tuple.js [acorn] format 1`] = `
"Unexpected character '[' (1:17)
> 1 | const tuple1 = #[1, 2, 3];
| ^
2 |
3 | assert(tuple1[0] === 1);
4 |
Cause: Unexpected character '[' (1:16)"
`;
exports[`tuple.js [espree] format 1`] = `
"Unexpected character '[' (1:17)
> 1 | const tuple1 = #[1, 2, 3];
| ^
2 |
3 | assert(tuple1[0] === 1);
4 |
Cause: Unexpected character '['"
`;
exports[`tuple.js [meriyah] format 1`] = `
"'#' not followed by identifier (1:16)
> 1 | const tuple1 = #[1, 2, 3];
| ^
2 |
3 | assert(tuple1[0] === 1);
4 |
Cause: [1:15-1:16]: '#' not followed by identifier"
`;
exports[`tuple.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
const tuple1 = #[1, 2, 3];
assert(tuple1[0] === 1);
const tuple2 = tuple1.with(0, 2);
assert(tuple1 !== tuple2);
assert(tuple2 === #[2, 2, 3]);
const tuple3 = #[1, ...tuple2];
assert(tuple3 === #[1, 2, 2, 3]);
const tuple4 = tuple3.pushed(4);
assert(tuple4 === #[1, 2, 2, 3, 4]);
assert(tuple4.first() === 1);
const tuple5 = tuple4.popped();
assert(tuple5 === #[2, 2, 3, 4]);
=====================================output=====================================
const tuple1 = #[1, 2, 3];
assert(tuple1[0] === 1);
const tuple2 = tuple1.with(0, 2);
assert(tuple1 !== tuple2);
assert(tuple2 === #[2, 2, 3]);
const tuple3 = #[1, ...tuple2];
assert(tuple3 === #[1, 2, 2, 3]);
const tuple4 = tuple3.pushed(4);
assert(tuple4 === #[1, 2, 2, 3, 4]);
assert(tuple4.first() === 1);
const tuple5 = tuple4.popped();
assert(tuple5 === #[2, 2, 3, 4]);
================================================================================
`;
exports[`tuple-trailing-comma.js [acorn] format 1`] = `
"Unexpected character '[' (1:2)
> 1 | #[1,]
| ^
2 |
Cause: Unexpected character '[' (1:1)"
`;
exports[`tuple-trailing-comma.js [espree] format 1`] = `
"Unexpected character '[' (1:2)
> 1 | #[1,]
| ^
2 |
Cause: Unexpected character '['"
`;
exports[`tuple-trailing-comma.js [meriyah] format 1`] = `
"'#' not followed by identifier (1:1)
> 1 | #[1,]
| ^
2 |
Cause: [1:0-1:1]: '#' not followed by identifier"
`;
exports[`tuple-trailing-comma.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
#[1,]
=====================================output=====================================
#[1];
================================================================================
`;
-9
View File
@@ -1,9 +0,0 @@
const [a, b] = #[1, 2];
assert(a === 1);
assert(b === 2);
const [a, ...rest] = #[1, 2, 3];
assert(a === 1);
assert(Array.isArray(rest));
assert(rest[0] === 2);
assert(rest[1] === 3);
-9
View File
@@ -1,9 +0,0 @@
runFormatTest(import.meta, ["babel"], {
errors: {
babel: ["invalid-tuple-holes.js"],
__babel_estree: ["invalid-tuple-holes.js"],
acorn: true,
espree: true,
meriyah: true,
},
});
@@ -1 +0,0 @@
#[,]
-3
View File
@@ -1,3 +0,0 @@
#[]
#[1, 2]
#[1, 2, #{ a: 3 }]
@@ -1 +0,0 @@
#[1,]
-17
View File
@@ -1,17 +0,0 @@
const tuple1 = #[1, 2, 3];
assert(tuple1[0] === 1);
const tuple2 = tuple1.with(0, 2);
assert(tuple1 !== tuple2);
assert(tuple2 === #[2, 2, 3]);
const tuple3 = #[1, ...tuple2];
assert(tuple3 === #[1, 2, 2, 3]);
const tuple4 = tuple3.pushed(4);
assert(tuple4 === #[1, 2, 2, 3, 4]);
assert(tuple4.first() === 1);
const tuple5 = tuple4.popped();
assert(tuple5 === #[2, 2, 3, 4]);
@@ -1,61 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`tuple.js [acorn] format 1`] = `
"Unexpected character '[' (6:6)
4 | ]
5 |
> 6 | a = #[
| ^
7 | <div/>,
8 | <div/>,
9 | ]
Cause: Unexpected character '[' (6:5)"
`;
exports[`tuple.js [espree] format 1`] = `
"Unexpected character '[' (6:6)
4 | ]
5 |
> 6 | a = #[
| ^
7 | <div/>,
8 | <div/>,
9 | ]
Cause: Unexpected character '['"
`;
exports[`tuple.js [meriyah] format 1`] = `
"'#' not followed by identifier (6:5)
4 | ]
5 |
> 6 | a = #[
| ^
7 | <div/>,
8 | <div/>,
9 | ]
Cause: [6:4-6:5]: '#' not followed by identifier"
`;
exports[`tuple.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
a = [
<div/>,
<div/>,
]
a = #[
<div/>,
<div/>,
]
=====================================output=====================================
a = [<div />, <div />];
a = #[<div />, <div />];
================================================================================
`;
-7
View File
@@ -1,7 +0,0 @@
runFormatTest(import.meta, ["babel"], {
errors: {
acorn: ["tuple.js"],
espree: ["tuple.js"],
meriyah: ["tuple.js"],
},
});
-9
View File
@@ -1,9 +0,0 @@
a = [
<div/>,
<div/>,
]
a = #[
<div/>,
<div/>,
]
@@ -145,10 +145,9 @@ Cause: Unexpected token (5:11)"
`; `;
exports[`snippet: #7 [babel] format 1`] = ` exports[`snippet: #7 [babel] format 1`] = `
"Unexpected token (1:7) "Unexpected token. (1:7)
> 1 | const #{ a, b } = #{ a: 1, b: 2 }; > 1 | const #{ a, b } = #{ a: 1, b: 2 };
| ^ | ^"
Cause: Unexpected token (1:6)"
`; `;
exports[`snippet: #8 [babel] format 1`] = ` exports[`snippet: #8 [babel] format 1`] = `
@@ -159,10 +158,10 @@ Cause: Unexpected token (1:6)"
`; `;
exports[`snippet: #9 [babel] format 1`] = ` exports[`snippet: #9 [babel] format 1`] = `
"Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'. (1:1) "Unexpected token (1:2)
> 1 | [| 1 |] > 1 | [| 1 |]
| ^ | ^
Cause: Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'. (1:0)" Cause: Unexpected token (1:1)"
`; `;
exports[`snippet: #10 [babel] format 1`] = ` exports[`snippet: #10 [babel] format 1`] = `
@@ -8,10 +8,9 @@ Cause: Unexpected character '{' (1:1)"
`; `;
exports[`snippet: #0 [babel] format 1`] = ` exports[`snippet: #0 [babel] format 1`] = `
"Only properties and spread elements are allowed in record definitions. (1:3) "Unexpected token. (1:1)
> 1 | #{a() {}} > 1 | #{a() {}}
| ^ | ^"
Cause: Only properties and spread elements are allowed in record definitions. (1:2)"
`; `;
exports[`snippet: #0 [espree] format 1`] = ` exports[`snippet: #0 [espree] format 1`] = `
@@ -36,10 +35,9 @@ Cause: Unexpected character '{' (1:1)"
`; `;
exports[`snippet: #1 [babel] format 1`] = ` exports[`snippet: #1 [babel] format 1`] = `
"Only properties and spread elements are allowed in record definitions. (1:3) "Unexpected token. (1:1)
> 1 | #{async b() {}} > 1 | #{async b() {}}
| ^ | ^"
Cause: Only properties and spread elements are allowed in record definitions. (1:2)"
`; `;
exports[`snippet: #1 [espree] format 1`] = ` exports[`snippet: #1 [espree] format 1`] = `
@@ -64,10 +62,9 @@ Cause: Unexpected character '{' (1:1)"
`; `;
exports[`snippet: #2 [babel] format 1`] = ` exports[`snippet: #2 [babel] format 1`] = `
"Only properties and spread elements are allowed in record definitions. (1:3) "Unexpected token. (1:1)
> 1 | #{get c() {}} > 1 | #{get c() {}}
| ^ | ^"
Cause: Only properties and spread elements are allowed in record definitions. (1:2)"
`; `;
exports[`snippet: #2 [espree] format 1`] = ` exports[`snippet: #2 [espree] format 1`] = `
@@ -92,10 +89,9 @@ Cause: Unexpected character '{' (1:1)"
`; `;
exports[`snippet: #3 [babel] format 1`] = ` exports[`snippet: #3 [babel] format 1`] = `
"Only properties and spread elements are allowed in record definitions. (1:3) "Unexpected token. (1:1)
> 1 | #{set d(_) {}} > 1 | #{set d(_) {}}
| ^ | ^"
Cause: Only properties and spread elements are allowed in record definitions. (1:2)"
`; `;
exports[`snippet: #3 [espree] format 1`] = ` exports[`snippet: #3 [espree] format 1`] = `
@@ -120,10 +116,9 @@ Cause: Unexpected character '{' (1:1)"
`; `;
exports[`snippet: #4 [babel] format 1`] = ` exports[`snippet: #4 [babel] format 1`] = `
"Only properties and spread elements are allowed in record definitions. (1:3) "Unexpected token. (1:1)
> 1 | #{*e() {}} > 1 | #{*e() {}}
| ^ | ^"
Cause: Only properties and spread elements are allowed in record definitions. (1:2)"
`; `;
exports[`snippet: #4 [espree] format 1`] = ` exports[`snippet: #4 [espree] format 1`] = `
@@ -1,5 +1,25 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`array-and-object.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
breakAfterCast = <PermissionsChecker<any> | undefined>(<any>permissions)[receiverType];
testObjLiteral = <PermissionsChecker<any> | undefined>{ prop1: "myPropVal" };
=====================================output=====================================
breakAfterCast = <PermissionsChecker<any> | undefined>(
(<any>permissions)[receiverType]
);
testObjLiteral = <PermissionsChecker<any> | undefined>{ prop1: "myPropVal" };
================================================================================
`;
exports[`as-const.ts format 1`] = ` exports[`as-const.ts format 1`] = `
====================================options===================================== ====================================options=====================================
parsers: ["babel-ts", "typescript"] parsers: ["babel-ts", "typescript"]
@@ -375,40 +395,3 @@ function* g() {
================================================================================ ================================================================================
`; `;
exports[`tuple-and-record.ts [typescript] format 1`] = `
"Invalid character. (2:74)
1 | breakAfterCast = <PermissionsChecker<any> | undefined>(<any>permissions)[receiverType];
> 2 | breakAfterCast = <PermissionsChecker<any> | undefined>(<any>permissions)(#[receiverType]);
| ^
3 |
4 | testObjLiteral = <PermissionsChecker<any> | undefined>{ prop1: "myPropVal" };
5 | testObjLiteral = <PermissionsChecker<any> | undefined>#{ prop1: "myPropVal" };
Cause: Invalid character."
`;
exports[`tuple-and-record.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
breakAfterCast = <PermissionsChecker<any> | undefined>(<any>permissions)[receiverType];
breakAfterCast = <PermissionsChecker<any> | undefined>(<any>permissions)(#[receiverType]);
testObjLiteral = <PermissionsChecker<any> | undefined>{ prop1: "myPropVal" };
testObjLiteral = <PermissionsChecker<any> | undefined>#{ prop1: "myPropVal" };
=====================================output=====================================
breakAfterCast = <PermissionsChecker<any> | undefined>(
(<any>permissions)[receiverType]
);
breakAfterCast = <PermissionsChecker<any> | undefined>(
(<any>permissions)(#[receiverType])
);
testObjLiteral = <PermissionsChecker<any> | undefined>{ prop1: "myPropVal" };
testObjLiteral = <PermissionsChecker<any> | undefined>#{ prop1: "myPropVal" };
================================================================================
`;
@@ -0,0 +1,3 @@
breakAfterCast = <PermissionsChecker<any> | undefined>(<any>permissions)[receiverType];
testObjLiteral = <PermissionsChecker<any> | undefined>{ prop1: "myPropVal" };
+1 -3
View File
@@ -1,3 +1 @@
runFormatTest(import.meta, ["babel-ts", "typescript"], { runFormatTest(import.meta, ["babel-ts", "typescript"]);
errors: { typescript: ["tuple-and-record.ts"] },
});
@@ -1,5 +0,0 @@
breakAfterCast = <PermissionsChecker<any> | undefined>(<any>permissions)[receiverType];
breakAfterCast = <PermissionsChecker<any> | undefined>(<any>permissions)(#[receiverType]);
testObjLiteral = <PermissionsChecker<any> | undefined>{ prop1: "myPropVal" };
testObjLiteral = <PermissionsChecker<any> | undefined>#{ prop1: "myPropVal" };
@@ -700,9 +700,6 @@ exports[`visitor keys estree 1`] = `
"id", "id",
"qualification", "qualification",
], ],
"RecordExpression": [
"properties",
],
"RegExpLiteral": [], "RegExpLiteral": [],
"RestElement": [ "RestElement": [
"argument", "argument",
@@ -1047,9 +1044,6 @@ exports[`visitor keys estree 1`] = `
"finalizer", "finalizer",
"handler", "handler",
], ],
"TupleExpression": [
"elements",
],
"TupleTypeAnnotation": [ "TupleTypeAnnotation": [
"elementTypes", "elementTypes",
"types", "types",