lint-staged
- Version 16.1.2
- Published
- 136 kB
- 10 dependencies
- MIT license
Install
npm i lint-staged
yarn add lint-staged
pnpm add lint-staged
Overview
Lint files staged by git
Index
Functions
function lintStaged
lintStaged: (options: Options, logger?: Logger) => Promise<boolean>;
Returns
{boolean}
true
when all tasks were successful,false
when some tasks failed with errorsThrows
{Error} when failed to some other errors
Type Aliases
type AsyncGenerateTask
type AsyncGenerateTask = (stagedFileNames: string[]) => Promise<string | string[]>;
type Configuration
type Configuration = | Record< string, string | TaskFunction | GenerateTask | (string | GenerateTask)[] > | GenerateTask;
type GenerateTask
type GenerateTask = SyncGenerateTask | AsyncGenerateTask;
type LogFunction
type LogFunction = (...params: any) => void;
type Logger
type Logger = { log: LogFunction; warn: LogFunction; error: LogFunction;};
type Options
type Options = { /** * Allow empty commits when tasks revert all staged changes * @default false */ allowEmpty?: boolean; /** * The number of tasks to run concurrently, or `false` to run tasks serially * @default true */ concurrent?: boolean | number; /** * Manual task configuration; disables automatic config file discovery when used */ config?: Configuration; /** * Path to single configuration file; disables automatic config file discovery when used */ configPath?: string; /** * Working directory to run all tasks in, defaults to current working directory */ cwd?: string; /** * Whether or not to enable debug output * @default false */ debug?: boolean; /** * Override the default `--staged` flag of `git diff` to get list of files. * @warn changing this also implies `stash: false`. * @example HEAD...origin/main */ diff?: string; /** * Override the default `--diff-filter=ACMR` flag of `git diff` to get list of files * @default "ACMR" */ diffFilter?: string; /** * Maximum argument string length, by default automatically detected */ maxArgLength?: number; /** * Disable lint-staged’s own console output * @default false */ quiet?: boolean; /** * Pass filepaths relative to `CWD` to tasks, instead of absolute * @default false */ relative?: boolean; /** * Revert to original state in case of errors * @default true */ revert?: boolean; /** * Enable the backup stash, and revert in case of errors. * @warn Disabling this also implies `hidePartiallyStaged: false`. * @default true */ stash?: boolean; /** * Whether to hide unstaged changes from partially staged files before running tasks * @default true */ hidePartiallyStaged?: boolean; /** * Show task output even when tasks succeed; by default only failed output is shown * @default false */ verbose?: boolean;};
type SyncGenerateTask
type SyncGenerateTask = (stagedFileNames: string[]) => string | string[];
type TaskFunction
type TaskFunction = { title: string; task: (stagedFileNames: string[]) => void | Promise<void>;};
Package Files (1)
Dependencies (10)
Dev Dependencies (20)
- @changesets/changelog-github
- @changesets/cli
- @commitlint/cli
- @commitlint/config-conventional
- @eslint/js
- consolemock
- cross-env
- eslint
- eslint-config-prettier
- eslint-plugin-jest
- eslint-plugin-n
- eslint-plugin-prettier
- eslint-plugin-simple-import-sort
- husky
- jest
- jest-snapshot-serializer-ansi
- mock-stdin
- prettier
- semver
- typescript
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/lint-staged
.
- Markdown[](https://www.jsdocs.io/package/lint-staged)
- HTML<a href="https://www.jsdocs.io/package/lint-staged"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3293 ms. - Missing or incorrect documentation? Open an issue for this package.