lint-and-publish
raw JSON → 0.0.8 verified Fri May 01 auth: no javascript
A tool to prevent unnecessary npm publishes in CI/CD by checking if code changes actually warrant a new version. v0.0.8, frequently updated. Unlike standard npm publish, it validates whether a publish is needed, avoiding noisy failures. Ships TypeScript types. Primarily for Node.js/CI environments.
Common errors
error Error: Cannot find module 'lint-and-publish' ↓
cause Package not installed
fix
Run npm install lint-and-publish
error TypeError: lintAndPublish is not a function ↓
cause Using default import without awaiting async function
fix
Add await: await lintAndPublish(...)
error Error: No such file or directory for .lint-publish.json ↓
cause Configuration file not created
fix
Run npx lint-and-publish --init or call init()
Warnings
gotcha Default export is an async function, must be awaited ↓
fix Use await lintAndPublish(...)
deprecated CLI --init flag is deprecated, use init() programmatically ↓
fix Call init() from code
breaking v0.0.8 changed default export from object to function ↓
fix Update import: import fn from 'lint-and-publish' instead of import { publish } from 'lint-and-publish'
Install
npm install lint-and-publish yarn add lint-and-publish pnpm add lint-and-publish Imports
- default wrong
const lintAndPublish = require('lint-and-publish')correctimport lintAndPublish from 'lint-and-publish' - init
import { init } from 'lint-and-publish' - LintOptions
import type { LintOptions } from 'lint-and-publish'
Quickstart
import lintAndPublish from 'lint-and-publish';
import { init } from 'lint-and-publish';
// Initialize configuration
init();
// Use to check and publish if needed
lintAndPublish({
checkOnly: true,
registry: 'https://registry.npmjs.org/',
token: process.env.NPM_TOKEN ?? ''
});