šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Book a DemoInstallSign in
Socket

rollup-plugin-eslint-bundle

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

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

9.0.0
latest
Source
npm
Version published
Weekly downloads
148
-31.16%
Maintainers
1
Weekly downloads
Ā 
Created
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

rollup

FAQs

Package last updated on 17 Dec 2023

Did you know?

Socket

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