🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

lint-staged

Package Overview
Dependencies
Maintainers
1
Versions
261
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lint-staged

Lint files staged by git

9.4.2
Source
npm
Version published
Weekly downloads
12M
-7.27%
Maintainers
1
Weekly downloads
 
Created

What is lint-staged?

The lint-staged npm package is used to run linters on staged git files. It allows you to run specific commands before committing, ensuring that only clean, linted code gets committed to your repository. This helps in maintaining code quality and reducing the chances of committing code with errors or that doesn't adhere to the project's coding standards.

What are lint-staged's main functionalities?

Running linters on staged files

This configuration in package.json will run ESLint on staged JavaScript files and Stylelint on staged CSS files, automatically fixing any fixable issues.

"lint-staged": {
  "*.js": "eslint --fix",
  "*.css": "stylelint --fix"
}

Running custom scripts

This configuration will run markdownlint-cli2 on staged Markdown files to ensure they meet the project's markdown style requirements.

"lint-staged": {
  "*.md": "npx markdownlint-cli2"
}

Using with pre-commit hooks

This configuration sets up Husky to run lint-staged as a pre-commit hook, ensuring that the linters are run automatically before each commit.

{
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  }
}

Other packages similar to lint-staged

Keywords

lint

FAQs

Package last updated on 08 Oct 2019

Did you know?

Socket

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.

Install

Related posts