Remove special logic in comment attach (#17270)
This commit is contained in:
1 parent
5d8337e8e0
commit
e51310d793
1 file changed
-21
@@ -142,8 +142,6 @@ function attachComments(ast, options) {
|
|||||||
|
|
||||||
const tiesToBreak = [];
|
const tiesToBreak = [];
|
||||||
const {
|
const {
|
||||||
locStart,
|
|
||||||
locEnd,
|
|
||||||
printer: {
|
printer: {
|
||||||
experimentalFeatures: {
|
experimentalFeatures: {
|
||||||
// TODO: Make this as default behavior
|
// TODO: Make this as default behavior
|
||||||
@@ -180,25 +178,6 @@ function attachComments(ast, options) {
|
|||||||
isLastComment,
|
isLastComment,
|
||||||
} = context;
|
} = context;
|
||||||
|
|
||||||
if (
|
|
||||||
options.parser === "json" ||
|
|
||||||
options.parser === "json5" ||
|
|
||||||
options.parser === "jsonc" ||
|
|
||||||
options.parser === "__js_expression" ||
|
|
||||||
options.parser === "__ts_expression" ||
|
|
||||||
options.parser === "__vue_expression" ||
|
|
||||||
options.parser === "__vue_ts_expression"
|
|
||||||
) {
|
|
||||||
if (locStart(comment) - locStart(ast) <= 0) {
|
|
||||||
addLeadingComment(ast, comment);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (locEnd(comment) > locEnd(ast)) {
|
|
||||||
addTrailingComment(ast, comment);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let args;
|
let args;
|
||||||
if (avoidAstMutation) {
|
if (avoidAstMutation) {
|
||||||
args = [context];
|
args = [context];
|
||||||
|
|||||||
Reference in new issue
Block a user