Socket
Socket
Sign inDemoInstall

@mccraveiro/lint-diff

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mccraveiro/lint-diff

:nail_care: Run eslint only in the changed parts of the code


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

lint-diff

Build Status

:nail_care: Run eslint only in the changed parts of the code

Why

ESLint is a great tool to enforce code style in your code, but it has some limitations: it can only lint entire files. When working with legacy code, we often have to make changes to very large files (which would be too troublesome to fix all lint errors)and thus it would be good to lint only the lines changed and not the entire file.

lint-diff receives a commit range and uses ESLint to lint the changed files and filter only the errors introduced in the commit range (and nothing more).

State of the art

  • lint-staged is a similar tool that lints only the staged changes. It's very helpful for adding a precommit hook, but it cannot be used to enforce the styleguide on a Continuous Integration service like Travis, because the changes are already commited.

Usage

  1. Install it:
$ npm install lint-diff
  1. Install eslint and add your eslint configuration file.

  2. Use it:

# This will lint the last commit
$ lint-diff HEAD^..HEAD

Examples

  1. Lint the last 3 commits:
$ lint-diff HEAD~3..HEAD
  1. Lint local changes that are not yet commited (similar to what lint-staged do):
$ lint-diff HEAD
# or
$ lint-diff
  1. Lint all commits from a build in Travis:
# This environment variable will be available in any Travis build
$ lint-diff $TRAVIS_COMMIT_RANGE

Keywords

FAQs

Package last updated on 16 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc