{"id":26117,"library":"publint","title":"publint","description":"publint is a tool for linting npm packaging errors to ensure compatibility across environments. The current stable version is 0.3.18, with frequent patch releases addressing edge cases in export mapping, file existence checks, and CJS/ESM interop warnings. It differentiates from tsc or api-extractor by focusing specifically on package.json validation, including exports, imports, main, types fields, and CommonJS default export issues. It provides a CLI, API, and online playground, and supports Node >=18.","status":"active","version":"0.3.18","language":"javascript","source_language":"en","source_url":"https://github.com/publint/publint","tags":["javascript","publish","lint"],"install":[{"cmd":"npm install publint","lang":"bash","label":"npm"},{"cmd":"yarn add publint","lang":"bash","label":"yarn"},{"cmd":"pnpm add publint","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"CLI/API tool; no required peer dependencies","package":"publint","optional":false},{"reason":"Used internally for packing packages; installed automatically","package":"@publint/pack","optional":true}],"imports":[{"note":"publint is a named export, not default.","wrong":"import publint from 'publint'","symbol":"publint","correct":"import { publint } from 'publint'"},{"note":"ESM-only since v0.3.0; CommonJS require may fail.","wrong":"const check = require('publint').check","symbol":"check","correct":"import { check } from 'publint'"},{"note":"Utility functions are in 'publint/utils' subpath.","wrong":"import { getPkgPathValue } from 'publint'","symbol":"getPkgPathValue","correct":"import { getPkgPathValue } from 'publint/utils'"}],"quickstart":{"code":"import { check, formatMessage } from 'publint';\nimport { readFile } from 'node:fs/promises';\n\nconst pkgJson = JSON.parse(await readFile('./package.json', 'utf-8'));\nconst results = await check({ pkg: pkgJson, rootDir: '.' });\nfor (const msg of results.messages) {\n  console.log(formatMessage(msg));\n}","lang":"typescript","description":"Demonstrates using the publint API to lint a package.json and print formatted messages."},"warnings":[{"fix":"Upgrade Node to >=18.","message":"Requires Node >=18; older versions will fail","severity":"breaking","affected_versions":"<18"},{"fix":"Use import statements instead of require().","message":"ESM-only since v0.3.0; CommonJS require will not work","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"Stay updated via changelog.","message":"Some rules may change severity in future; check docs","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Upgrade Node to 18 or later.","cause":"Using Node <18 which lacks support for ?? operator in publint code","error":"SyntaxError: Unexpected token '?'"},{"fix":"Add \"type\": \"module\" in package.json and use import statements.","cause":"Using CommonJS require() with ESM-only package","error":"ERR_MODULE_NOT_FOUND: Cannot find module 'publint'"},{"fix":"Import from 'publint/utils' instead of 'publint'.","cause":"Incorrect import path; utility exports are under 'publint/utils' subpath","error":"Error: Cannot find module 'publint/utils'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}