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

--list-different does not work when use --write, using prettier+prettier-eslint+prettier-eslint-cli #93

Closed
dzhytomyrsky opened this issue Jun 10, 2017 · 3 comments

Comments

@dzhytomyrsky
Copy link

I wrote such npm script in my package.json:

"format-js": "prettier-eslint --print-width 100 --list-different --write 'webpack/**/*.js' 'development/**/*.js'"

it formats my js, but does not print prettified files. Is it possible to use --list-different with --write?

If not, it would be great to))

@kentcdodds
Copy link
Member

I'm not sure whether it's possible. I don't use that feature. Could you describe your use case?

@yannickschuchmann
Copy link

Hey, @kentcdodds,
When running prettier --list-different --write it formats all files and prints all paths of prettified files.

Unfortunately prettier-eslint behaves differently.

> prettier-eslint --list-different --write "./src/**/*.js"
success formatting 28 files with prettier-eslint
14 files were unchanged

A use case would be integrating the formatting to lintstaged.
E.g.:

"lint-staged": {
    "*.{js}": ["prettier-eslint --list-different --write \"./src/**/*.js\"", "git add"]
}

Here lintstaged is expecting a list of pathnames to pass it along to git add after formatting.

Well, I'm aware that this is not a very common use case because modifying files on precommit hook could be a dangerous thing.
But anyways, I thought that prettier-eslint tries to provide a similar API compared to prettier. Or am I wrong? :)

I believe there are at least two options:
a) printing pathnames like I mentioned above
b) telling the user that combining --list-different & --write is not supported (yet).

What do you think?

@github-actions
Copy link
Contributor

Stale issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants