Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rspack-contrib/rsbuild-plugin-publint
Run `publint` to lint npm packages after the build.
https://github.com/rspack-contrib/rsbuild-plugin-publint
npm rsbuild rsbuild-plugin rslib rspack
Last synced: 11 days ago
JSON representation
Run `publint` to lint npm packages after the build.
- Host: GitHub
- URL: https://github.com/rspack-contrib/rsbuild-plugin-publint
- Owner: rspack-contrib
- License: mit
- Created: 2024-12-11T09:17:31.000Z (15 days ago)
- Default Branch: main
- Last Pushed: 2024-12-11T14:18:40.000Z (15 days ago)
- Last Synced: 2024-12-11T14:39:57.054Z (15 days ago)
- Topics: npm, rsbuild, rsbuild-plugin, rslib, rspack
- Language: TypeScript
- Homepage:
- Size: 42 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rspack - rsbuild-plugin-publint
README
# rsbuild-plugin-publint
Run [publint](https://github.com/bluwy/publint) to lint npm packages after the build.
## Preview
`rsbuild-plugin-publint` is the perfect partner for [Rslib](https://github.com/web-infra-dev/rslib). When building a library, publint helps you to lint the npm package and give suggestions to improve its compatibility with different environments.
![Preview](https://github.com/user-attachments/assets/bb6940df-ab15-4155-bdf5-03b7bae5458f)
## Usage
Install:
```bash
npm add rsbuild-plugin-publint -D
```Add plugin to your `rslib.config.ts` or `rsbuild.config.ts`:
```ts
import { pluginPublint } from "rsbuild-plugin-publint";export default {
plugins: [pluginPublint()],
};
```## Options
### enable
Whether to enable publint.
- Type: `boolean`
- Default: `true`For example, only run publint in the CI environment:
```ts
pluginPublint({
enable: Boolean(process.env.CI),
});
```### publintOptions
Options for publint. See [publint - API](https://github.com/bluwy/publint/blob/master/pkg/README.md#api) for more details.
- Type: `import('publint').Options`
- Default:```js
const defaultOptions = {
pkgDir: api.context.rootPath,
};
```- Example:
```js
pluginPublint({
publintOptions: {
level: "error",
},
});
```### throwOn
Specify when to throw an error based on message severity.
- Type: `'error' | 'warning' | 'suggestion' | 'never'`
- Default: `'error'`
- Example:```ts
pluginPublint({
throwOn: "warning",
});
```Optional values:
- `'error'`: Only throw on errors.
- `'warning'`: Throw on errors and warnings.
- `'suggestion'`: Throw on errors, warnings and suggestions.
- `'never'`: Never throw an error.## License
[MIT](./LICENSE).