Run publint to lint npm packages after the build.
rsbuild-plugin-publint
is the perfect partner for Rslib. When building a library, publint helps you to lint the npm package and give suggestions to improve its compatibility with different environments.
Install:
npm add rsbuild-plugin-publint -D
Add plugin to your rslib.config.ts
or rsbuild.config.ts
:
import { pluginPublint } from "rsbuild-plugin-publint";
export default {
plugins: [pluginPublint()],
};
Whether to enable publint.
- Type:
boolean
- Default:
true
For example, only run publint in the CI environment:
pluginPublint({
enable: Boolean(process.env.CI),
});
Options for publint. See publint - API for more details.
- Type:
import('publint').Options
- Default:
const defaultOptions = {
pkgDir: api.context.rootPath,
};
- Example:
pluginPublint({
publintOptions: {
level: "error",
},
});
Specify when to throw an error based on message severity.
- Type:
'error' | 'warning' | 'suggestion' | 'never'
- Default:
'error'
- Example:
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.
MIT.