Run linters against staged git files and don't let anything slip into your code base! Linting makes more sense when run before committing your code. By doing so you can ensure no errors go into the repository and enforce code style. But running a lint process on a whole project is slow, and linting results can be irrelevant. Ultimately you only want to lint files that will be committed. This project contains a script that will run arbitrary shell tasks with a list of staged files as an argument, filtered by a specified glob pattern. Linter commands work on a subset of all staged files, defined by a glob pattern. lint-staged uses micromatch for matching files. The concept of lint-staged is to run configured linter tasks (or other tasks) on files that are staged in git. lint-staged will always pass a list of all staged files to the task, and ignoring any files should be configured in the task itself.

Features

  • Resolve the git root automatically, no configuration needed
  • Pick the staged files which are present inside the project directory
  • Filter them using the specified glob patterns
  • Pass absolute paths to the linters as arguments
  • Supported are any executables installed locally or globally via npm as well as any executable from your $PATH
  • You can run multiple commands in a sequence on every glob

Project Samples

Project Activity

See All Activity >

Categories

Git, Linters

License

MIT License

Follow lint-staged

lint-staged Web Site

Other Useful Business Software
Go From Idea to Deployed AI App Fast Icon
Go From Idea to Deployed AI App Fast

One platform to build, fine-tune, and deploy. No MLOps team required.

Access Gemini 3 and 200+ models. Build chatbots, agents, or custom models with built-in monitoring and scaling.
Try Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of lint-staged!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript Git Software, JavaScript Linters

Registered

2021-07-08