https://github.com/robinloeffel/esbuild-plugin-eslint
Lint your esbuild bundles with eslint. 🧐
https://github.com/robinloeffel/esbuild-plugin-eslint
esbuild esbuild-plugin eslint
Last synced: 3 months ago
JSON representation
Lint your esbuild bundles with eslint. 🧐
- Host: GitHub
- URL: https://github.com/robinloeffel/esbuild-plugin-eslint
- Owner: robinloeffel
- License: mit
- Created: 2022-02-01T15:57:40.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-12T17:52:33.000Z (about 1 year ago)
- Last Synced: 2025-04-12T06:15:43.621Z (3 months ago)
- Topics: esbuild, esbuild-plugin, eslint
- Language: TypeScript
- Homepage: https://npmjs.com/esbuild-plugin-eslint
- Size: 320 KB
- Stars: 8
- Watchers: 1
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- License: license
Awesome Lists containing this project
README
# `esbuild-plugin-eslint`
[](https://www.npmjs.com/package/esbuild-plugin-eslint)
[](https://www.npmjs.com/package/esbuild-plugin-eslint)
[](https://github.com/nodejs/Release)
[](https://github.com/evanw/esbuild)
[](https://github.com/eslint/eslint)
[](license)> Lint your [`esbuild`](https://github.com/evanw/esbuild) bundles with [`eslint`](https://github.com/eslint/eslint). 🧐
Nicely integrates the most recent version of [`eslint`](https://github.com/eslint/eslint) into an [`esbuild`](https://github.com/evanw/esbuild) plugin.
## How
```bash
npm i esbuild-plugin-eslint eslint --save-dev
``````js
import { build } from 'esbuild';
import eslint from 'esbuild-plugin-eslint';await build({
// ...
plugins: [
eslint({ /* config */ })
]
});
``````bash
node esbuild.config.js
```## Config
This plugin respects your [ESLint configuration](https://eslint.org/docs/user-guide/configuring) as per default. It also takes a configuration object intended for the [ESLint constructor](https://eslint.org/docs/latest/developer-guide/nodejs-api#parameters) with the addition of a `filter`, `throwOnError`, and `throwOnWarning` property. The most important options are:
### `filter`
Type: `RegExp`
Default: `/\.(?:jsx?|tsx?|mts|cts|mjs|cjs|vue|svelte)$/`
Used by: [`esbuild`](https://github.com/evanw/esbuild)
Reference: [esbuild.github.io](https://esbuild.github.io/plugins/#on-load-options)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](https://github.com/robinloeffel/esbuild-plugin-eslint)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](https://github.com/robinloeffel/esbuild-plugin-eslint)Instructs the plugin to forward warnings found by ESLint to esbuild and throw an error.
### `fix`
Type: `boolean`
Default: `false`
Used by: [`eslint`](https://github.com/eslint/eslint)
Reference: [eslint.org (`options.fix`)](https://eslint.org/docs/latest/developer-guide/nodejs-api#parameters)Controls whether to enable or disable the autofix feature of ESLint.
### `useEslintrc`
Type: `boolean`
Default: `true`
Used by: [`eslint`](https://github.com/eslint/eslint)
Reference: [eslint.org (`options.useEslintrc`)](https://eslint.org/docs/latest/developer-guide/nodejs-api#parameters)If set to `false`, ESLint will not respect any configuration files it finds.
## License
MIT