Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

676
Views
lint-staged no se ejecuta en precommit

más bonito no se está ejecutando en la confirmación previa. Esto funcionó con la misma configuración en otros proyectos, así que estoy desconcertado por qué no funciona esta vez.

Esta es la sección relevante de mi archivo package.json:

 "scripts": { "precommit": "lint-staged" }, "lint-staged": { "*.{js,json,css,scss,html,md}": [ "prettier --write", "git add" ] },

Editar. Aquí están las dependencias de desarrollo relevantes:

 "devDependencies": { "husky": "^0.14.3", "lint-staged": "^7.0.4", "prettier": "1.12.0" },
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

En 2021

A veces, husky no agrega ganchos, por lo que debe agregarlos con un truco simple y fácil.

Primero debe desinstalar husky después de instalar la V4 de husky porque garantiza que sus ganchos estén instalados correctamente y luego instale la última versión de husky para obtener las últimas actualizaciones.

MNP

 npm uninstall husky npm install -D husky@4 npm install -D husky

HILO

 yarn remove husky yarn add -D husky@4 yarn add -D husky

Si a veces el truco anterior no funciona, agreguemos el gancho a husky, el método mencionado a continuación se usa solo en V6 y estoy mostrando el ejemplo de husky con lint-staged .

MNP

 npm install -D husky npm set-script prepare "husky install" && npm run prepare npx husky add .husky/pre-commit "npx lint-staged" git commit -m "added husky and lint-stagged" // here you will notice the lint-staged checking the files with help of husky

HILO

 yarn add -D husky npm set-script prepare "husky install" && yarn prepare npx husky add .husky/pre-commit "yarn lint-staged" git commit -m "added husky and lint-stagged" // here you will notice the lint-staged checking the files with help of husky
over 4 years ago · Santiago Trujillo Report

0

Probé tantas soluciones aquí, ¡pero una combinación finalmente funcionó!

  1. Asegúrese de que Husky v4 esté instalado. v6 nunca se disparó para mí.
  2. Verifique la salida de git config core.hooksPath . Esto no debería devolver nada. Si corre,
 git config --unset core.hookspath

¡Y FINALMENTE funcionó!

over 4 years ago · Santiago Trujillo Report

0

El problema para mí fue que ejecuté " npx mrm lint-staged " como dice el sitio web oficial, pero solo configuró las configuraciones husky y lint-staged en package.json. No los agrega como dependencia ni los instala.

La solución para mí fue:

  1. npm i -D husky lint-staged

  2. npx mrm lint-staged

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!