From 24c8e7d853aa34aaa01204f715901c2610bfd9d6 Mon Sep 17 00:00:00 2001 From: Erika <3019731+Princesseuh@users.noreply.github.com> Date: Sat, 6 Aug 2022 00:36:31 -0400 Subject: [PATCH] Add `prettier-plugin-astro` to the monorepo (#4083) * 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 5536c5122ca01c64e2be6bdbc88aaaa71a690a58. * Add back CLI parameter * Update to latest prettier plugin * Add more ignored files, unfortunately --- .prettierignore | 10 ++++--- .prettierrc.json | 10 +++++-- package.json | 5 ++-- pnpm-lock.yaml | 69 ++++++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 84 insertions(+), 10 deletions(-) diff --git a/.prettierignore b/.prettierignore index 7b6398b3e2..9075aae848 100644 --- a/.prettierignore +++ b/.prettierignore @@ -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 diff --git a/.prettierrc.json b/.prettierrc.json index b0a1a2a075..4048bb8232 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -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"] + ] } diff --git a/package.json b/package.json index 4c62e25f41..0c97dfba24 100644 --- a/package.json +++ b/package.json @@ -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", @@ -27,7 +27,6 @@ "version": "changeset version && pnpm install --no-frozen-lockfile && pnpm run format" }, "workspaces": [ - "compiled/*", "packages/markdown/*", "packages/integrations/*", "packages/*", @@ -35,7 +34,6 @@ "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" @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index aa59dbee6d..9f4faf8350 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -30,6 +30,7 @@ importers: 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 @@ -52,6 +53,7 @@ importers: execa: 6.1.0 organize-imports-cli: 0.10.0 prettier: 2.7.1 + prettier-plugin-astro: 0.3.0 pretty-bytes: 6.0.0 tiny-glob: 0.2.9 turbo: 1.2.5 @@ -3027,6 +3029,10 @@ packages: leven: 3.1.0 dev: true + /@astrojs/compiler/0.19.0: + resolution: {integrity: sha512-8nvyxZTfCXLyRmYfTttpJT6EPhfBRg0/q4J/Jj3/pNPLzp+vs05ZdktsY6QxAREaOMAnNEtSqcrB4S5DsXOfRg==} + dev: true + /@astrojs/compiler/0.23.1: resolution: {integrity: sha512-KsoDrASGwTKZoWXbjy8SlIeoDv7y1OfBJtHVLuPuzhConA8e0SZpGzFqIuVRfG4bhisSTptZLDQZ7oxwgPv2jA==} dev: false @@ -5458,6 +5464,18 @@ packages: '@octokit/openapi-types': 12.11.0 dev: true + /@pkgr/utils/2.3.0: + resolution: {integrity: sha512-7dIJ9CRVzBnqyEl7diUHPUFJf/oty2SeoVzcMocc5PeOUDK9KGzvgIBjGRRzzlRDaOjh3ADwH0WeibQvi3ls2Q==} + engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} + dependencies: + cross-spawn: 7.0.3 + is-glob: 4.0.3 + open: 8.4.0 + picocolors: 1.0.0 + tiny-glob: 0.2.9 + tslib: 2.4.0 + dev: true + /@playwright/test/1.24.2: resolution: {integrity: sha512-Q4X224pRHw4Dtkk5PoNJplZCokLNvVbXD9wDQEMrHcEuvWpJWEQDeJ9gEwkZ3iCWSFSWBshIX177B231XW4wOQ==} engines: {node: '>=14'} @@ -10184,6 +10202,11 @@ packages: dependencies: clone: 1.0.4 + /define-lazy-prop/2.0.0: + resolution: {integrity: sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==} + engines: {node: '>=8'} + dev: true + /define-properties/1.1.4: resolution: {integrity: sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==} engines: {node: '>= 0.4'} @@ -12091,7 +12114,6 @@ packages: resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==} engines: {node: '>=8'} hasBin: true - dev: false /is-docker/3.0.0: resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==} @@ -12278,7 +12300,6 @@ packages: engines: {node: '>=8'} dependencies: is-docker: 2.2.1 - dev: false /isarray/0.0.1: resolution: {integrity: sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==} @@ -13715,6 +13736,15 @@ packages: dependencies: mimic-fn: 4.0.0 + /open/8.4.0: + resolution: {integrity: sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==} + engines: {node: '>=12'} + dependencies: + define-lazy-prop: 2.0.0 + is-docker: 2.2.1 + is-wsl: 2.2.0 + dev: true + /optionator/0.8.3: resolution: {integrity: sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==} engines: {node: '>= 0.8.0'} @@ -14485,6 +14515,16 @@ packages: fast-diff: 1.2.0 dev: true + /prettier-plugin-astro/0.3.0: + resolution: {integrity: sha512-ApEy5U3FPdylBa72L8k7W/h/zgegAyuHppDu9geVwFHzaaEQpaRCrT3Wt0nc6tNcbDaOgotBfcaUzMr0Cw6a8w==} + engines: {node: ^14.15.0 || >=16.0.0, npm: '>=6.14.0'} + dependencies: + '@astrojs/compiler': 0.19.0 + prettier: 2.7.1 + sass-formatter: 0.7.5 + synckit: 0.7.3 + dev: true + /prettier/1.19.1: resolution: {integrity: sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==} engines: {node: '>=4'} @@ -15125,6 +15165,10 @@ packages: tslib: 2.4.0 dev: true + /s.color/0.0.15: + resolution: {integrity: sha512-AUNrbEUHeKY8XsYr/DYpl+qk5+aM+DChopnWOPEzn8YKzOhv4l2zH6LzZms3tOZP3wwdOyc0RmTciyi46HLIuA==} + dev: true + /sade/1.8.1: resolution: {integrity: sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==} engines: {node: '>=6'} @@ -15149,6 +15193,12 @@ packages: rimraf: 2.7.1 dev: false + /sass-formatter/0.7.5: + resolution: {integrity: sha512-NKFP8ddjhUYi6A/iD1cEtzkEs91U61kzqe3lY9SVNuvX7LGc88xnEN0mmsWL7Ol//YTi2GL/ol7b9XZ2+hgXuA==} + dependencies: + suf-log: 2.5.3 + dev: true + /sass/1.54.3: resolution: {integrity: sha512-fLodey5Qd41Pxp/Tk7Al97sViYwF/TazRc5t6E65O7JOk4XF8pzwIW7CvCxYVOfJFFI/1x5+elDyBIixrp+zrw==} engines: {node: '>=12.0.0'} @@ -15426,6 +15476,7 @@ packages: /source-map/0.6.1: resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} engines: {node: '>=0.10.0'} + requiresBuild: true /source-map/0.7.4: resolution: {integrity: sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==} @@ -15663,6 +15714,12 @@ packages: inline-style-parser: 0.1.1 dev: false + /suf-log/2.5.3: + resolution: {integrity: sha512-KvC8OPjzdNOe+xQ4XWJV2whQA0aM1kGVczMQ8+dStAO6KfEB140JEVQ9dE76ONZ0/Ylf67ni4tILPJB41U0eow==} + dependencies: + s.color: 0.0.15 + dev: true + /supports-color/5.5.0: resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} engines: {node: '>=4'} @@ -15770,6 +15827,14 @@ packages: svelte: 3.49.0 dev: false + /synckit/0.7.3: + resolution: {integrity: sha512-jNroMv7Juy+mJ/CHW5H6TzsLWpa1qck6sCHbkv8YTur+irSq2PjbvmGnm2gy14BUQ6jF33vyR4DPssHqmqsDQw==} + engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} + dependencies: + '@pkgr/utils': 2.3.0 + tslib: 2.4.0 + dev: true + /tailwindcss/3.1.7: resolution: {integrity: sha512-r7mgumZ3k0InfVPpGWcX8X/Ut4xBfv+1O/+C73ar/m01LxGVzWvPxF/w6xIUPEztrCoz7axfx0SMdh8FH8ZvRQ==} engines: {node: '>=12.13.0'}