{"id":25037,"library":"browserslist-lint","title":"Browserslist Lint","description":"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.","status":"active","version":"0.4.0","language":"javascript","source_language":"en","source_url":"https://github.com/browserslist/lint","tags":["javascript","caniuse","browsers","target","typescript"],"install":[{"cmd":"npm install browserslist-lint","lang":"bash","label":"npm"},{"cmd":"yarn add browserslist-lint","lang":"bash","label":"yarn"},{"cmd":"pnpm add browserslist-lint","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Resolves and validates target browser queries","package":"browserslist","optional":false},{"reason":"Terminal color output","package":"picocolors","optional":false}],"imports":[{"note":"Function is exported as a named export. Default export is not available since v0.3.","wrong":"import lint from 'browserslist-lint'","symbol":"lint","correct":"import { lint } from 'browserslist-lint'"},{"note":"TypeScript type for the options parameter. Available as a named export.","wrong":"import { Options } from 'browserslist-lint'","symbol":"LintOptions","correct":"import { LintOptions } from 'browserslist-lint'"},{"note":"TypeScript type for the result object. Available as a named export.","wrong":null,"symbol":"LintResult","correct":"import { LintResult } from 'browserslist-lint'"}],"quickstart":{"code":"// install: npm install browserslist-lint\nimport { lint } from 'browserslist-lint';\n\nasync function main() {\n  try {\n    const result = await lint({\n      path: '.browserslistrc', // path to config file\n      ignoreMissing: false,    // fail on 'not dead' missing\n      ignoreLimited: false,    // fail on limited browser names\n    });\n    if (result.warnings.length > 0) {\n      console.log('Lint warnings:', result.warnings);\n    } else {\n      console.log('No issues found.');\n    }\n  } catch (err) {\n    console.error('Lint error:', err.message);\n  }\n}\nmain();","lang":"typescript","description":"Shows how to import and use the lint function programmatically with TypeScript, including options and handling warnings."},"warnings":[{"fix":"Upgrade Node.js to version 20 or higher.","message":"Dropped support for Node.js 14, 16, and 18 in v0.4.0. Requires Node.js >=20.","severity":"breaking","affected_versions":">=0.4.0"},{"fix":"Use import { lint } from 'browserslist-lint' instead of default import.","message":"Default export removed in v0.3.0 in favor of named exports.","severity":"gotcha","affected_versions":">=0.3.0 <0.4.0"},{"fix":"Provide the file path string; to lint a string, use the 'config' option instead.","message":"The lint function expects a 'path' option as string, not a parsed config object. Passing a config object will throw an error.","severity":"gotcha","affected_versions":"<0.4.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Change to: import { lint } from 'browserslist-lint'","cause":"Attempted default import after v0.3.0 removed default export.","error":"Error: The default export is not available. Use named exports like { lint } instead."},{"fix":"Provide the file path string, e.g., { path: '.browserslistrc' }","cause":"Passed a config object as 'path' option instead of file path.","error":"Error: The 'path' option must be a string or file descriptor."},{"fix":"Install peer dependency: npm install picocolors","cause":"Missing dependency picocolors, which is a peer dependency.","error":"Error: Cannot find module 'picocolors'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}