Remove outdated range fix (#13736)

This commit is contained in:
fisker Cheung authored and GitHub committed 2022-11-14 19:45:08 +08:00
1 parent e83bd73d88
commit 0d808c5ad8
8 files changed
+131 -25

No files matched your search

@@ -105,15 +105,6 @@ function postprocess(ast, options) {
} }
break; break;
case "SequenceExpression": {
// Babel (unlike other parsers) includes spaces and comments in the range. Let's unify this.
const lastExpression = node.expressions.at(-1);
node.range = [
locStart(node),
Math.min(locEnd(lastExpression), locEnd(node)),
];
break;
}
// For hack-style pipeline // For hack-style pipeline
case "TopicReference": case "TopicReference":
options.__isUsingHackPipeline = true; options.__isUsingHackPipeline = true;
+1
View File
@@ -37,6 +37,7 @@ const unstableTests = new Map(
"typescript/prettier-ignore/mapped-types.ts", "typescript/prettier-ignore/mapped-types.ts",
"js/comments/html-like/comment.js", "js/comments/html-like/comment.js",
"js/for/continue-and-break-comment-without-blocks.js", "js/for/continue-and-break-comment-without-blocks.js",
"js/sequence-expression/parenthesized.js",
"typescript/satisfies-operators/comments-unstable.ts", "typescript/satisfies-operators/comments-unstable.ts",
].map((fixture) => { ].map((fixture) => {
const [file, isUnstable = () => true] = Array.isArray(fixture) const [file, isUnstable = () => true] = Array.isArray(fixture)
@@ -0,0 +1,97 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`export-default.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
export default (1,
2);
=====================================output=====================================
export default (1, 2);
================================================================================
`;
exports[`ignore.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
+
// prettier-ignore
(
(
first
)
,
(
last
)
)
;
=====================================output=====================================
+(
// prettier-ignore
(
first
)
,
(
last
)
);
================================================================================
`;
exports[`parenthesized.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
console.log(
/* 1 */
(
/* 2 */
(
/* 3 */
first
/* 4 */
)
/* 5 */
,
/* 6 */
(
/* 7 */
last
/* 8 */
)
/* 9 */
)
/* 10 */
);
=====================================output=====================================
console.log(
/* 1 */
/* 2 */
(/* 3 */
first,
/* 4 */
/* 5 */
/* 6 */
/* 7 */
last),
/* 8 */
/* 9 */
/* 10 */
);
================================================================================
`;
@@ -0,0 +1,12 @@
+
// prettier-ignore
(
(
first
)
,
(
last
)
)
;
@@ -0,0 +1,21 @@
console.log(
/* 1 */
(
/* 2 */
(
/* 3 */
first
/* 4 */
)
/* 5 */
,
/* 6 */
(
/* 7 */
last
/* 8 */
)
/* 9 */
)
/* 10 */
);
@@ -1,16 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`export-default.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
export default (1,
2);
=====================================output=====================================
export default (1, 2);
================================================================================
`;