Skip to content

Commit

Permalink
fix: content not returned anymore by add
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
dubzzz committed Jul 6, 2023
1 parent e0a5312 commit df34cb5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/util/__tests__/formatting.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ const presentConfigFileExpected = `{
`

test('falls back to JSON.stringify when the configPath cannot resolve to a config', () => {
expect(formatting.formatConfig(absentFile, content)).toBe(
expect(formatting.formatConfig(content, absentFile)).toBe(
absentConfigFileExpected,
)
})

test('uses Prettier when the configPath can resolve to a config', () => {
expect(formatting.formatConfig(presentFile, content)).toBe(
expect(formatting.formatConfig(content, presentFile)).toBe(
presentConfigFileExpected,
)
})
2 changes: 1 addition & 1 deletion src/util/formatting.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function formatConfig(configPath, content) {
function formatConfig(content, configPath) {
const stringified = JSON.stringify(content, null, 2)
try {
const prettier = require('prettier')
Expand Down

0 comments on commit df34cb5

Please sign in to comment.