Skip to content

Add pre-commit hook to lint? #253

@shawnbot

Description

@shawnbot

I just stumbled across lint-staged, which allows you to run (if I'm reading it correctly) any linter on staged files in a pre-commit hook. In other words, if you did this:

perl -pi -e 's/font-size: 12px;/font-size: \$font-size-small;/' **/*.scss
git commit -am 'use $font-size-small instead of 12px'

Then we'd run stylelint on only the staged files, and if any errors were found the commit would be aborted. ✨

We'd either need to offer instructions for adding the relevant commit hook or add husky to our dev dependencies.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions