Skip to content

Commit

Permalink
Add prettier-plugin-astro to the monorepo (#4083)
Browse files Browse the repository at this point in the history
* Add `prettier-plugin-astro` to the monorepo

* Fix issue that prevent formatting Picture component

* Revert "Fix issue that prevent formatting Picture component"

This reverts commit 5536c51.

* Add back CLI parameter

* Update to latest prettier plugin

* Add more ignored files, unfortunately
  • Loading branch information
Princesseuh authored Aug 6, 2022
1 parent 3f3a293 commit 24c8e7d
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 10 deletions.
10 changes: 7 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# To be removed with ".astro" parsing is ready
# Also, be sure to remove "pluginSearchDirs" from config
**/*.astro
# Ignoring these files for now due to https://github.com/withastro/compiler/issues/318
examples/basics/src/layouts
examples/blog/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

# Deep Directories
**/dist
Expand Down
10 changes: 8 additions & 2 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": true,
"plugins": ["./node_modules/prettier-plugin-astro"],
"overrides": [
{
"files": [".*", "*.json", "*.md", "*.toml", "*.yml"],
"options": {
"useTabs": false
}
},
{
"files": ["**/*.astro"],
"options": {
"parser": "astro"
}
}
],
"pluginSearchDirs": ["./assets"]
]
}
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dev": "turbo run dev --no-deps --no-cache --parallel --filter=astro --filter=create-astro --filter=\"@astrojs/*\"",
"format": "pnpm run format:code",
"format:ci": "pnpm run format:imports && pnpm run format:code",
"format:code": "prettier -w . --cache",
"format:code": "prettier -w . --cache --plugin-search-dir=.",
"format:imports": "organize-imports-cli ./packages/*/tsconfig.json ./packages/*/*/tsconfig.json",
"test": "turbo run test --output-logs=new-only --concurrency=1 --filter=astro --filter=create-astro --filter=\"@astrojs/*\"",
"test:match": "cd packages/astro && pnpm run test:match",
Expand All @@ -27,15 +27,13 @@
"version": "changeset version && pnpm install --no-frozen-lockfile && pnpm run format"
},
"workspaces": [
"compiled/*",
"packages/markdown/*",
"packages/integrations/*",
"packages/*",
"examples/*",
"examples/component/demo",
"examples/component/packages/*",
"scripts",
"smoke/*",
"packages/astro/test/fixtures/component-library-shared",
"packages/astro/test/fixtures/custom-elements/my-component-lib",
"packages/astro/test/fixtures/static build/pkg"
Expand Down Expand Up @@ -90,6 +88,7 @@
"execa": "^6.1.0",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.0",
"prettier-plugin-astro": "^0.3.0",
"pretty-bytes": "^6.0.0",
"tiny-glob": "^0.2.9",
"turbo": "1.2.5",
Expand Down
69 changes: 67 additions & 2 deletions pnpm-lock.yaml

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

0 comments on commit 24c8e7d

Please sign in to comment.