Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lint-staged

Package Overview
Dependencies
Maintainers
1
Versions
250
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

  • 3.6.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
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

FAQs

Package last updated on 10 Jun 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc