GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: use Prettier to write config file, if possible by JoshuaKGoldberg · Pull Request #356 · all-contributors/cli

Conversation

@JoshuaKGoldberg

@JoshuaKGoldberg JoshuaKGoldberg commented May 25, 2023

Copy link
Copy Markdown
Contributor

What: If the user has the prettier package available in their project and has a Prettier config file (e.g. .prettierrc.json), Prettier will be used to write .allcontributorsrc files.

Why: See #347.

How: Adds prettier as an optional dependency. Augments the config writing logic to:

  1. Attempt to require('prettier')
  2. Find the nearest Prettier config for the file with prettier.resolveConfigFile.sync
  3. Use Prettier to format the file with that config
    ...falling back to the traditional JSON.stringify(content, null, 2) if any of that fails.

Checklist:

  • Documentation N/A
  • Tests
  • Ready to be merged
  • Added myself to contributors table N/A

Are optionalDependencies the way to go? I can never keep track of the latest preferences around optionals/peers/etc.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

navin-moorthy reacted with hooray emoji
All reactions
  • 🎉 1 reaction
@JoshuaKGoldberg
feat: use Prettier to write config file, if possible
de8bdd8
Berkmann18
Berkmann18 approved these changes May 28, 2023
View reviewed changes
@Berkmann18

Berkmann18 commented May 28, 2023

Copy link
Copy Markdown
Member

@all-contributors Please add @JoshuaKGoldberg for ideas and code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@allcontributors allcontributors Bot mentioned this pull request May 28, 2023
docs: add JoshuaKGoldberg as a contributor for ideas, and code #357
Merged
@allcontributors

allcontributors Bot commented May 28, 2023

Copy link
Copy Markdown
Contributor

@Berkmann18

I've put up a pull request to add @JoshuaKGoldberg! 🎉

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Berkmann18
Berkmann18 merged commit e0a5312 into all-contributors:master May 28, 2023
@all-contributors-release-bot

all-contributors-release-bot commented May 28, 2023

Copy link
Copy Markdown
Member

🎉 This PR is included in version 6.26.0 🎉

The release is available on:

  • npm package (@latest dist-tag)
  • GitHub release

Your semantic-release bot 📦🚀

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@all-contributors-release-bot all-contributors-release-bot added the released label May 28, 2023
@JoshuaKGoldberg
JoshuaKGoldberg deleted the use-prettier-if-possible branch May 29, 2023 06:18
@dubzzz

dubzzz commented Jul 6, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Not sure it's fully related (I'm still investigating) but when passing from 6.25.0 to 6.26.0 of the project the command all-contributors add username doc,code,test stopped working and fully erased the content of the file .all-contributorsrc. An easy repro is to take https://github.com/dubzzz/fast-check and run yarn contributor:add username doc,code,test on it.


UPDATE 1

No issue with version 6.25.1. Issue starts at 6.26.0.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

dubzzz
dubzzz reviewed Jul 6, 2023
View reviewed changes
Comment thread src/util/config-file.js
)
}
return pify(fs.writeFile)(configPath, `${JSON.stringify(content, null, 2)}\n`)
return pify(fs.writeFile)(configPath, `${formatConfig(content)}\n`)

@dubzzz dubzzz Jul 6, 2023

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that we pass the content as config, no?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@dubzzz dubzzz Jul 6, 2023

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we are replacing this code by JSON.stringify(undefined, null, 2)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Semsemq Semsemq Nov 27, 2023

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌷🌷

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
dubzzz added a commit to dubzzz/cli that referenced this pull request Jul 6, 2023
@dubzzz
fix: content not returned anymore by add
df34cb5
The change all-contributors#356 seem to break the formatting of the file .all-contributorsrc. Instead of formatting the content, it formats "undefined".

See:
- all-contributors#356 (comment)
- all-contributors#356 (comment)
@dubzzz dubzzz mentioned this pull request Jul 6, 2023
fix: content not returned anymore by add #361
Closed
3 of 4 tasks
This was referenced Sep 19, 2023
🐛 Bug: allcontributors isn't respecting prettier config JoshuaKGoldberg/create-typescript-app#837
Closed
Visibility into what CLI / underlying library version the app is using? all-contributors/app#479
Open
@JoshuaKGoldberg JoshuaKGoldberg mentioned this pull request Dec 11, 2023
chore: verify changes on allowedFiles according to the template JoshuaKGoldberg/create-typescript-app#1048
Merged
3 tasks done
@Mhmonicox Mhmonicox mentioned this pull request May 24, 2024
[Snyk] Upgrade all-contributors-cli from 6.20.0 to 6.26.1 Mhmonicox/app#12
Closed
@JoshuaKGoldberg JoshuaKGoldberg mentioned this pull request Dec 31, 2024
🐛 Bug: .all-contributorsrc shouldn't be ignored by Prettier JoshuaKGoldberg/create-typescript-app#1814
Closed
3 tasks done
@JoshuaKGoldberg JoshuaKGoldberg mentioned this pull request Jan 12, 2025
Repo: Use the user's formatter on written config files, not JSON.stringify JoshuaKGoldberg/TypeStat#1066
Open
@JoshuaKGoldberg JoshuaKGoldberg mentioned this pull request Apr 8, 2025
App uses an outdated version of all-contributors-cli all-contributors/app#507
Closed
@lwasser lwasser mentioned this pull request Mar 6, 2026
chore(main): release all-contributors-cli 7.0.0 #476
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Berkmann18 Berkmann18 Berkmann18 approved these changes
+2 more reviewers
@dubzzz dubzzz dubzzz left review comments
@Semsemq Semsemq Semsemq left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@JoshuaKGoldberg @Berkmann18 @all-contributors-release-bot @dubzzz @Semsemq
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.