-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathprettier-benchmark.js
41 lines (38 loc) · 996 Bytes
/
prettier-benchmark.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
const fs = require("fs");
const prettier = require("prettier");
const payloads = [
{
name: "preact-8.2.5.js",
options: { semi: false, useTabs: false }
},
{
name: "lodash.core-4.17.4.js",
options: { semi: true, useTabs: true }
},
{
name: "todomvc/react/app.jsx",
options: { semi: false, useTabs: true }
},
{
name: "todomvc/react/footer.jsx",
options: { jsxBracketSameLine: true, semi: true, useTabs: true }
},
{
name: "todomvc/react/todoItem.jsx",
options: { semi: false, singleQuote: true, useTabs: true }
}
].map(({ name, options }) => ({
payload: fs.readFileSync(`third_party/${name}`, "utf8"),
options
}));
module.exports = {
name: "prettier",
fn() {
return payloads.map(({ payload, options }) =>
prettier.format(payload, options)
);
}
};