sheerun / prettier-standard

Formats with Prettier and lints with ESLint+Standard! (✿◠‿◠)
MIT License
868 stars 44 forks source link

throw in case of ESlint errors #18

Closed slorber closed 7 years ago

slorber commented 7 years ago

Hi,

I'm using this setting

    "lint": "eslint src/**/*.js",
    "format": "prettier-standard 'src/**/*.js'",

What I think is unexpected is that when running link I get ESLint errors (valid/expected errors), and the prettier-standard works fine to fix most of the code, but it does not throw any error. I'd like it to throw errors, how can I do that?

21:36 $ yarn lint
yarn lint v0.24.4
$ eslint src/**/*.js

/Users/sebastienlorber/Desktop/projects/shoootin/mobile/photographers/src/styleguide/ShoootinButton.js
  6:27  error  'text' is missing in props validation     react/prop-types
  6:33  error  'onPress' is missing in props validation  react/prop-types

✖ 2 problems (2 errors, 0 warnings)

error Command failed with exit code 1.
21:36 $ yarn format
yarn format v0.24.4
$ prettier-standard 'src/**/*.js'
11 files were unchanged
✨  Done in 2.37s.

I'd like yarn format to fail, because there are eslint errors

slorber commented 7 years ago

Not sure if it should be the recommended way but I added eslint to my lint-staged and it seems to do what I want now.

  "lint-staged": {
    "gitDir": "./../..",
    "linters": {
      "**/*.js": [
        "prettier-standard",
        "eslint",
        "git add"
      ]
    }
  },
sheerun commented 7 years ago

This is probably dup of #17