docs: update changelog for v1.1.0
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
const estreePlugin = require('prettier/plugins/estree');
|
||||
const estreePlugin = require("prettier/plugins/estree");
|
||||
|
||||
function hasSpecifierComments(node) {
|
||||
return node.specifiers?.some((specifier) => specifier.comments?.length > 0) ?? false;
|
||||
return (
|
||||
node.specifiers?.some((specifier) => specifier.comments?.length > 0) ??
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
function flattenImportLines(doc) {
|
||||
if (typeof doc === 'string') {
|
||||
if (typeof doc === "string") {
|
||||
return doc;
|
||||
}
|
||||
|
||||
@@ -13,40 +16,40 @@ function flattenImportLines(doc) {
|
||||
return doc.map(flattenImportLines);
|
||||
}
|
||||
|
||||
if (!doc || typeof doc !== 'object') {
|
||||
if (!doc || typeof doc !== "object") {
|
||||
return doc;
|
||||
}
|
||||
|
||||
if (doc.type === 'line') {
|
||||
return ' ';
|
||||
if (doc.type === "line") {
|
||||
return " ";
|
||||
}
|
||||
|
||||
if ('contents' in doc) {
|
||||
if ("contents" in doc) {
|
||||
return {
|
||||
...doc,
|
||||
contents: flattenImportLines(doc.contents)
|
||||
contents: flattenImportLines(doc.contents),
|
||||
};
|
||||
}
|
||||
|
||||
if (doc.type === 'fill' && 'parts' in doc) {
|
||||
if (doc.type === "fill" && "parts" in doc) {
|
||||
return {
|
||||
...doc,
|
||||
parts: flattenImportLines(doc.parts)
|
||||
parts: flattenImportLines(doc.parts),
|
||||
};
|
||||
}
|
||||
|
||||
if (doc.type === 'if-break') {
|
||||
if (doc.type === "if-break") {
|
||||
return {
|
||||
...doc,
|
||||
breakContents: flattenImportLines(doc.breakContents),
|
||||
flatContents: flattenImportLines(doc.flatContents)
|
||||
flatContents: flattenImportLines(doc.flatContents),
|
||||
};
|
||||
}
|
||||
|
||||
if (doc.type === 'group' && 'expandedStates' in doc) {
|
||||
if (doc.type === "group" && "expandedStates" in doc) {
|
||||
return {
|
||||
...doc,
|
||||
expandedStates: flattenImportLines(doc.expandedStates)
|
||||
expandedStates: flattenImportLines(doc.expandedStates),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -63,13 +66,12 @@ module.exports = {
|
||||
const printed = estreePrinter.print(path, options, print, args);
|
||||
const node = path.getNode();
|
||||
|
||||
if (node?.type === 'ImportDeclaration' && !hasSpecifierComments(node)) {
|
||||
if (node?.type === "ImportDeclaration" && !hasSpecifierComments(node)) {
|
||||
return flattenImportLines(printed);
|
||||
}
|
||||
|
||||
return printed;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user