Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nikolay-borzov/rollup-plugin-eslint-bundle
Rollup plugin to lint (and fix) bundled code with ESLint.
https://github.com/nikolay-borzov/rollup-plugin-eslint-bundle
Last synced: 4 days ago
JSON representation
Rollup plugin to lint (and fix) bundled code with ESLint.
- Host: GitHub
- URL: https://github.com/nikolay-borzov/rollup-plugin-eslint-bundle
- Owner: nikolay-borzov
- License: mit
- Created: 2021-01-24T17:37:23.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-17T19:42:10.000Z (about 1 year ago)
- Last Synced: 2024-03-15T02:50:58.259Z (10 months ago)
- Language: JavaScript
- Size: 563 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome - eslint-bundle - Lint bundles with ESLint. (Plugins / Code Quality)
README
[![ru](https://img.shields.io/badge/lang-ru-%23d52b1e)](./README.ru.md)
[![NPM version][npm-image]][npm-url] [![install size](https://packagephobia.com/badge?p=rollup-plugin-eslint-bundle)](https://packagephobia.com/result?p=rollup-plugin-eslint-bundle) ![build](https://github.com/nikolay-borzov/rollup-plugin-eslint-bundle/workflows/CI/badge.svg) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) ![npm type definitions](https://img.shields.io/npm/types/rollup-plugin-eslint-bundle)
# rollup-plugin-eslint-bundle
[npm-image]: https://img.shields.io/npm/v/rollup-plugin-eslint-bundle.svg
[npm-url]: https://npmjs.org/package/rollup-plugin-eslint-bundle
[rollup]: https://github.com/rollup/rollup
[eslint]: https://github.com/eslint/eslint
[eslint-config]: https://eslint.org/docs/developer-guide/nodejs-api#parameters🍣 A [Rollup] plugin to lint and fix bundled code with [ESLint].
## Requirements
This plugin requires an Node.js v20.x, Rollup v4.x and ESLint v8.x
## Install
```sh
npm i -D rollup-plugin-eslint-bundle
```## Usage
```js
// rollup.config.js ESM
import { rollup } from 'rollup'
import { eslintBundle } from 'rollup-plugin-eslint-bundle'const root = path.dirname(url.fileURLToPath(import.meta.url))
export default {
input: path.resolve(root, './main.js'),plugins: [
eslintBundle({
eslintOptions: {
fix: true,
},
throwOnWarning: true,
throwOnError: true,
formatter: 'compact',
}),
],output: {
file: path.resolve(root, './dist/bundle.js'),
format: 'es',
},
}
``````js
// Rollup JavaScript API
import { rollup } from 'rollup'
import { eslintBundle } from 'rollup-plugin-eslint-bundle'// ...
const bundle = await rollup.rollup({
input: 'main.js',
plugins: [
eslintBundle({
eslintOptions: {
fix: true,
},
throwOnWarning: true,
throwOnError: true,
formatter: 'compact',
}),
],
})await bundle.write({
file: 'dist/bundle.js',
format: 'es',
})await bundle.close()
```## Options
| | Description |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `eslintOptions` | [ESLint class options object](https://eslint.org/docs/developer-guide/nodejs-api#parameters) |
| `throwOnWarning` | `boolean` (Default: `false`)
If true, will throw an error if any ESLint warnings were found. |
| `throwOnError` | `boolean` (Default: `false`)
If true, will throw an error if any ESLint errors were found. |
| `formatter` | `string` (Default: `undefined`)
[Value](https://eslint.org/docs/developer-guide/nodejs-api#-eslintloadformatternameorpath) to be passed to `eslint.loadFormatter()` |## License
MIT License (MIT)
## Contributing
If you find a bug or think about enhancement, feel free to contribute and submit an issue or a pull request.