GithubHelp home page GithubHelp logo

Comments (3)

timlrx avatar timlrx commented on May 7, 2024

Hi Derek,

Husky is a pre-commit hook to ensure that new code committed runs through prettier and eslint. I guess you were having some eslint errors? If so, the solution is to fix it, then recommit. Or use --no-verify as an escape hatch.

Would still prefer it to be there for the template, but I can understand users opting to remove them for their own repos. Let me know what problem you ran into and I will see whether I can replicate / fix it.

from tailwind-nextjs-starter-blog.

DoctorDerek avatar DoctorDerek commented on May 7, 2024

Hi Tim,
Bumping this. I don't get it?

image

I mean, sure, I get it -- but isn't the appropriate place for this type of hook to be in some type of automation after the pull request?

I'll submit a PR that will let me not have ESLint errors...
--> They're caused by not having a .gitattributes file when I'm a Windows developer, so every single file in the PR has a ESLint error on every line, see tailwindlabs/tailwindcss#3760

But fundamentally husky seems like an odd dependency, given that it forces someone to use the command line -- at least if they're a Windows developer like myself using GitHub Desktop. I'm one of those developers who thinks the GUI (GitHub Desktop) is a better choice and never commit from the command line except in case of emergency.

The error is related to "cygpath" not being found (because GitHub Desktop doesn't know what that means); the ESLint errors get auto-fixed by running husky:
image

Anyway, I'll close the issue since you're keeping the dependency. No worries.

from tailwind-nextjs-starter-blog.

DoctorDerek avatar DoctorDerek commented on May 7, 2024

Just to follow up in case anybody stumbles on this in Google, GitHub Desktop will work with husky as configured, but only if you've already done npm install (so husky is in PATH locally).

There were previously various bugs (on both macOS and GitHub Desktop) with husky not working, but pre-commit hooks like @timlrx has set up for https://github.com/timlrx/tailwind-nextjs-starter-blog/ will work fine:
package.json

  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.+(js|jsx|ts|tsx)": [
      "eslint --fix"
    ],
    "*.+(js|jsx|ts|tsx|json|css|md|mdx)": [
      "prettier --write"
    ]
  }

Cheers!

from tailwind-nextjs-starter-blog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.