Package: akitainu:source-git-diff

Internal source package for linting files that have diff between certain git commits.

Files deleted in after commit are not included.

Example

To lint all changed files between master and HEAD:

{
  rules: {
    source: ["akitainu:source-git-diff", {
      before: "master",
      after: "HEAD"
    }],
    checker: /* ... */
  }
}

Example2

On pull request-based workflows, this source can be used to only check files changed in that PR.

For example, GitHub Actions provides an environment variable GITHUB_BASE_REF for this purpose.

{
  rules: {
    source: ["akitainu:source-git-diff", {
      before: "origin/" + process.env.GITHUB_BASE_REF
      after: "HEAD"
    }],
    checker: /* ... */
  }
}

Options

before, after

before: string;
after: string;

Commits to take diff between. Anything understood by git diff can be specified.