Twaha-Rahman/e-commercify

[REQUEST] Lint staged files before commits

Closed this issue · 1 comments

Currently, staged files are not linted during pre-commit hooks, which sometimes allow files containing errors to pass.

Describe the solution you would like

I would suggest changing the lint-staged config from

  "lint-staged": {
    "*.{js,css,md}": "prettier --write"
  }

to

  "lint-staged": {
    "*.js": ["eslint", "prettier --write"],
    "*.{css,md}": "prettier --write"
  }

Describe alternatives you have considered

It could also be changed so as to have Prettier runs before ESLint:

  "lint-staged": {
    "*.js": ["prettier --write", "eslint"],
    "*.{css,md}": "prettier --write"
  }

There should be no difference between the two, except in case
of a semi-colon or line-break error (if any other rule causes conflicts,
it can be amended or removed).

@snowteamer Can you test the changes and do a PR? I'm currently looking into GraphQL integration with MongoDB