rollup-plugin-eslint
raw JSON → 7.0.0 verified Sat Apr 25 auth: no javascript deprecated
A Rollup plugin that verifies entry point and all imported files with ESLint. Version 7.0.0, released 2021-02-12. Maintained by TrySound, this plugin integrates ESLint linting into the Rollup build pipeline. Key differentiators: auto-fix support (via `fix` option) and integration with Rollup's plugin system. Compared to other lint plugins like rollup-plugin-eslint-plugin or @rollup/plugin-eslint (which replaced it), this was the original but is now deprecated in favor of @rollup/plugin-eslint. Last commit was 2019-09-18, so no recent activity.
Common errors
error TypeError: (0 , _rollupPluginEslint.eslint) is not a function ↓
cause Using default import instead of named import in v5+.
fix
Change to: import { eslint } from 'rollup-plugin-eslint'
error Error: Cannot find module 'rollup-plugin-eslint' ↓
cause Package not installed or incorrect path.
fix
Install: npm install rollup-plugin-eslint --save-dev
error The 'eslint' option is not supported. Use 'lint' instead. ↓
cause Confusion with other lint plugins.
fix
Use the 'eslint' function from rollup-plugin-eslint directly.
Warnings
deprecated rollup-plugin-eslint is deprecated. Use @rollup/plugin-eslint instead. ↓
fix Replace with @rollup/plugin-eslint: npm install @rollup/plugin-eslint --save-dev and change import to { eslint } from '@rollup/plugin-eslint'
breaking v5.0.0: Changed from default export to named export. ↓
fix Use import { eslint } from 'rollup-plugin-eslint' instead of import eslint from 'rollup-plugin-eslint'
breaking v6.0.0: Dropped Node.js v6 support and upgraded Rollup to v1. ↓
fix Ensure Node.js >=8 and Rollup >=1.0
breaking v7.0.0: Upgraded ESLint to v6, dropped older ESLint versions. ↓
fix ESLint >=6 required
gotcha Plugin processes files only once; if files change after initial build, they are not re-linted unless Rollup runs again. ↓
fix Use Rollup's watch mode or configure the plugin to run on every build.
Install
npm install rollup-plugin-eslint yarn add rollup-plugin-eslint pnpm add rollup-plugin-eslint Imports
- eslint wrong
import eslint from 'rollup-plugin-eslint'correctimport { eslint } from 'rollup-plugin-eslint' - rollup-plugin-eslint (CommonJS) wrong
const eslint = require('rollup-plugin-eslint')correctconst { eslint } = require('rollup-plugin-eslint') - TypeScript types
import { eslint } from 'rollup-plugin-eslint'
Quickstart
// rollup.config.js
import { rollup } from 'rollup';
import { eslint } from 'rollup-plugin-eslint';
export default {
input: 'src/main.js',
plugins: [
eslint({
throwOnError: true,
throwOnWarning: false,
include: ['src/**/*.js'],
exclude: ['node_modules/**']
})
]
};