lint-time
will run your linters of your choice against the files of your choice (like
lint-staged
). It only checks staged files - i.e. files that have changed since the previous
commit.
It aims to achieve the same goal with a far smaller footprint.
When used with simple-git-hooks
or
husky
, it can lint your commits and block bad commits.
Why not just use lint-staged
instead?
lint-time |
lint-staged |
---|---|
0 deps | 60 nested deps |
This package is available from the npm
registry.
npm install lint-time
Put your scripts inside a "lint-time"
array inside your package.json
file.
// ...
"lint-time": [
[
"*.ts",
"npx eslint"
],
[
"*.{ts,js,cjs,mjs,json}",
"npx prettier --ignore-path .gitignore --write"
]
],
// ...
And then to run on your staged files:
npx lint-time
Note: the array order is respected when a staged file matches multiple scripts
Exports a single function:
export declare const lintTime: () => Promise<boolean>;
lintTime()
will not throw if the checks fail, but will throw if there's something unexpected with
your system (e.g. a malformed package.json
).
import { lintTime } from "lint-time";
lintTime().then((wasSuccessful) => {
console.log({ wasSuccessful });
});
Supports JavaScript + TypeScript.
Can also be imported via require("lint-time")
.
GitHub issues / PRs welcome.
Dev environment requires:
- node >= 16.14.0
- npm >= 6.8.0
- git >= 2.11
Apache-2.0