esbuild-plugin-eslint
Nicely integrates the most recent version of eslint
into an esbuild
plugin.
How
yarn add esbuild-plugin-eslint eslint --dev
ES Modules
import { build } from 'esbuild';
import eslint from 'esbuild-plugin-eslint';
await build({
// ...
plugins: [
eslint({ /* config */ })
]
});
CommonJS
const { build } = require('esbuild');
const eslint = require('esbuild-plugin-eslint').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