Registry / testing / browserslist-lint

browserslist-lint

JSON →
library0.4.0jsnpmunverified

Linter for Browserslist configuration files. Checks target browser queries against popular mistakes like missing 'not dead', ignoring browser diversity, or listing already dead browsers. Stable version 0.4.0, released frequently alongside Browserslist ecosystem. Integrates with CI via CLI or npx. Differentiator: opinionated rules to avoid common footguns when defining browser targets, with online checking at browsersl.ist.

npm install browserslist-lint
INSTALL
IMPORT
SIG · BROWSERSLIST-LINT
B
browserslist-lint
testingjavascriptv0.4.0
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.

lint
import { lint } from 'browserslist-lint'
import lint from 'browserslist-lint'
Function is exported as a named export. Default export is not available since v0.3.
LintOptions
import { LintOptions } from 'browserslist-lint'
import { Options } from 'browserslist-lint'
TypeScript type for the options parameter. Available as a named export.
LintResult
import { LintResult } from 'browserslist-lint'
TypeScript type for the result object. Available as a named export.

Shows how to import and use the lint function programmatically with TypeScript, including options and handling warnings.

// install: npm install browserslist-lint import { lint } from 'browserslist-lint'; async function main() { try { const result = await lint({ path: '.browserslistrc', // path to config file ignoreMissing: false, // fail on 'not dead' missing ignoreLimited: false, // fail on limited browser names }); if (result.warnings.length > 0) { console.log('Lint warnings:', result.warnings); } else { console.log('No issues found.'); } } catch (err) { console.error('Lint error:', err.message); } } main();
browserslist-lint --version
Debug
Known issues
breakingDropped support for Node.js 14, 16, and 18 in v0.4.0. Requires Node.js >=20.
fix
Upgrade Node.js to version 20 or higher.
affects: >=0.4.0
gotchaDefault export removed in v0.3.0 in favor of named exports.
fix
Use import { lint } from 'browserslist-lint' instead of default import.
affects: >=0.3.0 <0.4.0
gotchaThe lint function expects a 'path' option as string, not a parsed config object. Passing a config object will throw an error.
fix
Provide the file path string; to lint a string, use the 'config' option instead.
affects: <0.4.0
Errors
Common errors & fixes
Error: The default export is not available. Use named exports like { lint } instead.
Attempted default import after v0.3.0 removed default export.
fix
Change to: import { lint } from 'browserslist-lint'
Error: The 'path' option must be a string or file descriptor.
Passed a config object as 'path' option instead of file path.
fix
Provide the file path string, e.g., { path: '.browserslistrc' }
Error: Cannot find module 'picocolors'
Missing dependency picocolors, which is a peer dependency.
fix
Install peer dependency: npm install picocolors
Upgrade
Version history
0.4.0latest on npm
Audit
Dependencies
browserslistrequiredResolves and validates target browser queries
picocolorsrequiredTerminal color output
Agent activity
13 hits · last 30 days
node
10
OpenAI (training)
1
Resources
browserslist-lint — npm install browserslist-lint · libregistry