pretty-quick icon indicating copy to clipboard operation
pretty-quick copied to clipboard

Prettier-eslint support

Open eramdam opened this issue 7 years ago • 6 comments
trafficstars

Would it be possible to integrate support prettier-eslint? Or at least have some pointers to know what it would take to make a PR to support it 😊

eramdam avatar Feb 27 '18 02:02 eramdam

prettier-eslint has a lot of extra configurability that I don't think the minimal API that this module uses can support. https://github.com/prettier/prettier-eslint#options

I'd be interested to hear a proposal for a way we could make it work with no extra config!

azz avatar Mar 04 '18 01:03 azz

Ideally it would just invoke the format method of prettier-eslint with the default options, leaving the configuration up to the user's .eslintrc file. From what I can see in the doc of prettier-eslint, by default it will find the proper eslint/prettier configuration files for the given files so I feel like you would not have to pass a lot of options?

https://github.com/prettier/prettier-eslint#eslintpath-string https://github.com/prettier/prettier-eslint#prettierpath-string

eramdam avatar Mar 04 '18 05:03 eramdam

I guess no progress was made on this as of yet?

rfgamaral avatar Jul 01 '19 15:07 rfgamaral

Lack of prettier-eslint support is currently my blocker for using pretty-quick. Just invoking with defaults and handling configuration externally, would be absolutely fine and shouldn't be too disruptive. Would you consider a PR if there were no other externally visible changes to pretty-quick aside from an option to use prettier-eslint instead of plain prettier?

pmcnr-hx avatar Aug 16 '19 08:08 pmcnr-hx

You can achieve similar functionality using just prettier-eslint module. You need lint-staged module and use this configuration:

"lint-staged": {
    "app/**/*.{js,jsx}": [
      "eslint --fix",
      "prettier-eslint --config .prettierrc.json --write",
      "git add"
    ]
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  }

shahankit avatar Sep 10 '19 08:09 shahankit

I use the following yaml config with lint-staged in order to work with prettier-eslint:

"app/**/*.{js,jsx}":
  - yarn --cwd ./app prettier-eslint '$@' --write --prettier-last

In order for the above to work, I use the following command to run lint-staged:

npx lint-staged --shell /bin/sh

smac89 avatar Dec 27 '21 06:12 smac89

It will be done in https://github.com/prettier-eslint/prettier-plugin

JounQin avatar Jan 16 '24 10:01 JounQin