Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
eslint-plugin-diff
Advanced tools
Readme
You've got changes, we've got checks. Run ESLint on your modified lines only.
Imagine a world where your developers receive feedback that's laser-focused on the changes they've made. Traditional setups can't offer this. But with our plugin, you can run ESLint on your changed lines only. This means all warnings and errors are directly relevant to you, saving you from drowning in a sea of linter errors.
Updating your linter or its dependencies can trigger a flood of new linter warnings and errors. Fixing them all can skyrocket your project costs. But with our plugin, you can run ESLint on only the changed lines of your code. This means new errors won't pop up in code that other developers have already reviewed and approved.
A healthy, high-quality code-base is the fuel for high velocity. But too many errors in your linter's output can slow you down. Our plugin ensures your linter runs on only the changed lines of your code. This keeps your developers from feeling overwhelmed, your code-base healthy, and your team productive.
Developers are constantly bombarded with errors and notifications. If a linter has too much output, it can be hard to tell if their changes caused an issue or if it's just old code. With our plugin, all the linter output your developers see will be related to their changes, making it easier to focus on the task at hand.
When creating pull-requests, this plugin enables you to run ESLint on only the changed lines. This sharpens the focus of your code review and reduces the time spent on it, while still maintaining a high-quality code base.
As a bonus, introducing new ESLint rules (or updating 3rd party configs) in a large codebase becomes a breeze, because you avoid getting blocked by new ESLint issues in already-approved code.
Get the plugin and extend your ESLint config.
npm install --save-dev eslint eslint-plugin-diff
yarn add -D eslint eslint-plugin-diff
pnpm add -D eslint eslint-plugin-diff
Extend your ESLint config with one of our configs.
"plugin:diff/diff"
(recommended)Only lint changes
{
"extends": ["plugin:diff/diff"]
}
"plugin:diff/ci"
In a CI-environment, only lint changes. Locally, skip the plugin (i.e. lint everything).
NOTE: This requires the environment variable
CI
to be defined, which most CI-providers set automatically.
{
"extends": ["plugin:diff/ci"]
}
"plugin:diff/staged"
Only lint the changes you've staged for an upcoming commit.
{
"extends": ["plugin:diff/staged"]
}
To lint all the changes of a pull-request, you only have to set
ESLINT_PLUGIN_DIFF_COMMIT
before running ESLint.
name: Run ESLint on your changes only
on:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install modules
run: npm install
- name: Fetch the base branch, so we can use `git diff`
run: git fetch origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }}
- name: Run ESLint on your changes only
env:
ESLINT_PLUGIN_DIFF_COMMIT: ${{ github.event.pull_request.base.ref }}
run: npx --no-install eslint --ext .js,.jsx,.ts,.tsx .
export ESLINT_PLUGIN_DIFF_COMMIT="origin/$BITBUCKET_PR_DESTINATION_BRANCH";
npx --no-install eslint --ext .js,.ts,.tsx .
ESLINT_PLUGIN_DIFF_COMMIT
. See git's official documentation on the syntax"plugin:diff/diff"
) or staged changes only (using "plugin:diff/staged"
)."plugin:diff/diff"
, which is equivalent to running git diff HEAD
."plugin:diff/staged"
is equivalent to running git diff HEAD --staged
FAQs
Run ESLint on your changes only
The npm package eslint-plugin-diff receives a total of 58,938 weekly downloads. As such, eslint-plugin-diff popularity was classified as popular.
We found that eslint-plugin-diff demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.