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.

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.
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.
npm install danger-plugin-eslint
yarn add danger-plugin-eslint
pnpm add danger-plugin-eslint

Shows minimal usage of the eslint() function with optional configuration.

// 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()
})