{"id":19675,"library":"eslint-linter-browserify","title":"eslint-linter-browserify","description":"A browser-compatible build of ESLint that runs the Linter API client-side without Node.js. Version 10.2.1 mirrors ESLint's core linting engine, made available for browser environments via bundlers like webpack or direct script tags. It ships TypeScript definitions and supports ESM, CJS, and UMD. Unlike server-side ESLint, only the Linter class is available (no CLI, no built-in formatters). Key differentiator: enables real-time linting in browser-based code editors such as CodeMirror or Monaco.","status":"active","version":"10.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/UziTech/eslint-linter-browserify","tags":["javascript","eslint","lint","linter","browser","browserify","typescript"],"install":[{"cmd":"npm install eslint-linter-browserify","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-linter-browserify","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-linter-browserify","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Use named import, not default. The package exports an object with Linter property.","wrong":"import Linter from 'eslint-linter-browserify'","symbol":"Linter","correct":"import { Linter } from 'eslint-linter-browserify'"},{"note":"Both ESM and CJS work. For browser scripts, use UMD: <script src='...linter.js'> and access window.eslint.","wrong":"const eslint = require('eslint-linter-browserify')","symbol":"eslint (namespace)","correct":"import * as eslint from 'eslint-linter-browserify'"},{"note":"Only use type import when you only need the type, e.g. for TypeScript declarations.","wrong":"import { Linter } from 'eslint-linter-browserify' // no runtime import needed","symbol":"type Linter","correct":"import type { Linter } from 'eslint-linter-browserify'"}],"quickstart":{"code":"import { Linter } from 'eslint-linter-browserify';\n\nconst linter = new Linter();\nconst code = \"var foo = 1;\";\nconst config = {\n  rules: {\n    semi: [\"error\", \"always\"],\n    \"no-var\": [\"error\"]\n  }\n};\nconst messages = linter.verify(code, config, { filename: \"test.js\" });\nconsole.log(messages);\n// Example output: [{ line: 1, column: 1, message: \"Unexpected var, use let or const instead.\", ruleId: \"no-var\", severity: 2 }]","lang":"typescript","description":"Shows how to create a Linter instance, define rules, and verify code. Output is an array of lint messages."},"warnings":[{"fix":"Use only Linter. For other APIs, consider server-side ESLint.","message":"Only the Linter class is available; other ESLint APIs (CLIEngine, RuleTester, etc.) are not bundled.","severity":"binding","affected_versions":"*"},{"fix":"Only use syntax and built-in rules that don't rely on Node.js APIs. Test thoroughly.","message":"Rules that require file system access (e.g., 'import', 'node') may not work or behave differently in the browser.","severity":"gotcha","affected_versions":"*"},{"fix":"Use <script src='linter.js'> before any code that depends on window.eslint.","message":"The namespace import via <script> tag returns the linter object as window.eslint. Ensure script order if using multiple bundles.","severity":"deprecated","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install eslint-linter-browserify' and ensure import path is correct.","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'eslint-linter-browserify'"},{"fix":"Use 'import { Linter } from 'eslint-linter-browserify''.","cause":"Using default import instead of named import: 'import Linter from ...' returns the module object, not the Linter class.","error":"linter.verify is not a function"},{"fix":"Use import instead, or switch to a bundler that supports require.","cause":"Using CJS require in an ESM context (e.g., modern browser or Node with 'type':'module').","error":"ReferenceError: require is not defined"},{"fix":"Only use rules that are bundled with the linter. Check the package's bundled rules list.","cause":"Trying to load a rule that expects Node.js module resolution; browser build may not include all rules.","error":"Failed to load rule 'no-undef': Cannot find module 'eslint/lib/rules/no-undef'","affected_versions":"*"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}