1.0.4 • Published 2 years ago

esbuild-plugin-eslint-hybrid v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

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.

latest version on npm Lint Test Release npm downloads a month required node version esbuild peer dep eslint peer dep package license

Lint your code when bundling with esbuild using eslint. 🧐

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

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago