From 9a525450949881d07d6f87fb69f3353b2be78367 Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Fri, 12 Nov 2021 10:55:50 +0100 Subject: [PATCH] Run `prettier` --- build/utils.js | 14 +++-- monaco-css/build.js | 5 +- monaco-css/src/monaco.contribution.ts | 4 +- .../test/webpack-cross-origin.config.js | 12 +++-- .../test/webpack.config.js | 12 +++-- .../sample.js | 2 +- monaco-html/scripts/build.js | 53 +++++++++++-------- monaco-json/scripts/build.js | 53 +++++++++++-------- monaco-json/src/tokenization.ts | 4 +- 9 files changed, 97 insertions(+), 62 deletions(-) diff --git a/build/utils.js b/build/utils.js index 266b5549..c98ea9c2 100644 --- a/build/utils.js +++ b/build/utils.js @@ -82,7 +82,11 @@ exports.removeDir = removeDir; function tsc(_projectPath) { const projectPath = path.join(REPO_ROOT, _projectPath); console.log(`Launching compiler at ${_projectPath}...`); - cp.spawnSync(process.execPath, [path.join(__dirname, '../node_modules/typescript/lib/tsc.js'), '-p', projectPath], { stdio: 'inherit', stderr: 'inherit' }); + cp.spawnSync( + process.execPath, + [path.join(__dirname, '../node_modules/typescript/lib/tsc.js'), '-p', projectPath], + { stdio: 'inherit', stderr: 'inherit' } + ); console.log(`Compiled ${_projectPath}`); } exports.tsc = tsc; @@ -94,7 +98,11 @@ exports.tsc = tsc; */ function prettier(_filePath) { const filePath = path.join(REPO_ROOT, _filePath); - cp.spawnSync(process.execPath, [path.join(__dirname, '../node_modules/prettier/bin-prettier.js'), '--write', filePath], { stdio: 'inherit', stderr: 'inherit' }); + cp.spawnSync( + process.execPath, + [path.join(__dirname, '../node_modules/prettier/bin-prettier.js'), '--write', filePath], + { stdio: 'inherit', stderr: 'inherit' } + ); console.log(`Ran prettier over ${_filePath}`); } @@ -189,7 +197,7 @@ function getGitVersion() { let refsMatch; const refs = {}; - while (refsMatch = refsRegex.exec(refsRaw)) { + while ((refsMatch = refsRegex.exec(refsRaw))) { refs[refsMatch[2]] = refsMatch[1]; } diff --git a/monaco-css/build.js b/monaco-css/build.js index d2b4a9c6..7f9b9395 100644 --- a/monaco-css/build.js +++ b/monaco-css/build.js @@ -96,6 +96,9 @@ function buildAMD(entryPoint, banner) { buildOneAMD('min', entryPoint, banner); } -buildAMD('src/monaco.contribution.ts', 'define("vs/language/css/monaco.contribution",["vs/editor/editor.api"],()=>{'); +buildAMD( + 'src/monaco.contribution.ts', + 'define("vs/language/css/monaco.contribution",["vs/editor/editor.api"],()=>{' +); buildAMD('src/cssMode.ts', 'define("vs/language/css/cssMode",["vs/editor/editor.api"],()=>{'); buildAMD('src/cssWorker.ts', 'define("vs/language/css/cssWorker",[],()=>{'); diff --git a/monaco-css/src/monaco.contribution.ts b/monaco-css/src/monaco.contribution.ts index c7055c3c..55882223 100644 --- a/monaco-css/src/monaco.contribution.ts +++ b/monaco-css/src/monaco.contribution.ts @@ -223,7 +223,9 @@ declare var require: any; function getMode(): Promise { if (AMD) { - return new Promise((resolve, reject) => { require(['vs/language/css/cssMode'], resolve, reject); }); + return new Promise((resolve, reject) => { + require(['vs/language/css/cssMode'], resolve, reject); + }); } else { return import('./cssMode'); } diff --git a/monaco-editor-webpack-plugin/test/webpack-cross-origin.config.js b/monaco-editor-webpack-plugin/test/webpack-cross-origin.config.js index a11788ac..31af75ee 100644 --- a/monaco-editor-webpack-plugin/test/webpack-cross-origin.config.js +++ b/monaco-editor-webpack-plugin/test/webpack-cross-origin.config.js @@ -14,8 +14,8 @@ module.exports = { }, resolve: { alias: { - 'monaco-editor': path.resolve(__dirname, '../../release'), - }, + 'monaco-editor': path.resolve(__dirname, '../../release') + } }, module: { rules: [ @@ -29,7 +29,9 @@ module.exports = { } ] }, - plugins: [new MonacoWebpackPlugin({ - monacoEditorPath: path.resolve(__dirname, '../../release') - })] + plugins: [ + new MonacoWebpackPlugin({ + monacoEditorPath: path.resolve(__dirname, '../../release') + }) + ] }; diff --git a/monaco-editor-webpack-plugin/test/webpack.config.js b/monaco-editor-webpack-plugin/test/webpack.config.js index 89c3ab41..a387f882 100644 --- a/monaco-editor-webpack-plugin/test/webpack.config.js +++ b/monaco-editor-webpack-plugin/test/webpack.config.js @@ -11,8 +11,8 @@ module.exports = { }, resolve: { alias: { - 'monaco-editor': path.resolve(__dirname, '../../release'), - }, + 'monaco-editor': path.resolve(__dirname, '../../release') + } }, module: { rules: [ @@ -26,7 +26,9 @@ module.exports = { } ] }, - plugins: [new MonacoWebpackPlugin({ - monacoEditorPath: path.resolve(__dirname, '../../release') - })] + plugins: [ + new MonacoWebpackPlugin({ + monacoEditorPath: path.resolve(__dirname, '../../release') + }) + ] }; diff --git a/monaco-editor/website/playground/new-samples/extending-language-services/semantic-tokens-provider-example/sample.js b/monaco-editor/website/playground/new-samples/extending-language-services/semantic-tokens-provider-example/sample.js index ec694261..eacdf1bc 100644 --- a/monaco-editor/website/playground/new-samples/extending-language-services/semantic-tokens-provider-example/sample.js +++ b/monaco-editor/website/playground/new-samples/extending-language-services/semantic-tokens-provider-example/sample.js @@ -110,7 +110,7 @@ monaco.languages.registerDocumentSemanticTokensProvider('plaintext', { monaco.editor.defineTheme('myCustomTheme', { base: 'vs', inherit: true, - colors : {}, + colors: {}, rules: [ { token: 'comment', foreground: 'aaaaaa', fontStyle: 'italic' }, { token: 'keyword', foreground: 'ce63eb' }, diff --git a/monaco-html/scripts/build.js b/monaco-html/scripts/build.js index 9ef144cb..c74ed6e0 100644 --- a/monaco-html/scripts/build.js +++ b/monaco-html/scripts/build.js @@ -14,27 +14,36 @@ removeDir(`monaco-html/out`); tsc(`monaco-html/src/tsconfig.json`); -dts(`monaco-html/out/amd/monaco.contribution.d.ts`, `monaco-html/monaco.d.ts`, 'monaco.languages.html'); +dts( + `monaco-html/out/amd/monaco.contribution.d.ts`, + `monaco-html/monaco.d.ts`, + 'monaco.languages.html' +); -esbuild.build({ - entryPoints: ['src/htmlMode.ts', 'src/html.worker.ts', 'src/monaco.contribution.ts'], - bundle: true, - target: 'esnext', - format: 'esm', - external: ['monaco-editor-core', '*/htmlMode'], - outdir: 'release/esm/', - plugins: [ - alias({ - 'vscode-nls': path.join(__dirname, '../src/fillers/vscode-nls.ts'), - }), - ], -}).then((result) => { - if (result.errors.length > 0) { - console.error(result.errors); - } - if (result.warnings.length > 0) { - console.error(result.warnings); - } +esbuild + .build({ + entryPoints: ['src/htmlMode.ts', 'src/html.worker.ts', 'src/monaco.contribution.ts'], + bundle: true, + target: 'esnext', + format: 'esm', + external: ['monaco-editor-core', '*/htmlMode'], + outdir: 'release/esm/', + plugins: [ + alias({ + 'vscode-nls': path.join(__dirname, '../src/fillers/vscode-nls.ts') + }) + ] + }) + .then((result) => { + if (result.errors.length > 0) { + console.error(result.errors); + } + if (result.warnings.length > 0) { + console.error(result.warnings); + } + }); + +cp.spawnSync(process.execPath, [path.join(__dirname, './bundle.js')], { + stdio: 'inherit', + stderr: 'inherit' }); - -cp.spawnSync(process.execPath, [path.join(__dirname, './bundle.js')], { stdio: 'inherit', stderr: 'inherit' }); diff --git a/monaco-json/scripts/build.js b/monaco-json/scripts/build.js index 4096cae0..1f2b9133 100644 --- a/monaco-json/scripts/build.js +++ b/monaco-json/scripts/build.js @@ -14,27 +14,36 @@ removeDir(`monaco-json/out`); tsc(`monaco-json/src/tsconfig.json`); -dts(`monaco-json/out/amd/monaco.contribution.d.ts`, `monaco-json/monaco.d.ts`, 'monaco.languages.json'); +dts( + `monaco-json/out/amd/monaco.contribution.d.ts`, + `monaco-json/monaco.d.ts`, + 'monaco.languages.json' +); -esbuild.build({ - entryPoints: ['src/jsonMode.ts', 'src/json.worker.ts', 'src/monaco.contribution.ts'], - bundle: true, - target: 'esnext', - format: 'esm', - external: ['monaco-editor-core', '*/jsonMode'], - outdir: 'release/esm/', - plugins: [ - alias({ - 'vscode-nls': path.join(__dirname, '../src/fillers/vscode-nls.ts'), - }), - ], -}).then((result) => { - if (result.errors.length > 0) { - console.error(result.errors); - } - if (result.warnings.length > 0) { - console.error(result.warnings); - } +esbuild + .build({ + entryPoints: ['src/jsonMode.ts', 'src/json.worker.ts', 'src/monaco.contribution.ts'], + bundle: true, + target: 'esnext', + format: 'esm', + external: ['monaco-editor-core', '*/jsonMode'], + outdir: 'release/esm/', + plugins: [ + alias({ + 'vscode-nls': path.join(__dirname, '../src/fillers/vscode-nls.ts') + }) + ] + }) + .then((result) => { + if (result.errors.length > 0) { + console.error(result.errors); + } + if (result.warnings.length > 0) { + console.error(result.warnings); + } + }); + +cp.spawnSync(process.execPath, [path.join(__dirname, './bundle.js')], { + stdio: 'inherit', + stderr: 'inherit' }); - -cp.spawnSync(process.execPath, [path.join(__dirname, './bundle.js')], { stdio: 'inherit', stderr: 'inherit' }); diff --git a/monaco-json/src/tokenization.ts b/monaco-json/src/tokenization.ts index a4d0ad7e..bb8d7ad2 100644 --- a/monaco-json/src/tokenization.ts +++ b/monaco-json/src/tokenization.ts @@ -177,7 +177,7 @@ function tokenize( let offset = offsetDelta + scanner.getPosition(); let type = ''; - const kind = scanner.scan(); + const kind = (scanner.scan()); if (kind === SyntaxKind.EOF) { break; } @@ -261,7 +261,7 @@ function tokenize( ret.endState = new JSONState( state.getStateData(), - scanner.getTokenError(), + (scanner.getTokenError()), lastWasColon, parents );