aspect-build / aspect-build/rules_lint
[Bug]: how do prettier plugins work?
- Dominant language
- Starlark
- Stars
- 154
- Forks
- 125
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 20
Description
(It is entirely possible that I'm just Holding It Wrong; guidance welcome and appreciated. ❤️)
### What happened?
I've got prettier set up as described in the docs, with a handful of plugins specified in BUILD as well as the .prettierrc file:
````py
prettier.prettier_binary(
name = "prettier",
data = [
"//:prettierrc",
"//:node_modules/@trivago/prettier-plugin-sort-imports",
"//:node_modules/prettier-plugin-tailwindcss",
],
# Allow the binary to be run outside bazel
env = {"BAZEL_BINDIR": "."},
)
multi_formatter_binary(
name = "format",
javascript = ":prettier",
)
````
Unfortunately, no force on earth can compel these plugins to work:
````
Formatting JavaScript with Prettier...
[error] Cannot find package '@trivago/prettier-plugin-sort-imports' imported from /cloud/noop.js
FAILED: A formatter tool exited with code 123
````
I've been trying permutations for hours. Things I've tried that have not worked:
- public_hoist_packages per https://docs.aspect.build/rulesets/aspect_rules_js/docs/troubleshooting/#its-a-plugin
- pnpm.packageExtensions per https://pnpm.io/package_json#pnpmpackageextensions
- replacing `:prettierrc` (a plain old file) with a `js_library` target that .prettierrc as `srcs` and had the plugins as `deps`
At this point, I am fresh out of ideas and would love a nudge in the right direction. 🙏
### Version
Development (host) and target OS/architectures: Ubuntu running in Docker on a M1 Mac
Output of `bazel --version`: bazel 6.4.0
Version of the Aspect rules, or other relevant rules from your
`WORKSPACE` or `MODULE.bazel` file: 0.9.1
Language(s) and/or frameworks involved: JS
### How to reproduce
_No response_
### Any other information?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.