-
-
Notifications
You must be signed in to change notification settings - Fork 859
Open
Labels
A-formatterArea - FormatterArea - Formatter
Description
Background: Feedback on our company's Discord
const posts = readdirSync(join(root, './posts'))
.filter((file) => file.endsWith('.mdx'))
.map((file) => {
const { content, data } = matter(
readFileSync(join('./posts', file), 'utf8'),
);
const {
minutes,
words: { total: words },
} = readingTime(content);
return {
...data,
lastUpdateDate: getLastUpdateDate(`posts/${file}`),
minutes,
slug: basename(file, '.mdx'),
words,
} as Post;
})
.sort(({ date: dateA }, { date: dateB }) =>
compareDesc(parseISO(dateA), parseISO(dateB)),
);Note the multiple blank lines immediately preceding .sort().
And current formatted result (the same as Prettier):
const posts = readdirSync(join(root, "./posts"))
.filter((file) => file.endsWith(".mdx"))
.map((file) => {
const { content, data } = matter(
readFileSync(join("./posts", file), "utf8"),
);
const {
minutes,
words: { total: words },
} = readingTime(content);
return {
...data,
lastUpdateDate: getLastUpdateDate(`posts/${file}`),
minutes,
slug: basename(file, ".mdx"),
words,
} as Post;
})
.sort(({ date: dateA }, { date: dateB }) =>
compareDesc(parseISO(dateA), parseISO(dateB)),
);Generally, multiple blank lines are formatted into a single blank line, but in this case, even that seems unnecessary.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-formatterArea - FormatterArea - Formatter