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
This commit is contained in:
Erika 2022-08-06 00:36:31 -04:00 committed by GitHub
parent 3f3a293b6b
commit 24c8e7d853
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 84 additions and 10 deletions

View file

@ -1,6 +1,10 @@
# To be removed with ".astro" parsing is ready # Ignoring these files for now due to https://github.com/withastro/compiler/issues/318
# Also, be sure to remove "pluginSearchDirs" from config examples/basics/src/layouts
**/*.astro 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 # Deep Directories
**/dist **/dist

View file

@ -5,13 +5,19 @@
"tabWidth": 2, "tabWidth": 2,
"trailingComma": "es5", "trailingComma": "es5",
"useTabs": true, "useTabs": true,
"plugins": ["./node_modules/prettier-plugin-astro"],
"overrides": [ "overrides": [
{ {
"files": [".*", "*.json", "*.md", "*.toml", "*.yml"], "files": [".*", "*.json", "*.md", "*.toml", "*.yml"],
"options": { "options": {
"useTabs": false "useTabs": false
} }
},
{
"files": ["**/*.astro"],
"options": {
"parser": "astro"
}
} }
], ]
"pluginSearchDirs": ["./assets"]
} }

View file

@ -14,7 +14,7 @@
"dev": "turbo run dev --no-deps --no-cache --parallel --filter=astro --filter=create-astro --filter=\"@astrojs/*\"", "dev": "turbo run dev --no-deps --no-cache --parallel --filter=astro --filter=create-astro --filter=\"@astrojs/*\"",
"format": "pnpm run format:code", "format": "pnpm run format:code",
"format:ci": "pnpm run format:imports && 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", "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": "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", "test:match": "cd packages/astro && pnpm run test:match",
@ -27,7 +27,6 @@
"version": "changeset version && pnpm install --no-frozen-lockfile && pnpm run format" "version": "changeset version && pnpm install --no-frozen-lockfile && pnpm run format"
}, },
"workspaces": [ "workspaces": [
"compiled/*",
"packages/markdown/*", "packages/markdown/*",
"packages/integrations/*", "packages/integrations/*",
"packages/*", "packages/*",
@ -35,7 +34,6 @@
"examples/component/demo", "examples/component/demo",
"examples/component/packages/*", "examples/component/packages/*",
"scripts", "scripts",
"smoke/*",
"packages/astro/test/fixtures/component-library-shared", "packages/astro/test/fixtures/component-library-shared",
"packages/astro/test/fixtures/custom-elements/my-component-lib", "packages/astro/test/fixtures/custom-elements/my-component-lib",
"packages/astro/test/fixtures/static build/pkg" "packages/astro/test/fixtures/static build/pkg"
@ -90,6 +88,7 @@
"execa": "^6.1.0", "execa": "^6.1.0",
"organize-imports-cli": "^0.10.0", "organize-imports-cli": "^0.10.0",
"prettier": "^2.7.0", "prettier": "^2.7.0",
"prettier-plugin-astro": "^0.3.0",
"pretty-bytes": "^6.0.0", "pretty-bytes": "^6.0.0",
"tiny-glob": "^0.2.9", "tiny-glob": "^0.2.9",
"turbo": "1.2.5", "turbo": "1.2.5",

View file

@ -30,6 +30,7 @@ importers:
execa: ^6.1.0 execa: ^6.1.0
organize-imports-cli: ^0.10.0 organize-imports-cli: ^0.10.0
prettier: ^2.7.0 prettier: ^2.7.0
prettier-plugin-astro: ^0.3.0
pretty-bytes: ^6.0.0 pretty-bytes: ^6.0.0
tiny-glob: ^0.2.9 tiny-glob: ^0.2.9
turbo: 1.2.5 turbo: 1.2.5
@ -52,6 +53,7 @@ importers:
execa: 6.1.0 execa: 6.1.0
organize-imports-cli: 0.10.0 organize-imports-cli: 0.10.0
prettier: 2.7.1 prettier: 2.7.1
prettier-plugin-astro: 0.3.0
pretty-bytes: 6.0.0 pretty-bytes: 6.0.0
tiny-glob: 0.2.9 tiny-glob: 0.2.9
turbo: 1.2.5 turbo: 1.2.5
@ -3027,6 +3029,10 @@ packages:
leven: 3.1.0 leven: 3.1.0
dev: true dev: true
/@astrojs/compiler/0.19.0:
resolution: {integrity: sha512-8nvyxZTfCXLyRmYfTttpJT6EPhfBRg0/q4J/Jj3/pNPLzp+vs05ZdktsY6QxAREaOMAnNEtSqcrB4S5DsXOfRg==}
dev: true
/@astrojs/compiler/0.23.1: /@astrojs/compiler/0.23.1:
resolution: {integrity: sha512-KsoDrASGwTKZoWXbjy8SlIeoDv7y1OfBJtHVLuPuzhConA8e0SZpGzFqIuVRfG4bhisSTptZLDQZ7oxwgPv2jA==} resolution: {integrity: sha512-KsoDrASGwTKZoWXbjy8SlIeoDv7y1OfBJtHVLuPuzhConA8e0SZpGzFqIuVRfG4bhisSTptZLDQZ7oxwgPv2jA==}
dev: false dev: false
@ -5458,6 +5464,18 @@ packages:
'@octokit/openapi-types': 12.11.0 '@octokit/openapi-types': 12.11.0
dev: true 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: /@playwright/test/1.24.2:
resolution: {integrity: sha512-Q4X224pRHw4Dtkk5PoNJplZCokLNvVbXD9wDQEMrHcEuvWpJWEQDeJ9gEwkZ3iCWSFSWBshIX177B231XW4wOQ==} resolution: {integrity: sha512-Q4X224pRHw4Dtkk5PoNJplZCokLNvVbXD9wDQEMrHcEuvWpJWEQDeJ9gEwkZ3iCWSFSWBshIX177B231XW4wOQ==}
engines: {node: '>=14'} engines: {node: '>=14'}
@ -10184,6 +10202,11 @@ packages:
dependencies: dependencies:
clone: 1.0.4 clone: 1.0.4
/define-lazy-prop/2.0.0:
resolution: {integrity: sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==}
engines: {node: '>=8'}
dev: true
/define-properties/1.1.4: /define-properties/1.1.4:
resolution: {integrity: sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==} resolution: {integrity: sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
@ -12091,7 +12114,6 @@ packages:
resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==} resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==}
engines: {node: '>=8'} engines: {node: '>=8'}
hasBin: true hasBin: true
dev: false
/is-docker/3.0.0: /is-docker/3.0.0:
resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==} resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==}
@ -12278,7 +12300,6 @@ packages:
engines: {node: '>=8'} engines: {node: '>=8'}
dependencies: dependencies:
is-docker: 2.2.1 is-docker: 2.2.1
dev: false
/isarray/0.0.1: /isarray/0.0.1:
resolution: {integrity: sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==} resolution: {integrity: sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==}
@ -13715,6 +13736,15 @@ packages:
dependencies: dependencies:
mimic-fn: 4.0.0 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: /optionator/0.8.3:
resolution: {integrity: sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==} resolution: {integrity: sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==}
engines: {node: '>= 0.8.0'} engines: {node: '>= 0.8.0'}
@ -14485,6 +14515,16 @@ packages:
fast-diff: 1.2.0 fast-diff: 1.2.0
dev: true 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: /prettier/1.19.1:
resolution: {integrity: sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==} resolution: {integrity: sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==}
engines: {node: '>=4'} engines: {node: '>=4'}
@ -15125,6 +15165,10 @@ packages:
tslib: 2.4.0 tslib: 2.4.0
dev: true dev: true
/s.color/0.0.15:
resolution: {integrity: sha512-AUNrbEUHeKY8XsYr/DYpl+qk5+aM+DChopnWOPEzn8YKzOhv4l2zH6LzZms3tOZP3wwdOyc0RmTciyi46HLIuA==}
dev: true
/sade/1.8.1: /sade/1.8.1:
resolution: {integrity: sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==} resolution: {integrity: sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==}
engines: {node: '>=6'} engines: {node: '>=6'}
@ -15149,6 +15193,12 @@ packages:
rimraf: 2.7.1 rimraf: 2.7.1
dev: false 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: /sass/1.54.3:
resolution: {integrity: sha512-fLodey5Qd41Pxp/Tk7Al97sViYwF/TazRc5t6E65O7JOk4XF8pzwIW7CvCxYVOfJFFI/1x5+elDyBIixrp+zrw==} resolution: {integrity: sha512-fLodey5Qd41Pxp/Tk7Al97sViYwF/TazRc5t6E65O7JOk4XF8pzwIW7CvCxYVOfJFFI/1x5+elDyBIixrp+zrw==}
engines: {node: '>=12.0.0'} engines: {node: '>=12.0.0'}
@ -15426,6 +15476,7 @@ packages:
/source-map/0.6.1: /source-map/0.6.1:
resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
requiresBuild: true
/source-map/0.7.4: /source-map/0.7.4:
resolution: {integrity: sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==} resolution: {integrity: sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==}
@ -15663,6 +15714,12 @@ packages:
inline-style-parser: 0.1.1 inline-style-parser: 0.1.1
dev: false 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: /supports-color/5.5.0:
resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==}
engines: {node: '>=4'} engines: {node: '>=4'}
@ -15770,6 +15827,14 @@ packages:
svelte: 3.49.0 svelte: 3.49.0
dev: false 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: /tailwindcss/3.1.7:
resolution: {integrity: sha512-r7mgumZ3k0InfVPpGWcX8X/Ut4xBfv+1O/+C73ar/m01LxGVzWvPxF/w6xIUPEztrCoz7axfx0SMdh8FH8ZvRQ==} resolution: {integrity: sha512-r7mgumZ3k0InfVPpGWcX8X/Ut4xBfv+1O/+C73ar/m01LxGVzWvPxF/w6xIUPEztrCoz7axfx0SMdh8FH8ZvRQ==}
engines: {node: '>=12.13.0'} engines: {node: '>=12.13.0'}