mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
[sort-package-json] always ensure 2-space indent is used
This commit is contained in:
parent
d35296ea3b
commit
72bd23b740
1 changed files with 29 additions and 25 deletions
|
@ -13,29 +13,33 @@ import sorter from 'sort-package-json';
|
|||
* @returns
|
||||
*/
|
||||
export function sortPackageJson(json) {
|
||||
return sorter(typeof json === 'string' ? json : JSON.stringify(json, null, 2), {
|
||||
// top level keys in the order they were written when this was implemented
|
||||
sortOrder: [
|
||||
'name',
|
||||
'description',
|
||||
'keywords',
|
||||
'private',
|
||||
'version',
|
||||
'branch',
|
||||
'main',
|
||||
'browser',
|
||||
'types',
|
||||
'tsdocMetadata',
|
||||
'build',
|
||||
'homepage',
|
||||
'bugs',
|
||||
'license',
|
||||
'kibana',
|
||||
'author',
|
||||
'scripts',
|
||||
'repository',
|
||||
'engines',
|
||||
'resolutions',
|
||||
],
|
||||
});
|
||||
return sorter(
|
||||
// always parse and stringify the json to make sure it's using 2 space indentation
|
||||
JSON.stringify(typeof json === 'string' ? JSON.parse(json) : json, null, 2),
|
||||
{
|
||||
// top level keys in the order they were written when this was implemented
|
||||
sortOrder: [
|
||||
'name',
|
||||
'description',
|
||||
'keywords',
|
||||
'private',
|
||||
'version',
|
||||
'branch',
|
||||
'main',
|
||||
'browser',
|
||||
'types',
|
||||
'tsdocMetadata',
|
||||
'build',
|
||||
'homepage',
|
||||
'bugs',
|
||||
'license',
|
||||
'kibana',
|
||||
'author',
|
||||
'scripts',
|
||||
'repository',
|
||||
'engines',
|
||||
'resolutions',
|
||||
],
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue