danger-plugin-eslint
raw JSON → 0.1.1 verified Sat Apr 25 auth: no javascript maintenance
A Danger plugin to run ESLint on changed files in PRs. Current stable version is 1.0.0, released in December 2017. This plugin automatically runs ESLint on modified files using the project's ESLint config and reports linting errors as Danger messages. It integrates with Danger's PR workflow to enforce code quality. The plugin is ESM-only and requires Danger JS. It is a niche tool for teams using Danger and ESLint in CI. Differentiators: simple setup, zero-config use of project's own ESLint config. Note: no longer actively maintained; last release was 2017.
Common errors
error SyntaxError: Cannot use import statement outside a module ↓
cause Package is ESM-only but used in CommonJS project without 'type:module' in package.json.
fix
Add 'type':'module' to package.json or use .mjs extension for dangerfile.
error eslint is not a function ↓
cause Using default import as an object and then trying to call eslint as method.
fix
Use 'import eslint from "danger-plugin-eslint"' and then call eslint() directly.
Warnings
breaking Node 6 support removed in v1.0.0 ↓
fix Upgrade Node to >=8.0.0
deprecated Package is no longer actively maintained; last release was 2017. ↓
fix Consider using danger-plugin-eslint-files or implementing custom ESLint integration.
gotcha Function expects ESLint config file to be present; otherwise it fails silently. ↓
fix Ensure an ESLint config file exists in the project root.
Install
npm install danger-plugin-eslint yarn add danger-plugin-eslint pnpm add danger-plugin-eslint Imports
- default wrong
const eslint = require('danger-plugin-eslint')correctimport eslint from 'danger-plugin-eslint' - eslint wrong
import { eslint } from 'danger-plugin-eslint'correctimport eslint from 'danger-plugin-eslint' eslint({ extensions: ['.js', '.ts'], configFile: '.eslintrc.json' }) - eslint() wrong
new eslint()correctimport eslint from 'danger-plugin-eslint' eslint()
Quickstart
// dangerfile.js
import { danger, warn, fail, markdown } from 'danger'
import eslint from 'danger-plugin-eslint'
eslint({
extensions: ['.js', '.jsx'],
configFile: '.eslintrc.json',
basePath: process.cwd()
})