Fix comments.js import style (#9917)
This commit is contained in:
1 parent
f09ad46166
commit
334609d81e
4 files changed
+13
-22
No files matched your search
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
const comments = require("../../main/comments");
|
||||
const { printDanglingComments } = require("../../main/comments");
|
||||
const {
|
||||
getLast,
|
||||
getPenultimate,
|
||||
@@ -43,7 +43,7 @@ function printCallArguments(path, options, print) {
|
||||
if (args.length === 0) {
|
||||
return concat([
|
||||
"(",
|
||||
comments.printDanglingComments(path, options, /* sameIndent */ true),
|
||||
printDanglingComments(path, options, /* sameIndent */ true),
|
||||
")",
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
const flat = require("lodash/flatten");
|
||||
|
||||
const comments = require("../../main/comments");
|
||||
const { printComments } = require("../../main/comments");
|
||||
const {
|
||||
getLast,
|
||||
isNextLineEmpty,
|
||||
@@ -99,7 +99,7 @@ function printMemberChain(path, options, print) {
|
||||
printedNodes.unshift({
|
||||
node,
|
||||
printed: concat([
|
||||
comments.printComments(
|
||||
printComments(
|
||||
path,
|
||||
() =>
|
||||
concat([
|
||||
@@ -117,7 +117,7 @@ function printMemberChain(path, options, print) {
|
||||
printedNodes.unshift({
|
||||
node,
|
||||
needsParens: pathNeedsParens(path, options),
|
||||
printed: comments.printComments(
|
||||
printed: printComments(
|
||||
path,
|
||||
() =>
|
||||
node.type === "OptionalMemberExpression" ||
|
||||
@@ -131,7 +131,7 @@ function printMemberChain(path, options, print) {
|
||||
} else if (node.type === "TSNonNullExpression") {
|
||||
printedNodes.unshift({
|
||||
node,
|
||||
printed: comments.printComments(path, () => "!", options),
|
||||
printed: printComments(path, () => "!", options),
|
||||
});
|
||||
path.call((expression) => rec(expression), "expression");
|
||||
} else {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
const assert = require("assert");
|
||||
|
||||
// TODO(azz): anything that imports from main shouldn't be in a `language-*` dir.
|
||||
const comments = require("../main/comments");
|
||||
const { printDanglingComments } = require("../main/comments");
|
||||
const {
|
||||
hasNewline,
|
||||
printString,
|
||||
@@ -646,7 +646,7 @@ function printPathNoParens(path, options, print, args) {
|
||||
|
||||
if (hasComment(n, CommentCheckFlags.Dangling)) {
|
||||
parts.push(
|
||||
comments.printDanglingComments(path, options, true),
|
||||
printDanglingComments(path, options, true),
|
||||
commentOnOwnLine ? hardline : " "
|
||||
);
|
||||
}
|
||||
@@ -671,7 +671,7 @@ function printPathNoParens(path, options, print, args) {
|
||||
// We want to keep dangling comments above the loop to stay consistent.
|
||||
// Any comment positioned between the for statement and the parentheses
|
||||
// is going to be printed before the statement.
|
||||
const dangling = comments.printDanglingComments(
|
||||
const dangling = printDanglingComments(
|
||||
path,
|
||||
options,
|
||||
/* sameLine */ true
|
||||
@@ -985,12 +985,7 @@ function printPathNoParens(path, options, print, args) {
|
||||
if (n.members.length === 0 && !n.hasUnknownMembers) {
|
||||
parts.push(
|
||||
group(
|
||||
concat([
|
||||
"{",
|
||||
comments.printDanglingComments(path, options),
|
||||
softline,
|
||||
"}",
|
||||
])
|
||||
concat(["{", printDanglingComments(path, options), softline, "}"])
|
||||
)
|
||||
);
|
||||
} else {
|
||||
@@ -1012,11 +1007,7 @@ function printPathNoParens(path, options, print, args) {
|
||||
...(n.hasUnknownMembers ? [hardline, "..."] : []),
|
||||
])
|
||||
),
|
||||
comments.printDanglingComments(
|
||||
path,
|
||||
options,
|
||||
/* sameIndent */ true
|
||||
),
|
||||
printDanglingComments(path, options, /* sameIndent */ true),
|
||||
hardline,
|
||||
"}",
|
||||
])
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
const assert = require("assert");
|
||||
const FastPath = require("../common/fast-path");
|
||||
const doc = require("../document");
|
||||
const comments = require("./comments");
|
||||
const { printComments } = require("./comments");
|
||||
const multiparser = require("./multiparser");
|
||||
|
||||
const docBuilders = doc.builders;
|
||||
@@ -59,7 +59,7 @@ function printAstToDoc(ast, options, alignmentSize = 0) {
|
||||
} else {
|
||||
// printComments will call the plugin print function and check for
|
||||
// comments to print
|
||||
res = comments.printComments(
|
||||
res = printComments(
|
||||
path,
|
||||
(p) => callPluginPrintFunction(p, options, printGenerically, args),
|
||||
options,
|
||||
|
||||
Reference in new issue
Block a user