Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Prettier #8420

Merged
merged 7 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# Ignoring these files for now due to https://github.com/withastro/compiler/issues/585
examples/basics/src/layouts
examples/with-nanostores/src/layouts

# Ignoring this file for now due to https://github.com/withastro/compiler/issues/485
packages/markdown/component/Markdown.astro

natemoo-re marked this conversation as resolved.
Show resolved Hide resolved
# Benchmark artifacts
benchmark/projects/
benchmark/results/
Expand Down
24 changes: 0 additions & 24 deletions .prettierrc.cjs

This file was deleted.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "root",
"type": "module",
natemoo-re marked this conversation as resolved.
Show resolved Hide resolved
"version": "0.0.0",
"private": true,
"repository": {
Expand All @@ -14,7 +15,7 @@
"dev": "turbo run dev --concurrency=40 --parallel --filter=astro --filter=create-astro --filter=\"@astrojs/*\" --filter=\"@benchmark/*\"",
"format": "pnpm run format:code",
"format:ci": "pnpm run format:imports && pnpm run format:code",
"format:code": "prettier -w . --cache",
"format:code": "prettier -w \"**/*\" --ignore-unknown --cache",
Comment on lines -17 to +18
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently this is why .astro files were not formatted. Seems... wrong?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out this an upstream issue! prettier/prettier#15079

"format:imports": "organize-imports-cli ./packages/*/tsconfig.json ./packages/*/*/tsconfig.json",
"test": "turbo run test --concurrency=1 --filter=astro --filter=create-astro --filter=\"@astrojs/*\"",
"test:match": "cd packages/astro && pnpm run test:match",
Expand Down Expand Up @@ -89,7 +90,7 @@
"eslint-plugin-prettier": "^5.0.0",
"only-allow": "^1.1.1",
"organize-imports-cli": "^0.10.0",
"prettier": "^3.0.2",
"prettier": "^3.0.3",
"prettier-plugin-astro": "^0.12.0",
"tiny-glob": "^0.2.9",
"turbo": "^1.10.12",
Expand Down
34 changes: 17 additions & 17 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/** @type {import("prettier").Config} */
export default {
printWidth: 100,
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
useTabs: true,
plugins: ['prettier-plugin-astro'],
overrides: [
{
files: ['.*', '*.json', '*.md', '*.toml', '*.yml'],
options: {
useTabs: false,
},
},
{
files: ['**/*.astro'],
options: {
parser: 'astro',
},
},
],
};