prettier-eslint-cli icon indicating copy to clipboard operation
prettier-eslint-cli copied to clipboard

fix: should match dots

Open u3u opened this issue 6 years ago • 5 comments

I hope it can format and repair all matching files in my project, but I found that it did not format my configuration file (eg: .eslintrc.js, .postcssrc.js, etc.)

"format": "prettier-eslint \"**/*.{js,json,vue,md}\" --write"

https://github.com/isaacs/node-glob#dots

u3u avatar May 09 '18 09:05 u3u

Codecov Report

Merging #132 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #132   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           3      3           
  Lines         123    123           
  Branches       16     16           
=====================================
  Hits          123    123
Impacted Files Coverage Δ
src/format-files.js 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c8c077b...dfb776d. Read the comment docs.

codecov-io avatar May 09 '18 11:05 codecov-io

@kentcdodds @zimme Any chance we could get this merged? Or at least give us the option to control the dot option of glob? It would be nice to also get files starting with a dot prettified :)

Oligrand avatar Aug 15 '19 11:08 Oligrand

@u3u feel free to resolve merge conflicts

@Oligrand feel free to open a new PR with the same fixes here if above doesn't happen fast enough for you!

kylemh avatar Mar 06 '21 22:03 kylemh

Stale pull request

github-actions[bot] avatar May 06 '21 00:05 github-actions[bot]

Dot files are excluded by ESLint and prettier by default AFAIK, maybe this new feature should be behind a flag?

Or maybe we should respect .eslintignore and .prettierignore instead.

JounQin avatar Jul 31 '22 15:07 JounQin

I think this should be implemented under a flag, can false by default same as ESLint and prettier.

JounQin avatar Aug 25 '22 08:08 JounQin

🦋 Changeset detected

Latest commit: 64155551c7ef0edc156413a1fae87e79c256ffd3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
prettier-eslint-cli Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Aug 25 '22 08:08 changeset-bot[bot]

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

codesandbox-ci[bot] avatar Aug 25 '22 08:08 codesandbox-ci[bot]

I think a includeDotFiles flag is good; however, you touched on a good point with the ignore files. If we WERE to respect those, how would we do it?

I can see at least 2 ways:

  1. Use each ignore file for their respective runner. So, if ONLY a prettier ignore file exists, the eslint portion of our task will complete as expected and only the prettier portion would adhere to the ignore file.
  2. We merge the ignore files and avoid those files for our entire runner.

kylemh avatar Aug 25 '22 10:08 kylemh

Use each ignore file for their respective runner.

I review the source codes we're using this approach now: https://github.com/prettier/prettier-eslint-cli/blob/master/src/format-files.js#L206-L236

So we'll only need to support a includeDotFiles flag.

JounQin avatar Aug 25 '22 11:08 JounQin

TODO: document

JounQin avatar Aug 25 '22 12:08 JounQin

Codecov Report

Merging #132 (6d16127) into master (625a7fe) will not change coverage. The diff coverage is 100.00%.

:exclamation: Current head 6d16127 differs from pull request most recent head 6415555. Consider uploading reports for the commit 6415555 to get more accurate results

@@            Coverage Diff            @@
##            master      #132   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines          166       167    +1     
  Branches        29        29           
=========================================
+ Hits           166       167    +1     
Impacted Files Coverage Δ
src/format-files.js 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Aug 25 '22 13:08 codecov-commenter