Skip to content

fbartho/danger-plugin-eslint

 
 

Repository files navigation

danger-plugin-eslint

Build Status npm version semantic-release

Eslint your code with Danger

Usage

Install:

yarn add danger-plugin-eslint --dev

At a glance:

// dangerfile.js
import eslint from "danger-plugin-eslint";

eslint();

This fork of danger-plugin-eslint automatically comments inline on linter violations.

Slightly more advanced users may be interested in providing the PluginOptions. Among other things, this allows you to inject your own logic to be run for every lint message.

Some use cases include:

  • customizing the formatting of the lint-error-message (since this comments inline in your source, this might be useful!)
  • building your own workflow where PRs shouldn't always fail due to the lint errors if the PR is labeled: WIP, for example!
eslint(undefined, {
  onLintMessage: ({ filePath, line, hasFixesOrSuggestions, linterMessage, formattedMessage, suggestedReporter }) => {
    if (prIsWIP() && suggestedReporter === error) {
      warn(formattedMessage, filePath, line);
    } else {
      suggestedReporter(formattedMessage, filePath, line);
    }
  },
});

Changelog

See the GitHub release history.

Contributing

See CONTRIBUTING.md.

About

Eslint your code with Danger

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%