Giter VIP home page Giter VIP logo

Comments (6)

sheerun avatar sheerun commented on May 15, 2024

Hey!

These are desired behaviors. In the "Example 1" we prefer whitespace formatting of prettier before standard's rules. This is whole point of prettier-standard. Not sure how I can help here :/

As for the second example, for the same reason you'd need to use eslint-disable-next-line

from prettier-standard.

dylanjha avatar dylanjha commented on May 15, 2024

@sheerun thanks.

Is it not common (nor suggested) to both use prettier-standard (for formatting) & run standard (for linting)

(from the README):

While standard is a linter, prettier-standard is a formatter.

For example, I want to use the linter to catch things like unused variables, not handling errors, etc. What is the recommended way to achieve this?

from prettier-standard.

sheerun avatar sheerun commented on May 15, 2024

You need to disable whitespace checking in your .eslintrc, something like so:

{
  "rules": {
     "indent": "off"
  }
}

from prettier-standard.

dylanjha avatar dylanjha commented on May 15, 2024

Gotcha, thanks for that. One thing I'm a little unclear about:

  • Is adding this line to .eslintrc meant to tell the standard CLI to ignore the indent rule? Or is it telling prettier-standard to ignore the indent rule? I would expect it to be the latter.

Either way, as I'm trying this it doesn't seem to be working:

  1. add .eslintrc with {"rules": {"indent": "off"}}
  2. Using Example 1
  3. Run standard --fix (fixes whitespace so standard is happy)
  4. Run prettier-standard - whitespace gets fixed according to prettier 's rules, so now standard is no longer happy

Using: standard (10.0.3) prettier-standard (7.0.3)

I made a repo here demonstrating the above example: https://github.com/dylanjha/sample-prettier-standard, there is a .eslintrc file in the root directory. If anyone pulls this down you can run:

  1. yarn lint (standard passes)
  2. yarn format-prettier
  3. yarn lint (standard fails)

Thank you for taking the time, appreciate the help. Cheers 🍻

from prettier-standard.

sheerun avatar sheerun commented on May 15, 2024

both eslint and prettier-standard will respect that .eslintrc (but prettier-standard ignores any non-fixable rules, and indentation is probably one of them).

I'm not sure that standard respects .eslintrc, you probably need to use https://github.com/standard/eslint-config-standard instead

Also prettier-standard should be run before eslint/standard

Hope you manage to fix your setup

from prettier-standard.

dylanjha avatar dylanjha commented on May 15, 2024

Gotcha, thanks sheerun. In my example prettier-standard is fixing indentation rules, but it is ignoring the .eslintrc config. Never got to the bottom of that, but that ended up not being a blocker for me. In case anyone finds this thread, I managed fixing my setup by doing this:

  • no .eslintrc

Pre commit hook:

  • run prettier-standard (this will edit whitespace stuff + all the other prettier rules)
  • run standard --fix (this will edit whitespace stuff again to make it compliant with standard, it will fail if there are any non-fixable standard rules being broken)

On CI:

  • run standard to lint for StandardJS compliance.

from prettier-standard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.