Closed aspiers closed 4 years ago
Personally, I would try to remove the need for this hack in some other way, maybe by relaxing lint rules or changing the code style. (At my day job, we've been using eslint-config-prettier). Running eslint --fix
after every change is going to slow things down no matter how much you optimize it.
That said, I'm happy to accept a PR that adds support for this as long as it's in line with this package's philosophy, which means:
I'm afraid this would likely rule out using eslint_d.js
:
prettier-eslint
seems like a better option, and could maybe be changed to suit, but couldn't be used in its current form because currently:
I think the cleanest solution would be the following:
prettier-eslint
, or create a new packages (either from scratch or based on prettier-eslint
), so that it has an API identical to Prettier's [†]'(that-package prettier)
.The advantages of this approach are:
[†] Except that it might support additional configuration options. Also, from this package's perspective, currently only the following two API methods would have to be implemented: formatWithCursor
, resolveConfig.sync
.
Thanks a lot for the very detailed and carefully considered response! I agree with everything you've written. I'm not 100% convinced that prettier-eslint
's current design is great - it seems like a workaround for the fact that two tools are disagreeing over style and consequently fighting over how the same file should look. eslint-config-prettier
does sound like a less conflicted approach.
I won't have time to do any more on this right now, but maybe I'll be able to return to it in a while.
Sounds like this is unlikely to happen, which is fine by me. I'm closing this for now.
Sometimes
prettier
disagrees witheslint --fix
. One solution to this is https://github.com/prettier/prettier-eslint which runseslint --fix
after everyprettier
invocation. It would be great if this mode could support that. It would probably require use of https://github.com/mantoni/eslint_d.js, maybe by integrating with https://github.com/aaronjensen/eslintd-fix or at least using a very similar approach.