Update prettier to v2 (#11579)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This commit is contained in:
@@ -187,9 +187,7 @@ runner
|
||||
"The following Features are not currently mapped or ignored:"
|
||||
);
|
||||
console.log(
|
||||
Array.from(unmappedFeatures)
|
||||
.join("\n")
|
||||
.replace(/^/gm, " ")
|
||||
Array.from(unmappedFeatures).join("\n").replace(/^/gm, " ")
|
||||
);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -121,7 +121,7 @@ class TestRunner {
|
||||
count: results.length,
|
||||
};
|
||||
|
||||
results.forEach(function(result) {
|
||||
results.forEach(function (result) {
|
||||
let classification, isAllowed;
|
||||
const inWhitelist = whitelist.has(result.id);
|
||||
whitelist.delete(result.id);
|
||||
@@ -200,7 +200,7 @@ class TestRunner {
|
||||
tests: summary.unrecognized,
|
||||
label: "non-existent programs specified in the whitelist file",
|
||||
},
|
||||
].forEach(function({ tests, label }) {
|
||||
].forEach(function ({ tests, label }) {
|
||||
if (!tests.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ const path = require("path");
|
||||
const fs = require("fs");
|
||||
const dirname = path.join(__dirname, "..");
|
||||
|
||||
module.exports = function() {
|
||||
module.exports = function () {
|
||||
return {
|
||||
name: "babel-source",
|
||||
load(id) {
|
||||
|
||||
@@ -1,11 +1,22 @@
|
||||
"use strict";
|
||||
const prettier = require("prettier");
|
||||
|
||||
module.exports = function formatCode(code, filename) {
|
||||
filename = filename || __filename;
|
||||
const prettierConfig = prettier.resolveConfig.sync(filename);
|
||||
prettierConfig.filepath = filename;
|
||||
prettierConfig.parser = "babel";
|
||||
// TODO: Remove this `if` in Babel 8
|
||||
// Prettier only supports Node.js 10+, so we can fallback to not formatting
|
||||
// o CI on older Node.js versions
|
||||
|
||||
return prettier.format(code, prettierConfig);
|
||||
};
|
||||
if (process.env.CI && parseInt(process.versions.node, 10) < 10) {
|
||||
module.exports = function formatCode(code) {
|
||||
return code;
|
||||
};
|
||||
} else {
|
||||
const prettier = require("prettier");
|
||||
|
||||
module.exports = function formatCode(code, filename) {
|
||||
filename = filename || __filename;
|
||||
const prettierConfig = prettier.resolveConfig.sync(filename);
|
||||
prettierConfig.filepath = filename;
|
||||
prettierConfig.parser = "babel";
|
||||
|
||||
return prettier.format(code, prettierConfig);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user