{"id":27110,"library":"lint-and-publish","title":"lint-and-publish","description":"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.","status":"active","version":"0.0.8","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install lint-and-publish","lang":"bash","label":"npm"},{"cmd":"yarn add lint-and-publish","lang":"bash","label":"yarn"},{"cmd":"pnpm add lint-and-publish","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"dev dependency for type definitions","package":"typescript","optional":true}],"imports":[{"note":"ESM-only; no CJS support. Default export is a function.","wrong":"const lintAndPublish = require('lint-and-publish')","symbol":"default","correct":"import lintAndPublish from 'lint-and-publish'"},{"note":"Named export for the CLI init command.","symbol":"init","correct":"import { init } from 'lint-and-publish'"},{"note":"TypeScript type for configuration options.","symbol":"LintOptions","correct":"import type { LintOptions } from 'lint-and-publish'"}],"quickstart":{"code":"import lintAndPublish from 'lint-and-publish';\nimport { init } from 'lint-and-publish';\n\n// Initialize configuration\ninit();\n\n// Use to check and publish if needed\nlintAndPublish({\n  checkOnly: true,\n  registry: 'https://registry.npmjs.org/',\n  token: process.env.NPM_TOKEN ?? ''\n});","lang":"typescript","description":"Shows how to import and use lint-and-publish to check if publish is needed before actually publishing."},"warnings":[{"fix":"Use await lintAndPublish(...)","message":"Default export is an async function, must be awaited","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Call init() from code","message":"CLI --init flag is deprecated, use init() programmatically","severity":"deprecated","affected_versions":">=0.0.7"},{"fix":"Update import: import fn from 'lint-and-publish' instead of import { publish } from 'lint-and-publish'","message":"v0.0.8 changed default export from object to function","severity":"breaking","affected_versions":">=0.0.8"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run npm install lint-and-publish","cause":"Package not installed","error":"Error: Cannot find module 'lint-and-publish'"},{"fix":"Add await: await lintAndPublish(...)","cause":"Using default import without awaiting async function","error":"TypeError: lintAndPublish is not a function"},{"fix":"Run npx lint-and-publish --init or call init()","cause":"Configuration file not created","error":"Error: No such file or directory for .lint-publish.json"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}