Nicely integrates the most recent version of eslint
into an esbuild
plugin.
yarn add esbuild-plugin-eslint eslint --dev
import { build } from 'esbuild';
import eslint from 'esbuild-plugin-eslint';
await build({
// ...
plugins: [
eslint({ /* config */ })
]
});
const { build } = require('esbuild');
const eslint = require('esbuild-plugin-eslint').default;
await build({
// ...
plugins: [
eslint({ /* 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:
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.
Type: boolean
Default: false
Used by: The plugin itself
Instructs the plugin to forward errors found by ESLint to esbuild and throw an error.
Type: boolean
Default: false
Used by: The plugin itself
Instructs the plugin to forward warnings found by ESLint to esbuild and throw an error.
Type: boolean
Default: false
Used by: eslint
Reference: eslint.org (options.fix
)
Controls whether to enable or disable the autofix feature of ESLint.
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.
MIT