Registry / devops / danger-plugin-lint-report

danger-plugin-lint-report

JSON →
library1.8.1jsnpmunverified

A Danger plugin that reads checkstyle/lint reports and posts issues and violations as inline comments on pull requests. Current version is 1.8.1, released in 2024. It supports multiple report formats (checkstyle, PMD, etc.), customizable violation formatting, deduplication of violations, and configurable project root. Designed for use with Danger JS in CI pipelines. Ships TypeScript definitions.

npm install danger-plugin-lint-report
INSTALL
IMPORT
SIG · DANGER-PLUGIN-LINT
D
danger-plugin-lint-report
devopsjavascriptv1.8.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

lintReport
import { lintReport } from 'danger-plugin-lint-report'
const lintReport = require('danger-plugin-lint-report')
ESM import supported if using TypeScript or ES modules. For CJS, use require but note that default export is named export 'lintReport'.
default
import lintReport from 'danger-plugin-lint-report'
import { default as lintReport } from 'danger-plugin-lint-report'
Default import also works since v1. It is equivalent to named import 'lintReport'.
ViolationFormatter
import { ViolationFormatter } from 'danger-plugin-lint-report'
TypeScript type export for custom formatter function.
CheckstyleConfig
import type { CheckstyleConfig } from 'danger-plugin-lint-report'
import { CheckstyleConfig } from 'danger-plugin-lint-report'
CheckstyleConfig is a TypeScript interface, only import as type to avoid runtime issues.

Shows how to import and use the lintReport function in both CJS and ESM contexts.

// dangerfile.js (CommonJS) const { lintReport } = require('danger-plugin-lint-report'); schedule(lintReport({ // Path to your lint report file (checkstyle XML or JSON) reportPath: 'path/to/lint-report.xml', // Optional: remove duplicate violations across files (since v1.8.0) removeDuplicates: true, // Optional: custom violation formatter // ViolationFormatter: (violation) => `- ${violation.file}:${violation.line}: ${violation.message}` })); // dangerfile.ts (ESM) import { lintReport } from 'danger-plugin-lint-report'; schedule(lintReport({ reportPath: 'path/to/lint-report.xml', removeDuplicates: true }));
Debug
Known issues
breakingIn v1.5.0, the default export changed from the entire module to just the lintReport function. If you were using import * as DangerLintReport from 'danger-plugin-lint-report', you need to switch to named import.
fix
Change import to: import { lintReport } from 'danger-plugin-lint-report'
affects: <1.5.0
deprecatedThe option 'failOnWarning' has been deprecated since v1.3.0; use 'failOnSeverity' instead.
fix
Replace failOnWarning with failOnSeverity with appropriate severity level.
affects: >=1.0.0 <1.7.0
gotchaWhen using the removeDuplicates option (v1.8.0+), be aware that duplicates are determined by file, line, and message. If your tool produces multiple identical violations on the same line, they are considered duplicates.
fix
No fix needed, just understand the deduplication logic.
affects: >=1.8.0
gotchaThe 'projectRoot' option (v1.7.0+) expects an absolute path. Relative paths may cause unexpected behavior.
fix
Use path.resolve() to ensure absolute path.
affects: >=1.7.0
breakingIn v1.6.0, the signature of ViolationFormatter changed. It now receives a single violation object instead of multiple arguments.
fix
Update your custom formatter to accept one argument: (violation) => string
affects: <1.6.0
deprecatedSupport for Node.js versions below 12 has been dropped as of v1.0.0.
fix
Upgrade Node.js to v12 or higher.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Module 'danger-plugin-lint-report' does not provide a default export
Using import lintReport from 'danger-plugin-lint-report' in a CommonJS environment without a default export set up.
fix
Change to import { lintReport } from 'danger-plugin-lint-report' or use require().
TypeError: Cannot destructure property 'lintReport' of 'undefined' or 'null'
Import statement imports the module incorrectly, e.g., import { lintReport } from 'danger-plugin-lint-report' but the module is not installed or not resolved.
fix
Ensure the package is installed: npm install danger-plugin-lint-report
Type '{}' is not assignable to type 'Violation'
Using a custom ViolationFormatter that does not match the expected signature.
fix
Update the formatter to accept a single argument of type Violation.
Upgrade
Version history
1.8.1latest on npm
Audit
Dependencies
dangerrequiredpeer dependency: required to run as a Danger plugin
Agent activity
6 hits · last 30 days
node
6
Resources