Registry / devops / esbuild-plugin-eslint-hybrid

esbuild-plugin-eslint-hybrid

JSON →
library1.0.4jsnpmunverified

esbuild plugin to integrate ESLint for linting code during bundling. Version 1.0.4 (latest). Supports both ESM and CJS, unlike the original esbuild-plugin-eslint which is ESM-only. Requires Node >=18.16.0, esbuild ^0.18.2, and eslint ^8.42.0 as peer dependencies. Provides filter, throwOnError, throwOnWarning, and fix options.

npm install esbuild-plugin-eslint-hybrid
INSTALL
IMPORT
SIG · ESBUILD-PLUGIN-ESL
E
esbuild-plugin-eslint-hybrid
devopsjavascriptv1.0.4
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.

default (eslint)
import eslint from 'esbuild-plugin-eslint-hybrid'
const eslint = require('esbuild-plugin-eslint-hybrid')
In CJS, the plugin is the default export, so you must use .default
default (CJS)
const eslint = require('esbuild-plugin-eslint-hybrid').default
const eslint = require('esbuild-plugin-eslint-hybrid')
CJS require returns an object with default export; without .default it will be undefined
type (TypeScript)
import type { ESLintPluginOpts } from 'esbuild-plugin-eslint-hybrid'
import { ESLintPluginOpts } from 'esbuild-plugin-eslint-hybrid'
Type exports are available for TypeScript users

Shows how to use the plugin with esbuild in ESM, including filter and throwOnError options.

import { build } from 'esbuild'; import eslint from 'esbuild-plugin-eslint-hybrid'; await build({ entryPoints: ['src/app.ts'], outfile: 'dist/app.js', bundle: true, plugins: [ eslint({ filter: /\.(?:jsx?|tsx?)$/, throwOnError: true, throwOnWarning: false, fix: false, }), ], });
Debug
Known issues
gotchaIn CommonJS, require returns an object; you must use .default to get the plugin function.
fix
Use const eslint = require('esbuild-plugin-eslint-hybrid').default;
affects: >=1.0.0
deprecatedThe original esbuild-plugin-eslint is deprecated in favor of this hybrid plugin if you need CJS support.
fix
Switch to esbuild-plugin-eslint-hybrid for CJS compatibility.
affects: >=1.0.0
gotchaThe plugin does not automatically respect .eslintignore; you must configure ignores in ESLint options.
fix
Pass ignorePatterns in the options object to the ESLint constructor.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: eslint is not a function
In CJS, not accessing .default from require.
fix
Use const eslint = require('esbuild-plugin-eslint-hybrid').default;
Error: Cannot find module 'esbuild-plugin-eslint-hybrid'
Missing dependency.
fix
Run npm install esbuild-plugin-eslint-hybrid --save-dev
Error: The plugin must be a function or an object with a 'name' property
Passing an undefined or incorrect plugin to esbuild.
fix
Ensure you call eslint(opts) and pass the returned object: plugins: [eslint(opts)]
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies
esbuildrequiredpeer dependency for the esbuild plugin architecture
eslintrequiredpeer dependency to perform linting
Agent activity
2 hits · last 30 days
node
2
Resources
esbuild-plugin-eslint-hybrid — npm install esbuild-plugin-eslint-hybrid · libregistry