Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(husky): enhance with lint-staged #187

Merged
merged 1 commit into from
Jun 15, 2020
Merged

chore(husky): enhance with lint-staged #187

merged 1 commit into from
Jun 15, 2020

Conversation

LoneRifle
Copy link
Contributor

Problem

Files can currently be committed without linting, which presents inconvenience to the developer at pre-push or CI since the developer has to add or modify a commit to incorporate the linting. lint-staged is designed to avoid precisely this, git adding any modifications to files (including linting) before commit.

Closes #183

Solution

Allow husky to invoke lint-staged so that files that are about to
be committed get automatically linted.

  • Update husky, add lint-staged
  • Add lint-staged commands to lint-fix files before they are committed

New dev dependencies:

  • lint-staged : as detailed above

Allow husky to invoke lint-staged so that files that are about to
be committed get automatically linted.

- Update husky, add lint-staged
- Add lint-staged commands to lint-fix files before they are committed

Closes #183
Copy link
Contributor

@liangyuanruo liangyuanruo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see you took a leaf out of @karrui 's book

@liangyuanruo liangyuanruo merged commit 4e29b6a into develop Jun 15, 2020
@liangyuanruo liangyuanruo deleted the lint-staged branch June 15, 2020 05:24
},
"lint-staged": {
"**/*.(js|jsx)": [
"eslint --ext .js,.jsx --no-eslintrc -c .eslintrc.json --fix"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't actually need to pass in .js or .jsx anymore, lint staged automatically does it. Same for the other globs

LoneRifle added a commit that referenced this pull request Jun 17, 2020
Allow husky to invoke lint-staged so that files that are about to
be committed get automatically linted.

Closes #183
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Apply lint to pre-commit hooks
3 participants