Skip to content

Commit 61b179b

Browse files
authored
Update prettier to latest version (#10838)
* Update prettier * News entry * Revert changes
1 parent c10a89d commit 61b179b

File tree

751 files changed

+43037
-43023
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

751 files changed

+43037
-43023
lines changed

.prettierrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module.exports = {
22
singleQuote: true,
33
printWidth: 120,
44
tabWidth: 4,
5+
trailingComma: 'none',
56
overrides: [
67
{
78
files: ['*.yml', '*.yaml'],

build/ci/performance/checkPerformanceResults.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ fs.readFile(performanceResultsFile, 'utf8', (performanceResultsFileError, perfor
2424
const benchmarkJson = JSON.parse(benchmark);
2525
const performanceJson = JSON.parse(performanceData);
2626

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

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

4848
// Delete performance-results.json
49-
fs.unlink(performanceResultsFile, deleteError => {
49+
fs.unlink(performanceResultsFile, (deleteError) => {
5050
if (deleteError) {
5151
if (failedTests.length > 0) {
5252
console.log(failedTests);

build/ci/performance/createNewPerformanceBenchmark.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fs.readFile(xmlFile, 'utf8', (xmlReadError, xmlData) => {
2121
};
2222
const jsonObj = fastXmlParser.parse(xmlData, defaultOptions);
2323

24-
jsonObj.testsuite.testcase.forEach(testcase => {
24+
jsonObj.testsuite.testcase.forEach((testcase) => {
2525
const test = {
2626
name: testcase.classname + ' ' + testcase.name,
2727
time: testcase.failure || testcase.skipped === '' ? -1 : parseFloat(testcase.time)
@@ -33,7 +33,7 @@ fs.readFile(xmlFile, 'utf8', (xmlReadError, xmlData) => {
3333
fs.writeFile(
3434
path.join(constants.ExtensionRootDir, 'build', 'ci', 'performance', 'DS_test_benchmark.json'),
3535
JSON.stringify(performanceData, null, 2),
36-
writeResultsError => {
36+
(writeResultsError) => {
3737
if (writeResultsError) {
3838
throw writeResultsError;
3939
}

build/ci/performance/savePerformanceResults.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fs.readFile(xmlFile, 'utf8', (xmlReadError, xmlData) => {
2525
fs.readFile(jsonFile, 'utf8', (jsonReadError, data) => {
2626
if (jsonReadError) {
2727
// File doesn't exist, so we create it
28-
jsonObj.testsuite.testcase.forEach(testcase => {
28+
jsonObj.testsuite.testcase.forEach((testcase) => {
2929
const test = {
3030
name: testcase.classname + ' ' + testcase.name,
3131
times: [testcase.failure || testcase.skipped === '' ? -1 : parseFloat(testcase.time)]
@@ -36,8 +36,8 @@ fs.readFile(xmlFile, 'utf8', (xmlReadError, xmlData) => {
3636
} else {
3737
performanceData = JSON.parse(data);
3838

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

4343
if (test) {
@@ -58,7 +58,7 @@ fs.readFile(xmlFile, 'utf8', (xmlReadError, xmlData) => {
5858
fs.writeFile(
5959
path.join(constants.ExtensionRootDir, 'build', 'ci', 'performance', 'performance-results.json'),
6060
JSON.stringify(performanceData, null, 2),
61-
writeResultsError => {
61+
(writeResultsError) => {
6262
if (writeResultsError) {
6363
throw writeResultsError;
6464
}

build/tslint-rules/messagesMustBeLocalizedRule.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ class NoStringLiteralsInMessages extends baseRuleWalker.BaseRuleWalker {
2626
visitCallExpression(node) {
2727
if (!this.shouldIgnoreNode(node)) {
2828
node.arguments
29-
.filter(arg => ts.isStringLiteral(arg) || ts.isTemplateLiteral(arg))
30-
.forEach(arg => {
29+
.filter((arg) => ts.isStringLiteral(arg) || ts.isTemplateLiteral(arg))
30+
.forEach((arg) => {
3131
this.addFailureAtNode(arg, failureMessage);
3232
});
3333
}

build/util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function getListOfFiles(filename) {
1212
}
1313
const data = fs.readFileSync(filename).toString();
1414
const files = JSON.parse(data);
15-
return files.map(file => {
15+
return files.map((file) => {
1616
return path.join(exports.ExtensionRootDir, file.replace(/\//g, path.sep));
1717
});
1818
}

build/webpack/common.js

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,61 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
2-
// Licensed under the MIT License.
3-
'use strict';
4-
5-
const glob = require('glob');
6-
const path = require('path');
7-
const webpack_bundle_analyzer = require('webpack-bundle-analyzer');
8-
const constants = require('../constants');
9-
exports.nodeModulesToExternalize = [
10-
'unicode/category/Lu',
11-
'unicode/category/Ll',
12-
'unicode/category/Lt',
13-
'unicode/category/Lo',
14-
'unicode/category/Lm',
15-
'unicode/category/Nl',
16-
'unicode/category/Mn',
17-
'unicode/category/Mc',
18-
'unicode/category/Nd',
19-
'unicode/category/Pc',
20-
'@jupyterlab/services',
21-
'azure-storage',
22-
'request',
23-
'request-progress',
24-
'source-map-support',
25-
'diff-match-patch',
26-
'sudo-prompt',
27-
'node-stream-zip',
28-
'xml2js',
29-
'vsls/vscode',
30-
'pdfkit',
31-
'crypto-js',
32-
'fontkit',
33-
'linebreak',
34-
'png-js',
35-
'@koa/cors',
36-
'koa',
37-
'koa-compress',
38-
'koa-logger',
39-
'zeromq'
40-
];
41-
exports.nodeModulesToReplacePaths = [...exports.nodeModulesToExternalize];
42-
function getDefaultPlugins(name) {
43-
const plugins = [];
44-
plugins.push(
45-
new webpack_bundle_analyzer.BundleAnalyzerPlugin({
46-
analyzerMode: 'static',
47-
reportFilename: `${name}.analyzer.html`,
48-
generateStatsFile: true,
49-
statsFilename: `${name}.stats.json`,
50-
openAnalyzer: false // Open file manually if you want to see it :)
51-
})
52-
);
53-
return plugins;
54-
}
55-
exports.getDefaultPlugins = getDefaultPlugins;
56-
function getListOfExistingModulesInOutDir() {
57-
const outDir = path.join(constants.ExtensionRootDir, 'out', 'client');
58-
const files = glob.sync('**/*.js', { sync: true, cwd: outDir });
59-
return files.map(filePath => `./${filePath.slice(0, -3)}`);
60-
}
61-
exports.getListOfExistingModulesInOutDir = getListOfExistingModulesInOutDir;
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
'use strict';
4+
5+
const glob = require('glob');
6+
const path = require('path');
7+
const webpack_bundle_analyzer = require('webpack-bundle-analyzer');
8+
const constants = require('../constants');
9+
exports.nodeModulesToExternalize = [
10+
'unicode/category/Lu',
11+
'unicode/category/Ll',
12+
'unicode/category/Lt',
13+
'unicode/category/Lo',
14+
'unicode/category/Lm',
15+
'unicode/category/Nl',
16+
'unicode/category/Mn',
17+
'unicode/category/Mc',
18+
'unicode/category/Nd',
19+
'unicode/category/Pc',
20+
'@jupyterlab/services',
21+
'azure-storage',
22+
'request',
23+
'request-progress',
24+
'source-map-support',
25+
'diff-match-patch',
26+
'sudo-prompt',
27+
'node-stream-zip',
28+
'xml2js',
29+
'vsls/vscode',
30+
'pdfkit',
31+
'crypto-js',
32+
'fontkit',
33+
'linebreak',
34+
'png-js',
35+
'@koa/cors',
36+
'koa',
37+
'koa-compress',
38+
'koa-logger',
39+
'zeromq'
40+
];
41+
exports.nodeModulesToReplacePaths = [...exports.nodeModulesToExternalize];
42+
function getDefaultPlugins(name) {
43+
const plugins = [];
44+
plugins.push(
45+
new webpack_bundle_analyzer.BundleAnalyzerPlugin({
46+
analyzerMode: 'static',
47+
reportFilename: `${name}.analyzer.html`,
48+
generateStatsFile: true,
49+
statsFilename: `${name}.stats.json`,
50+
openAnalyzer: false // Open file manually if you want to see it :)
51+
})
52+
);
53+
return plugins;
54+
}
55+
exports.getDefaultPlugins = getDefaultPlugins;
56+
function getListOfExistingModulesInOutDir() {
57+
const outDir = path.join(constants.ExtensionRootDir, 'out', 'client');
58+
const files = glob.sync('**/*.js', { sync: true, cwd: outDir });
59+
return files.map((filePath) => `./${filePath.slice(0, -3)}`);
60+
}
61+
exports.getListOfExistingModulesInOutDir = getListOfExistingModulesInOutDir;
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
2-
// Licensed under the MIT License.
3-
4-
const common = require('../common');
5-
function replaceModule(contents, moduleName, quotes) {
6-
const stringToSearch = `${quotes}${moduleName}${quotes}`;
7-
const stringToReplaceWith = `${quotes}./node_modules/${moduleName}${quotes}`;
8-
return contents.replace(new RegExp(stringToSearch, 'gm'), stringToReplaceWith);
9-
}
10-
// tslint:disable:no-default-export no-invalid-this
11-
function default_1(source) {
12-
common.nodeModulesToReplacePaths.forEach(moduleName => {
13-
if (source.indexOf(moduleName) > 0) {
14-
source = replaceModule(source, moduleName, '"');
15-
source = replaceModule(source, moduleName, "'");
16-
}
17-
});
18-
return source;
19-
}
20-
exports.default = default_1;
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
const common = require('../common');
5+
function replaceModule(contents, moduleName, quotes) {
6+
const stringToSearch = `${quotes}${moduleName}${quotes}`;
7+
const stringToReplaceWith = `${quotes}./node_modules/${moduleName}${quotes}`;
8+
return contents.replace(new RegExp(stringToSearch, 'gm'), stringToReplaceWith);
9+
}
10+
// tslint:disable:no-default-export no-invalid-this
11+
function default_1(source) {
12+
common.nodeModulesToReplacePaths.forEach((moduleName) => {
13+
if (source.indexOf(moduleName) > 0) {
14+
source = replaceModule(source, moduleName, '"');
15+
source = replaceModule(source, moduleName, "'");
16+
}
17+
});
18+
return source;
19+
}
20+
exports.default = default_1;

build/webpack/loaders/fixNodeFetch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const nodeFetchFile = constants.isWindows ? nodeFetchIndexFile.replace(/\\/g, '\
2828
* @param {string} source
2929
* @returns
3030
*/
31-
exports.default = function(source) {
31+
exports.default = function (source) {
3232
if (source.indexOf("require('node-fetch')") > 0) {
3333
source = source.replace(/require\('node-fetch'\)/g, `require('${nodeFetchFile}')`);
3434
}

build/webpack/loaders/jsonloader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// For some reason this has to be in commonjs format
22

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

build/webpack/loaders/remarkLoader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// For some reason this has to be in commonjs format
22

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

0 commit comments

Comments
 (0)