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

prettier-eslint-cli does not throw eslint's errors #87

Closed
arfa opened this issue Jul 12, 2017 · 5 comments
Closed

prettier-eslint-cli does not throw eslint's errors #87

arfa opened this issue Jul 12, 2017 · 5 comments

Comments

@arfa
Copy link

arfa commented Jul 12, 2017

  • prettier-eslint-cli version: 4.1.1
  • prettier-eslint version: 6.4.2
  • prettier version: 1.5.2
  • eslint version: 3.19.0

.eslintrc:

{
  "env": {
    "browser": true,
    "es6": true
  },
  "parser": "babel-eslint",
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    }
  },
  "extends": "defaults",
  "plugins": [
    "react"
  ],
  "rules": {
    "no-console": 2,
    "no-const-assign": 2,
    "no-unused-vars": 2,
    "prefer-const": 2,
    "semi": 2,
    "comma-dangle": 0,
    "react/jsx-uses-react": 2,
    "react/jsx-uses-vars": 2
  }
}

Problem description:

I have "no-console": 2 in my .eslintrc file.
I put a console.log in my code so when I run the command eslint it throws an error.

capture d ecran 2017-07-12 a 14 00 36

However when I run prettier-eslint it doesn't show this error (I have tried all the --log-level possible values).

If I am not missing something, it is supposed to show the error as it is mentioned in prettier-eslint

prettier-eslint will propagate errors when either prettier or eslint fails for one reason or another. In addition to propagating the errors, it will also log a specific message indicating what it was doing at the time of the failure.

@kentcdodds
Copy link
Member

Hi @arfa, 👋

That phrase in the docs is referring to errors thrown (like when parsing), not errors in the rules. prettier-eslint is focused only on formatting things that can be formatted, not about reporting rule violations. It is intended to be used completely separately from eslint (you should have both).

So you use prettier-eslint to autoformat your code, and eslint to find issues which cannot be autofixed.

I hope that helps.

@arfa
Copy link
Author

arfa commented Jul 12, 2017

Hi @kentcdodds

Thanks you for your response. it is clear now 👍

Maybe you should specify that in the docs.
I think it is important to know that we should have both.

@kentcdodds
Copy link
Member

Agreed. Would you like to makeapullrequest.com? 😄

@arfa
Copy link
Author

arfa commented Jul 12, 2017

I will do it 😄

It will be a PR on prettier-eslint

@humanchimp
Copy link

humanchimp commented Aug 27, 2019

Our tree is large and it would be nice to only have to run one tool to format the files when nothing else is wrong, but that would throw when other eslint rules are violated so we don't need to run the expensive operation against the entire tree twice. I can understand that it's not the default behavior, but it seems reasonable to allow that as a configuration.

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

No branches or pull requests

3 participants