esbuild-plugin-eslint-hybrid
v1.0.4
Published
esbuild plugin to integrate eslint
Downloads
1
Readme
ESBUILD-PLUGIN-ESLINT-HYBRID
Created this package, since the original esbuild-plugin-eslint
only supports ESM well. It is not very convenient to use it with commonjs module/packages.
This package is mostly based on esbuild-plugin-eslint
. Very thankful for the author's great work.
Nicely integrates the most recent version of eslint
into an esbuild
plugin.
How
yarn add esbuild-plugin-eslint-hybrid eslint --dev
ES Modules
import { build } from 'esbuild';
import eslint from 'esbuild-plugin-eslint-hybrid';
await build({
// ...
plugins: [
eslint({ /* config */ })
]
});
CommonJS
const { build } = require('esbuild');
const eslint = require('esbuild-plugin-eslint-hybrid').default;
await build({
// ...
plugins: [
eslint({ /* config */ })
]
});
Config
This plugin respects your ESLint configuration as per default. It also takes a configuration object intended for the ESLint constructor with the addition of a filter
, throwOnError
, and throwOnWarning
property. The most important options are:
filter
Type: RegExp
Default: /\.(?:jsx?|tsx?|vue|svelte)$/
Used by: esbuild
Reference: esbuild.github.io
Tells esbuild what files to look at. Only files matching this pattern will be handled by the plugin.
throwOnError
Type: boolean
Default: false
Used by: The plugin itself
Instructs the plugin to forward errors found by ESLint to esbuild and throw an error.
throwOnWarning
Type: boolean
Default: false
Used by: The plugin itself
Instructs the plugin to forward warnings found by ESLint to esbuild and throw an error.
fix
Type: boolean
Default: false
Used by: eslint
Reference: eslint.org (options.fix
)
Controls whether to enable or disable the autofix feature of ESLint.
useEslintrc
Type: boolean
Default: true
Used by: eslint
Reference: eslint.org (options.useEslintrc
)
If set to false
, ESLint will not respect any configuration files it finds.
License
MIT