by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 22:20
    tjenkinson commented #13472
  • 22:08
    btmills labeled #13483
  • 22:08
    btmills opened #13483
  • 22:05

    btmills on docs-int-level-to-string

    Docs: Update int rule level to … (compare)

  • 22:03

    btmills on docs-int-level-to-string

    Docs: Update int rule level to … (compare)

  • 21:57
    btmills commented #13467
  • 21:52
    btmills unlabeled #13467
  • 21:45
    btmills commented #13472
  • 21:44
    btmills unlabeled #13472
  • 21:34
    btmills closed #13474
  • 21:34
    btmills commented #13474
  • 21:24
    btmills closed #13479
  • 21:24
    btmills commented #13479
  • 21:10
    btmills commented #13465
  • 21:01
    btmills commented #13482
  • 18:57
    nzakas locked #13482
  • 18:57
    nzakas labeled #13482
  • 18:57
    nzakas opened #13482
  • 18:57
    nzakas labeled #13482
  • 18:57
    nzakas assigned #13482
Carl Vitullo
@vcarl
i haven't thought that deeply, but for me half the value of sharing a config was to simplify new project setup. if i still have to gather together every plugin needed, then that's functionally the same as using a custom config in the first place and documenting what plugins i used last time
Roy Sutton
@webOS101
Can’t argue you with you about that.
Carl Vitullo
@vcarl
our workflow before setting up this package was to copy the list of deps needed + the .eslintrc.js. now, it's the same, but with 1 more package and slightly fewer items in the eslint config
just venting though. burned a bit of time hunting this down
Roy Sutton
@webOS101
The shared config does still make it easier to share updates to rules, but I hear you.
Robert Kieffer
@broofa
Hi all, quick ? about extends. I have a shareable config file "eslint-config-myconfig.js" inside a private module "@foo/common". I've npm linked the private module into my project, and am trying to include it with "extends": "@foo/common/eslint-config-myconfig". Sadly, eslint is saying it can't find the config file. So... what am I doing wrong?
Jordan Harband
@ljharb
a shared config in a package generally has to be the "main" of the package
(i believe)
i think if you want anything else to be a config you need to use a plugin as the vehicle, not a shared config
(i could be wrong here)
rouxfeur
@rouxfeur
Hi, I wanted to use “prettier-eslint”, but the eslint part doesn’t work. So I want to try doing it myself. What they seem to do is that they suppress all un-fixable rules and then run eslint. The closest command I could find was eslint —fix —quiet, which I think just suppresses (some) messages, not actual checking?
What do I do if all I want is for eslint to format my code?
What I am trying to do, is to run prettier on save and eslint —fix right after, to apply some styling that diverges from prettier.
Roy Sutton
@webOS101
I don’t use prettier myself, but can’t you just change prettier to apply the styling you want and just use eslint for non-stylistic warnings?
Having two tools fight over the formatting seems like a bad idea.
Kai Cataldo
@kaicataldo
Prettier has some excellent documentation around using Prettier and ESLint here https://prettier.io/docs/en/integrating-with-linters.html
rouxfeur
@rouxfeur
@ Roy: no, prettier is opinionated and they favor less configuration.
Roy Sutton
@webOS101
Bummer, I’m opinionated, too, and was hoping to use prettier at some point. ;P
Jordan Harband
@ljharb
if you want to run prettier (you don't have to, of course), then you should only run it via eslint, using eslint-config-prettier to disable conflicting rules, and eslint-plugin-prettier to format
Kai Cataldo
@kaicataldo
I think there's a misunderstanding here - what @webOS101 suggested is really the only way to use Prettier and ESLint simultaneously
Jordan Harband
@ljharb
i don't think prettier-eslint is even maintained anymore
rouxfeur
@rouxfeur
@ Kai: The actually is about how to suppress other eslint rules and in favor of prettier.
Jordan Harband
@ljharb
@rouxfeur you do that by extending eslint-config-prettier
Kai Cataldo
@kaicataldo
Yes, please see the link above. There's an eslint config for that
rouxfeur
@rouxfeur
Yes, I know about eslint-config-prettier, which suppresses eslint rules in favor of prettier. What I’m looking for is what prettier-eslint is doing.
It’s the opposite - override some prettier styles.
Jordan Harband
@ljharb
@rouxfeur i've tried it, and it doesn't work well, and prettier-eslint is unmaintained. so i'd suggest either accepting prettier's limited configuration, or abandoning prettier entirely and pursuing regular eslint rules for the things you're missing
Kai Cataldo
@kaicataldo
Sounds like you don't want to use Prettier :P
FWIW, you can use ESLint's autofixing feature for more flexibility
The beauty of Prettier is its opinionated nature. I like using it because it eliminates most discussions around style :)
Jordan Harband
@ljharb
meh, "beauty"
using a shared eslint config like airbnb's or similar achieves the same goal
Kai Cataldo
@kaicataldo
For sure
To each their own
rouxfeur
@rouxfeur
Ok, but no matter if I use prettier && eslint or just eslint, I think my original questions is still relevant: What do I do if all I want is for eslint to format my code? As fast as possible, without it having to check all the rules that it cant automatically fix.
Kai Cataldo
@kaicataldo
ESLint has autofixing built in - you can run eslint --fix and it will autofix for you
Jordan Harband
@ljharb
there's not currently a way to do like eslint --only-fix
so if all you want is to lint autofixable rules, i think you have to just "not enable" rules that aren't autofixable
rouxfeur
@rouxfeur
Oh ok. And does —quiet makes any difference or it is just about logging?
Jordan Harband
@ljharb
--quiet suppresses things set to "warn"
rouxfeur
@rouxfeur
I see. Thank you!
Jordan Harband
@ljharb
(but warnings don't fail the build, so it's not really a viable approach to set all non-autofixable to warn, in case that's what you're thinking)
rouxfeur
@rouxfeur
I was actually thinking about it haha 😄 but yeah, I agree. I think I’ll just run prettier —write && eslint —fix on save for a few days and will see.
Roy Sutton
@webOS101
You can always force a failure on build with --max-warnings 0. I don’t know whether that will also fail on fixable warnings or only unfixable ones, though.
(If you also wanted to be fixing at build time)
Kevin Partington
@platinumazure

@webOS101 --max-warnings only takes into account warnings left after autofix.

In practice this means non-autofixable warnings, although it could also happen if one rule's autofix causes a violation in another rule, and that rule's autofix causes a violation in another rule, etc. (in such a way that there is a cycle/loop). ESLint bails out after 10 autofix attempts, so in that degenerate case, an autofixable rule could fix and still leave a warning (on the 10th pass).

Roy Sutton
@webOS101
That’s what I suspected.
ku64
@Jaku6Rojek
Do you know how can I solve the this kind of problem:
ESLint couldn't find the config "eslint-config-airbnb-es5" to extend from. Please check that the name of the config is correct.
Kai Cataldo
@kaicataldo
Kevin Partington
@platinumazure
@Jaku6Rojek Did you intentionally extend from that config in your ESLint configuration? If not-- sounds like you are linting node_modules, which you shouldn't do.