Skip to content

Commit

Permalink
Update prettier to latest version (#10838)
Browse files Browse the repository at this point in the history
* Update prettier

* News entry

* Revert changes
  • Loading branch information
DonJayamanne authored Mar 31, 2020
1 parent c10a89d commit 61b179b
Show file tree
Hide file tree
Showing 751 changed files with 43,037 additions and 43,023 deletions.
1 change: 1 addition & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module.exports = {
singleQuote: true,
printWidth: 120,
tabWidth: 4,
trailingComma: 'none',
overrides: [
{
files: ['*.yml', '*.yaml'],
Expand Down
8 changes: 4 additions & 4 deletions build/ci/performance/checkPerformanceResults.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ fs.readFile(performanceResultsFile, 'utf8', (performanceResultsFileError, perfor
const benchmarkJson = JSON.parse(benchmark);
const performanceJson = JSON.parse(performanceData);

performanceJson.forEach(result => {
const cleanTimes = result.times.filter(x => x !== -1);
performanceJson.forEach((result) => {
const cleanTimes = result.times.filter((x) => x !== -1);
const avg =
cleanTimes.length === 0
? 999
: cleanTimes.reduce((a, b) => parseFloat(a) + parseFloat(b)) / cleanTimes.length;
const testcase = benchmarkJson.find(x => x.name === result.name);
const testcase = benchmarkJson.find((x) => x.name === result.name);

// compare the average result to the base JSON
if (testcase && testcase.time !== -1 && avg > parseFloat(testcase.time) + errorMargin) {
Expand All @@ -46,7 +46,7 @@ fs.readFile(performanceResultsFile, 'utf8', (performanceResultsFileError, perfor
});

// Delete performance-results.json
fs.unlink(performanceResultsFile, deleteError => {
fs.unlink(performanceResultsFile, (deleteError) => {
if (deleteError) {
if (failedTests.length > 0) {
console.log(failedTests);
Expand Down
4 changes: 2 additions & 2 deletions build/ci/performance/createNewPerformanceBenchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fs.readFile(xmlFile, 'utf8', (xmlReadError, xmlData) => {
};
const jsonObj = fastXmlParser.parse(xmlData, defaultOptions);

jsonObj.testsuite.testcase.forEach(testcase => {
jsonObj.testsuite.testcase.forEach((testcase) => {
const test = {
name: testcase.classname + ' ' + testcase.name,
time: testcase.failure || testcase.skipped === '' ? -1 : parseFloat(testcase.time)
Expand All @@ -33,7 +33,7 @@ fs.readFile(xmlFile, 'utf8', (xmlReadError, xmlData) => {
fs.writeFile(
path.join(constants.ExtensionRootDir, 'build', 'ci', 'performance', 'DS_test_benchmark.json'),
JSON.stringify(performanceData, null, 2),
writeResultsError => {
(writeResultsError) => {
if (writeResultsError) {
throw writeResultsError;
}
Expand Down
8 changes: 4 additions & 4 deletions build/ci/performance/savePerformanceResults.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fs.readFile(xmlFile, 'utf8', (xmlReadError, xmlData) => {
fs.readFile(jsonFile, 'utf8', (jsonReadError, data) => {
if (jsonReadError) {
// File doesn't exist, so we create it
jsonObj.testsuite.testcase.forEach(testcase => {
jsonObj.testsuite.testcase.forEach((testcase) => {
const test = {
name: testcase.classname + ' ' + testcase.name,
times: [testcase.failure || testcase.skipped === '' ? -1 : parseFloat(testcase.time)]
Expand All @@ -36,8 +36,8 @@ fs.readFile(xmlFile, 'utf8', (xmlReadError, xmlData) => {
} else {
performanceData = JSON.parse(data);

jsonObj.testsuite.testcase.forEach(testcase => {
let test = performanceData.find(x => x.name === testcase.classname + ' ' + testcase.name);
jsonObj.testsuite.testcase.forEach((testcase) => {
let test = performanceData.find((x) => x.name === testcase.classname + ' ' + testcase.name);
let time = testcase.failure || testcase.skipped === '' ? -1 : parseFloat(testcase.time);

if (test) {
Expand All @@ -58,7 +58,7 @@ fs.readFile(xmlFile, 'utf8', (xmlReadError, xmlData) => {
fs.writeFile(
path.join(constants.ExtensionRootDir, 'build', 'ci', 'performance', 'performance-results.json'),
JSON.stringify(performanceData, null, 2),
writeResultsError => {
(writeResultsError) => {
if (writeResultsError) {
throw writeResultsError;
}
Expand Down
4 changes: 2 additions & 2 deletions build/tslint-rules/messagesMustBeLocalizedRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class NoStringLiteralsInMessages extends baseRuleWalker.BaseRuleWalker {
visitCallExpression(node) {
if (!this.shouldIgnoreNode(node)) {
node.arguments
.filter(arg => ts.isStringLiteral(arg) || ts.isTemplateLiteral(arg))
.forEach(arg => {
.filter((arg) => ts.isStringLiteral(arg) || ts.isTemplateLiteral(arg))
.forEach((arg) => {
this.addFailureAtNode(arg, failureMessage);
});
}
Expand Down
2 changes: 1 addition & 1 deletion build/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function getListOfFiles(filename) {
}
const data = fs.readFileSync(filename).toString();
const files = JSON.parse(data);
return files.map(file => {
return files.map((file) => {
return path.join(exports.ExtensionRootDir, file.replace(/\//g, path.sep));
});
}
Expand Down
122 changes: 61 additions & 61 deletions build/webpack/common.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';

const glob = require('glob');
const path = require('path');
const webpack_bundle_analyzer = require('webpack-bundle-analyzer');
const constants = require('../constants');
exports.nodeModulesToExternalize = [
'unicode/category/Lu',
'unicode/category/Ll',
'unicode/category/Lt',
'unicode/category/Lo',
'unicode/category/Lm',
'unicode/category/Nl',
'unicode/category/Mn',
'unicode/category/Mc',
'unicode/category/Nd',
'unicode/category/Pc',
'@jupyterlab/services',
'azure-storage',
'request',
'request-progress',
'source-map-support',
'diff-match-patch',
'sudo-prompt',
'node-stream-zip',
'xml2js',
'vsls/vscode',
'pdfkit',
'crypto-js',
'fontkit',
'linebreak',
'png-js',
'@koa/cors',
'koa',
'koa-compress',
'koa-logger',
'zeromq'
];
exports.nodeModulesToReplacePaths = [...exports.nodeModulesToExternalize];
function getDefaultPlugins(name) {
const plugins = [];
plugins.push(
new webpack_bundle_analyzer.BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: `${name}.analyzer.html`,
generateStatsFile: true,
statsFilename: `${name}.stats.json`,
openAnalyzer: false // Open file manually if you want to see it :)
})
);
return plugins;
}
exports.getDefaultPlugins = getDefaultPlugins;
function getListOfExistingModulesInOutDir() {
const outDir = path.join(constants.ExtensionRootDir, 'out', 'client');
const files = glob.sync('**/*.js', { sync: true, cwd: outDir });
return files.map(filePath => `./${filePath.slice(0, -3)}`);
}
exports.getListOfExistingModulesInOutDir = getListOfExistingModulesInOutDir;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';

const glob = require('glob');
const path = require('path');
const webpack_bundle_analyzer = require('webpack-bundle-analyzer');
const constants = require('../constants');
exports.nodeModulesToExternalize = [
'unicode/category/Lu',
'unicode/category/Ll',
'unicode/category/Lt',
'unicode/category/Lo',
'unicode/category/Lm',
'unicode/category/Nl',
'unicode/category/Mn',
'unicode/category/Mc',
'unicode/category/Nd',
'unicode/category/Pc',
'@jupyterlab/services',
'azure-storage',
'request',
'request-progress',
'source-map-support',
'diff-match-patch',
'sudo-prompt',
'node-stream-zip',
'xml2js',
'vsls/vscode',
'pdfkit',
'crypto-js',
'fontkit',
'linebreak',
'png-js',
'@koa/cors',
'koa',
'koa-compress',
'koa-logger',
'zeromq'
];
exports.nodeModulesToReplacePaths = [...exports.nodeModulesToExternalize];
function getDefaultPlugins(name) {
const plugins = [];
plugins.push(
new webpack_bundle_analyzer.BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: `${name}.analyzer.html`,
generateStatsFile: true,
statsFilename: `${name}.stats.json`,
openAnalyzer: false // Open file manually if you want to see it :)
})
);
return plugins;
}
exports.getDefaultPlugins = getDefaultPlugins;
function getListOfExistingModulesInOutDir() {
const outDir = path.join(constants.ExtensionRootDir, 'out', 'client');
const files = glob.sync('**/*.js', { sync: true, cwd: outDir });
return files.map((filePath) => `./${filePath.slice(0, -3)}`);
}
exports.getListOfExistingModulesInOutDir = getListOfExistingModulesInOutDir;
40 changes: 20 additions & 20 deletions build/webpack/loaders/externalizeDependencies.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

const common = require('../common');
function replaceModule(contents, moduleName, quotes) {
const stringToSearch = `${quotes}${moduleName}${quotes}`;
const stringToReplaceWith = `${quotes}./node_modules/${moduleName}${quotes}`;
return contents.replace(new RegExp(stringToSearch, 'gm'), stringToReplaceWith);
}
// tslint:disable:no-default-export no-invalid-this
function default_1(source) {
common.nodeModulesToReplacePaths.forEach(moduleName => {
if (source.indexOf(moduleName) > 0) {
source = replaceModule(source, moduleName, '"');
source = replaceModule(source, moduleName, "'");
}
});
return source;
}
exports.default = default_1;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

const common = require('../common');
function replaceModule(contents, moduleName, quotes) {
const stringToSearch = `${quotes}${moduleName}${quotes}`;
const stringToReplaceWith = `${quotes}./node_modules/${moduleName}${quotes}`;
return contents.replace(new RegExp(stringToSearch, 'gm'), stringToReplaceWith);
}
// tslint:disable:no-default-export no-invalid-this
function default_1(source) {
common.nodeModulesToReplacePaths.forEach((moduleName) => {
if (source.indexOf(moduleName) > 0) {
source = replaceModule(source, moduleName, '"');
source = replaceModule(source, moduleName, "'");
}
});
return source;
}
exports.default = default_1;
2 changes: 1 addition & 1 deletion build/webpack/loaders/fixNodeFetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const nodeFetchFile = constants.isWindows ? nodeFetchIndexFile.replace(/\\/g, '\
* @param {string} source
* @returns
*/
exports.default = function(source) {
exports.default = function (source) {
if (source.indexOf("require('node-fetch')") > 0) {
source = source.replace(/require\('node-fetch'\)/g, `require('${nodeFetchFile}')`);
}
Expand Down
2 changes: 1 addition & 1 deletion build/webpack/loaders/jsonloader.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For some reason this has to be in commonjs format

module.exports = function(source) {
module.exports = function (source) {
// Just inline the source and fix up defaults so that they don't
// mess up the logic in the setOptions.js file
return `module.exports = ${source}\nmodule.exports.default = false`;
Expand Down
2 changes: 1 addition & 1 deletion build/webpack/loaders/remarkLoader.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For some reason this has to be in commonjs format

module.exports = function(source) {
module.exports = function (source) {
// Just inline the source and fix up defaults so that they don't
// mess up the logic in the setOptions.js file
return `module.exports = ${source}\nmodule.exports.default = false`;
Expand Down
Loading

0 comments on commit 61b179b

Please sign in to comment.