Registry / devops / jsr-exports-lint

jsr-exports-lint

JSON →
library0.4.2jsnpmunverified

A linting tool for validating the `exports` field in JSR's `jsr.json` manifest files, designed to be used as a build hook in `tsdown` or `unbuild`. Current stable version is 0.4.2. Released under MIT license with active development. Key differentiator: unlike `publint` which lints npm `package.json` exports, this tool specifically targets JSR's `jsr.json` exports, making it essential for library authors distributing via both npm and JSR. It fully supports TypeScript and requires Node >= 20. The lint runs after the build is done, checking that all exported entries match the actual built files.

npm install jsr-exports-lint
INSTALL
IMPORT
SIG · JSR-EXPORTS-LINT
J
jsr-exports-lint
devopsjavascriptv0.4.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

lintJsrExports
import { lintJsrExports } from 'jsr-exports-lint/tsdown'
import { lintJsrExports } from 'jsr-exports-lint'
Must import from subpath '/tsdown' for tsdown; from '/unbuild' for unbuild.
lintJsrExports
import { lintJsrExports } from 'jsr-exports-lint/unbuild'
import { lintJsrExports } from 'jsr-exports-lint'
Use '/unbuild' subpath when integrating with unbuild.
lintJsrExports
const { lintJsrExports } = require('jsr-exports-lint/tsdown')
const lintJsrExports = require('jsr-exports-lint')
CommonJS supported but requires subpath import.

Demonstrates the simplest setup for tsdown using the default jsr.json path.

// Install: npm install --save-dev jsr-exports-lint // tsdown.config.ts import { defineConfig } from 'tsdown' import { lintJsrExports } from 'jsr-exports-lint/tsdown' export default defineConfig({ entry: ['./src/index.ts', './src/features/a.ts'], publint: true, dts: true, hooks: { 'build:done': lintJsrExports() } }) // Run: npx tsdown build
Debug
Known issues
breakingPackage renamed in v0.2.0 from 'tsdown-jsr-exports-lint' to 'jsr-exports-lint'. Old imports break.
fix
Update import paths from 'tsdown-jsr-exports-lint' to 'jsr-exports-lint'.
affects: >=0.2.0
deprecatedSupport for tsdown <0.9.6 and unbuild <1.0.0 was dropped.
fix
Upgrade tsdown to >=0.9.6 and unbuild to >=1.0.0.
affects: >=0.2.0
gotchaThe lintJsrExports function must be called (invoked) in the hook, not just passed as a reference.
fix
Use hooks: { 'build:done': lintJsrExports() } — with parentheses.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'jsr-exports-lint'
Importing from the package root instead of the subpath.
fix
Import from 'jsr-exports-lint/tsdown' or 'jsr-exports-lint/unbuild'.
Error: 'undefined' is not a function (evaluating 'lintJsrExports()')
Passing lintJsrExports as a reference without calling it.
fix
Call it: hooks: { 'build:done': lintJsrExports() }.
TypeError: (0 , _jsr_exports_lint_tsdown.lintJsrExports) is not a function
Using default import instead of named import.
fix
Use named import: import { lintJsrExports } from 'jsr-exports-lint/tsdown'.
Upgrade
Version history
0.4.2latest on npm
Audit
Dependencies
tsdownoptionalPeer dependency for tsdown hook integration
unbuildoptionalPeer dependency for unbuild hook integration
Agent activity
4 hits · last 30 days
node
4
Resources
jsr-exports-lint — npm install jsr-exports-lint · libregistry