Skip to content

Commit

Permalink
fix: remove clumsy prettier plugin hoisting (#417)
Browse files Browse the repository at this point in the history
It didn't work correctly because prettier runs outside the sandbox and finds node_modules in the source tree.
Instead the plugin loading should be explicit, and point prettier at the right config file
  • Loading branch information
alexeagle authored Oct 23, 2024
1 parent d66e9ae commit ce99c2b
Show file tree
Hide file tree
Showing 8 changed files with 1,035 additions and 447 deletions.
34 changes: 4 additions & 30 deletions docs/format.md

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

10 changes: 7 additions & 3 deletions example/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ js_library(
js_library(
name = "stylelintrc",
srcs = ["stylelint.config.mjs"],
deps = [
":node_modules/stylelint-config-standard",
],
deps = [":node_modules/stylelint-config-standard"],
)

js_library(
name = "prettierrc",
srcs = ["prettier.config.cjs"],
deps = [":node_modules/prettier-plugin-sql"],
)

# NB: this alias does NOT cause Bazel's Loading phase to load the tools/BUILD file.
Expand Down
1 change: 0 additions & 1 deletion example/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ npm.npm_translate_lock(
pnpm_lock = "//:pnpm-lock.yaml",
public_hoist_packages = {
"typescript-eslint": [""],
"prettier-plugin-sql": [""],
},
)
use_repo(npm, "npm")
Expand Down
10 changes: 0 additions & 10 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,5 @@
"stylelint-config-standard": "^36.0.1",
"typescript": "4.9.5",
"typescript-eslint": "^7.10.0"
},
"//FIXME(alexeagle)": "This section shouldn't be needed since these are plugins",
"pnpm": {
"packageExtensions": {
"prettier": {
"peerDependencies": {
"prettier-plugin-sql": "*"
}
}
}
}
}
Loading

0 comments on commit ce99c2b

Please sign in to comment.