diff --git a/README.md b/README.md index d246d72e..78c8ddbe 100644 --- a/README.md +++ b/README.md @@ -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)) @@ -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)) @@ -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? + diff --git a/cli.js b/cli.js index cc00411a..cca7c13b 100755 --- a/cli.js +++ b/cli.js @@ -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) diff --git a/tests/cli.js b/tests/cli.js index 1ff477f8..c2f62c8b 100644 --- a/tests/cli.js +++ b/tests/cli.js @@ -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 = {