Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

144
Vistas
Husky & Prettier [error] Cannot read property '' of null

I have set up a husky hook for a react app, for eslint and prettier, though when I commit and the prettier script runs I get this error:

> eslint  --fix src/**/*.js


> prettier src/**/*.js --write. --config ./.prettierrc
[error] Cannot read property '' of null
> husky - pre-commit hook exited with code 1 (error)

I have checked the entire app for this '' null condition though have found nothing.

.prettierrc

{
    "arrowParens": "always",
    "bracketSpacing": true,
    "embeddedLanguageFormatting": "auto",
    "htmlWhitespaceSensitivity": "css",
    "insertPragma": false,
    "jsxSingleQuote": false,
    "proseWrap": "preserve",
    "quoteProps": "as-needed",
    "requirePragma": false,
    "semi": true,
    "singleQuote": false,
    "trailingComma": "es5",
    "useTabs": false,
    "vueIndentScriptAndStyle": false,
    "printWidth": 150,
    "tabWidth": 4,
    "rangeStart": 0
}

package.json

"scripts": {
        "start": "react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject",
        "lint": "eslint  --fix src/**/*.js",
        "format": "prettier src/**/*.js --write. --config ./.prettierrc",
        "prepare": "husky install"
    },
    "eslintConfig": {
        "extends": [
            "react-app",
            "react-app/jest"
        ]
    },
    "husky": {
        "hooks": {
            "pre-commit": "npm run lint && npm run format"
        }
    },
    "devDependencies": {
        "eslint": "^7.32.0",
        "eslint-config-prettier": "^8.3.0",
        "eslint-plugin-prettier": "^4.0.0",
        "eslint-plugin-react": "^7.27.1",
        "eslint-plugin-react-hooks": "^4.3.0",
        "husky": "^7.0.4",
        "prettier": "^2.5.1"
    }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

There is typo in format script, you can just put it as

"format": "prettier src/**/*.js --write"

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda