Skip to content

Commit

Permalink
chore(compass-editor): default user facing prettier to have no traili…
Browse files Browse the repository at this point in the history
…ngComma (#5483)
  • Loading branch information
Anemy authored Apr 5, 2024
1 parent d4a5084 commit 90e0590
Show file tree
Hide file tree
Showing 13 changed files with 120 additions and 130 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('PipelineBuilder', function () {
expect(pipelineBuilder.stages.length).to.equal(1);
const stage = pipelineBuilder.stages[0];
expect(stage.operator).to.equal('$match');
expect(stage.value).to.equal('{\n name: /berlin/i,\n}');
expect(stage.value).to.equal('{\n name: /berlin/i\n}');
expect(stage.disabled).to.equal(false);
expect(stage.syntaxError).to.be.null;
});
Expand Down Expand Up @@ -215,15 +215,15 @@ describe('PipelineBuilder', function () {
expect(pipelineBuilder.source).to.eq(`[
{
$match: {
_id: 1,
},
_id: 1
}
},
{
$limit: 10,
$limit: 10
},
{
$out: "test-out",
},
$out: "test-out"
}
]`);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const pipelines = [
input: `[{$unwind: "users"}]`,
output: `[
{
$unwind: "users",
},
$unwind: "users"
}
]`,
pipeline: [
{
Expand All @@ -25,10 +25,10 @@ const pipelines = [
input: `[\n//{$unwind: "users"},\n // {$limit: 20}\n]`,
output: `[
// {
// $unwind: "users",
// $unwind: "users"
// }
// {
// $limit: 20,
// $limit: 20
// }
]`,
pipeline: [
Expand All @@ -51,16 +51,16 @@ const pipelines = [
input: `[{$unwind: "users"},\n // {$limit: 20},\n {$sort: {name: -1}}\n// trailing comment\n]`,
output: `[
{
$unwind: "users",
$unwind: "users"
},
// {
// $limit: 20,
// $limit: 20
// }
{
$sort: {
name: -1,
},
},
name: -1
}
}
// trailing comment
]`,
pipeline: [
Expand Down Expand Up @@ -91,15 +91,15 @@ const pipelines = [
input: `[{$unwind: "users"},{$limit: 20},\n// {$sort: {name: -1}}\n]`,
output: `[
{
$unwind: "users",
$unwind: "users"
},
{
$limit: 20,
},
$limit: 20
}
// {
// $sort: {
// name: -1,
// },
// name: -1
// }
// }
]`,
pipeline: [
Expand Down Expand Up @@ -130,14 +130,14 @@ const pipelines = [
input: `[// {$match: {}}\n // {$unwind: "users"}, \n {$limit: 20}\n]`,
output: `[
// {
// $match: {},
// $match: {}
// }
// {
// $unwind: "users",
// $unwind: "users"
// }
{
$limit: 20,
},
$limit: 20
}
]`,
pipeline: [
{
Expand Down Expand Up @@ -175,77 +175,77 @@ const pipelines = [
// {
// $match: {
// name: {
// $in: [/ber/i, /bas/i],
// $in: [/ber/i, /bas/i]
// },
// bathrooms: {
// $gte: 2,
// },
// },
// $gte: 2
// }
// }
// },
// {
// where: {
// name: 'berlin',
// },
// name: 'berlin'
// }
// }
{
$project: {
_id: 1,
name: 1,
bathrooms: 1,
},
bathrooms: 1
}
},
// Another comment
{
// Fixed the bug
$sort: {
bathrooms: -1,
},
bathrooms: -1
}
},
{
$skip: 1,
$skip: 1
},
{
// This should not go away!
$limit: 8,
},
$limit: 8
}
]`,
output: `[
// {
// $match: {
// name: {
// $in: [/ber/i, /bas/i],
// $in: [/ber/i, /bas/i]
// },
// bathrooms: {
// $gte: 2,
// },
// },
// $gte: 2
// }
// }
// }
// {
// where: {
// name: 'berlin',
// },
// name: 'berlin'
// }
// }
{
$project: {
_id: 1,
name: 1,
bathrooms: 1,
},
bathrooms: 1
}
},
// Another comment
{
// Fixed the bug
$sort: {
bathrooms: -1,
},
bathrooms: -1
}
},
{
$skip: 1,
$skip: 1
},
{
// This should not go away!
$limit: 8,
},
$limit: 8
}
]`,
pipeline: [
{
Expand Down Expand Up @@ -340,12 +340,12 @@ const pipelines = [
// {
// $match: {
// name: {
// $in: [/ber/i, /bas/i],
// $in: [/ber/i, /bas/i]
// },
// bathrooms: {
// $gte: 2,
// },
// },
// $gte: 2
// }
// }
// }
// {
// where: {
Expand All @@ -356,23 +356,23 @@ const pipelines = [
// $project: {
// _id: 1,
// name: 1,
// bathrooms: 1,
// },
// bathrooms: 1
// }
// }
// Another comment
{
// Fixed the bug
$sort: {
bathrooms: -1,
},
bathrooms: -1
}
},
{
$skip: 1,
$skip: 1
},
{
// This should not go away!
$limit: 8,
},
$limit: 8
}
]`,
pipeline: [
{
Expand Down Expand Up @@ -514,15 +514,15 @@ describe('PipelineParser', function () {
expect(newPipeline).to.equal(`[
// {
// $match: {
// name: /berlin/i,
// },
// name: /berlin/i
// }
// }
// {
// $unwind: "users",
// $unwind: "users"
// }
{
$limit: 20,
},
$limit: 20
}
]`);
});
it('stage with leading comments', function () {
Expand All @@ -542,12 +542,12 @@ describe('PipelineParser', function () {
// Some comment that should be preserved.
// {
// $match: {
// name: /berlin/i,
// },
// name: /berlin/i
// }
// }
{
$skip: 10,
},
$skip: 10
}
]`);
});
it('stage with trailing comments', function () {
Expand All @@ -568,15 +568,15 @@ describe('PipelineParser', function () {
expect(newPipeline).to.equal(`[
// {
// $match: {
// name: /berlin/i,
// },
// name: /berlin/i
// }
// }
// Some comment that should be preserved.
// Followed by something.
// Followed by something else.
{
$skip: 10,
},
$skip: 10
}
]`);
});
it('stage with leading and trailing comments', function () {
Expand All @@ -598,14 +598,14 @@ describe('PipelineParser', function () {
// Some comment that should be preserved.
// {
// $match: {
// name: /berlin/i,
// },
// name: /berlin/i
// }
// }
// Followed by something.
// Followed by something else.
{
$skip: 10,
},
$skip: 10
}
]`);
});
it('stages with leading and trailing comments', function () {
Expand All @@ -628,17 +628,17 @@ describe('PipelineParser', function () {
// Some comment that should be preserved.
// {
// $match: {
// name: /berlin/i,
// },
// name: /berlin/i
// }
// }
// Followed by something.
// {
// $limit: 20,
// $limit: 20
// }
// Followed by something else.
{
$skip: 10,
},
$skip: 10
}
]`);
});
});
Expand Down
Loading

0 comments on commit 90e0590

Please sign in to comment.