From faf04e005c6707276387650d2e6aaabb6d5c82f7 Mon Sep 17 00:00:00 2001 From: Florent Cailhol Date: Tue, 29 May 2018 16:14:16 +0200 Subject: [PATCH] Update prettier to v1.13 --- declarations.d.ts | 12 ++++++++++-- lib/ProgressPlugin.js | 4 ++-- lib/SourceMapDevToolPlugin.js | 4 ++-- package.json | 2 +- test/BenchmarkTestCases.benchmark.js | 6 +++--- test/Compiler-caching.test.js | 12 ++++++------ yarn.lock | 6 +++--- 7 files changed, 27 insertions(+), 19 deletions(-) diff --git a/declarations.d.ts b/declarations.d.ts index bd6471594..af1065ef3 100644 --- a/declarations.d.ts +++ b/declarations.d.ts @@ -83,7 +83,12 @@ declare module "@webassemblyjs/ast" { export class IndexInFuncSection extends Node {} export function indexLiteral(index: number): IndexLiteral; export function numberLiteralFromRaw(num: number): NumberLiteral; - export function floatLiteral(value: number, nan?: boolean, inf?: boolean, raw?: string): FloatLiteral; + export function floatLiteral( + value: number, + nan?: boolean, + inf?: boolean, + raw?: string + ): FloatLiteral; export function global(globalType: string, nodes: Node[]): Global; export function identifier(indentifier: string): Identifier; export function funcParam(valType: string, id: Identifier): FuncParam; @@ -96,7 +101,10 @@ declare module "@webassemblyjs/ast" { ): ObjectInstruction; export function signature(params: FuncParam[], results: string[]): Signature; export function func(initFuncId, Signature, funcBody): Func; - export function typeInstruction(id: Identifier, functype: Signature): TypeInstruction; + export function typeInstruction( + id: Identifier, + functype: Signature + ): TypeInstruction; export function indexInFuncSection(index: IndexLiteral): IndexInFuncSection; export function moduleExport( identifier: string, diff --git a/lib/ProgressPlugin.js b/lib/ProgressPlugin.js index 137bb492e..d62c18a72 100644 --- a/lib/ProgressPlugin.js +++ b/lib/ProgressPlugin.js @@ -101,7 +101,7 @@ class ProgressPlugin { const update = module => { handler( - 0.1 + doneModules / Math.max(lastModulesCount, moduleCount) * 0.6, + 0.1 + (doneModules / Math.max(lastModulesCount, moduleCount)) * 0.6, "building modules", `${doneModules}/${moduleCount} modules`, `${activeModules.length} active`, @@ -187,7 +187,7 @@ class ProgressPlugin { const numberOfHooks = Object.keys(hooks).length; Object.keys(hooks).forEach((name, idx) => { const title = hooks[name]; - const percentage = idx / numberOfHooks * 0.25 + 0.7; + const percentage = (idx / numberOfHooks) * 0.25 + 0.7; compilation.hooks[name].intercept({ name: "ProgressPlugin", context: true, diff --git a/lib/SourceMapDevToolPlugin.js b/lib/SourceMapDevToolPlugin.js index cb6e8b271..cbcd5997b 100644 --- a/lib/SourceMapDevToolPlugin.js +++ b/lib/SourceMapDevToolPlugin.js @@ -121,7 +121,7 @@ class SourceMapDevToolPlugin { const tasks = []; files.forEach(({ file, chunk }, idx) => { reportProgress( - 0.5 * idx / files.length, + (0.5 * idx) / files.length, file, "generate SourceMap" ); @@ -205,7 +205,7 @@ class SourceMapDevToolPlugin { } tasks.forEach((task, index) => { reportProgress( - 0.5 + 0.5 * index / tasks.length, + 0.5 + (0.5 * index) / tasks.length, task.file, "attach SourceMap" ); diff --git a/package.json b/package.json index cef372826..b72878508 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "less": "^2.5.1", "less-loader": "^4.0.3", "lodash": "^4.17.4", - "prettier": "^1.11.1", + "prettier": "^1.13.2", "pug": "^2.0.3", "pug-loader": "^2.4.0", "raw-loader": "~0.5.0", diff --git a/test/BenchmarkTestCases.benchmark.js b/test/BenchmarkTestCases.benchmark.js index e48634548..5ed590548 100644 --- a/test/BenchmarkTestCases.benchmark.js +++ b/test/BenchmarkTestCases.benchmark.js @@ -254,8 +254,8 @@ describe("BenchmarkTestCases", function() { const n = stats.sample.length; const nSqrt = Math.sqrt(n); const z = tDistribution(n - 1); - stats.minConfidence = stats.mean - z * stats.deviation / nSqrt; - stats.maxConfidence = stats.mean + z * stats.deviation / nSqrt; + stats.minConfidence = stats.mean - (z * stats.deviation) / nSqrt; + stats.maxConfidence = stats.mean + (z * stats.deviation) / nSqrt; stats.text = `${Math.round(stats.mean * 1000)}ms ± ${Math.round( stats.deviation * 1000 )}ms [${Math.round(stats.minConfidence * 1000)}ms; ${Math.round( @@ -352,7 +352,7 @@ describe("BenchmarkTestCases", function() { ) { console.log( `======> HEAD is ${Math.round( - baselineStats.mean / headStats.mean * 100 - 100 + (baselineStats.mean / headStats.mean) * 100 - 100 )}% faster than ${baseline.name} (90% confidence)!` ); } diff --git a/test/Compiler-caching.test.js b/test/Compiler-caching.test.js index 28bdafb02..5c7ba0e8e 100644 --- a/test/Compiler-caching.test.js +++ b/test/Compiler-caching.test.js @@ -109,12 +109,12 @@ describe("Compiler (caching)", () => { // Copy over file since we"ll be modifying some of them fs.mkdirSync(fixturePath); - fs - .createReadStream(path.join(__dirname, "fixtures", "a.js")) - .pipe(fs.createWriteStream(aFilepath)); - fs - .createReadStream(path.join(__dirname, "fixtures", "c.js")) - .pipe(fs.createWriteStream(cFilepath)); + fs.createReadStream(path.join(__dirname, "fixtures", "a.js")).pipe( + fs.createWriteStream(aFilepath) + ); + fs.createReadStream(path.join(__dirname, "fixtures", "c.js")).pipe( + fs.createWriteStream(cFilepath) + ); fixtureCount++; return { diff --git a/yarn.lock b/yarn.lock index 6c0f32e90..ee6ca3e80 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4703,9 +4703,9 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" -prettier@^1.11.1: - version "1.12.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.12.1.tgz#c1ad20e803e7749faf905a409d2367e06bbe7325" +prettier@^1.13.2: + version "1.13.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.2.tgz#412b87bc561cb11074d2877a33a38f78c2303cda" pretty-format@^23.0.0-charlie.3: version "23.0.0-charlie.3"