{"id":26344,"library":"rsbuild-plugin-publint","title":"rsbuild-plugin-publint","description":"Rsbuild plugin that runs publint to lint npm packages after the build process. It helps library authors catch compatibility issues early by validating package exports, detecting incorrect module formats, and ensuring proper CJS/ESM interop. Version 0.3.4 is the current stable release; maintained actively with frequent updates. Key differentiators: seamless integration with Rsbuild/Rslib, configurable severity thresholds via throwOn option, and ability to run conditionally with enable option. Unlike manual publint invocation, this runs automatically on each build, preventing publishing broken packages.","status":"active","version":"0.3.4","language":"javascript","source_language":"en","source_url":"https://github.com/rstackjs/rsbuild-plugin-publint","tags":["javascript","typescript"],"install":[{"cmd":"npm install rsbuild-plugin-publint","lang":"bash","label":"npm"},{"cmd":"yarn add rsbuild-plugin-publint","lang":"bash","label":"yarn"},{"cmd":"pnpm add rsbuild-plugin-publint","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required to register the plugin","package":"@rsbuild/core","optional":false}],"imports":[{"note":"Named export only; default import is not available.","wrong":"import pluginPublint from 'rsbuild-plugin-publint'","symbol":"pluginPublint","correct":"import { pluginPublint } from 'rsbuild-plugin-publint'"},{"note":"CommonJS requires destructured require; package exports both CJS and ESM.","wrong":"const pluginPublint = require('rsbuild-plugin-publint')","symbol":"pluginPublint","correct":"const { pluginPublint } = require('rsbuild-plugin-publint')"},{"note":"pluginPublint is a function that returns a plugin object, not a plugin object itself. Must be called.","wrong":"export default { plugins: [pluginPublint] }","symbol":"pluginPublint","correct":"export default { plugins: [pluginPublint()] }"}],"quickstart":{"code":"import { defineConfig } from '@rsbuild/core';\nimport { pluginPublint } from 'rsbuild-plugin-publint';\n\nexport default defineConfig({\n  plugins: [pluginPublint({\n    enable: Boolean(process.env.CI ?? false),\n    throwOn: 'error',\n    publintOptions: {\n      level: 'error',\n    },\n  })],\n});","lang":"typescript","description":"Demonstrates basic usage with CI-only enable and strict error handling."},"warnings":[{"fix":"Use pluginPublint() with parentheses.","message":"pluginPublint() must be called; passing the function reference without parentheses will not register the plugin.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Do not rely on throw behavior in watch mode; check console output.","message":"In watch mode, errors are printed instead of thrown, even if throwOn is set to 'error'.","severity":"gotcha","affected_versions":">=0.2.1"},{"fix":"Use throwOn instead of setting level in publintOptions.","message":"The level option in publintOptions may be deprecated in future publint versions; prefer using throwOn for severity control.","severity":"deprecated","affected_versions":">=0.2.0 <0.3.0"},{"fix":"Upgrade to >=0.3.1 which restored per-build behavior for non-watch.","message":"In v0.3.0, pluginPublint changed from running on every build to only on first build to improve watch mode. If you relied on it running every time, update your workflow.","severity":"breaking","affected_versions":"0.3.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Change import to: import { pluginPublint } from 'rsbuild-plugin-publint'","cause":"Using default import instead of named import.","error":"TypeError: pluginPublint is not a function"},{"fix":"Run: npm install rsbuild-plugin-publint -D","cause":"Package not installed or missing from node_modules.","error":"Error: Cannot find module 'rsbuild-plugin-publint'"},{"fix":"Call pluginPublint() with or without options object, e.g., pluginPublint() or pluginPublint({})","cause":"Passing nothing to pluginPublint() is allowed, but if you pass undefined explicitly, it may error. Also if you call pluginPublint without parentheses.","error":"Error: Expected options to be an object, got undefined"},{"fix":"Check publint output for details; you can set throwOn to 'never' to avoid build failure.","cause":"publint found errors in the built package.","error":"Error: publint failed with errors"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}