-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(plugin): distribution and loading #11408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ematipico
wants to merge
9
commits into
next
Choose a base branch
from
feat/plugins-as-packages
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
fdbf9dd
feat(plugin): distribution and loading
ematipico 82384c2
[autofix.ci] apply automated fixes
autofix-ci[bot] 3fa3092
address feedback
ematipico 084b307
fix test and cache
ematipico 381c529
feat: better resolution
ematipico ad24f12
[autofix.ci] apply automated fixes
autofix-ci[bot] cf557c8
move tests around and add edge cases tests, and docs
ematipico e1c70c5
[autofix.ci] apply automated fixes
autofix-ci[bot] bfb4a2b
fix CI
ematipico File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| --- | ||
| "@biomejs/biome": minor | ||
| --- | ||
|
|
||
| Added support for distributing named Grit rules, rule presets, and configurations through `biome-manifest.json` or `biome-manifest.jsonc`. | ||
|
|
||
| The field `plugins` is used to export named Grit plugins, and `configs` is used to export named configurations. | ||
| Package entries must select a named export: `package/rule`, `package/presets/preset`, or `package/configs/config`. Bare package entries aren't supported. | ||
| Rules consumed from another package are exposed under the consuming package's name, while package authors continue to reference them by their source package inside the manifest. | ||
| Configurations consumed from another package are also exposed under the consuming package's name. | ||
|
|
||
| ```json5 | ||
| { | ||
| "$schema": "./node_modules/@biomejs/biome/manifest_schema.json", | ||
| "version": 1, | ||
| "plugins": { | ||
| "rules": [ | ||
| "@org/shared-rules/noDeprecatedApi", | ||
| "@org/strict-rules/presets/recommended", | ||
| { "useCompanyLogger": "./rules/useCompanyLogger.grit" } | ||
| ], | ||
| "presets": { | ||
| "recommended": [ | ||
| "useCompanyLogger", | ||
| "@org/shared-rules/noDeprecatedApi" | ||
| ] | ||
| } | ||
| }, | ||
| "configs": [ | ||
| "@org/shared-configs/configs/recommended", | ||
| { "base": "./configs/base.json" } | ||
| ] | ||
| } | ||
| ``` | ||
|
dyc3 marked this conversation as resolved.
|
||
|
|
||
| The package must publish the manifest and every referenced file, for example, through the `files` field in `package.json`. | ||
| Plugin authors can expose their manifest through the `biome` condition with `./biome-manifest.json` as its value. | ||
|
|
||
| ```json5 | ||
| // package.json | ||
| { | ||
| "name": "@org/biome-plugin", | ||
| "exports": { | ||
| "biome": "./biome-manifest.json", | ||
| "default": "./index.js" | ||
| }, | ||
| "files": ["biome-manifest.json", "rules", "configs"] | ||
| } | ||
| ``` | ||
|
|
||
| And then, you can load the rules in your `biome.json`: | ||
|
|
||
| ```json | ||
| { | ||
| "plugins": [ | ||
| "@org/biome-plugin/useCompanyLogger", | ||
| "@org/biome-plugin/presets/recommended" | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| For more information on how to create a plugin to distribute via npm, check the relative [guide](https://biomejs.dev/guides/publish-packages/). | ||
|
ematipico marked this conversation as resolved.
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I would say something like "in packages that have a manifest"