1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Update Prettier to version 2.0

Please note that these changes were done automatically, using `gulp lint --fix`.

Given that the major version number was increased, there's a fair number of (primarily whitespace) changes; please see https://prettier.io/blog/2020/03/21/2.0.0.html
In order to reduce the size of these changes somewhat, this patch maintains the old "arrowParens" style for now (once mozilla-central updates Prettier we can simply choose the same formatting, assuming it will differ here).
This commit is contained in:
Jonas Jenwald 2020-04-14 12:28:14 +02:00
parent a4dd081d7b
commit 426945b480
145 changed files with 2005 additions and 2009 deletions

View file

@ -34,10 +34,7 @@ var fs = require("fs"),
*/
function preprocess(inFilename, outFilename, defines) {
// TODO make this really read line by line.
var lines = fs
.readFileSync(inFilename)
.toString()
.split("\n");
var lines = fs.readFileSync(inFilename).toString().split("\n");
var totalLines = lines.length;
var out = "";
var i = 0;
@ -50,7 +47,7 @@ function preprocess(inFilename, outFilename, defines) {
var writeLine =
typeof outFilename === "function"
? outFilename
: function(line) {
: function (line) {
out += line + "\n";
};
function evaluateCondition(code) {
@ -95,7 +92,7 @@ function preprocess(inFilename, outFilename, defines) {
}
}
function expand(line) {
line = line.replace(/__[\w]+__/g, function(variable) {
line = line.replace(/__[\w]+__/g, function (variable) {
variable = variable.substring(2, variable.length - 2);
if (variable in defines) {
return defines[variable];
@ -122,7 +119,7 @@ function preprocess(inFilename, outFilename, defines) {
var stack = [];
var control = /^(?:\/\/|<!--)\s*#(if|elif|else|endif|expand|include|error)\b(?:\s+(.*?)(?:-->)?$)?/;
var lineNumber = 0;
var loc = function() {
var loc = function () {
return fs.realpathSync(inFilename) + ":" + lineNumber;
};
while ((line = readLine()) !== null) {
@ -215,7 +212,7 @@ function preprocessCSS(mode, source, destination) {
}
function expandImports(content, baseUrl) {
return content.replace(/^\s*@import\s+url\(([^\)]+)\);\s*$/gm, function(
return content.replace(/^\s*@import\s+url\(([^\)]+)\);\s*$/gm, function (
all,
url
) {