Skip to content

Commit

Permalink
refactor: remove extra changes to improve diff
Browse files Browse the repository at this point in the history
  • Loading branch information
aarondill committed Jan 30, 2023
1 parent 5bc8c51 commit ea61369
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ If an array, sort keys in ordering of `options.sortOrder`.
```js
const sorted = sortPackageJson(packageJsonObject, {
sortOrder: ['version'],
sortOrder: ['version']
})

console.log(Object.keys(sorted))
Expand All @@ -186,7 +186,7 @@ If a function, sort fields by [Array#sort(options.sortOrder)](https://developer.
const sorted = sortPackageJson(packageJsonObject, {
sortOrder(left, right) {
return left.localeCompare(right)
},
}
})

console.log(Object.keys(sorted))
Expand Down Expand Up @@ -268,3 +268,4 @@ A lot of people who ask for configuration cite the use case that they simply don
### What?! Why would you want to do this?!
Well, it's nice to have the keys of a package.json in a well sorted order. Almost everyone would agree having "name" at the top of a package.json is sensible (rather than sorted alphabetically or somewhere silly like the bottom), so why not the rest of the package.json?
2 changes: 1 addition & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import fs from 'node:fs'
import sortPackageJson from './index.js'

const isCheckFlag = (argument) => argument === '--check' || argument === '-c'
const isQuietFlag = (argument) => argument === '--quiet' || argument === '-q'
const isHelpFlag = (argument) => argument === '--help' || argument === '-h'
const isVersionFlag = (argument) =>
argument === '--version' || argument === '-v'
const isQuietFlag = (argument) => argument === '--quiet' || argument === '-q'

const cliArguments = process.argv.slice(2)
const isCheck = cliArguments.some(isCheckFlag)
Expand Down
2 changes: 1 addition & 1 deletion tests/cli.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava'
import fs from 'node:fs'
import test from 'ava'
import { cliScript, macro } from './_helpers.js'

const badJson = {
Expand Down

0 comments on commit ea61369

Please sign in to comment.