Socket
Socket
Sign inDemoInstall

rollup-plugin-eslint-bundle

Package Overview
Dependencies
110
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    rollup-plugin-eslint-bundle

Rollup plugin to verify (and fix) bundled code with ESLint


Version published
Weekly downloads
34
decreased by-32%
Maintainers
1
Install size
872 kB
Created
Weekly downloads
 

Changelog

Source

9.0.0 - 2023-12-17

Changed

  • Update dependencies

BREAKING CHANGES

  • Require Node.js version >= 20
  • Update rollup to 4.x

Readme

Source

ru

NPM version install size build JavaScript Style Guide npm type definitions

rollup-plugin-eslint-bundle

🍣 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

npm i -D rollup-plugin-eslint-bundle

Usage

// 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',
  },
}
// 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
eslintOptionsESLint class options object
throwOnWarningboolean (Default: false)
If true, will throw an error if any ESLint warnings were found.
throwOnErrorboolean (Default: false)
If true, will throw an error if any ESLint errors were found.
formatterstring (Default: undefined)
Value 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.

Keywords

FAQs

Last updated on 17 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc