Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(parsers): use const for vars data and sort #4202

Merged
merged 3 commits into from
Mar 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .yarn/versions/768814ed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
releases:
"@yarnpkg/parsers": patch

declined:
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-nm"
- "@yarnpkg/plugin-version"
- "@yarnpkg/cli"
- "@yarnpkg/core"
- "@yarnpkg/sdks"
- "@yarnpkg/shell"
13 changes: 3 additions & 10 deletions packages/yarnpkg-parsers/sources/syml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,9 @@ function stringifyValue(value: any, indentLevel: number, newLineIfObject: boolea
}

if (typeof value === `object` && value) {
let data: any;
let sort: boolean;

if (value instanceof PreserveOrdering) {
data = value.data;
sort = false;
} else {
data = value;
sort = true;
}
const [data, sort] = value instanceof PreserveOrdering
? [value.data, false]
: [value, true];

const indent = ` `.repeat(indentLevel);

Expand Down