Skip to content

Commit 8e0bda8

Browse files
committed
Sort keys without flat option in default
1 parent 7260b69 commit 8e0bda8

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

cli.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const cli = meow(
1515
-f, --format json | yaml [default: json]
1616
-d, --default-locale default locale
1717
--flat json [default: true] | yaml [default: false]
18-
--sort-when-not-flat keys are sorted even when flat option is false [default: false]
1918
2019
Example
2120
$ extract-messages --locales=ja,en --output app/translations 'app/**/*.js'
@@ -26,9 +25,6 @@ const cli = meow(
2625
flat: {
2726
type: 'boolean'
2827
},
29-
'sort-when-not-flat': {
30-
type: 'boolean'
31-
},
3228
output: {
3329
type: 'string',
3430
alias: 'o'

src/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ type Opts = {
6161
defaultLocale: string
6262
format?: string
6363
flat?: boolean
64-
sortWhenNotFlat?: boolean
6564
[key: string]: unknown
6665
}
6766

@@ -73,7 +72,6 @@ const extractMessage = async (
7372
{
7473
format = 'json',
7574
flat = isJson(format),
76-
sortWhenNotFlat = false,
7775
defaultLocale = 'en',
7876
...opts
7977
}: Opts = {
@@ -123,9 +121,7 @@ const extractMessage = async (
123121

124122
const fomattedLocaleMap: object = flat
125123
? sortKeys(localeMap, { deep: true })
126-
: sortWhenNotFlat
127-
? sortKeys(unflatten(localeMap, { object: true }), { deep: true })
128-
: unflatten(sortKeys(localeMap), { object: true })
124+
: sortKeys(unflatten(localeMap, { object: true }), { deep: true })
129125

130126
const fn = isJson(format) ? writeJson : writeYaml
131127

0 commit comments

Comments
 (0)