publint
Lint packaging errors. Ensure compatibility across environments.
Try it online
This package contains a CLI and API to lint packages locally. The package to be linted must exist and be built locally for the lint to succeed. To test other npm packages, try https://publint.dev.
Usage
CLI
$ npx publint
$ npx publint ./node_modules/some-lib
$ npx publint deps
Use npx publint --help
for more information.
API
import { publint } from 'publint'
const { messages } = await publint({
pkgDir: './path/to/package',
vfs: createCustomVfsObj(),
level: 'warning',
strict: true
})
console.log(messages)
Extra utilities are exported under publint/utils
:
import { formatMessage } from 'publint/utils'
import fs from 'node:fs/promises'
const pkg = JSON.parse(
await fs.readFile('./path/to/package/package.json', 'utf8')
)
for (const message of messages) {
console.log(formatMessage(message, pkg))
}
License
MIT