From 3500a59ec76e15ed9be0bfd2f46c97a63efc6195 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 5 Sep 2022 20:29:33 -0700 Subject: [PATCH 01/10] Add eslint rule for trailing commas --- .eslintrc.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.json b/.eslintrc.json index 0eb936e9be5c8..ec7b9b31c8cbb 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -131,6 +131,7 @@ "simple-import-sort/exports": "error", // Formatting rules; remove once a formatter enforces these. + "@typescript-eslint/comma-dangle": ["error", "always-multiline"], "curly": ["error", "multi-line"], "linebreak-style": ["error", "windows"], "max-statements-per-line": ["error", { "max": 1 }], From a83633c147976916a7def470821f10dad79ed076 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 5 Sep 2022 20:31:42 -0700 Subject: [PATCH 02/10] [generated] Run eslint --fix [git-generate] set -x npm ci npx eslint . --fix --- Herebyfile.mjs | 30 +- scripts/build/options.mjs | 4 +- scripts/build/tests.mjs | 2 +- scripts/eslint/rules/argument-trivia.cjs | 4 +- scripts/eslint/rules/jsdoc-format.cjs | 2 +- scripts/eslint/rules/simple-indent.cjs | 2 +- scripts/eslint/tests/argument-trivia.test.cjs | 2 +- scripts/eslint/tests/debug-assert.test.cjs | 2 +- scripts/eslint/tests/no-keywords.test.cjs | 6 +- .../object-literal-surrounding-space.test.cjs | 2 +- scripts/eslint/tests/simple-indent.test.cjs | 18 +- scripts/link-hooks.mjs | 2 +- scripts/open-cherry-pick-pr.mjs | 28 +- scripts/open-user-pr.mjs | 6 +- scripts/perf-result-post.mjs | 8 +- scripts/post-vsts-artifact-comment.mjs | 8 +- scripts/request-pr-review.mjs | 6 +- scripts/update-experimental-branches.mjs | 6 +- src/cancellationToken/cancellationToken.ts | 6 +- src/compiler/binder.ts | 8 +- src/compiler/builder.ts | 10 +- src/compiler/builderState.ts | 4 +- src/compiler/checker.ts | 60 +- src/compiler/commandLineParser.ts | 126 ++-- src/compiler/corePublic.ts | 2 +- src/compiler/debug.ts | 30 +- src/compiler/emitter.ts | 20 +- src/compiler/factory/baseNodeFactory.ts | 2 +- src/compiler/factory/emitHelpers.ts | 78 +-- src/compiler/factory/nodeFactory.ts | 8 +- src/compiler/factory/utilities.ts | 8 +- src/compiler/moduleNameResolver.ts | 12 +- src/compiler/moduleSpecifiers.ts | 4 +- src/compiler/parser.ts | 20 +- src/compiler/performance.ts | 2 +- src/compiler/performanceCore.ts | 4 +- src/compiler/program.ts | 32 +- src/compiler/resolutionCache.ts | 4 +- src/compiler/scanner.ts | 10 +- src/compiler/semver.ts | 4 +- src/compiler/sourcemap.ts | 14 +- src/compiler/sys.ts | 40 +- src/compiler/transformer.ts | 10 +- src/compiler/transformers/classFields.ts | 6 +- src/compiler/transformers/classThis.ts | 4 +- src/compiler/transformers/declarations.ts | 8 +- .../transformers/declarations/diagnostics.ts | 18 +- src/compiler/transformers/destructuring.ts | 4 +- src/compiler/transformers/es2015.ts | 44 +- src/compiler/transformers/es2016.ts | 2 +- src/compiler/transformers/es2017.ts | 14 +- src/compiler/transformers/es2018.ts | 26 +- src/compiler/transformers/es2021.ts | 2 +- src/compiler/transformers/esDecorators.ts | 24 +- src/compiler/transformers/esnext.ts | 22 +- src/compiler/transformers/generators.ts | 38 +- src/compiler/transformers/jsx.ts | 6 +- src/compiler/transformers/legacyDecorators.ts | 6 +- .../transformers/module/esnextAnd2015.ts | 8 +- src/compiler/transformers/module/module.ts | 50 +- src/compiler/transformers/module/system.ts | 24 +- src/compiler/transformers/namedEvaluation.ts | 4 +- src/compiler/transformers/taggedTemplate.ts | 2 +- src/compiler/transformers/ts.ts | 12 +- src/compiler/transformers/typeSerializer.ts | 2 +- src/compiler/transformers/utilities.ts | 6 +- src/compiler/tsbuildPublic.ts | 66 +-- src/compiler/types.ts | 54 +- src/compiler/utilities.ts | 222 +++---- src/compiler/visitorPublic.ts | 2 +- src/compiler/watch.ts | 8 +- src/compiler/watchPublic.ts | 4 +- src/compiler/watchUtilities.ts | 34 +- .../5.0/identifierProperties.ts | 8 +- src/deprecatedCompat/deprecations.ts | 8 +- src/executeCommandLine/executeCommandLine.ts | 16 +- src/harness/client.ts | 46 +- src/harness/compilerImpl.ts | 12 +- src/harness/documentsUtil.ts | 2 +- src/harness/evaluatorImpl.ts | 12 +- src/harness/fakesHosts.ts | 2 +- src/harness/fourslashImpl.ts | 52 +- src/harness/fourslashInterfaceImpl.ts | 34 +- src/harness/harnessIO.ts | 14 +- src/harness/harnessLanguageService.ts | 40 +- src/harness/harnessUtils.ts | 2 +- src/harness/typeWriter.ts | 4 +- src/harness/vfsUtil.ts | 12 +- src/jsTyping/jsTyping.ts | 4 +- src/server/editorServices.ts | 48 +- src/server/moduleSpecifierCache.ts | 2 +- src/server/project.ts | 28 +- src/server/protocol.ts | 6 +- src/server/scriptInfo.ts | 2 +- src/server/scriptVersionCache.ts | 6 +- src/server/session.ts | 106 ++-- src/server/typingsCache.ts | 6 +- src/server/utilitiesPublic.ts | 6 +- src/services/classifier.ts | 2 +- src/services/classifier2020.ts | 12 +- src/services/codeFixProvider.ts | 2 +- src/services/codefixes/addMissingAsync.ts | 2 +- src/services/codefixes/addMissingConst.ts | 2 +- .../codefixes/addOptionalPropertyUndefined.ts | 4 +- src/services/codefixes/convertConstToLet.ts | 2 +- .../convertLiteralTypeToMappedType.ts | 2 +- .../codefixes/convertToAsyncFunction.ts | 2 +- src/services/codefixes/convertToEsModule.ts | 2 +- .../codefixes/convertToMappedObjectType.ts | 2 +- .../codefixes/convertToTypeOnlyExport.ts | 4 +- .../codefixes/convertToTypeOnlyImport.ts | 4 +- .../codefixes/convertTypedefToType.ts | 2 +- .../codefixes/fixAddMissingConstraint.ts | 2 +- src/services/codefixes/fixAddMissingMember.ts | 6 +- src/services/codefixes/fixAddVoidToPromise.ts | 4 +- .../codefixes/fixAwaitInSyncFunction.ts | 4 +- .../fixClassIncorrectlyImplementsInterface.ts | 2 +- src/services/codefixes/fixEnableJsxFlag.ts | 4 +- .../codefixes/fixImportNonExportedMember.ts | 2 +- .../codefixes/fixIncorrectNamedTupleSyntax.ts | 4 +- .../codefixes/fixInvalidImportSyntax.ts | 4 +- .../codefixes/fixInvalidJsxCharacters.ts | 6 +- src/services/codefixes/fixJSDocTypes.ts | 2 +- .../codefixes/fixMissingCallParentheses.ts | 2 +- .../codefixes/fixModuleAndTargetOptions.ts | 2 +- src/services/codefixes/fixNaNEquality.ts | 2 +- .../fixNoPropertyAccessFromIndexSignature.ts | 4 +- src/services/codefixes/fixOverrideModifier.ts | 10 +- .../codefixes/fixPropertyAssignment.ts | 4 +- .../codefixes/fixReturnTypeInAsyncFunction.ts | 2 +- .../codefixes/fixUnmatchedParameter.ts | 2 +- src/services/codefixes/fixUnreachableCode.ts | 2 +- src/services/codefixes/fixUnusedIdentifier.ts | 6 +- src/services/codefixes/generateAccessors.ts | 12 +- src/services/codefixes/helpers.ts | 2 +- src/services/codefixes/importFixes.ts | 6 +- src/services/codefixes/inferFromUsage.ts | 12 +- src/services/codefixes/requireInTs.ts | 2 +- src/services/codefixes/returnValueCorrect.ts | 14 +- src/services/completions.ts | 18 +- src/services/documentHighlights.ts | 4 +- src/services/documentRegistry.ts | 8 +- src/services/findAllReferences.ts | 44 +- src/services/formatting/formatting.ts | 14 +- src/services/formatting/formattingContext.ts | 2 +- src/services/formatting/formattingScanner.ts | 2 +- src/services/formatting/rules.ts | 2 +- src/services/formatting/rulesMap.ts | 2 +- src/services/formatting/smartIndenter.ts | 4 +- src/services/goToDefinition.ts | 2 +- src/services/inlayHints.ts | 2 +- src/services/jsDoc.ts | 4 +- src/services/navigationBar.ts | 8 +- src/services/patternMatcher.ts | 10 +- src/services/preProcess.ts | 2 +- .../addOrRemoveBracesToArrowFunction.ts | 14 +- ...onvertArrowFunctionOrFunctionExpression.ts | 6 +- src/services/refactors/convertExport.ts | 8 +- src/services/refactors/convertImport.ts | 4 +- .../convertOverloadListToSingleSignature.ts | 6 +- .../convertParamsToDestructuredObject.ts | 8 +- .../convertStringOrTemplateLiteral.ts | 6 +- src/services/refactors/extractSymbol.ts | 24 +- src/services/refactors/extractType.ts | 12 +- .../generateGetAccessorAndSetAccessor.ts | 2 +- .../refactors/inferFunctionReturnType.ts | 8 +- src/services/refactors/inlineVariable.ts | 12 +- src/services/refactors/moveToFile.ts | 8 +- src/services/refactors/moveToNewFile.ts | 8 +- src/services/rename.ts | 2 +- src/services/services.ts | 44 +- src/services/shims.ts | 10 +- src/services/signatureHelp.ts | 6 +- src/services/smartSelection.ts | 2 +- src/services/sourcemaps.ts | 2 +- src/services/stringCompletions.ts | 6 +- src/services/textChanges.ts | 12 +- src/services/transpile.ts | 6 +- src/services/types.ts | 8 +- src/services/utilities.ts | 8 +- src/testRunner/compilerRunner.ts | 2 +- src/testRunner/parallel/host.ts | 18 +- src/testRunner/projectsRunner.ts | 12 +- src/testRunner/runner.ts | 2 +- .../unittests/config/commandLineParsing.ts | 12 +- .../config/configurationExtension.ts | 116 ++-- .../config/convertCompilerOptionsFromJson.ts | 74 +-- .../config/convertTypeAcquisitionFromJson.ts | 22 +- src/testRunner/unittests/config/matchFiles.ts | 292 +++++----- src/testRunner/unittests/config/showConfig.ts | 22 +- .../unittests/config/tsconfigParsing.ts | 24 +- .../config/tsconfigParsingWatchOptions.ts | 32 +- src/testRunner/unittests/customTransforms.ts | 26 +- src/testRunner/unittests/debugDeprecation.ts | 22 +- .../unittests/evaluation/asyncGenerator.ts | 6 +- .../unittests/evaluation/autoAccessors.ts | 2 +- .../evaluation/awaitUsingDeclarations.ts | 66 +-- .../unittests/evaluation/esDecorators.ts | 4 +- .../unittests/evaluation/externalModules.ts | 8 +- .../evaluation/updateExpressionInModule.ts | 32 +- .../unittests/evaluation/usingDeclarations.ts | 74 +-- src/testRunner/unittests/helpers.ts | 2 +- src/testRunner/unittests/helpers/baseline.ts | 4 +- src/testRunner/unittests/helpers/extends.ts | 2 +- .../unittests/helpers/libraryResolution.ts | 2 +- .../unittests/helpers/node10Result.ts | 14 +- src/testRunner/unittests/helpers/tsc.ts | 18 +- src/testRunner/unittests/helpers/tscWatch.ts | 10 +- src/testRunner/unittests/helpers/tsserver.ts | 30 +- src/testRunner/unittests/helpers/vfs.ts | 2 +- .../helpers/virtualFileSystemWithWatch.ts | 12 +- src/testRunner/unittests/incrementalParser.ts | 2 +- .../unittests/jsonParserRecovery.ts | 2 +- src/testRunner/unittests/moduleResolution.ts | 66 +-- src/testRunner/unittests/printer.ts | 10 +- src/testRunner/unittests/programApi.ts | 4 +- src/testRunner/unittests/publicApi.ts | 10 +- .../unittests/reuseProgramStructure.ts | 66 +-- .../cancellableLanguageServiceOperations.ts | 2 +- .../services/convertToAsyncFunction.ts | 8 +- .../unittests/services/extract/helpers.ts | 4 +- .../services/extract/symbolWalker.ts | 2 +- .../unittests/services/hostNewLineSupport.ts | 4 +- .../unittests/services/languageService.ts | 28 +- .../unittests/services/organizeImports.ts | 20 +- .../unittests/services/preProcessFile.ts | 118 ++-- .../unittests/services/textChanges.ts | 8 +- .../unittests/services/transpile.ts | 200 +++---- src/testRunner/unittests/transform.ts | 78 +-- .../unittests/tsbuild/amdModulesWithOut.ts | 16 +- .../unittests/tsbuild/commandLine.ts | 12 +- .../unittests/tsbuild/configFileErrors.ts | 10 +- .../unittests/tsbuild/configFileExtends.ts | 14 +- .../tsbuild/containerOnlyReferenced.ts | 8 +- .../unittests/tsbuild/declarationEmit.ts | 30 +- src/testRunner/unittests/tsbuild/demo.ts | 8 +- .../unittests/tsbuild/emitDeclarationOnly.ts | 2 +- .../unittests/tsbuild/exitCodeOnBogusFile.ts | 2 +- .../unittests/tsbuild/fileDelete.ts | 8 +- .../unittests/tsbuild/graphOrdering.ts | 4 +- .../inferredTypeFromTransitiveModule.ts | 14 +- .../tsbuild/javascriptProjectEmit.ts | 10 +- .../unittests/tsbuild/lateBoundSymbol.ts | 4 +- .../unittests/tsbuild/moduleResolution.ts | 32 +- .../unittests/tsbuild/moduleSpecifiers.ts | 6 +- src/testRunner/unittests/tsbuild/noEmit.ts | 4 +- src/testRunner/unittests/tsbuild/outFile.ts | 76 +-- .../unittests/tsbuild/outputPaths.ts | 32 +- src/testRunner/unittests/tsbuild/publicApi.ts | 8 +- .../tsbuild/referencesWithRootDirInParent.ts | 6 +- .../unittests/tsbuild/resolveJsonModule.ts | 6 +- src/testRunner/unittests/tsbuild/roots.ts | 16 +- src/testRunner/unittests/tsbuild/sample.ts | 58 +- .../unittests/tsbuild/transitiveReferences.ts | 4 +- .../tsbuildWatch/configFileErrors.ts | 10 +- src/testRunner/unittests/tsbuildWatch/demo.ts | 8 +- .../tsbuildWatch/moduleResolution.ts | 70 +-- .../unittests/tsbuildWatch/noEmit.ts | 2 +- .../unittests/tsbuildWatch/noEmitOnError.ts | 4 +- .../unittests/tsbuildWatch/programUpdates.ts | 170 +++--- .../tsbuildWatch/projectsBuilding.ts | 36 +- .../unittests/tsbuildWatch/publicApi.ts | 24 +- .../unittests/tsbuildWatch/reexport.ts | 8 +- .../tsbuildWatch/watchEnvironment.ts | 20 +- .../unittests/tsc/cancellationToken.ts | 10 +- src/testRunner/unittests/tsc/composite.ts | 6 +- .../unittests/tsc/declarationEmit.ts | 46 +- src/testRunner/unittests/tsc/incremental.ts | 76 +-- src/testRunner/unittests/tsc/listFilesOnly.ts | 10 +- .../unittests/tsc/moduleResolution.ts | 2 +- .../unittests/tsc/projectReferences.ts | 14 +- .../unittests/tsc/projectReferencesConfig.ts | 68 +-- src/testRunner/unittests/tsc/redirect.ts | 4 +- .../unittests/tsc/runWithoutArgs.ts | 4 +- .../unittests/tscWatch/consoleClearing.ts | 8 +- src/testRunner/unittests/tscWatch/emit.ts | 136 ++--- .../unittests/tscWatch/emitAndErrorUpdates.ts | 64 +- .../forceConsistentCasingInFileNames.ts | 78 +-- .../unittests/tscWatch/incremental.ts | 64 +- .../unittests/tscWatch/libraryResolution.ts | 16 +- .../unittests/tscWatch/moduleResolution.ts | 114 ++-- .../unittests/tscWatch/nodeNextWatch.ts | 14 +- .../unittests/tscWatch/programUpdates.ts | 548 +++++++++--------- .../tscWatch/projectsWithReferences.ts | 92 +-- .../unittests/tscWatch/resolutionCache.ts | 154 ++--- .../resolveJsonModuleWithIncremental.ts | 2 +- .../sourceOfProjectReferenceRedirect.ts | 28 +- src/testRunner/unittests/tscWatch/watchApi.ts | 82 +-- .../unittests/tscWatch/watchEnvironment.ts | 128 ++-- .../tsserver/applyChangesToOpenFiles.ts | 64 +- .../unittests/tsserver/autoImportProvider.ts | 40 +- .../unittests/tsserver/auxiliaryProject.ts | 6 +- .../tsserver/cachingFileSystemInformation.ts | 94 +-- .../unittests/tsserver/cancellationToken.ts | 48 +- .../unittests/tsserver/compileOnSave.ts | 278 ++++----- .../unittests/tsserver/completions.ts | 36 +- .../tsserver/completionsIncomplete.ts | 14 +- .../unittests/tsserver/configFileSearch.ts | 20 +- .../unittests/tsserver/configuredProjects.ts | 276 ++++----- .../unittests/tsserver/declarationFileMaps.ts | 58 +- .../unittests/tsserver/documentRegistry.ts | 16 +- .../unittests/tsserver/duplicatePackages.ts | 2 +- .../unittests/tsserver/dynamicFiles.ts | 28 +- .../tsserver/events/largeFileReferenced.ts | 8 +- .../events/projectLanguageServiceState.ts | 14 +- .../tsserver/events/projectLoading.ts | 40 +- .../events/projectUpdatedInBackground.ts | 60 +- .../unittests/tsserver/exportMapCache.ts | 32 +- .../unittests/tsserver/externalProjects.ts | 180 +++--- .../unittests/tsserver/findAllReferences.ts | 38 +- .../forceConsistentCasingInFileNames.ts | 36 +- .../unittests/tsserver/formatSettings.ts | 8 +- .../tsserver/getApplicableRefactors.ts | 2 +- .../tsserver/getEditsForFileRename.ts | 4 +- .../unittests/tsserver/getFileReferences.ts | 8 +- .../getMoveToRefactoringFileSuggestions.ts | 26 +- .../unittests/tsserver/goToDefinition.ts | 24 +- .../unittests/tsserver/importHelpers.ts | 4 +- .../tsserver/inconsistentErrorInEditor.ts | 24 +- .../unittests/tsserver/inferredProjects.ts | 58 +- .../unittests/tsserver/inlayHints.ts | 22 +- src/testRunner/unittests/tsserver/jsdocTag.ts | 24 +- .../unittests/tsserver/languageService.ts | 20 +- .../unittests/tsserver/libraryResolution.ts | 2 +- .../tsserver/maxNodeModuleJsDepth.ts | 8 +- .../unittests/tsserver/metadataInResponse.ts | 16 +- .../unittests/tsserver/moduleResolution.ts | 10 +- .../tsserver/moduleSpecifierCache.ts | 14 +- src/testRunner/unittests/tsserver/navTo.ts | 36 +- .../unittests/tsserver/occurences.ts | 8 +- src/testRunner/unittests/tsserver/openFile.ts | 48 +- .../unittests/tsserver/packageJsonInfo.ts | 16 +- .../tsserver/partialSemanticServer.ts | 40 +- src/testRunner/unittests/tsserver/plugins.ts | 62 +- .../unittests/tsserver/pluginsAsync.ts | 10 +- .../unittests/tsserver/projectErrors.ts | 186 +++--- .../tsserver/projectReferenceCompileOnSave.ts | 494 ++++++++-------- .../tsserver/projectReferenceErrors.ts | 26 +- .../unittests/tsserver/projectReferences.ts | 378 ++++++------ .../tsserver/projectReferencesSourcemap.ts | 40 +- src/testRunner/unittests/tsserver/projects.ts | 348 +++++------ .../tsserver/projectsWithReferences.ts | 24 +- .../unittests/tsserver/refactors.ts | 22 +- src/testRunner/unittests/tsserver/reload.ts | 20 +- .../unittests/tsserver/reloadProjects.ts | 34 +- src/testRunner/unittests/tsserver/rename.ts | 34 +- .../unittests/tsserver/resolutionCache.ts | 118 ++-- src/testRunner/unittests/tsserver/session.ts | 78 +-- .../unittests/tsserver/skipLibCheck.ts | 58 +- .../unittests/tsserver/smartSelection.ts | 4 +- src/testRunner/unittests/tsserver/symLinks.ts | 46 +- .../unittests/tsserver/symlinkCache.ts | 14 +- .../unittests/tsserver/syntacticServer.ts | 30 +- .../unittests/tsserver/syntaxOperations.ts | 14 +- .../unittests/tsserver/telemetry.ts | 30 +- .../unittests/tsserver/textStorage.ts | 6 +- .../unittests/tsserver/typeAquisition.ts | 14 +- .../tsserver/typeOnlyImportChains.ts | 56 +- .../tsserver/typeReferenceDirectives.ts | 24 +- .../unittests/tsserver/typingsInstaller.ts | 454 +++++++-------- .../unittests/tsserver/watchEnvironment.ts | 114 ++-- .../typeParameterIsPossiblyReferenced.ts | 2 +- src/tsc/tsc.ts | 2 +- src/tsserver/nodeServer.ts | 10 +- src/tsserver/server.ts | 2 +- src/typescript/typescript.ts | 2 +- src/typingsInstallerCore/typingsInstaller.ts | 8 +- 367 files changed, 5532 insertions(+), 5532 deletions(-) diff --git a/Herebyfile.mjs b/Herebyfile.mjs index 38269cbcc3929..23ae58b896f13 100644 --- a/Herebyfile.mjs +++ b/Herebyfile.mjs @@ -32,7 +32,7 @@ const copyright = memoize(async () => { export const buildScripts = task({ name: "scripts", description: "Builds files in the 'scripts' folder.", - run: () => buildProject("scripts") + run: () => buildProject("scripts"), }); const libs = memoize(() => { @@ -77,7 +77,7 @@ export const generateDiagnostics = task({ description: "Generates a diagnostic file in TypeScript based on an input JSON file", run: async () => { await exec(process.execPath, ["scripts/processDiagnosticMessages.mjs", diagnosticMessagesJson]); - } + }, }); const cleanDiagnostics = task({ @@ -113,7 +113,7 @@ const localize = task({ if (needsUpdate(diagnosticMessagesGeneratedJson, generatedLCGFile)) { await exec(process.execPath, ["scripts/generateLocalizedDiagnosticMessages.mjs", "src/loc/lcl", "built/local", diagnosticMessagesGeneratedJson], { ignoreExitCode: true }); } - } + }, }); export const buildSrc = task({ @@ -210,7 +210,7 @@ function createBundler(entrypoint, outfile, taskOptions = {}) { await fs.promises.writeFile(outfile, contents); }); }, - } + }, ]; } @@ -236,7 +236,7 @@ function createBundler(entrypoint, outfile, taskOptions = {}) { onRebuild(); } }); - } + }, }]); } @@ -331,7 +331,7 @@ function entrypointBuildTask(options) { return watchProject(options.project); } return bundler.watch(); - } + }, }); return { build, bundle, shim, main, watch }; @@ -438,7 +438,7 @@ const lssl = task({ dependencies: [services], run: async () => { await fs.promises.writeFile("./built/local/tsserverlibrary.js", await fileContentsWithCopyright(lsslJs)); - } + }, }); export const dtsLssl = task({ @@ -448,7 +448,7 @@ export const dtsLssl = task({ run: async () => { await fs.promises.writeFile("./built/local/tsserverlibrary.d.ts", await fileContentsWithCopyright(lsslDts)); await fs.promises.writeFile("./built/local/tsserverlibrary.internal.d.ts", await fileContentsWithCopyright(lsslDtsInternal)); - } + }, }); export const dts = task({ @@ -473,7 +473,7 @@ const { main: tests, watch: watchTests } = entrypointBuildTask({ treeShaking: false, onWatchRebuild() { watchTestsEmitter.emit("rebuild"); - } + }, }, }); export { tests, watchTests }; @@ -506,7 +506,7 @@ export const lint = task({ console.log(`Linting: ${args.join(" ")}`); return exec(process.execPath, args); - } + }, }); const { main: cancellationToken, watch: watchCancellationToken } = entrypointBuildTask({ @@ -543,7 +543,7 @@ export const generateTypesMap = task({ const contents = await fs.promises.readFile(source, "utf-8"); JSON.parse(contents); // Validates that the JSON parses. await fs.promises.writeFile(target, contents); - } + }, }); @@ -558,7 +558,7 @@ const copyBuiltLocalDiagnosticMessages = task({ const contents = await fs.promises.readFile(diagnosticMessagesGeneratedJson, "utf-8"); JSON.parse(contents); // Validates that the JSON parses. await fs.promises.writeFile(builtLocalDiagnosticMessagesGeneratedJson, contents); - } + }, }); @@ -636,7 +636,7 @@ export const runTestsAndWatch = task({ "tests/projects/**/*.*", ], { ignorePermissionErrors: true, - alwaysStat: true + alwaysStat: true, }); process.on("SIGINT", endWatchMode); @@ -807,7 +807,7 @@ export const updateSublime = task({ for (const file of ["built/local/tsserver.js", "built/local/tsserver.js.map"]) { await fs.promises.copyFile(file, path.resolve("../TypeScript-Sublime-Plugin/tsserver/", path.basename(file))); } - } + }, }); @@ -839,7 +839,7 @@ export const produceLKG = task({ } await exec(process.execPath, ["scripts/produceLKG.mjs"]); - } + }, }); export const lkg = task({ diff --git a/scripts/build/options.mjs b/scripts/build/options.mjs index ce2aa1330cb67..092d94e816c14 100644 --- a/scripts/build/options.mjs +++ b/scripts/build/options.mjs @@ -16,7 +16,7 @@ const parsed = minimist(process.argv.slice(2), { "c": ["colors", "color"], "skippercent": "skipPercent", "w": "workers", - "f": "fix" + "f": "fix", /* eslint-enable quote-props */ }, default: { @@ -43,7 +43,7 @@ const parsed = minimist(process.argv.slice(2), { typecheck: true, lint: true, coverage: false, - } + }, }); /** @type {CommandLineOptions} */ diff --git a/scripts/build/tests.mjs b/scripts/build/tests.mjs index 205076f51dd3e..0e2ab86e4c68f 100644 --- a/scripts/build/tests.mjs +++ b/scripts/build/tests.mjs @@ -201,7 +201,7 @@ export function writeTestConfigFile(tests, runners, light, taskConfigsFolder, wo timeout, keepFailed, shards, - shardId + shardId, }); console.info("Running tests with config: " + testConfigContents); fs.writeFileSync("test.config", testConfigContents); diff --git a/scripts/eslint/rules/argument-trivia.cjs b/scripts/eslint/rules/argument-trivia.cjs index 49ec726dc4b04..1ffbabbd396a1 100644 --- a/scripts/eslint/rules/argument-trivia.cjs +++ b/scripts/eslint/rules/argument-trivia.cjs @@ -132,7 +132,7 @@ module.exports = createRule({ node, fix: (fixer) => { return fixer.insertTextBefore(node, `/*${expectedName}*/ `); - } + }, }); } else { @@ -167,7 +167,7 @@ module.exports = createRule({ node, fix: (fixer) => { return fixer.replaceTextRange([commentRangeEnd, argRangeStart], " "); - } + }, }); } }; diff --git a/scripts/eslint/rules/jsdoc-format.cjs b/scripts/eslint/rules/jsdoc-format.cjs index 140e22b5e4fd3..0f962efae9548 100644 --- a/scripts/eslint/rules/jsdoc-format.cjs +++ b/scripts/eslint/rules/jsdoc-format.cjs @@ -130,7 +130,7 @@ module.exports = createRule({ end: { line, column: actual - 1, - } + }, }, fix: (fixer) => { if (diff > 0) { diff --git a/scripts/eslint/rules/simple-indent.cjs b/scripts/eslint/rules/simple-indent.cjs index 958e04658ee29..779942cc0e34e 100644 --- a/scripts/eslint/rules/simple-indent.cjs +++ b/scripts/eslint/rules/simple-indent.cjs @@ -53,7 +53,7 @@ module.exports = createRule({ return fixer .replaceTextRange([rangeStart, rangeEnd], whitespace.replace(TAB_REGEX, " ".repeat(TAB_SIZE))); - } + }, }); } diff --git a/scripts/eslint/tests/argument-trivia.test.cjs b/scripts/eslint/tests/argument-trivia.test.cjs index 3e749bdf25512..7d81782aef411 100644 --- a/scripts/eslint/tests/argument-trivia.test.cjs +++ b/scripts/eslint/tests/argument-trivia.test.cjs @@ -80,7 +80,7 @@ fn(/* boolean arg */false); output:` const fn = (prop: boolean) => {}; fn(/* boolean arg */ false); - ` + `, }, ], }); diff --git a/scripts/eslint/tests/debug-assert.test.cjs b/scripts/eslint/tests/debug-assert.test.cjs index ae5961e41fc12..702017ff7afec 100644 --- a/scripts/eslint/tests/debug-assert.test.cjs +++ b/scripts/eslint/tests/debug-assert.test.cjs @@ -45,6 +45,6 @@ ruleTester.run("debug-assert", rule, { { messageId: "secondArgumentDebugAssertError" }, { messageId: "thirdArgumentDebugAssertError" }, ], - } + }, ], }); diff --git a/scripts/eslint/tests/no-keywords.test.cjs b/scripts/eslint/tests/no-keywords.test.cjs index 3618329b68aba..731b05a9d1ffe 100644 --- a/scripts/eslint/tests/no-keywords.test.cjs +++ b/scripts/eslint/tests/no-keywords.test.cjs @@ -76,7 +76,7 @@ interface Foo { number: string; } `, - } + }, ], invalid: [ @@ -144,14 +144,14 @@ interface A { code: `let [number, string] = [3, ''];`, errors: [ { messageId: "noKeywordsError" }, - { messageId: "noKeywordsError" } + { messageId: "noKeywordsError" }, ], }, { code: `let { String, Boolean } = { String: 1, Boolean: false };`, errors: [ { messageId: "noKeywordsError" }, - { messageId: "noKeywordsError" } + { messageId: "noKeywordsError" }, ], }, ], diff --git a/scripts/eslint/tests/object-literal-surrounding-space.test.cjs b/scripts/eslint/tests/object-literal-surrounding-space.test.cjs index 7c697af531fb9..4c0da58b37091 100644 --- a/scripts/eslint/tests/object-literal-surrounding-space.test.cjs +++ b/scripts/eslint/tests/object-literal-surrounding-space.test.cjs @@ -26,7 +26,7 @@ ruleTester.run("object-literal-surrounding-space", rule, { code: `const prop = {x: 1}`, errors: [ { messageId: "leadingStringError" }, - { messageId: "trailingStringError" } + { messageId: "trailingStringError" }, ], }, { diff --git a/scripts/eslint/tests/simple-indent.test.cjs b/scripts/eslint/tests/simple-indent.test.cjs index 0e4d925c56091..3b0f986708edb 100644 --- a/scripts/eslint/tests/simple-indent.test.cjs +++ b/scripts/eslint/tests/simple-indent.test.cjs @@ -15,7 +15,7 @@ ruleTester.run("simple-indent", rule, { /** * Comment */ - ` + `, }, { code: ` @@ -167,7 +167,7 @@ var obj = { { messageId: "simpleIndentError", line: 3, column: 2 }, { messageId: "simpleIndentError", line: 4, column: 2 }, { messageId: "simpleIndentError", line: 5, column: 2 }, - ] + ], }, { code: ` @@ -220,7 +220,7 @@ switch (integerValue) { { messageId: "simpleIndentError", line: 9, column: 2 }, { messageId: "simpleIndentError", line: 10, column: 3 }, { messageId: "simpleIndentError", line: 11, column: 3 }, - ] + ], }, { code: ` @@ -250,7 +250,7 @@ while (i < 1) { `, errors: [ { messageId: "simpleIndentError", line: 3, column: 2 }, - ] + ], }, { code: ` @@ -265,7 +265,7 @@ do { `, errors: [ { messageId: "simpleIndentError", line: 3, column: 2 }, - ] + ], }, { code: ` @@ -280,7 +280,7 @@ if (i < 1) { `, errors: [ { messageId: "simpleIndentError", line: 3, column: 2 }, - ] + ], }, { code: ` @@ -297,7 +297,7 @@ var arr = [ `, errors: [ { messageId: "simpleIndentError", line: 3, column: 2 }, - ] + ], }, { code: ` @@ -327,7 +327,7 @@ var arr2 = [ errors: [ { messageId: "simpleIndentError", line: 4, column: 3 }, { messageId: "simpleIndentError", line: 9, column: 3 }, - ] - } + ], + }, ], }); diff --git a/scripts/link-hooks.mjs b/scripts/link-hooks.mjs index c54456fcacf66..c0691059d1a40 100644 --- a/scripts/link-hooks.mjs +++ b/scripts/link-hooks.mjs @@ -8,7 +8,7 @@ const __filename = url.fileURLToPath(new URL(import.meta.url)); const __dirname = path.dirname(__filename); const hooks = [ - "post-checkout" + "post-checkout", ]; hooks.forEach((hook) => { diff --git a/scripts/open-cherry-pick-pr.mjs b/scripts/open-cherry-pick-pr.mjs index 6b9fc9b1ab2fa..72ad8bd8fb52b 100644 --- a/scripts/open-cherry-pick-pr.mjs +++ b/scripts/open-cherry-pick-pr.mjs @@ -22,30 +22,30 @@ async function main() { throw new Error("Source issue not specified"); } const currentSha = runSequence([ - ["git", ["rev-parse", "HEAD"]] + ["git", ["rev-parse", "HEAD"]], ]); const currentAuthor = runSequence([ - ["git", ["log", "-1", `--pretty="%aN <%aE>"`]] + ["git", ["log", "-1", `--pretty="%aN <%aE>"`]], ]); const gh = new Octokit({ - auth: process.argv[2] + auth: process.argv[2], }); const inputPR = (await gh.pulls.get({ pull_number: +process.env.SOURCE_ISSUE, owner: "microsoft", repo: "TypeScript" })).data; let remoteName = "origin"; if (inputPR.base.repo.git_url !== `git:github.com/microsoft/TypeScript` && inputPR.base.repo.git_url !== `git://github.com/microsoft/TypeScript`) { runSequence([ - ["git", ["remote", "add", "nonlocal", inputPR.base.repo.git_url.replace(/^git:(?:\/\/)?/, "https://")]] + ["git", ["remote", "add", "nonlocal", inputPR.base.repo.git_url.replace(/^git:(?:\/\/)?/, "https://")]], ]); remoteName = "nonlocal"; } const baseBranchName = inputPR.base.ref; runSequence([ - ["git", ["fetch", remoteName, baseBranchName]] + ["git", ["fetch", remoteName, baseBranchName]], ]); let logText = runSequence([ - ["git", ["log", `${remoteName}/${baseBranchName}..${currentSha.trim()}`, `--pretty="%h %s%n%b"`, "--reverse"]] + ["git", ["log", `${remoteName}/${baseBranchName}..${currentSha.trim()}`, `--pretty="%h %s%n%b"`, "--reverse"]], ]); logText = `Cherry-pick PR #${process.env.SOURCE_ISSUE} into ${process.env.TARGET_BRANCH} @@ -55,15 +55,15 @@ ${logText.trim()}`; const mergebase = runSequence([["git", ["merge-base", `${remoteName}/${baseBranchName}`, currentSha]]]).trim(); runSequence([ ["git", ["checkout", "-b", "temp-branch"]], - ["git", ["reset", mergebase, "--soft"]] + ["git", ["reset", mergebase, "--soft"]], ]); fs.writeFileSync(logpath, logText); runSequence([ - ["git", ["commit", "-F", logpath, `--author="${currentAuthor.trim()}"`]] + ["git", ["commit", "-F", logpath, `--author="${currentAuthor.trim()}"`]], ]); fs.unlinkSync(logpath); const squashSha = runSequence([ - ["git", ["rev-parse", "HEAD"]] + ["git", ["rev-parse", "HEAD"]], ]); runSequence([ ["git", ["checkout", process.env.TARGET_BRANCH]], // checkout the target branch @@ -74,12 +74,12 @@ ${logText.trim()}`; runSequence([ ["node", ["./node_modules/hereby/dist/cli.js", "LKG"]], ["git", ["add", "lib"]], - ["git", ["commit", "-m", `"Update LKG"`]] + ["git", ["commit", "-m", `"Update LKG"`]], ]); } runSequence([ ["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork - ["git", ["push", "--set-upstream", "fork", branchName, "-f"]] // push the branch + ["git", ["push", "--set-upstream", "fork", branchName, "-f"]], // push the branch ]); const r = await gh.pulls.create({ @@ -103,7 +103,7 @@ cc ${reviewers.map(r => "@" + r).join(" ")}`, issue_number: +process.env.SOURCE_ISSUE, owner: "Microsoft", repo: "TypeScript", - body: `Hey @${process.env.REQUESTING_USER}, I've opened #${num} for you.` + body: `Hey @${process.env.REQUESTING_USER}, I've opened #${num} for you.`, }); } @@ -112,13 +112,13 @@ main().catch(async e => { process.exitCode = 1; if (process.env.SOURCE_ISSUE) { const gh = new Octokit({ - auth: process.argv[2] + auth: process.argv[2], }); await gh.issues.createComment({ issue_number: +process.env.SOURCE_ISSUE, owner: "Microsoft", repo: "TypeScript", - body: `Hey @${process.env.REQUESTING_USER}, I couldn't open a PR with the cherry-pick. ([You can check the log here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary)). You may need to squash and pick this PR into ${process.env.TARGET_BRANCH} manually.` + body: `Hey @${process.env.REQUESTING_USER}, I couldn't open a PR with the cherry-pick. ([You can check the log here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary)). You may need to squash and pick this PR into ${process.env.TARGET_BRANCH} manually.`, }); } }); diff --git a/scripts/open-user-pr.mjs b/scripts/open-user-pr.mjs index f79e56f0fb71d..1bde80173644e 100644 --- a/scripts/open-user-pr.mjs +++ b/scripts/open-user-pr.mjs @@ -20,11 +20,11 @@ runSequence([ ["git", ["checkout", "-b", branchName]], // create a branch ["git", ["add", "."]], // Add all changes ["git", ["commit", "-m", `"Update user baselines${+(process.env.SOURCE_ISSUE ?? 0) === 33716 ? " +cc @sandersn" : ""}"`]], // Commit all changes (ping nathan if we would post to CI thread) - ["git", ["push", "--set-upstream", "fork", branchName, "-f"]] // push the branch + ["git", ["push", "--set-upstream", "fork", branchName, "-f"]], // push the branch ]); const gh = new Octokit({ - auth: process.argv[2] + auth: process.argv[2], }); const prOwner = branchName === masterBranchname ? "microsoft" : userName; gh.pulls.create({ @@ -55,7 +55,7 @@ cc ${reviewers.map(r => "@" + r).join(" ")}`, issue_number: +process.env.SOURCE_ISSUE, owner: "microsoft", repo: "TypeScript", - body: `The user suite test run you requested has finished and _failed_. I've opened a [PR with the baseline diff from master](${r.data.html_url}).` + body: `The user suite test run you requested has finished and _failed_. I've opened a [PR with the baseline diff from master](${r.data.html_url}).`, }); } }).then(() => { diff --git a/scripts/perf-result-post.mjs b/scripts/perf-result-post.mjs index 77ce392688828..87733764f527c 100644 --- a/scripts/perf-result-post.mjs +++ b/scripts/perf-result-post.mjs @@ -52,7 +52,7 @@ async function main() { issue_number: +source, owner: "Microsoft", repo: "TypeScript", - body: `@${requester}\nThe results of the perf run you requested are in!\n
Here they are:

\n${outputTableText}\n

${benchmarkText}
` + body: `@${requester}\nThe results of the perf run you requested are in!\n
Here they are:

\n${outputTableText}\n

${benchmarkText}
`, }); console.log(`Results posted!`); @@ -60,14 +60,14 @@ async function main() { const comment = await gh.issues.getComment({ owner: "Microsoft", repo: "TypeScript", - comment_id: +postedComment + comment_id: +postedComment, }); const newBody = `${comment.data.body}\n\nUpdate: [The results are in!](${newCommentUrl})`; await gh.issues.updateComment({ owner: "Microsoft", repo: "TypeScript", comment_id: +postedComment, - body: newBody + body: newBody, }); } catch (e) { @@ -76,7 +76,7 @@ async function main() { issue_number: +source, owner: "Microsoft", repo: "TypeScript", - body: `Hey @${requester}, something went wrong when publishing results. ([You can check the log here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${buildId}&_a=summary)).` + body: `Hey @${requester}, something went wrong when publishing results. ([You can check the log here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${buildId}&_a=summary)).`, }); } } diff --git a/scripts/post-vsts-artifact-comment.mjs b/scripts/post-vsts-artifact-comment.mjs index 8c345c5842798..0508c1b3fc65e 100644 --- a/scripts/post-vsts-artifact-comment.mjs +++ b/scripts/post-vsts-artifact-comment.mjs @@ -23,7 +23,7 @@ async function main() { tgzUrl.search = `artifactName=tgz&fileId=${file.blob.id}&fileName=${file.path}`; const link = "" + tgzUrl; const gh = new Octokit({ - auth: process.argv[2] + auth: process.argv[2], }); // Please keep the strings "an installable tgz" and "packed" in this message, as well as the devDependencies section, @@ -42,7 +42,7 @@ async function main() { } \`\`\` and then running \`npm install\`. -` +`, }); // Temporarily disable until we get access controls set up right @@ -55,13 +55,13 @@ main().catch(async e => { process.exitCode = 1; if (process.env.SOURCE_ISSUE) { const gh = new Octokit({ - auth: process.argv[2] + auth: process.argv[2], }); await gh.issues.createComment({ issue_number: +process.env.SOURCE_ISSUE, owner: "Microsoft", repo: "TypeScript", - body: `Hey @${process.env.REQUESTING_USER}, something went wrong when looking for the build artifact. ([You can check the log here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary)).` + body: `Hey @${process.env.REQUESTING_USER}, something went wrong when looking for the build artifact. ([You can check the log here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary)).`, }); } }); diff --git a/scripts/request-pr-review.mjs b/scripts/request-pr-review.mjs index 51c9e90e786a6..6f1825f5bd2a2 100644 --- a/scripts/request-pr-review.mjs +++ b/scripts/request-pr-review.mjs @@ -7,15 +7,15 @@ const options = minimist(process.argv.slice(2), { alias: { pr: "pull", h: "help", - ["?"]: "help" + ["?"]: "help", }, default: { token: process.env.GH_TOKEN, pull: process.env.GH_PULL_NUMBER, reviewer: process.env.REQUESTED_REVIEWER, owner: "microsoft", - repo: "TypeScript" - } + repo: "TypeScript", + }, }); if (options.help) { diff --git a/scripts/update-experimental-branches.mjs b/scripts/update-experimental-branches.mjs index 3251d8a0a7d0e..e604dd9d51181 100644 --- a/scripts/update-experimental-branches.mjs +++ b/scripts/update-experimental-branches.mjs @@ -13,7 +13,7 @@ const triggeredPR = process.env.SOURCE_ISSUE || process.env.SYSTEM_PULLREQUEST_P */ async function main() { const gh = new Octokit({ - auth: process.argv[2] + auth: process.argv[2], }); const prnums = (await gh.issues.listForRepo({ labels: "typescript@experimental", @@ -50,7 +50,7 @@ async function main() { owner: "Microsoft", repo: "TypeScript", issue_number: num, - body: `This PR is configured as an experiment, and currently has rebase conflicts with main - please rebase onto main and fix the conflicts.` + body: `This PR is configured as an experiment, and currently has rebase conflicts with main - please rebase onto main and fix the conflicts.`, }); } throw new Error(`Rebase conflict detected in PR ${num} with main`); // A PR is currently in conflict, give up @@ -83,7 +83,7 @@ async function main() { ]); // Simulate the merge and abort if there are conflicts const mergeTree = runSequence([ - ["git", ["merge-tree", mergeBase.trim(), branch, "experimental"]] + ["git", ["merge-tree", mergeBase.trim(), branch, "experimental"]], ]); if (mergeTree.indexOf(`===${"="}===`) >= 0) { // 7 equals is the center of the merge conflict marker throw new Error(`Merge conflict detected involving PR ${branch} with other experiment`); diff --git a/src/cancellationToken/cancellationToken.ts b/src/cancellationToken/cancellationToken.ts index 7f1b3998210e1..8ea543e01d473 100644 --- a/src/cancellationToken/cancellationToken.ts +++ b/src/cancellationToken/cancellationToken.ts @@ -29,7 +29,7 @@ function createCancellationToken(args: string[]): ServerCancellationToken { return { isCancellationRequested: () => false, setRequest: (_requestId: number): void => void 0, - resetRequest: (_requestId: number): void => void 0 + resetRequest: (_requestId: number): void => void 0, }; } // cancellationPipeName is a string without '*' inside that can optionally end with '*' @@ -55,14 +55,14 @@ function createCancellationToken(args: string[]): ServerCancellationToken { throw new Error(`Mismatched request id, expected ${currentRequestId}, actual ${requestId}`); } perRequestPipeName = undefined; - } + }, }; } else { return { isCancellationRequested: () => pipeExists(cancellationPipeName!), // TODO: GH#18217 setRequest: (_requestId: number): void => void 0, - resetRequest: (_requestId: number): void => void 0 + resetRequest: (_requestId: number): void => void 0, }; } } diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index cefe7b9c88797..c0cebf3f5b0c3 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -313,7 +313,7 @@ import { unusedLabelIsError, VariableDeclaration, WhileStatement, - WithStatement + WithStatement, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; @@ -321,7 +321,7 @@ import * as performance from "./_namespaces/ts.performance"; export const enum ModuleInstanceState { NonInstantiated = 0, Instantiated = 1, - ConstEnumOnly = 2 + ConstEnumOnly = 2, } interface ActiveLabel { @@ -1724,7 +1724,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void { name: node.label.escapedText, breakTarget: postStatementLabel, continueTarget: undefined, - referenced: false + referenced: false, }; bind(node.label); bind(node.statement); @@ -1868,7 +1868,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void { stackIndex: 0, skip: false, inStrictModeStack: [undefined], - parentStack: [undefined] + parentStack: [undefined], }; } // TODO: bindLogicalExpression is recursive - if we want to handle deeply nested `&&` expressions diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index 7eae60d4e434b..a83c741f7cdba 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -1115,7 +1115,7 @@ function getBuildInfo(state: BuilderProgramState, bundle: BundleBuildInfo | unde if (state.referencedMap) { referencedMap = arrayFrom(state.referencedMap.keys()).sort(compareStringsCaseSensitive).map(key => [ toFileId(key), - toFileIdListId(state.referencedMap!.getValues(key)!) + toFileIdListId(state.referencedMap!.getValues(key)!), ]); } @@ -1138,7 +1138,7 @@ function getBuildInfo(state: BuilderProgramState, bundle: BundleBuildInfo | unde value.length ? [ toFileId(key), - convertToReusableDiagnostics(value, relativeToBuildInfo) + convertToReusableDiagnostics(value, relativeToBuildInfo), ] : toFileId(key) ); @@ -1326,7 +1326,7 @@ function convertToReusableDiagnosticMessageChainArray(array: DiagnosticMessageCh /** @internal */ export enum BuilderProgramKind { SemanticDiagnosticsBuilderProgram, - EmitAndSemanticDiagnosticsBuilderProgram + EmitAndSemanticDiagnosticsBuilderProgram, } /** @internal */ @@ -1357,7 +1357,7 @@ export function getBuilderCreationParameters(newProgramOrRootNames: Program | re host: oldProgramOrHost as CompilerHost, oldProgram: oldProgram && oldProgram.getProgramOrUndefined(), configFileParsingDiagnostics, - projectReferences + projectReferences, }); host = oldProgramOrHost as CompilerHost; } @@ -1669,7 +1669,7 @@ export function createBuilderProgram(kind: BuilderProgramKind, { newProgram, hos emitSkipped, diagnostics: diagnostics || emptyArray, emittedFiles, - sourceMaps + sourceMaps, }; } // In non Emit builder, clear affected files pending emit diff --git a/src/compiler/builderState.ts b/src/compiler/builderState.ts index 5424336399c4e..d106723f0cec1 100644 --- a/src/compiler/builderState.ts +++ b/src/compiler/builderState.ts @@ -335,7 +335,7 @@ export namespace BuilderState { signature, // No need to calculate affectsGlobalScope with --out since its not used at all affectsGlobalScope: !isOutFile ? isFileAffectingGlobalScope(sourceFile) || undefined : undefined, - impliedFormat: sourceFile.impliedNodeFormat + impliedFormat: sourceFile.impliedNodeFormat, }); } @@ -343,7 +343,7 @@ export namespace BuilderState { fileInfos, referencedMap, exportedModulesMap, - useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState + useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState, }; } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 918da100936a7..5f52dab59b95a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1075,7 +1075,7 @@ import { WhileStatement, WideningContext, WithStatement, - YieldExpression + YieldExpression, } from "./_namespaces/ts"; import * as moduleSpecifiers from "./_namespaces/ts.moduleSpecifiers"; import * as performance from "./_namespaces/ts.performance"; @@ -1233,7 +1233,7 @@ const typeofNEFacts: ReadonlyMap = new Map(Object.entries({ symbol: TypeFacts.TypeofNESymbol, undefined: TypeFacts.NEUndefined, object: TypeFacts.TypeofNEObject, - function: TypeFacts.TypeofNEFunction + function: TypeFacts.TypeofNEFunction, })); type TypeSystemEntity = Node | Symbol | Type | Signature; @@ -1306,7 +1306,7 @@ const enum ExpandingFlags { const enum MembersOrExportsResolutionKind { resolvedExports = "resolvedExports", - resolvedMembers = "resolvedMembers" + resolvedMembers = "resolvedMembers", } const enum UnusedKind { @@ -1346,14 +1346,14 @@ const enum IntrinsicTypeKind { Uppercase, Lowercase, Capitalize, - Uncapitalize + Uncapitalize, } const intrinsicTypeKinds: ReadonlyMap = new Map(Object.entries({ Uppercase: IntrinsicTypeKind.Uppercase, Lowercase: IntrinsicTypeKind.Lowercase, Capitalize: IntrinsicTypeKind.Capitalize, - Uncapitalize: IntrinsicTypeKind.Uncapitalize + Uncapitalize: IntrinsicTypeKind.Uncapitalize, })); const SymbolLinks = class implements SymbolLinks { @@ -5313,7 +5313,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { target.set(id, sourceSymbol); if (lookupTable && exportNode) { lookupTable.set(id, { - specifierText: getTextOfNode(exportNode.moduleSpecifier!) + specifierText: getTextOfNode(exportNode.moduleSpecifier!), }); } } @@ -5961,7 +5961,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } // Any meaning of a module symbol is always accessible via an `import` type return { - accessibility: SymbolAccessibility.Accessible + accessibility: SymbolAccessibility.Accessible, }; } } @@ -5988,7 +5988,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (earlyModuleBail) { return { - accessibility: SymbolAccessibility.Accessible + accessibility: SymbolAccessibility.Accessible, }; } @@ -6160,7 +6160,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return (symbol && hasVisibleDeclarations(symbol, /*shouldComputeAliasToMakeVisible*/ true)) || { accessibility: SymbolAccessibility.NotAccessible, errorSymbolName: getTextOfNode(firstIdentifier), - errorNode: firstIdentifier + errorNode: firstIdentifier, }; } @@ -6313,7 +6313,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { visitedTypes: undefined, symbolDepth: undefined, inferTypeParameters: undefined, - approximateLength: 0 + approximateLength: 0, }; context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost); const resultingNode = cb(context); @@ -7248,7 +7248,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return [ typeToTypeNodeHelper(types[0], context), factory.createTypeReferenceNode(`... ${types.length - 2} more ...`, /*typeArguments*/ undefined), - typeToTypeNodeHelper(types[types.length - 1], context) + typeToTypeNodeHelper(types[types.length - 1], context), ]; } } @@ -7819,7 +7819,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { factory.createAssertEntry( factory.createStringLiteral("resolution-mode"), factory.createStringLiteral("import") - ) + ), ]))); context.tracker.reportImportTypeNodeResolutionModeOverride?.(); } @@ -7843,7 +7843,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { factory.createAssertEntry( factory.createStringLiteral("resolution-mode"), factory.createStringLiteral(swappedMode === ModuleKind.ESNext ? "import" : "require") - ) + ), ]))); context.tracker.reportImportTypeNodeResolutionModeOverride?.(); } @@ -8407,7 +8407,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const resolverHost = { getCanonicalFileName, getCurrentDirectory: () => context.tracker.moduleResolverHost!.getCurrentDirectory(), - getCommonSourceDirectory: () => context.tracker.moduleResolverHost!.getCommonSourceDirectory() + getCommonSourceDirectory: () => context.tracker.moduleResolverHost!.getCommonSourceDirectory(), }; const newName = getResolvedExternalModuleName(resolverHost, targetFile); return factory.createStringLiteral(newName); @@ -8564,7 +8564,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { /*isTypeOnly*/ false, factory.createNamedExports(flatMap(group, e => cast(e.exportClause, isNamedExports).elements)), group[0].moduleSpecifier - ) + ), ]; } } @@ -8770,7 +8770,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } else { const statement = setTextRange(factory.createVariableStatement(/*modifiers*/ undefined, factory.createVariableDeclarationList([ - factory.createVariableDeclaration(name, /*exclamationToken*/ undefined, serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled)) + factory.createVariableDeclaration(name, /*exclamationToken*/ undefined, serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled)), ], flags)), textRange); addResult(statement, name !== localName ? modifierFlags & ~ModifierFlags.Export : modifierFlags); if (name !== localName && !isPrivate) { @@ -9167,7 +9167,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { : anyType; const heritageClauses = [ ...!length(baseTypes) ? [] : [factory.createHeritageClause(SyntaxKind.ExtendsKeyword, map(baseTypes, b => serializeBaseType(b, staticBaseType, localName)))], - ...!length(implementsExpressions) ? [] : [factory.createHeritageClause(SyntaxKind.ImplementsKeyword, implementsExpressions)] + ...!length(implementsExpressions) ? [] : [factory.createHeritageClause(SyntaxKind.ImplementsKeyword, implementsExpressions)], ]; const symbolProps = getNonInheritedProperties(classType, baseTypes, getPropertiesOfType(classType)); const publicSymbolProps = filter(symbolProps, s => { @@ -9384,7 +9384,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { /*isTypeOnly*/ false, localName !== verbatimTargetName ? factory.createIdentifier(verbatimTargetName) : undefined, factory.createIdentifier(localName) - ) + ), ])), specifier, (node as ImportSpecifier).parent.parent.parent.assertClause, @@ -9511,7 +9511,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } else { const statement = factory.createVariableStatement(/*modifiers*/ undefined, factory.createVariableDeclarationList([ - factory.createVariableDeclaration(varName, /*exclamationToken*/ undefined, serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration, includePrivateSymbol, bundled)) + factory.createVariableDeclaration(varName, /*exclamationToken*/ undefined, serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration, includePrivateSymbol, bundled)), ], context.enclosingDeclaration?.kind === SyntaxKind.ModuleDeclaration ? NodeFlags.Let : NodeFlags.Const)); // Inlined JSON types exported with [module.]exports= will already emit an export=, so should use `declare`. // Otherwise, the type itself should be exported. @@ -9656,7 +9656,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { { name, questionToken: p.flags & SymbolFlags.Optional ? factory.createToken(SyntaxKind.QuestionToken) : undefined, - modifiers: flag ? factory.createModifiersFromModifierFlags(flag) : undefined + modifiers: flag ? factory.createModifiersFromModifierFlags(flag) : undefined, } ); const location = sig.declaration && isPrototypePropertyAssignment(sig.declaration.parent) ? sig.declaration.parent : sig.declaration; @@ -9745,7 +9745,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } const tempName = getUnusedName(`${rootName}_base`); const statement = factory.createVariableStatement(/*modifiers*/ undefined, factory.createVariableDeclarationList([ - factory.createVariableDeclaration(tempName, /*exclamationToken*/ undefined, typeToTypeNodeHelper(staticType, context)) + factory.createVariableDeclaration(tempName, /*exclamationToken*/ undefined, typeToTypeNodeHelper(staticType, context)), ], NodeFlags.Const)); addResult(statement, ModifierFlags.None); return factory.createExpressionWithTypeArguments(factory.createIdentifier(tempName), /*typeArguments*/ undefined); @@ -18075,7 +18075,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { outerTypeParameters, instantiations: undefined, aliasSymbol, - aliasTypeArguments + aliasTypeArguments, }; links.resolvedType = getConditionalType(root, /*mapper*/ undefined); if (outerTypeParameters) { @@ -20911,7 +20911,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { targetId: target.id, targetSize, pos: errorNode?.pos, - end: errorNode?.end + end: errorNode?.end, }); } } @@ -21322,7 +21322,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { targetId: target.id, targetIdStack: targetStack.map(t => t.id), depth: sourceDepth, - targetDepth + targetDepth, }); result = Ternary.Maybe; } @@ -24097,7 +24097,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { priority: undefined, topLevel: true, isFixed: false, - impliedArity: undefined + impliedArity: undefined, }; } @@ -24110,7 +24110,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { priority: inference.priority, topLevel: inference.topLevel, isFixed: inference.isFixed, - impliedArity: inference.impliedArity + impliedArity: inference.impliedArity, }; } @@ -34925,7 +34925,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return paramIdent ? { parameter: paramIdent, parameterName: param.escapedName, - isRestParameter: false + isRestParameter: false, } : undefined; } @@ -36389,7 +36389,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (node.operator === SyntaxKind.MinusToken) { return getFreshTypeOfLiteralType(getBigIntLiteralType({ negative: true, - base10Value: parsePseudoBigInt((node.operand as BigIntLiteral).text) + base10Value: parsePseudoBigInt((node.operand as BigIntLiteral).text), })); } } @@ -38045,7 +38045,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { checkGrammarBigIntLiteral(node as BigIntLiteral); return getFreshTypeOfLiteralType(getBigIntLiteralType({ negative: false, - base10Value: parsePseudoBigInt((node as BigIntLiteral).text) + base10Value: parsePseudoBigInt((node as BigIntLiteral).text), })); case SyntaxKind.TrueKeyword: return trueType; @@ -46940,7 +46940,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { firstAccessor, secondAccessor, setAccessor, - getAccessor + getAccessor, }; }, getSymbolOfExternalModuleSpecifier: moduleName => resolveExternalModuleNameWorker(moduleName, moduleName, /*moduleNotFoundError*/ undefined), diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 4004f0260ee8f..061a2d3aa56bf 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -301,7 +301,7 @@ export const optionsForWatch: CommandLineOption[] = [ name: "excludeDirectory", type: "string", isFilePath: true, - extraValidation: specToDiagnostic + extraValidation: specToDiagnostic, }, category: Diagnostics.Watch_and_Build_Modes, description: Diagnostics.Remove_a_list_of_directories_from_the_watch_process, @@ -313,7 +313,7 @@ export const optionsForWatch: CommandLineOption[] = [ name: "excludeFile", type: "string", isFilePath: true, - extraValidation: specToDiagnostic + extraValidation: specToDiagnostic, }, category: Diagnostics.Watch_and_Build_Modes, description: Diagnostics.Remove_a_list_of_files_from_the_watch_mode_s_processing, @@ -415,7 +415,7 @@ export const commonOptionsWithBuild: CommandLineOption[] = [ paramType: Diagnostics.FILE_OR_DIRECTORY, category: Diagnostics.Compiler_Diagnostics, description: Diagnostics.Emit_a_v8_CPU_profile_of_the_compiler_run_for_debugging, - defaultValueDescription: "profile.cpuprofile" + defaultValueDescription: "profile.cpuprofile", }, { name: "generateTrace", @@ -424,7 +424,7 @@ export const commonOptionsWithBuild: CommandLineOption[] = [ isCommandLineOnly: true, paramType: Diagnostics.DIRECTORY, category: Diagnostics.Compiler_Diagnostics, - description: Diagnostics.Generates_an_event_trace_and_a_list_of_types + description: Diagnostics.Generates_an_event_trace_and_a_list_of_types, }, { name: "incremental", @@ -433,7 +433,7 @@ export const commonOptionsWithBuild: CommandLineOption[] = [ category: Diagnostics.Projects, description: Diagnostics.Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects, transpileOptionValue: undefined, - defaultValueDescription: Diagnostics.false_unless_composite_is_set + defaultValueDescription: Diagnostics.false_unless_composite_is_set, }, { name: "declaration", @@ -456,7 +456,7 @@ export const commonOptionsWithBuild: CommandLineOption[] = [ category: Diagnostics.Emit, transpileOptionValue: undefined, defaultValueDescription: false, - description: Diagnostics.Create_sourcemaps_for_d_ts_files + description: Diagnostics.Create_sourcemaps_for_d_ts_files, }, { name: "emitDeclarationOnly", @@ -504,7 +504,7 @@ export const commonOptionsWithBuild: CommandLineOption[] = [ category: Diagnostics.Command_line_Options, isCommandLineOnly: true, description: Diagnostics.Set_the_language_of_the_messaging_from_TypeScript_This_does_not_affect_emit, - defaultValueDescription: Diagnostics.Platform_specific + defaultValueDescription: Diagnostics.Platform_specific, }, ]; @@ -644,7 +644,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ showInSimplifiedHelpView: true, category: Diagnostics.Language_and_Environment, description: Diagnostics.Specify_a_set_of_bundled_library_declaration_files_that_describe_the_target_runtime_environment, - transpileOptionValue: undefined + transpileOptionValue: undefined, }, { name: "allowJs", @@ -712,7 +712,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ paramType: Diagnostics.LOCATION, category: Diagnostics.Modules, description: Diagnostics.Specify_the_root_folder_within_your_source_files, - defaultValueDescription: Diagnostics.Computed_from_the_list_of_input_files + defaultValueDescription: Diagnostics.Computed_from_the_list_of_input_files, }, { name: "composite", @@ -826,7 +826,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ strictFlag: true, category: Diagnostics.Type_Checking, description: Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type, - defaultValueDescription: Diagnostics.false_unless_strict_is_set + defaultValueDescription: Diagnostics.false_unless_strict_is_set, }, { name: "strictNullChecks", @@ -836,7 +836,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ strictFlag: true, category: Diagnostics.Type_Checking, description: Diagnostics.When_type_checking_take_into_account_null_and_undefined, - defaultValueDescription: Diagnostics.false_unless_strict_is_set + defaultValueDescription: Diagnostics.false_unless_strict_is_set, }, { name: "strictFunctionTypes", @@ -846,7 +846,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ strictFlag: true, category: Diagnostics.Type_Checking, description: Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible, - defaultValueDescription: Diagnostics.false_unless_strict_is_set + defaultValueDescription: Diagnostics.false_unless_strict_is_set, }, { name: "strictBindCallApply", @@ -856,7 +856,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ strictFlag: true, category: Diagnostics.Type_Checking, description: Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function, - defaultValueDescription: Diagnostics.false_unless_strict_is_set + defaultValueDescription: Diagnostics.false_unless_strict_is_set, }, { name: "strictPropertyInitialization", @@ -866,7 +866,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ strictFlag: true, category: Diagnostics.Type_Checking, description: Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor, - defaultValueDescription: Diagnostics.false_unless_strict_is_set + defaultValueDescription: Diagnostics.false_unless_strict_is_set, }, { name: "noImplicitThis", @@ -876,7 +876,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ strictFlag: true, category: Diagnostics.Type_Checking, description: Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any, - defaultValueDescription: Diagnostics.false_unless_strict_is_set + defaultValueDescription: Diagnostics.false_unless_strict_is_set, }, { name: "useUnknownInCatchVariables", @@ -897,7 +897,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ strictFlag: true, category: Diagnostics.Type_Checking, description: Diagnostics.Ensure_use_strict_is_always_emitted, - defaultValueDescription: Diagnostics.false_unless_strict_is_set + defaultValueDescription: Diagnostics.false_unless_strict_is_set, }, // Additional Checks @@ -993,7 +993,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ paramType: Diagnostics.STRATEGY, category: Diagnostics.Modules, description: Diagnostics.Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier, - defaultValueDescription: Diagnostics.module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node + defaultValueDescription: Diagnostics.module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node, }, { name: "baseUrl", @@ -1001,7 +1001,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ affectsModuleResolution: true, isFilePath: true, category: Diagnostics.Modules, - description: Diagnostics.Specify_the_base_directory_to_resolve_non_relative_module_names + description: Diagnostics.Specify_the_base_directory_to_resolve_non_relative_module_names, }, { // this option can only be specified in tsconfig.json @@ -1012,7 +1012,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ isTSConfigOnly: true, category: Diagnostics.Modules, description: Diagnostics.Specify_a_set_of_entries_that_re_map_imports_to_additional_lookup_locations, - transpileOptionValue: undefined + transpileOptionValue: undefined, }, { // this option can only be specified in tsconfig.json @@ -1023,13 +1023,13 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ element: { name: "rootDirs", type: "string", - isFilePath: true + isFilePath: true, }, affectsModuleResolution: true, category: Diagnostics.Modules, description: Diagnostics.Allow_multiple_folders_to_be_treated_as_one_when_resolving_modules, transpileOptionValue: undefined, - defaultValueDescription: Diagnostics.Computed_from_the_list_of_input_files + defaultValueDescription: Diagnostics.Computed_from_the_list_of_input_files, }, { name: "typeRoots", @@ -1037,24 +1037,24 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ element: { name: "typeRoots", type: "string", - isFilePath: true + isFilePath: true, }, affectsModuleResolution: true, category: Diagnostics.Modules, - description: Diagnostics.Specify_multiple_folders_that_act_like_Slashnode_modules_Slash_types + description: Diagnostics.Specify_multiple_folders_that_act_like_Slashnode_modules_Slash_types, }, { name: "types", type: "list", element: { name: "types", - type: "string" + type: "string", }, affectsProgramStructure: true, showInSimplifiedHelpView: true, category: Diagnostics.Modules, description: Diagnostics.Specify_type_package_names_to_be_included_without_being_referenced_in_a_source_file, - transpileOptionValue: undefined + transpileOptionValue: undefined, }, { name: "allowSyntheticDefaultImports", @@ -1063,7 +1063,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ affectsBuildInfo: true, category: Diagnostics.Interop_Constraints, description: Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export, - defaultValueDescription: Diagnostics.module_system_or_esModuleInterop + defaultValueDescription: Diagnostics.module_system_or_esModuleInterop, }, { name: "esModuleInterop", @@ -1199,7 +1199,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ type: "string", category: Diagnostics.Language_and_Environment, description: Diagnostics.Specify_the_JSX_factory_function_used_when_targeting_React_JSX_emit_e_g_React_createElement_or_h, - defaultValueDescription: "`React.createElement`" + defaultValueDescription: "`React.createElement`", }, { name: "jsxFragmentFactory", @@ -1217,7 +1217,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ affectsModuleResolution: true, category: Diagnostics.Language_and_Environment, description: Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk, - defaultValueDescription: "react" + defaultValueDescription: "react", }, { name: "resolveJsonModule", @@ -1272,7 +1272,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ type: "string", category: Diagnostics.Backwards_Compatibility, description: Diagnostics.No_longer_supported_In_early_versions_manually_set_the_text_encoding_for_reading_files, - defaultValueDescription: "utf8" + defaultValueDescription: "utf8", }, { name: "emitBOM", @@ -1287,14 +1287,14 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ name: "newLine", type: new Map(Object.entries({ crlf: NewLineKind.CarriageReturnLineFeed, - lf: NewLineKind.LineFeed + lf: NewLineKind.LineFeed, })), affectsEmit: true, affectsBuildInfo: true, paramType: Diagnostics.NEWLINE, category: Diagnostics.Emit, description: Diagnostics.Set_the_newline_character_for_emitting_files, - defaultValueDescription: "lf" + defaultValueDescription: "lf", }, { name: "noErrorTruncation", @@ -1497,7 +1497,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ affectsBuildInfo: true, category: Diagnostics.Language_and_Environment, description: Diagnostics.Emit_ECMAScript_standard_compliant_class_fields, - defaultValueDescription: Diagnostics.true_for_ES2022_and_above_including_ESNext + defaultValueDescription: Diagnostics.true_for_ES2022_and_above_including_ESNext, }, { name: "preserveValueImports", @@ -1523,7 +1523,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ isTSConfigOnly: true, element: { name: "plugin", - type: "object" + type: "object", }, description: Diagnostics.Specify_a_list_of_language_service_plugins_to_include, category: Diagnostics.Editor_Support, @@ -1615,13 +1615,13 @@ export const optionsForBuild: CommandLineOption[] = [ description: Diagnostics.Delete_the_outputs_of_all_projects, type: "boolean", defaultValueDescription: false, - } + }, ]; /** @internal */ export const buildOpts: CommandLineOption[] = [ ...commonOptionsWithBuild, - ...optionsForBuild + ...optionsForBuild, ]; /** @internal */ @@ -1636,16 +1636,16 @@ export const typeAcquisitionDeclarations: CommandLineOption[] = [ type: "list", element: { name: "include", - type: "string" - } + type: "string", + }, }, { name: "exclude", type: "list", element: { name: "exclude", - type: "string" - } + type: "string", + }, }, { name: "disableFilenameBasedTypeAcquisition", @@ -1683,7 +1683,7 @@ export function getOptionsNameMap(): OptionsNameMap { const compilerOptionsAlternateMode: AlternateModeDiagnostics = { diagnostic: Diagnostics.Compiler_option_0_may_only_be_used_with_build, - getOptionsNameMap: getBuildOptionsNameMap + getOptionsNameMap: getBuildOptionsNameMap, }; /** @internal */ @@ -1693,7 +1693,7 @@ export const defaultInitCompilerOptions: CompilerOptions = { strict: true, esModuleInterop: true, forceConsistentCasingInFileNames: true, - skipLibCheck: true + skipLibCheck: true, }; /** @internal */ @@ -1785,7 +1785,7 @@ export function parseCommandLineWorker( options, watchOptions, fileNames, - errors + errors, }; function parseStrings(args: readonly string[]) { @@ -1937,7 +1937,7 @@ export const compilerOptionsDidYouMeanDiagnostics: ParseCommandLineWorkerDiagnos optionDeclarations, unknownOptionDiagnostic: Diagnostics.Unknown_compiler_option_0, unknownDidYouMeanDiagnostic: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1, - optionTypeMismatchDiagnostic: Diagnostics.Compiler_option_0_expects_an_argument + optionTypeMismatchDiagnostic: Diagnostics.Compiler_option_0_expects_an_argument, }; export function parseCommandLine(commandLine: readonly string[], readFile?: (path: string) => string | undefined): ParsedCommandLine { return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile); @@ -1976,7 +1976,7 @@ function getBuildOptionsNameMap(): OptionsNameMap { const buildOptionsAlternateMode: AlternateModeDiagnostics = { diagnostic: Diagnostics.Compiler_option_0_may_not_be_used_with_build, - getOptionsNameMap + getOptionsNameMap, }; const buildOptionsDidYouMeanDiagnostics: ParseCommandLineWorkerDiagnostics = { @@ -1985,7 +1985,7 @@ const buildOptionsDidYouMeanDiagnostics: ParseCommandLineWorkerDiagnostics = { optionDeclarations: buildOpts, unknownOptionDiagnostic: Diagnostics.Unknown_build_option_0, unknownDidYouMeanDiagnostic: Diagnostics.Unknown_build_option_0_Did_you_mean_1, - optionTypeMismatchDiagnostic: Diagnostics.Build_option_0_requires_a_value_of_type_1 + optionTypeMismatchDiagnostic: Diagnostics.Build_option_0_requires_a_value_of_type_1, }; /** @internal */ @@ -2094,7 +2094,7 @@ export function parseConfigFileTextToJson(fileName: string, jsonText: string): { const jsonSourceFile = parseJsonText(fileName, jsonText); return { config: convertConfigFileToObject(jsonSourceFile, jsonSourceFile.parseDiagnostics, /*jsonConversionNotifier*/ undefined), - error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : undefined + error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : undefined, }; } @@ -2138,7 +2138,7 @@ const watchOptionsDidYouMeanDiagnostics: ParseCommandLineWorkerDiagnostics = { optionDeclarations: optionsForWatch, unknownOptionDiagnostic: Diagnostics.Unknown_watch_option_0, unknownDidYouMeanDiagnostic: Diagnostics.Unknown_watch_option_0_Did_you_mean_1, - optionTypeMismatchDiagnostic: Diagnostics.Watch_option_0_requires_a_value_of_type_1 + optionTypeMismatchDiagnostic: Diagnostics.Watch_option_0_requires_a_value_of_type_1, }; let commandLineCompilerOptionsMapCache: Map; @@ -2159,7 +2159,7 @@ const extendsOptionDeclaration: CommandLineOptionOfListType = { type: "listOrElement", element: { name: "extends", - type: "string" + type: "string", }, category: Diagnostics.File_Management, disallowNullOrUndefined: true, @@ -2180,7 +2180,7 @@ const typeAcquisitionDeclaration: TsConfigOnlyOption = { name: "typeAcquisition", type: "object", elementOptions: getCommandLineTypeAcquisitionMap(), - extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics + extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics, }; let _tsconfigRootOptions: TsConfigOnlyOption; function getTsconfigRootOptionsMap() { @@ -2198,7 +2198,7 @@ function getTsconfigRootOptionsMap() { type: "list", element: { name: "references", - type: "object" + type: "object", }, category: Diagnostics.Projects, }, @@ -2207,7 +2207,7 @@ function getTsconfigRootOptionsMap() { type: "list", element: { name: "files", - type: "string" + type: "string", }, category: Diagnostics.File_Management, }, @@ -2216,23 +2216,23 @@ function getTsconfigRootOptionsMap() { type: "list", element: { name: "include", - type: "string" + type: "string", }, category: Diagnostics.File_Management, - defaultValueDescription: Diagnostics.if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk + defaultValueDescription: Diagnostics.if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk, }, { name: "exclude", type: "list", element: { name: "exclude", - type: "string" + type: "string", }, category: Diagnostics.File_Management, - defaultValueDescription: Diagnostics.node_modules_bower_components_jspm_packages_plus_the_value_of_outDir_if_one_is_specified + defaultValueDescription: Diagnostics.node_modules_bower_components_jspm_packages_plus_the_value_of_outDir_if_one_is_specified, }, - compileOnSaveCommandLineOption - ]) + compileOnSaveCommandLineOption, + ]), }; } return _tsconfigRootOptions; @@ -2492,9 +2492,9 @@ export function convertToTSConfig(configParseResult: ParsedCommandLine, configFi files: length(files) ? files : undefined, ...(configParseResult.options.configFile?.configFileSpecs ? { include: filterSameAsDefaultInclude(configParseResult.options.configFile.configFileSpecs.validatedIncludeSpecs), - exclude: configParseResult.options.configFile.configFileSpecs.validatedExcludeSpecs + exclude: configParseResult.options.configFile.configFileSpecs.validatedExcludeSpecs, } : {}), - compileOnSave: !!configParseResult.compileOnSave ? true : undefined + compileOnSave: !!configParseResult.compileOnSave ? true : undefined, }; return config; } @@ -2714,7 +2714,7 @@ export function generateTSConfig(options: CompilerOptions, fileNames: readonly s } entries.push({ value: optionName, - description: `/* ${option.description && getLocaleSpecificMessage(option.description) || option.name} */` + description: `/* ${option.description && getLocaleSpecificMessage(option.description) || option.name} */`, }); marginLength = Math.max(optionName.length, marginLength); } @@ -2968,7 +2968,7 @@ function parseJsonConfigFileContentWorker( path: getNormalizedAbsolutePath(ref.path, basePath), originalPath: ref.path, prepend: ref.prepend, - circular: ref.circular + circular: ref.circular, }); } } @@ -3838,13 +3838,13 @@ function getWildcardDirectoryFromSpec(spec: string, useCaseSensitiveFileNames: b key: useCaseSensitiveFileNames ? match[0] : toFileNameLowerCase(match[0]), flags: (questionWildcardIndex !== -1 && questionWildcardIndex < lastDirectorySeperatorIndex) || (starWildcardIndex !== -1 && starWildcardIndex < lastDirectorySeperatorIndex) - ? WatchDirectoryFlags.Recursive : WatchDirectoryFlags.None + ? WatchDirectoryFlags.Recursive : WatchDirectoryFlags.None, }; } if (isImplicitGlob(spec.substring(spec.lastIndexOf(directorySeparator) + 1))) { return { key: removeTrailingDirectorySeparator(useCaseSensitiveFileNames ? spec : toFileNameLowerCase(spec)), - flags: WatchDirectoryFlags.Recursive + flags: WatchDirectoryFlags.Recursive, }; } return undefined; diff --git a/src/compiler/corePublic.ts b/src/compiler/corePublic.ts index 9ae5e9b94db4f..f3a93f6fcd2bf 100644 --- a/src/compiler/corePublic.ts +++ b/src/compiler/corePublic.ts @@ -54,5 +54,5 @@ export type Comparer = (a: T, b: T) => Comparison; export const enum Comparison { LessThan = -1, EqualTo = 0, - GreaterThan = 1 + GreaterThan = 1, } diff --git a/src/compiler/debug.ts b/src/compiler/debug.ts index 21d7fa6129bb1..0f683237d9d7c 100644 --- a/src/compiler/debug.ts +++ b/src/compiler/debug.ts @@ -100,7 +100,7 @@ export enum LogLevel { Error, Warning, Info, - Verbose + Verbose, } /** @internal */ @@ -522,10 +522,10 @@ export namespace Debug { "UnknownFlow"; const remainingFlags = this.flags & ~(FlowFlags.Referenced - 1); return `${flowHeader}${remainingFlags ? ` (${formatFlowFlags(remainingFlags)})`: ""}`; - } + }, }, __debugFlowFlags: { get(this: FlowNodeBase) { return formatEnum(this.flags, (ts as any).FlowFlags, /*isFlags*/ true); } }, - __debugToString: { value(this: FlowNodeBase) { return formatControlFlowGraph(this); } } + __debugToString: { value(this: FlowNodeBase) { return formatControlFlowGraph(this); } }, }); } } @@ -563,8 +563,8 @@ export namespace Debug { // we're just taking note of it for anyone checking regex performance in the future. defaultValue = String(defaultValue).replace(/(?:,[\s\w\d_]+:[^,]+)+\]$/, "]"); return `NodeArray ${defaultValue}`; - } - } + }, + }, }); } } @@ -607,9 +607,9 @@ export namespace Debug { "Symbol"; const remainingSymbolFlags = this.flags & ~SymbolFlags.Transient; return `${symbolHeader} '${symbolName(this)}'${remainingSymbolFlags ? ` (${formatSymbolFlags(remainingSymbolFlags)})` : ""}`; - } + }, }, - __debugFlags: { get(this: Symbol) { return formatSymbolFlags(this.flags); } } + __debugFlags: { get(this: Symbol) { return formatSymbolFlags(this.flags); } }, }); Object.defineProperties(objectAllocator.getTypeConstructor().prototype, { @@ -642,7 +642,7 @@ export namespace Debug { "Type"; const remainingObjectFlags = this.flags & TypeFlags.Object ? (this as ObjectType).objectFlags & ~ObjectFlags.ObjectTypeKindMask : 0; return `${typeHeader}${this.symbol ? ` '${symbolName(this.symbol)}'` : ""}${remainingObjectFlags ? ` (${formatObjectFlags(remainingObjectFlags)})` : ""}`; - } + }, }, __debugFlags: { get(this: Type) { return formatTypeFlags(this.flags); } }, __debugObjectFlags: { get(this: Type) { return this.flags & TypeFlags.Object ? formatObjectFlags((this as ObjectType).objectFlags) : ""; } }, @@ -655,20 +655,20 @@ export namespace Debug { weakTypeTextMap.set(this, text); } return text; - } + }, }, }); Object.defineProperties(objectAllocator.getSignatureConstructor().prototype, { __debugFlags: { get(this: Signature) { return formatSignatureFlags(this.flags); } }, - __debugSignatureToString: { value(this: Signature) { return this.checker?.signatureToString(this); } } + __debugSignatureToString: { value(this: Signature) { return this.checker?.signatureToString(this); } }, }); const nodeConstructors = [ objectAllocator.getNodeConstructor(), objectAllocator.getIdentifierConstructor(), objectAllocator.getTokenConstructor(), - objectAllocator.getSourceFileConstructor() + objectAllocator.getSourceFileConstructor(), ]; for (const ctor of nodeConstructors) { @@ -716,7 +716,7 @@ export namespace Debug { isImportTypeNode(this) ? "ImportTypeNode" : formatSyntaxKind(this.kind); return `${nodeHeader}${this.flags ? ` (${formatNodeFlags(this.flags)})` : ""}`; - } + }, }, __debugKind: { get(this: Node) { return formatSyntaxKind(this.kind); } }, __debugNodeFlags: { get(this: Node) { return formatNodeFlags(this.flags); } }, @@ -736,8 +736,8 @@ export namespace Debug { weakNodeTextMap.set(this, text); } return text; - } - } + }, + }, }); } } @@ -938,7 +938,7 @@ m2: ${(this.mapper2 as unknown as DebugTypeMapper).__debugToString().split("\n") lane: -1, endLane: -1, level: -1, - circular: "circularity" + circular: "circularity", }; nodes.push(graphNode); return graphNode; diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 228c58bb8a856..d1a2fb968643c 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -785,7 +785,7 @@ export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFi buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory())); bundleBuildInfo = { commonSourceDirectory: relativeToBuildInfo(host.getCommonSourceDirectory()), - sourceFiles: sourceFileOrBundle.sourceFiles.map(file => relativeToBuildInfo(getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()))) + sourceFiles: sourceFileOrBundle.sourceFiles.map(file => relativeToBuildInfo(getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()))), }; } tracing?.push(tracing.Phase.Emit, "emitJsFileOrBundle", { jsFilePath }); @@ -867,7 +867,7 @@ export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFi inlineSources: compilerOptions.inlineSources, extendedDiagnostics: compilerOptions.extendedDiagnostics, writeBundleFileInfo: !!bundleBuildInfo, - relativeToBuildInfo + relativeToBuildInfo, }; // Create a printer to print the nodes @@ -927,7 +927,7 @@ export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFi onlyPrintJsDocStyle: true, writeBundleFileInfo: !!bundleBuildInfo, recordInternalSection: !!bundleBuildInfo, - relativeToBuildInfo + relativeToBuildInfo, }; const declarationPrinter = createPrinter(printerOptions, { @@ -1003,7 +1003,7 @@ export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFi if (sourceMapDataList) { sourceMapDataList.push({ inputSourceFileNames: sourceMapGenerator.getSources(), - sourceMap: sourceMapGenerator.toJSON() + sourceMap: sourceMapGenerator.toJSON(), }); } @@ -1381,7 +1381,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri onBeforeEmitNodeArray, onAfterEmitNodeArray, onBeforeEmitToken, - onAfterEmitToken + onAfterEmitToken, } = handlers; var extendedDiagnostics = !!printerOptions.extendedDiagnostics; @@ -1438,7 +1438,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri var { enter: enterComment, exit: exitComment } = performance.createTimerIf(extendedDiagnostics, "commentTime", "beforeComment", "afterComment"); var parenthesizer = factory.parenthesizer; var typeArgumentParenthesizerRuleSelector: OrdinalParentheizerRuleSelector = { - select: index => index === 0 ? parenthesizer.parenthesizeLeadingTypeArgument : undefined + select: index => index === 0 ? parenthesizer.parenthesizeLeadingTypeArgument : undefined, }; var emitBinaryExpression = createEmitBinaryExpression(); /* eslint-enable no-var */ @@ -1456,7 +1456,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri writeList, writeFile, writeBundle, - bundleFileInfo + bundleFileInfo, }; function printNode(hint: EmitHint, node: Node, sourceFile: SourceFile): string { @@ -1596,7 +1596,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri end: writer.getTextPos(), kind: BundleFileSectionKind.Prepend, data: relativeToBuildInfo!((prepend as UnparsedSource).fileName), - texts: newSections as BundleFileTextLike[] + texts: newSections as BundleFileTextLike[], }); } } @@ -4720,8 +4720,8 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri expression: { pos: statement.expression.pos, end: statement.expression.end, - text: statement.expression.text - } + text: statement.expression.text, + }, }); end = end < statement.end ? statement.end : end; } diff --git a/src/compiler/factory/baseNodeFactory.ts b/src/compiler/factory/baseNodeFactory.ts index 5641e25703ebe..9ea81cdf5632b 100644 --- a/src/compiler/factory/baseNodeFactory.ts +++ b/src/compiler/factory/baseNodeFactory.ts @@ -35,7 +35,7 @@ export function createBaseNodeFactory(): BaseNodeFactory { createBaseIdentifierNode, createBasePrivateIdentifierNode, createBaseTokenNode, - createBaseNode + createBaseNode, }; function createBaseSourceFileNode(kind: SyntaxKind.SourceFile): Node { diff --git a/src/compiler/factory/emitHelpers.ts b/src/compiler/factory/emitHelpers.ts index e198c123f302b..4cc0264b13c48 100644 --- a/src/compiler/factory/emitHelpers.ts +++ b/src/compiler/factory/emitHelpers.ts @@ -41,7 +41,7 @@ import { export const enum PrivateIdentifierKind { Field = "f", Method = "m", - Accessor = "a" + Accessor = "a", } /** @@ -231,7 +231,7 @@ export function createEmitHelperFactory(context: TransformationContext): EmitHel /*typeArguments*/ undefined, [ factory.createStringLiteral(metadataKey), - metadataValue + metadataValue, ] ); } @@ -244,7 +244,7 @@ export function createEmitHelperFactory(context: TransformationContext): EmitHel /*typeArguments*/ undefined, [ factory.createNumericLiteral(parameterOffset + ""), - expression + expression, ] ), location @@ -313,7 +313,7 @@ export function createEmitHelperFactory(context: TransformationContext): EmitHel accessor, factory.createIdentifier("value") ) - ) + ), ]) ) ); @@ -382,7 +382,7 @@ export function createEmitHelperFactory(context: TransformationContext): EmitHel decorators, createESDecorateContextObject(contextIn), initializers, - extraInitializers + extraInitializers, ]); } @@ -428,7 +428,7 @@ export function createEmitHelperFactory(context: TransformationContext): EmitHel [ hasLexicalThis ? factory.createThis() : factory.createVoidZero(), factory.createIdentifier("arguments"), - generatorFunc + generatorFunc, ] ); } @@ -521,7 +521,7 @@ export function createEmitHelperFactory(context: TransformationContext): EmitHel hasLexicalThis ? factory.createThis() : factory.createVoidZero(), hasLexicalArguments ? factory.createIdentifier("arguments") : factory.createVoidZero(), promiseConstructor ? createExpressionFromEntityName(factory, promiseConstructor) : factory.createVoidZero(), - generatorFunc + generatorFunc, ] ); } @@ -735,7 +735,7 @@ export const decorateHelper: UnscopedEmitHelper = { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; - };` + };`, }; /** @internal */ @@ -747,7 +747,7 @@ export const metadataHelper: UnscopedEmitHelper = { text: ` var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); - };` + };`, }; /** @internal */ @@ -759,7 +759,7 @@ export const paramHelper: UnscopedEmitHelper = { text: ` var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } - };` + };`, }; // ES Decorators Helpers @@ -796,7 +796,7 @@ export const esDecorateHelper: UnscopedEmitHelper = { } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; - };` + };`, }; /** @internal */ @@ -812,7 +812,7 @@ export const runInitializersHelper: UnscopedEmitHelper = { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; - };` + };`, }; // ES2018 Helpers @@ -834,7 +834,7 @@ export const assignHelper: UnscopedEmitHelper = { return t; }; return __assign.apply(this, arguments); - };` + };`, }; /** @internal */ @@ -843,7 +843,7 @@ export const awaitHelper: UnscopedEmitHelper = { importName: "__await", scoped: false, text: ` - var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }` + var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }`, }; /** @internal */ @@ -863,7 +863,7 @@ export const asyncGeneratorHelper: UnscopedEmitHelper = { function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - };` + };`, }; /** @internal */ @@ -877,7 +877,7 @@ export const asyncDelegator: UnscopedEmitHelper = { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } - };` + };`, }; /** @internal */ @@ -892,7 +892,7 @@ export const asyncValues: UnscopedEmitHelper = { return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - };` + };`, }; // ES2018 Destructuring Helpers @@ -913,7 +913,7 @@ export const restHelper: UnscopedEmitHelper = { t[p[i]] = s[p[i]]; } return t; - };` + };`, }; // ES2017 Helpers @@ -933,7 +933,7 @@ export const awaiterHelper: UnscopedEmitHelper = { function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); - };` + };`, }; // ES2015 Helpers @@ -960,7 +960,7 @@ export const extendsHelper: UnscopedEmitHelper = { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; - })();` + })();`, }; /** @internal */ @@ -973,7 +973,7 @@ export const templateObjectHelper: UnscopedEmitHelper = { var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; - };` + };`, }; /** @internal */ @@ -997,7 +997,7 @@ export const readHelper: UnscopedEmitHelper = { finally { if (e) throw e.error; } } return ar; - };` + };`, }; /** @internal */ @@ -1014,7 +1014,7 @@ export const spreadArrayHelper: UnscopedEmitHelper = { } } return to.concat(ar || Array.prototype.slice.call(from)); - };` + };`, }; /** @internal */ @@ -1025,7 +1025,7 @@ export const propKeyHelper: UnscopedEmitHelper = { text: ` var __propKey = (this && this.__propKey) || function (x) { return typeof x === "symbol" ? x : "".concat(x); - };` + };`, }; // https://tc39.es/ecma262/#sec-setfunctionname @@ -1038,7 +1038,7 @@ export const setFunctionNameHelper: UnscopedEmitHelper = { var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); - };` + };`, }; // ES2015 Destructuring Helpers @@ -1059,7 +1059,7 @@ export const valuesHelper: UnscopedEmitHelper = { } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - };` + };`, }; // ES2015 Generator Helpers @@ -1158,7 +1158,7 @@ export const generatorHelper: UnscopedEmitHelper = { } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } - };` + };`, }; // ES Module Helpers @@ -1180,7 +1180,7 @@ export const createBindingHelper: UnscopedEmitHelper = { }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; - }));` + }));`, }; /** @internal */ @@ -1194,7 +1194,7 @@ export const setModuleDefaultHelper: UnscopedEmitHelper = { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; - });` + });`, }; // emit helper for `import * as Name from "foo"` @@ -1212,7 +1212,7 @@ export const importStarHelper: UnscopedEmitHelper = { if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; - };` + };`, }; // emit helper for `import Name from "foo"` @@ -1224,7 +1224,7 @@ export const importDefaultHelper: UnscopedEmitHelper = { text: ` var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; - };` + };`, }; /** @internal */ @@ -1237,7 +1237,7 @@ export const exportStarHelper: UnscopedEmitHelper = { text: ` var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); - };` + };`, }; /** @@ -1299,7 +1299,7 @@ export const classPrivateFieldGetHelper: UnscopedEmitHelper = { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); - };` + };`, }; /** @@ -1365,7 +1365,7 @@ export const classPrivateFieldSetHelper: UnscopedEmitHelper = { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; - };` + };`, }; /** @@ -1390,7 +1390,7 @@ export const classPrivateFieldInHelper: UnscopedEmitHelper = { var __classPrivateFieldIn = (this && this.__classPrivateFieldIn) || function(state, receiver) { if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); return typeof state === "function" ? receiver === state : state.has(receiver); - };` + };`, }; /** @@ -1420,7 +1420,7 @@ export const addDisposableResourceHelper: UnscopedEmitHelper = { env.stack.push({ async: true }); } return value; - };` + };`, }; /** @@ -1455,7 +1455,7 @@ export const disposeResourcesHelper: UnscopedEmitHelper = { })(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; - });` + });`, }; let allUnscopedEmitHelpers: ReadonlyMap | undefined; @@ -1501,7 +1501,7 @@ export const asyncSuperHelper: EmitHelper = { name: "typescript:async-super", scoped: true, text: helperString` - const ${"_superIndex"} = name => super[name];` + const ${"_superIndex"} = name => super[name];`, }; /** @internal */ @@ -1512,7 +1512,7 @@ export const advancedAsyncSuperHelper: EmitHelper = { const ${"_superIndex"} = (function (geti, seti) { const cache = Object.create(null); return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } }); - })(name => super[name], (name, value) => super[name] = value);` + })(name => super[name], (name, value) => super[name] = value);`, }; /** @internal */ diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 5a33d53ed4dc9..741c52dd70710 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -1179,7 +1179,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode flags: autoGenerateFlags, id: nextAutoGenerateId, prefix, - suffix + suffix, }); nextAutoGenerateId++; return node; @@ -6378,7 +6378,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode /*modifiers*/ undefined, /*isTypeOnly*/ false, createNamedExports([ - createExportSpecifier(/*isTypeOnly*/ false, /*propertyName*/ undefined, exportName) + createExportSpecifier(/*isTypeOnly*/ false, /*propertyName*/ undefined, exportName), ]) ); } @@ -6649,9 +6649,9 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode /*initializer*/ undefined )], createBlock([ - createExpressionStatement(expression) + createExpressionStatement(expression), ]) - ) + ), ]) ), "value" diff --git a/src/compiler/factory/utilities.ts b/src/compiler/factory/utilities.ts index 221d4874d5226..f587b65b9043d 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -178,7 +178,7 @@ import { Token, TransformFlags, TypeNode, - WrappedExpression + WrappedExpression, } from "../_namespaces/ts"; // Compound nodes @@ -412,7 +412,7 @@ function createExpressionForAccessorDeclaration(factory: NodeFactory, properties setAccessor ), setAccessor - ) + ), }, !multiLine) ), firstAccessor @@ -1658,7 +1658,7 @@ export function createAccessorPropertyGetRedirector(factory: NodeFactory, node: receiver, factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage") ) - ) + ), ]) ); } @@ -1686,7 +1686,7 @@ export function createAccessorPropertySetRedirector(factory: NodeFactory, node: ), factory.createIdentifier("value") ) - ) + ), ]) ); } diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index c229d42be1b36..90b40bacfcc21 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -132,7 +132,7 @@ function withPackageId(packageInfo: PackageJsonInfo | undefined, r: PathAndExten packageId = { name: packageJsonContent.name, subModuleName: r.path.slice(packageInfo.packageDirectory.length + directorySeparator.length), - version: packageJsonContent.version + version: packageJsonContent.version, }; } } @@ -1080,7 +1080,7 @@ export function createModeAwareCache(): ModeAwareCache { }, size() { return underlying.size; - } + }, }; return cache; @@ -2243,7 +2243,7 @@ function loadEntrypointsFromExportMap( entrypoints = appendIfUnique(entrypoints, { path: entry, ext: getAnyExtensionFromPath(entry), - resolvedUsingTsExtension: undefined + resolvedUsingTsExtension: undefined, }); }); } @@ -2672,7 +2672,7 @@ function getLoadModuleFromTargetImportOrExport(extensions: Extensions, state: Mo extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath, - resolvedUsingTsExtension: result.resolvedModule.resolvedUsingTsExtension + resolvedUsingTsExtension: result.resolvedModule.resolvedUsingTsExtension, } : undefined); } if (state.traceEnabled) { @@ -3124,8 +3124,8 @@ function tryFindNonRelativeModuleNameInCache(cache: NonRelativeModuleNameResolut originalPath: result.resolvedModule.originalPath || true, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, - resolvedUsingTsExtension: result.resolvedModule.resolvedUsingTsExtension - } + resolvedUsingTsExtension: result.resolvedModule.resolvedUsingTsExtension, + }, }; } } diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts index eeeeb75615994..a50a9ba23944c 100644 --- a/src/compiler/moduleSpecifiers.ts +++ b/src/compiler/moduleSpecifiers.ts @@ -759,7 +759,7 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl: string, paths: MapLike ({ ending, - value: processEnding(relativeToBaseUrl, [ending], compilerOptions) + value: processEnding(relativeToBaseUrl, [ending], compilerOptions), })); if (tryGetExtensionFromPath(pattern)) { candidates.push({ ending: undefined, value: relativeToBaseUrl }); @@ -805,7 +805,7 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl: string, paths: MapLike Node; @@ -1336,7 +1336,7 @@ export function createSourceFile(fileName: string, sourceText: string, languageV const { languageVersion, setExternalModuleIndicator: overrideSetExternalModuleIndicator, - impliedNodeFormat: format + impliedNodeFormat: format, } = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions : ({ languageVersion: languageVersionOrOptions } as CreateSourceFileOptions); if (languageVersion === ScriptTarget.JSON) { result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, ScriptKind.JSON, noop); @@ -1442,7 +1442,7 @@ namespace Parser { createBaseIdentifierNode: kind => countNode(new IdentifierConstructor(kind, /*pos*/ 0, /*end*/ 0)), createBasePrivateIdentifierNode: kind => countNode(new PrivateIdentifierConstructor(kind, /*pos*/ 0, /*end*/ 0)), createBaseTokenNode: kind => countNode(new TokenConstructor(kind, /*pos*/ 0, /*end*/ 0)), - createBaseNode: kind => countNode(new NodeConstructor(kind, /*pos*/ 0, /*end*/ 0)) + createBaseNode: kind => countNode(new NodeConstructor(kind, /*pos*/ 0, /*end*/ 0)), }; var factory = createNodeFactory(NodeFactoryFlags.NoParenthesizerRules | NodeFactoryFlags.NoNodeConverters | NodeFactoryFlags.NoOriginalNode, baseNodeFactory); @@ -8608,13 +8608,13 @@ namespace Parser { ImportOrExportSpecifiers, // Named import clause's import specifier list, AssertEntries, // Import entries list. JSDocComment, // Parsing via JSDocParser - Count // Number of parsing contexts + Count, // Number of parsing contexts } const enum Tristate { False, True, - Unknown + Unknown, } export namespace JSDocParser { @@ -9834,7 +9834,7 @@ namespace IncrementalParser { // end, forward or backward appropriately. const updatedDirective: CommentDirective = { range: { pos: range.pos + delta, end: range.end + delta }, - type + type, }; commentDirectives = append(commentDirectives, updatedDirective); if (aggressiveChecks) { @@ -10280,7 +10280,7 @@ namespace IncrementalParser { // Either we don'd have a node, or we have a node at the position being asked for. Debug.assert(!current || current.pos === position); return current as IncrementalNode; - } + }, }; // Finds the highest element in the tree we can find that starts at the provided position. @@ -10342,7 +10342,7 @@ namespace IncrementalParser { } const enum InvalidPosition { - Value = -1 + Value = -1, } } @@ -10459,7 +10459,7 @@ export function processPragmasIntoFields(context: PragmaContext, reportDiagnosti context.checkJsDirective = { enabled: key === "ts-check", end: entry.range.end, - pos: entry.range.pos + pos: entry.range.pos, }; } }); @@ -10510,7 +10510,7 @@ function extractPragmas(pragmas: PragmaPseudoMapEntry[], range: CommentRange, te argument[arg.name] = { value, pos: startPos, - end: startPos + value.length + end: startPos + value.length, }; } else { diff --git a/src/compiler/performance.ts b/src/compiler/performance.ts index 4f2096ec7204f..1605fa5e3562a 100644 --- a/src/compiler/performance.ts +++ b/src/compiler/performance.ts @@ -35,7 +35,7 @@ export function createTimer(measureName: string, startMarkName: string, endMarkN let enterCount = 0; return { enter, - exit + exit, }; function enter() { diff --git a/src/compiler/performanceCore.ts b/src/compiler/performanceCore.ts index 3f8a459bb0d75..6e1317878e69b 100644 --- a/src/compiler/performanceCore.ts +++ b/src/compiler/performanceCore.ts @@ -75,7 +75,7 @@ function tryGetWebPerformanceHooks(): PerformanceHooks | undefined { // in the browser also slow down compilation. shouldWriteNativeEvents: true, performance, - PerformanceObserver + PerformanceObserver, }; } } @@ -89,7 +89,7 @@ function tryGetNodePerformanceHooks(): PerformanceHooks | undefined { // By default, only write native events when generating a cpu profile or using the v8 profiler. shouldWriteNativeEvents: false, performance, - PerformanceObserver + PerformanceObserver, }; } } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 9d1c258cec3e5..dcd2820be9ca5 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -500,7 +500,7 @@ export function createCompilerHostWorker(options: CompilerOptions, setParentNode realpath, readDirectory: (path, extensions, include, exclude, depth) => system.readDirectory(path, extensions, include, exclude, depth), createDirectory: d => system.createDirectory(d), - createHash: maybeBind(system, system.createHash) + createHash: maybeBind(system, system.createHash), }; return compilerHost; } @@ -625,7 +625,7 @@ export function changeCompilerHostLikeToUseCache( originalCreateDirectory, originalWriteFile, getSourceFileWithCache, - readFileWithCache + readFileWithCache, }; } @@ -680,7 +680,7 @@ export enum ForegroundColorEscapeSequences { Red = "\u001b[91m", Yellow = "\u001b[93m", Blue = "\u001b[94m", - Cyan = "\u001b[96m" + Cyan = "\u001b[96m", } const gutterStyleSequence = "\u001b[7m"; const gutterSeparator = " "; @@ -1689,7 +1689,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg toPath, getResolvedProjectReferences, getSourceOfProjectReferenceRedirect, - forEachResolvedProjectReference + forEachResolvedProjectReference, }); const readFile = host.readFile.bind(host) as typeof host.readFile; @@ -1952,7 +1952,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg if (!resolution.resolutionDiagnostics?.length) return; (fileProcessingDiagnostics ??= []).push({ kind: FilePreprocessingDiagnosticsKind.ResolutionDiagnostics, - diagnostics: resolution.resolutionDiagnostics + diagnostics: resolution.resolutionDiagnostics, }); } @@ -3810,7 +3810,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg isDefaultLib, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined, - { kind: FileIncludeKind.ReferenceFile, file: file.path, index, } + { kind: FileIncludeKind.ReferenceFile, file: file.path, index } ); }); } @@ -3834,11 +3834,11 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg (fileProcessingDiagnostics ??= []).push({ kind: FilePreprocessingDiagnosticsKind.ResolutionDiagnostics, diagnostics: [ - createDiagnosticForRange(file, ref, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext) - ] + createDiagnosticForRange(file, ref, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext), + ], }); } - processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: FileIncludeKind.TypeReferenceDirective, file: file.path, index, }); + processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: FileIncludeKind.TypeReferenceDirective, file: file.path, index }); } } @@ -3958,7 +3958,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg resolution, actual: resolution.resolvedModule ? resolution.resolvedModule.resolvedFileName : - combinePaths(defaultLibraryPath, libFileName) + combinePaths(defaultLibraryPath, libFileName), }; (resolvedLibProcessing ??= new Map()).set(libFileName, result); return result; @@ -3969,7 +3969,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg const { libName, libFileName } = getLibFileNameFromLibReference(libReference); if (libFileName) { // we ignore any 'no-default-lib' reference set on this file. - processRootFile(pathForLibFile(libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ true, { kind: FileIncludeKind.LibReferenceDirective, file: file.path, index, }); + processRootFile(pathForLibFile(libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ true, { kind: FileIncludeKind.LibReferenceDirective, file: file.path, index }); } else { const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts"); @@ -3978,7 +3978,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg const args = suggestion ? [libName, suggestion] : [libName]; (fileProcessingDiagnostics ||= []).push({ kind: FilePreprocessingDiagnosticsKind.FilePreprocessingReferencedDiagnostic, - reason: { kind: FileIncludeKind.LibReferenceDirective, file: file.path, index, }, + reason: { kind: FileIncludeKind.LibReferenceDirective, file: file.path, index }, diagnostic, args, }); @@ -4042,7 +4042,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg resolvedFileName, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, - { kind: FileIncludeKind.Import, file: file.path, index, }, + { kind: FileIncludeKind.Import, file: file.path, index }, resolution.packageId, ); } @@ -4621,7 +4621,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg file: file && file.path, fileProcessingReason, diagnostic, - args + args, }); } @@ -5085,7 +5085,7 @@ function updateHostForUseSourceOfProjectReferenceRedirect(host: HostForUseSource symlinkCache.setSymlinkedDirectory(directory, { real: ensureTrailingDirectorySeparator(real), - realPath + realPath, }); } @@ -5151,7 +5151,7 @@ export function handleNoEmitOptions( ...program.getOptionsDiagnostics(cancellationToken), ...program.getSyntacticDiagnostics(sourceFile, cancellationToken), ...program.getGlobalDiagnostics(cancellationToken), - ...program.getSemanticDiagnostics(sourceFile, cancellationToken) + ...program.getSemanticDiagnostics(sourceFile, cancellationToken), ]; if (diagnostics.length === 0 && getEmitDeclarations(program.getCompilerOptions())) { diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index 7d6ac150c05e8..13008786adea0 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -1053,7 +1053,7 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD actualWatcher.close(); // Ensure when watching symlinked package.json, we can close the actual file watcher only once actualWatcher = noopFileWatcher; - } + }, } : actualWatcher, resolutions: forResolution ? 1 : 0, files: forResolution ? 0 : 1, @@ -1400,7 +1400,7 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD arrayToMap(typeRoots, tr => resolutionHost.toPath(tr)), { createNewValue: createTypeRootsWatch, - onDeleteValue: closeFileWatcher + onDeleteValue: closeFileWatcher, } ); } diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index ccba86326b1cf..a5543e6ca014b 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -292,8 +292,8 @@ const textToToken = new Map(Object.entries({ Codepoint ranges for ES3 Identifiers are extracted from the Unicode 3.0.0 specification at: http://www.unicode.org/Public/3.0-Update/UnicodeData-3.0.0.txt */ -const unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, ]; -const unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, ]; +const unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500 ]; +const unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500 ]; /* As per ECMAScript Language Specification 5th Edition, Section 7.6: ISyntaxToken Names and Identifiers @@ -317,8 +317,8 @@ const unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 2 Codepoint ranges for ES5 Identifiers are extracted from the Unicode 6.2 specification at: http://www.unicode.org/Public/6.2.0/ucd/UnicodeData.txt */ -const unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, ]; -const unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, ]; +const unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500 ]; +const unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500 ]; /** * Generated by scripts/regenerate-unicode-identifier-parts.js on node v12.4.0 with unicode 12.1 @@ -482,7 +482,7 @@ export function computeLineAndCharacterOfPosition(lineStarts: readonly number[], const lineNumber = computeLineOfPosition(lineStarts, position); return { line: lineNumber, - character: position - lineStarts[lineNumber] + character: position - lineStarts[lineNumber], }; } diff --git a/src/compiler/semver.ts b/src/compiler/semver.ts index d17e8c55c1cd6..93fa1cdd5c5bf 100644 --- a/src/compiler/semver.ts +++ b/src/compiler/semver.ts @@ -122,7 +122,7 @@ export class Version { minor = this.minor, patch = this.patch, prerelease = this.prerelease, - build = this.build + build = this.build, } = fields; return new Version(major, minor, patch, prerelease, build); } @@ -147,7 +147,7 @@ function tryParseComponents(text: string) { minor: parseInt(minor, 10), patch: parseInt(patch, 10), prerelease, - build + build, }; } diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index 78ebf13ba0878..7f5254006b487 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -81,7 +81,7 @@ export function createSourceMapGenerator(host: EmitHost, file: string, sourceRoo addMapping, appendSourceMap, toJSON, - toString: () => JSON.stringify(toJSON()) + toString: () => JSON.stringify(toJSON()), }; function addSource(fileName: string) { @@ -373,7 +373,7 @@ export interface LineInfo { export function getLineInfo(text: string, lineStarts: readonly number[]): LineInfo { return { getLineCount: () => lineStarts.length, - getLineText: line => text.substring(lineStarts[line], lineStarts[line + 1]) + getLineText: line => text.substring(lineStarts[line], lineStarts[line + 1]), }; } @@ -529,7 +529,7 @@ export function decodeMappings(mappings: string): MappingsDecoder { }, [Symbol.iterator]() { return this; - } + }, }; function captureMapping(hasSource: true, hasName: true): Required; @@ -541,7 +541,7 @@ export function decodeMappings(mappings: string): MappingsDecoder { sourceIndex: hasSource ? sourceIndex : undefined, sourceLine: hasSource ? sourceLine : undefined, sourceCharacter: hasSource ? sourceCharacter : undefined, - nameIndex: hasName ? nameIndex : undefined + nameIndex: hasName ? nameIndex : undefined, }; } @@ -700,7 +700,7 @@ export function createDocumentPositionMapper(host: DocumentPositionMapperHost, m return { getSourcePosition, - getGeneratedPosition + getGeneratedPosition, }; function processMapping(mapping: Mapping): MappedPosition { @@ -721,7 +721,7 @@ export function createDocumentPositionMapper(host: DocumentPositionMapperHost, m source, sourceIndex: mapping.sourceIndex, sourcePosition, - nameIndex: mapping.nameIndex + nameIndex: mapping.nameIndex, }; } @@ -810,5 +810,5 @@ export function createDocumentPositionMapper(host: DocumentPositionMapperHost, m /** @internal */ export const identitySourceMapConsumer: DocumentPositionMapper = { getSourcePosition: identity, - getGeneratedPosition: identity + getGeneratedPosition: identity, }; diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index db12d3a6dd96e..293f0c5597820 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -81,7 +81,7 @@ export function setStackTraceLimit() { export enum FileWatcherEventKind { Created, Changed, - Deleted + Deleted, } export type FileWatcherCallback = (fileName: string, eventKind: FileWatcherEventKind, modifiedTime?: Date) => void; @@ -96,7 +96,7 @@ interface WatchedFile { export enum PollingInterval { High = 2000, Medium = 500, - Low = 250 + Low = 250, } /** @internal */ @@ -122,7 +122,7 @@ function createPollingIntervalBasedLevels(levels: Levels) { return { [PollingInterval.Low]: levels.Low, [PollingInterval.Medium]: levels.Medium, - [PollingInterval.High]: levels.High + [PollingInterval.High]: levels.High, }; } @@ -263,7 +263,7 @@ function createDynamicPriorityPollingWatchFile(host: { fileName, callback, unchangedPolls: 0, - mtime: getModifiedTime(host, fileName) + mtime: getModifiedTime(host, fileName), }; watchedFiles.push(file); @@ -274,7 +274,7 @@ function createDynamicPriorityPollingWatchFile(host: { // Remove from watchedFiles unorderedRemoveItem(watchedFiles, file); // Do not update polling interval queue since that will happen as part of polling - } + }, }; } @@ -402,7 +402,7 @@ function createUseFsEventsOnParentDirectoryWatchFile(fsWatch: FsWatch, useCaseSe watcher.referenceCount--; } fileWatcherCallbacks.remove(filePath, callback); - } + }, }; } @@ -445,7 +445,7 @@ function createFixedChunkSizePollingWatchFile(host: { const file: WatchedFileWithIsClosed = { fileName, callback, - mtime: getModifiedTime(host, fileName) + mtime: getModifiedTime(host, fileName), }; watchedFiles.push(file); scheduleNextPoll(); @@ -453,7 +453,7 @@ function createFixedChunkSizePollingWatchFile(host: { close: () => { file.isClosed = true; unorderedRemoveItem(watchedFiles, file); - } + }, }; } @@ -492,7 +492,7 @@ function createSingleWatcherPerName cache.get(path)?.callbacks.slice().forEach(cb => cb(param1, param2, param3)) ) as T), - callbacks: [callback] + callbacks: [callback], }); } @@ -505,7 +505,7 @@ function createSingleWatcherPerName FileWatcher) { @@ -1609,7 +1609,7 @@ export let sys: System = (() => { catch (error) { return { module: undefined, modulePath: undefined, error }; } - } + }, }; return nodeSystem; @@ -1737,7 +1737,7 @@ export let sys: System = (() => { _fs.watchFile(fileName, { persistent: true, interval: pollingInterval }, fileChanged); let eventKind: FileWatcherEventKind; return { - close: () => _fs.unwatchFile(fileName, fileChanged) + close: () => _fs.unwatchFile(fileName, fileChanged), }; function fileChanged(curr: import("fs").Stats, prev: import("fs").Stats) { diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index f8c1ee5d5eeca..ff2c467ccaa1f 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -72,7 +72,7 @@ import { transformNodeModule, transformSystemModule, transformTypeScript, - VariableDeclaration + VariableDeclaration, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; @@ -97,7 +97,7 @@ const enum TransformationState { Uninitialized, Initialized, Completed, - Disposed + Disposed, } const enum SyntaxKindFeatureFlags { @@ -304,7 +304,7 @@ export function transformNodes(resolver: EmitResolver | undefine }, addDiagnostic(diag) { diagnostics.push(diag); - } + }, }; // Ensure the parse tree is clean before applying transformations @@ -346,7 +346,7 @@ export function transformNodes(resolver: EmitResolver | undefine emitNodeWithNotification, isEmitNotificationEnabled, dispose, - diagnostics + diagnostics, }; function transformRoot(node: T) { @@ -600,7 +600,7 @@ export function transformNodes(resolver: EmitResolver | undefine blockScopedVariableDeclarations.map(identifier => factory.createVariableDeclaration(identifier)), NodeFlags.Let ) - ) + ), ] : undefined; blockScopeStackOffset--; blockScopedVariableDeclarations = blockScopedVariableDeclarationsStack[blockScopeStackOffset]; diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index aa4fb43ebc954..d0227308c3479 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -224,7 +224,7 @@ import { visitNodes, Visitor, visitParameterList, - VisitResult + VisitResult, } from "../_namespaces/ts"; const enum ClassPropertySubstitutionFlags { @@ -358,7 +358,7 @@ export function transformClassFields(context: TransformationContext): (x: Source endLexicalEnvironment, startLexicalEnvironment, resumeLexicalEnvironment, - addBlockScopedVariable + addBlockScopedVariable, } = context; const resolver = context.getEmitResolver(); const compilerOptions = context.getCompilerOptions(); @@ -3285,7 +3285,7 @@ function createPrivateStaticFieldInitializer(factory: NodeFactory, variableName: return factory.createAssignment( variableName, factory.createObjectLiteralExpression([ - factory.createPropertyAssignment("value", initializer || factory.createVoidZero()) + factory.createPropertyAssignment("value", initializer || factory.createVoidZero()), ]) ); } diff --git a/src/compiler/transformers/classThis.ts b/src/compiler/transformers/classThis.ts index b03cd68144b09..e85711caf7a04 100644 --- a/src/compiler/transformers/classThis.ts +++ b/src/compiler/transformers/classThis.ts @@ -20,7 +20,7 @@ import { some, Statement, SyntaxKind, - ThisExpression + ThisExpression, } from "../_namespaces/ts"; /** @@ -58,7 +58,7 @@ export type ClassThisAssignmentBlock = ClassStaticBlockDeclaration & { readonly left: Identifier; readonly right: ThisExpression; }; - } + }, ]; }; }; diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index f3530aacc8413..f4d9d9124c990 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -484,7 +484,7 @@ export function transformDeclarations(context: TransformationContext) { diagnosticMessage: s.errorModuleName ? Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit : Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit, - errorNode: s.errorNode || sourceFile + errorNode: s.errorNode || sourceFile, })); const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker, bundled); getSymbolAccessibilityDiagnostic = oldDiag; @@ -1394,7 +1394,7 @@ export function transformDeclarations(context: TransformationContext) { const newId = factory.createUniqueName("_default", GeneratedIdentifierFlags.Optimistic); getSymbolAccessibilityDiagnostic = () => ({ diagnosticMessage: Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0, - errorNode: input + errorNode: input, }); errorFallbackNode = input; const varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); @@ -1708,7 +1708,7 @@ export function transformDeclarations(context: TransformationContext) { /*questionOrExclamationToken*/ undefined, /*type*/ undefined, /*initializer*/ undefined - ) + ), ] : undefined; const memberNodes = concatenate(concatenate(privateIdentifier, parameterProperties), visitNodes(input.members, visitDeclarationSubtree, isClassElement)); const members = factory.createNodeArray(memberNodes); @@ -1722,7 +1722,7 @@ export function transformDeclarations(context: TransformationContext) { getSymbolAccessibilityDiagnostic = () => ({ diagnosticMessage: Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1, errorNode: extendsClause, - typeName: input.name + typeName: input.name, }); const varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(extendsClause.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); const statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(SyntaxKind.DeclareKeyword)] : [], factory.createVariableDeclarationList([varDecl], NodeFlags.Const)); diff --git a/src/compiler/transformers/declarations/diagnostics.ts b/src/compiler/transformers/declarations/diagnostics.ts index 2e3154aa7f710..6d7494bf96eb8 100644 --- a/src/compiler/transformers/declarations/diagnostics.ts +++ b/src/compiler/transformers/declarations/diagnostics.ts @@ -144,7 +144,7 @@ export function createGetSymbolAccessibilityDiagnosticForNodeName(node: Declarat return diagnosticMessage !== undefined ? { diagnosticMessage, errorNode: node, - typeName: (node as NamedDeclaration).name + typeName: (node as NamedDeclaration).name, } : undefined; } @@ -175,7 +175,7 @@ export function createGetSymbolAccessibilityDiagnosticForNodeName(node: Declarat return diagnosticMessage !== undefined ? { diagnosticMessage, errorNode: node, - typeName: (node as NamedDeclaration).name + typeName: (node as NamedDeclaration).name, } : undefined; } @@ -276,7 +276,7 @@ export function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationD return diagnosticMessage !== undefined ? { diagnosticMessage, errorNode: node, - typeName: (node as NamedDeclaration).name + typeName: (node as NamedDeclaration).name, } : undefined; } @@ -315,7 +315,7 @@ export function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationD return { diagnosticMessage, errorNode: (node as NamedDeclaration).name!, - typeName: (node as NamedDeclaration).name + typeName: (node as NamedDeclaration).name, }; } @@ -381,7 +381,7 @@ export function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationD return { diagnosticMessage, - errorNode: (node as NamedDeclaration).name || node + errorNode: (node as NamedDeclaration).name || node, }; } @@ -390,7 +390,7 @@ export function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationD return diagnosticMessage !== undefined ? { diagnosticMessage, errorNode: node, - typeName: (node as NamedDeclaration).name + typeName: (node as NamedDeclaration).name, } : undefined; } @@ -523,7 +523,7 @@ export function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationD return { diagnosticMessage, errorNode: node, - typeName: (node as NamedDeclaration).name + typeName: (node as NamedDeclaration).name, }; } @@ -545,7 +545,7 @@ export function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationD return { diagnosticMessage, errorNode: node, - typeName: getNameOfDeclaration(node.parent.parent as Declaration) + typeName: getNameOfDeclaration(node.parent.parent as Declaration), }; } @@ -553,7 +553,7 @@ export function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationD return { diagnosticMessage: Diagnostics.Import_declaration_0_is_using_private_name_1, errorNode: node, - typeName: (node as NamedDeclaration).name + typeName: (node as NamedDeclaration).name, }; } diff --git a/src/compiler/transformers/destructuring.ts b/src/compiler/transformers/destructuring.ts index 27a991d0f3402..d2a8f645c8a59 100644 --- a/src/compiler/transformers/destructuring.ts +++ b/src/compiler/transformers/destructuring.ts @@ -128,7 +128,7 @@ export function flattenDestructuringAssignment( createArrayBindingOrAssignmentPattern: elements => makeArrayAssignmentPattern(context.factory, elements), createObjectBindingOrAssignmentPattern: elements => makeObjectAssignmentPattern(context.factory, elements), createArrayBindingOrAssignmentElement: makeAssignmentElement, - visitor + visitor, }; if (value) { @@ -258,7 +258,7 @@ export function flattenDestructuringBinding( createArrayBindingOrAssignmentPattern: elements => makeArrayBindingPattern(context.factory, elements), createObjectBindingOrAssignmentPattern: elements => makeObjectBindingPattern(context.factory, elements), createArrayBindingOrAssignmentElement: name => makeBindingElement(context.factory, name), - visitor + visitor, }; if (isVariableDeclaration(node)) { diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index 5e2b895a23498..89d03fea707bc 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -208,7 +208,7 @@ import { VisitResult, VoidExpression, WhileStatement, - YieldExpression + YieldExpression, } from "../_namespaces/ts"; const enum ES2015SubstitutionFlags { @@ -270,13 +270,13 @@ const enum LoopOutParameterFlags { const enum CopyDirection { ToOriginal, - ToOutParameter + ToOutParameter, } const enum Jump { Break = 1 << 1, Continue = 1 << 2, - Return = 1 << 3 + Return = 1 << 3, } interface ConvertedLoopState { @@ -825,7 +825,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile node.expression ? Debug.checkDefined(visitNode(node.expression, visitor, isExpression)) : factory.createVoidZero() - ) + ), ] ) ); @@ -1447,7 +1447,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile factory.createNodeArray( [ ...prologue, - ...statements + ...statements, ] ), /*location*/ constructor.body.statements @@ -1675,7 +1675,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile ), EmitFlags.NoComments ) - ) + ), ]), parameter ), @@ -1739,7 +1739,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile /*exclamationToken*/ undefined, /*type*/ undefined, factory.createArrayLiteralExpression([]) - ) + ), ]) ), /*location*/ parameter @@ -1754,7 +1754,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile const forStatement = factory.createForStatement( setTextRange( factory.createVariableDeclarationList([ - factory.createVariableDeclaration(temp, /*exclamationToken*/ undefined, /*type*/ undefined, factory.createNumericLiteral(restIndex)) + factory.createVariableDeclaration(temp, /*exclamationToken*/ undefined, /*type*/ undefined, factory.createNumericLiteral(restIndex)), ]), parameter ), @@ -1782,7 +1782,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile ), /*location*/ parameter ) - ) + ), ]) ); @@ -1856,7 +1856,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile /*exclamationToken*/ undefined, /*type*/ undefined, initializer - ) + ), ]) ); setEmitFlags(captureThisStatement, EmitFlags.NoComments | EmitFlags.CustomPrologue); @@ -1923,7 +1923,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile /*exclamationToken*/ undefined, /*type*/ undefined, newTarget - ) + ), ]) ); @@ -2088,7 +2088,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile [ target, propertyName, - factory.createObjectLiteralExpression(properties, /*multiLine*/ true) + factory.createObjectLiteralExpression(properties, /*multiLine*/ true), ] ); if (startsOnNewLine) { @@ -2749,7 +2749,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile /*exclamationToken*/ undefined, /*type*/ undefined, boundValue - ) + ), ]), moveRangePos(initializer, -1) ), @@ -2842,7 +2842,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile setTextRange( factory.createVariableDeclarationList([ setTextRange(factory.createVariableDeclaration(counter, /*exclamationToken*/ undefined, /*type*/ undefined, factory.createNumericLiteral(0)), moveRangePos(node.expression, -1)), - setTextRange(factory.createVariableDeclaration(rhsReference, /*exclamationToken*/ undefined, /*type*/ undefined, expression), node.expression) + setTextRange(factory.createVariableDeclaration(rhsReference, /*exclamationToken*/ undefined, /*type*/ undefined, expression), node.expression), ]), node.expression ), @@ -2897,7 +2897,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile setTextRange( factory.createVariableDeclarationList([ setTextRange(factory.createVariableDeclaration(iterator, /*exclamationToken*/ undefined, /*type*/ undefined, initializer), node.expression), - factory.createVariableDeclaration(result, /*exclamationToken*/ undefined, /*type*/ undefined, next) + factory.createVariableDeclaration(result, /*exclamationToken*/ undefined, /*type*/ undefined, next), ]), node.expression ), @@ -2922,7 +2922,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile forStatement, outermostLabeledStatement, convertedLoopState && resetLabel - ) + ), ]), factory.createCatchClause(factory.createVariableDeclaration(catchVariable), setEmitFlags( @@ -2931,10 +2931,10 @@ export function transformES2015(context: TransformationContext): (x: SourceFile factory.createAssignment( errorRecord, factory.createObjectLiteralExpression([ - factory.createPropertyAssignment("error", catchVariable) + factory.createPropertyAssignment("error", catchVariable), ]) ) - ) + ), ]), EmitFlags.SingleLine ) @@ -2974,11 +2974,11 @@ export function transformES2015(context: TransformationContext): (x: SourceFile ) ), EmitFlags.SingleLine - ) + ), ]), EmitFlags.SingleLine ) - ) + ), ]) ); } @@ -3426,7 +3426,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile ), emitFlags ) - ) + ), ]), EmitFlags.NoHoisting ) @@ -3568,7 +3568,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile ), emitFlags ) - ) + ), ] ), EmitFlags.NoHoisting diff --git a/src/compiler/transformers/es2016.ts b/src/compiler/transformers/es2016.ts index 33df5b94f0d0b..2692f63d12b10 100644 --- a/src/compiler/transformers/es2016.ts +++ b/src/compiler/transformers/es2016.ts @@ -21,7 +21,7 @@ import { export function transformES2016(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle { const { factory, - hoistVariableDeclaration + hoistVariableDeclaration, } = context; return chainBundle(context, transformSourceFile); diff --git a/src/compiler/transformers/es2017.ts b/src/compiler/transformers/es2017.ts index 1c1a2e9f45f23..b09a5e57203a6 100644 --- a/src/compiler/transformers/es2017.ts +++ b/src/compiler/transformers/es2017.ts @@ -102,13 +102,13 @@ type SuperContainer = ClassDeclaration | MethodDeclaration | GetAccessorDeclarat const enum ES2017SubstitutionFlags { /** Enables substitutions for async methods with `super` calls. */ - AsyncMethodsWithSuper = 1 << 0 + AsyncMethodsWithSuper = 1 << 0, } const enum ContextFlags { None = 0, NonTopLevel = 1 << 0, - HasLexicalThis = 1 << 1 + HasLexicalThis = 1 << 1, } /** @internal */ @@ -118,7 +118,7 @@ export function transformES2017(context: TransformationContext): (x: SourceFile getEmitHelperFactory: emitHelpers, resumeLexicalEnvironment, endLexicalEnvironment, - hoistVariableDeclaration + hoistVariableDeclaration, } = context; const resolver = context.getEmitResolver(); @@ -858,7 +858,7 @@ export function transformES2017(context: TransformationContext): (x: SourceFile /*typeArguments*/ undefined, [ factory.createThis(), - ...node.arguments + ...node.arguments, ] ); } @@ -949,7 +949,7 @@ export function createSuperAccessVariableStatement(factory: NodeFactory, resolve /*questionToken*/ undefined, /*type*/ undefined, /*initializer*/ undefined - ) + ), ], /*type*/ undefined, /*equalsGreaterThanToken*/ undefined, @@ -993,10 +993,10 @@ export function createSuperAccessVariableStatement(factory: NodeFactory, resolve /*typeArguments*/ undefined, [ factory.createNull(), - factory.createObjectLiteralExpression(accessors, /*multiLine*/ true) + factory.createObjectLiteralExpression(accessors, /*multiLine*/ true), ] ) - ) + ), ], NodeFlags.Const)); } diff --git a/src/compiler/transformers/es2018.ts b/src/compiler/transformers/es2018.ts index 00ca8babafec4..27769d1442b91 100644 --- a/src/compiler/transformers/es2018.ts +++ b/src/compiler/transformers/es2018.ts @@ -114,7 +114,7 @@ import { const enum ESNextSubstitutionFlags { /** Enables substitutions for async methods with `super` calls. */ - AsyncMethodsWithSuper = 1 << 0 + AsyncMethodsWithSuper = 1 << 0, } // Facts we track as we traverse the tree @@ -156,7 +156,7 @@ export function transformES2018(context: TransformationContext): (x: SourceFile getEmitHelperFactory: emitHelpers, resumeLexicalEnvironment, endLexicalEnvironment, - hoistVariableDeclaration + hoistVariableDeclaration, } = context; const resolver = context.getEmitResolver(); @@ -552,7 +552,7 @@ export function transformES2018(context: TransformationContext): (x: SourceFile const visited = visitEachChild(node, visitor, context); const statement = concatenate(visited.statements, taggedTemplateStringDeclarations && [ factory.createVariableStatement(/*modifiers*/ undefined, - factory.createVariableDeclarationList(taggedTemplateStringDeclarations)) + factory.createVariableDeclarationList(taggedTemplateStringDeclarations)), ]); const result = factory.updateSourceFile(visited, setTextRange(factory.createNodeArray(statement), node.statements)); exitSubtree(ancestorFacts); @@ -738,7 +738,7 @@ export function transformES2018(context: TransformationContext): (x: SourceFile setTextRange( factory.createVariableDeclarationList( [ - setTextRange(factory.createVariableDeclaration(temp), node.initializer) + setTextRange(factory.createVariableDeclaration(temp), node.initializer), ], NodeFlags.Let ), @@ -829,7 +829,7 @@ export function transformES2018(context: TransformationContext): (x: SourceFile factory.createVariableDeclarationList([ factory.createVariableDeclaration(nonUserCode, /*exclamationToken*/ undefined, /*type*/ undefined, factory.createTrue()), setTextRange(factory.createVariableDeclaration(iterator, /*exclamationToken*/ undefined, /*type*/ undefined, initializer), node.expression), - factory.createVariableDeclaration(result) + factory.createVariableDeclaration(result), ]), node.expression ), @@ -838,7 +838,7 @@ export function transformES2018(context: TransformationContext): (x: SourceFile /*condition*/ factory.inlineExpressions([ factory.createAssignment(result, createDownlevelAwait(callNext)), factory.createAssignment(done, getDone), - factory.createLogicalNot(done) + factory.createLogicalNot(done), ]), /*incrementor*/ factory.createAssignment(nonUserCode, factory.createTrue()), /*statement*/ convertForOfStatementHead(node, getValue, nonUserCode) @@ -854,7 +854,7 @@ export function transformES2018(context: TransformationContext): (x: SourceFile factory.restoreEnclosingLabel( forStatement, outermostLabeledStatement - ) + ), ]), factory.createCatchClause( factory.createVariableDeclaration(catchVariable), @@ -864,10 +864,10 @@ export function transformES2018(context: TransformationContext): (x: SourceFile factory.createAssignment( errorRecord, factory.createObjectLiteralExpression([ - factory.createPropertyAssignment("error", catchVariable) + factory.createPropertyAssignment("error", catchVariable), ]) ) - ) + ), ]), EmitFlags.SingleLine ) @@ -890,7 +890,7 @@ export function transformES2018(context: TransformationContext): (x: SourceFile factory.createExpressionStatement(createDownlevelAwait(callReturn)) ), EmitFlags.SingleLine - ) + ), ]), /*catchClause*/ undefined, /*finallyBlock*/ setEmitFlags( @@ -903,11 +903,11 @@ export function transformES2018(context: TransformationContext): (x: SourceFile ) ), EmitFlags.SingleLine - ) + ), ]), EmitFlags.SingleLine ) - ) + ), ]) ); } @@ -1390,7 +1390,7 @@ export function transformES2018(context: TransformationContext): (x: SourceFile /*typeArguments*/ undefined, [ factory.createThis(), - ...node.arguments + ...node.arguments, ] ); } diff --git a/src/compiler/transformers/es2021.ts b/src/compiler/transformers/es2021.ts index b2fbd0fbe71b2..55019fd2d7acd 100644 --- a/src/compiler/transformers/es2021.ts +++ b/src/compiler/transformers/es2021.ts @@ -25,7 +25,7 @@ import { export function transformES2021(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle { const { hoistVariableDeclaration, - factory + factory, } = context; return chainBundle(context, transformSourceFile); diff --git a/src/compiler/transformers/esDecorators.ts b/src/compiler/transformers/esDecorators.ts index 3ed8995d32d17..d223c9b492a80 100644 --- a/src/compiler/transformers/esDecorators.ts +++ b/src/compiler/transformers/esDecorators.ts @@ -186,7 +186,7 @@ import { visitNodes, Visitor, VisitResult, - WrappedExpression + WrappedExpression, } from "../_namespaces/ts"; // Class/Decorator evaluation order, as it pertains to this transformer: @@ -1274,7 +1274,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc // 2. If _kind_ is ~field~, ~method~, ~accessor~, or ~getter~, then ... get: isPropertyDeclaration(member) || isGetAccessorDeclaration(member) || isMethodDeclaration(member), // 3. If _kind_ is ~field~, ~accessor~, or ~setter~, then ... - set: isPropertyDeclaration(member) || isSetAccessorDeclaration(member) + set: isPropertyDeclaration(member) || isSetAccessorDeclaration(member), }, metadata: classInfo.metadataReference, }; @@ -1475,7 +1475,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc if (some(declarations)) { initializer = factory.createImmediatelyInvokedArrowFunction([ ...declarations, - factory.createReturnStatement(initializer) + factory.createReturnStatement(initializer), ]); } @@ -2199,7 +2199,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc node.asteriskToken, "value", visitNodes(node.parameters, visitor, isParameter), - visitNode(node.body, visitor, isBlock)) + visitNode(node.body, visitor, isBlock)), ]); } @@ -2215,7 +2215,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc /*asteriskToken*/ undefined, "get", [], - visitNode(node.body, visitor, isBlock)) + visitNode(node.body, visitor, isBlock)), ]); } @@ -2231,7 +2231,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc /*asteriskToken*/ undefined, "set", visitNodes(node.parameters, visitor, isParameter), - visitNode(node.body, visitor, isBlock)) + visitNode(node.body, visitor, isBlock)), ]); } @@ -2258,7 +2258,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name) ) - ) + ), ]) ), createDescriptorMethod( @@ -2281,9 +2281,9 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc ), factory.createIdentifier("value") ) - ) + ), ]) - ) + ), ]); } @@ -2307,7 +2307,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc descriptorName, factory.createIdentifier("value") ) - ) + ), ]) ); } @@ -2336,7 +2336,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc factory.createThis(), [] ) - ) + ), ]) ); } @@ -2368,7 +2368,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc factory.createThis(), [factory.createIdentifier("value")] ) - ) + ), ]) ); } diff --git a/src/compiler/transformers/esnext.ts b/src/compiler/transformers/esnext.ts index d20cdd511d9ba..da8cda1461a54 100644 --- a/src/compiler/transformers/esnext.ts +++ b/src/compiler/transformers/esnext.ts @@ -60,7 +60,7 @@ import { visitEachChild, visitNode, visitNodes, - VisitResult + VisitResult, } from "../_namespaces/ts"; const enum UsingKind { @@ -243,7 +243,7 @@ export function transformESNext(context: TransformationContext): (x: SourceFile transformUsingDeclarations(node.statements, prologueCount, node.statements.length, envBinding, /*topLevelStatements*/ undefined), envBinding, usingKind === UsingKind.Async, - ) + ), ] ); } @@ -273,7 +273,7 @@ export function transformESNext(context: TransformationContext): (x: SourceFile node.condition, node.incrementor, node.statement - ) + ), ]), visitor, isStatement @@ -314,17 +314,17 @@ export function transformESNext(context: TransformationContext): (x: SourceFile node, node.awaitModifier, factory.createVariableDeclarationList([ - factory.createVariableDeclaration(temp) + factory.createVariableDeclaration(temp), ], NodeFlags.Const), node.expression, isBlock(node.statement) ? factory.updateBlock(node.statement, [ usingVarStatement, - ...node.statement.statements + ...node.statement.statements, ]) : factory.createBlock([ usingVarStatement, - node.statement + node.statement, ], /*multiLine*/ true) ), visitor, @@ -390,7 +390,7 @@ export function transformESNext(context: TransformationContext): (x: SourceFile node.caseBlock, node.caseBlock.clauses.map(clause => visitCaseOrDefaultClause(clause, envBinding)) ) - ) + ), ], envBinding, usingKind === UsingKind.Async, @@ -738,7 +738,7 @@ export function transformESNext(context: TransformationContext): (x: SourceFile const envObject = factory.createObjectLiteralExpression([ factory.createPropertyAssignment("stack", factory.createArrayLiteralExpression()), factory.createPropertyAssignment("error", factory.createVoidZero()), - factory.createPropertyAssignment("hasError", factory.createFalse()) + factory.createPropertyAssignment("hasError", factory.createFalse()), ]); const envVar = factory.createVariableDeclaration(envBinding, /*exclamationToken*/ undefined, /*type*/ undefined, envObject); const envVarList = factory.createVariableDeclarationList([envVar], NodeFlags.Const); @@ -806,17 +806,17 @@ export function transformESNext(context: TransformationContext): (x: SourceFile /*exclamationToken*/ undefined, /*type*/ undefined, emitHelpers().createDisposeResourcesHelper(envBinding) - ) + ), ], NodeFlags.Const) ), - factory.createIfStatement(result, factory.createExpressionStatement(factory.createAwaitExpression(result))) + factory.createIfStatement(result, factory.createExpressionStatement(factory.createAwaitExpression(result))), ], /*multiLine*/ true); } else { finallyBlock = factory.createBlock([ factory.createExpressionStatement( emitHelpers().createDisposeResourcesHelper(envBinding) - ) + ), ], /*multiLine*/ true); } diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts index 0439defa66437..748b6acce38c8 100644 --- a/src/compiler/transformers/generators.ts +++ b/src/compiler/transformers/generators.ts @@ -229,7 +229,7 @@ const enum OpCode { YieldStar, // A completion instruction for the `yield*` keyword (not implemented, but reserved for future use) Return, // A completion instruction for the `return` keyword Throw, // A completion instruction for the `throw` keyword - Endfinally // Marks the end of a `finally` block + Endfinally, // Marks the end of a `finally` block } type OperationArguments = [Label] | [Label, Expression] | [Statement] | [Expression | undefined] | [Expression, Expression]; @@ -246,7 +246,7 @@ const enum CodeBlockKind { With, Switch, Loop, - Labeled + Labeled, } // the state for a generated code exception block @@ -254,7 +254,7 @@ const enum ExceptionBlockState { Try, Catch, Finally, - Done + Done, } // A generated code block @@ -333,7 +333,7 @@ export function transformGenerators(context: TransformationContext): (x: SourceF resumeLexicalEnvironment, endLexicalEnvironment, hoistFunctionDeclaration, - hoistVariableDeclaration + hoistVariableDeclaration, } = context; const compilerOptions = context.getCompilerOptions(); @@ -1889,7 +1889,7 @@ export function transformGenerators(context: TransformationContext): (x: SourceF factory.createCaseClause( Debug.checkDefined(visitNode(clause.expression, visitor, isExpression)), [ - createInlineBreak(clauseLabels[i], /*location*/ clause.expression) + createInlineBreak(clauseLabels[i], /*location*/ clause.expression), ] ) ); @@ -2192,7 +2192,7 @@ export function transformGenerators(context: TransformationContext): (x: SourceF kind: CodeBlockKind.With, expression, startLabel, - endLabel + endLabel, }); } @@ -2216,7 +2216,7 @@ export function transformGenerators(context: TransformationContext): (x: SourceF kind: CodeBlockKind.Exception, state: ExceptionBlockState.Try, startLabel, - endLabel + endLabel, }); emitNop(); return endLabel; @@ -2313,7 +2313,7 @@ export function transformGenerators(context: TransformationContext): (x: SourceF kind: CodeBlockKind.Loop, isScript: true, breakLabel: -1, - continueLabel: -1 + continueLabel: -1, }); } @@ -2358,7 +2358,7 @@ export function transformGenerators(context: TransformationContext): (x: SourceF beginBlock({ kind: CodeBlockKind.Switch, isScript: true, - breakLabel: -1 + breakLabel: -1, }); } @@ -2394,7 +2394,7 @@ export function transformGenerators(context: TransformationContext): (x: SourceF kind: CodeBlockKind.Labeled, isScript: true, labelText, - breakLabel: -1 + breakLabel: -1, }); } @@ -2404,7 +2404,7 @@ export function transformGenerators(context: TransformationContext): (x: SourceF kind: CodeBlockKind.Labeled, isScript: false, labelText, - breakLabel + breakLabel, }); } @@ -2563,7 +2563,7 @@ export function transformGenerators(context: TransformationContext): (x: SourceF factory.createReturnStatement( factory.createArrayLiteralExpression([ createInstruction(Instruction.Break), - createLabel(label) + createLabel(label), ]) ), location @@ -2899,8 +2899,8 @@ export function transformGenerators(context: TransformationContext): (x: SourceF createLabel(startLabel), createLabel(catchLabel), createLabel(finallyLabel), - createLabel(endLabel) - ]) + createLabel(endLabel), + ]), ] ) ) @@ -3151,7 +3151,7 @@ export function transformGenerators(context: TransformationContext): (x: SourceF factory.createReturnStatement( factory.createArrayLiteralExpression([ createInstruction(Instruction.Break), - createLabel(label) + createLabel(label), ]) ), operationLocation @@ -3178,7 +3178,7 @@ export function transformGenerators(context: TransformationContext): (x: SourceF factory.createReturnStatement( factory.createArrayLiteralExpression([ createInstruction(Instruction.Break), - createLabel(label) + createLabel(label), ]) ), operationLocation @@ -3208,7 +3208,7 @@ export function transformGenerators(context: TransformationContext): (x: SourceF factory.createReturnStatement( factory.createArrayLiteralExpression([ createInstruction(Instruction.Break), - createLabel(label) + createLabel(label), ]) ), operationLocation @@ -3260,7 +3260,7 @@ export function transformGenerators(context: TransformationContext): (x: SourceF factory.createReturnStatement( factory.createArrayLiteralExpression([ createInstruction(Instruction.YieldStar), - expression + expression, ]) ), operationLocation @@ -3278,7 +3278,7 @@ export function transformGenerators(context: TransformationContext): (x: SourceF writeStatement( factory.createReturnStatement( factory.createArrayLiteralExpression([ - createInstruction(Instruction.Endfinally) + createInstruction(Instruction.Endfinally), ]) ) ); diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts index fe3ccc883f718..a2641c0ebd33d 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -182,7 +182,7 @@ export function transformJsx(context: TransformationContext): (x: SourceFile | B /*exclamationToken*/ undefined, /*type*/ undefined, factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, [factory.createStringLiteral(importSource)]) - ) + ), ], NodeFlags.Const)); setParentRecursive(requireStatement, /*incremental*/ false); statements = insertStatementAfterCustomPrologue(statements.slice(), requireStatement); @@ -352,7 +352,7 @@ export function transformJsx(context: TransformationContext): (x: SourceFile | B args.push(factory.createObjectLiteralExpression([ factory.createPropertyAssignment("fileName", getCurrentFileNameExpression()), factory.createPropertyAssignment("lineNumber", factory.createNumericLiteral(lineCol.line + 1)), - factory.createPropertyAssignment("columnNumber", factory.createNumericLiteral(lineCol.character + 1)) + factory.createPropertyAssignment("columnNumber", factory.createNumericLiteral(lineCol.character + 1)), ])); // __self development flag args.push(factory.createThis()); @@ -926,5 +926,5 @@ const entities = new Map(Object.entries({ spades: 0x2660, clubs: 0x2663, hearts: 0x2665, - diams: 0x2666 + diams: 0x2666, })); diff --git a/src/compiler/transformers/legacyDecorators.ts b/src/compiler/transformers/legacyDecorators.ts index d8ff2bcf72bb4..6ceb7dfeb70aa 100644 --- a/src/compiler/transformers/legacyDecorators.ts +++ b/src/compiler/transformers/legacyDecorators.ts @@ -189,7 +189,7 @@ export function transformLegacyDecorators(context: TransformationContext): (x: S ...members, factory.createClassStaticBlockDeclaration( factory.createBlock(decorationStatements, /*multiLine*/ true) - ) + ), ]), members); decorationStatements = undefined; } @@ -353,10 +353,10 @@ export function transformLegacyDecorators(context: TransformationContext): (x: S factory.createBlock([ factory.createExpressionStatement( factory.createAssignment(classAlias, factory.createThis()) - ) + ), ]) ), - ...members + ...members, ]), members); } diff --git a/src/compiler/transformers/module/esnextAnd2015.ts b/src/compiler/transformers/module/esnextAnd2015.ts index 879544063f9f0..e6f2ae77ffc11 100644 --- a/src/compiler/transformers/module/esnextAnd2015.ts +++ b/src/compiler/transformers/module/esnextAnd2015.ts @@ -154,7 +154,7 @@ export function transformECMAScriptModule(context: TransformationContext): (x: S /*isTypeOnly*/ false, /*name*/ undefined, factory.createNamedImports([ - factory.createImportSpecifier(/*isTypeOnly*/ false, factory.createIdentifier("createRequire"), createRequireName) + factory.createImportSpecifier(/*isTypeOnly*/ false, factory.createIdentifier("createRequire"), createRequireName), ]) ), factory.createStringLiteral("module") @@ -169,9 +169,9 @@ export function transformECMAScriptModule(context: TransformationContext): (x: S /*exclamationToken*/ undefined, /*type*/ undefined, factory.createCallExpression(factory.cloneNode(createRequireName), /*typeArguments*/ undefined, [ - factory.createPropertyAccessExpression(factory.createMetaProperty(SyntaxKind.ImportKeyword, factory.createIdentifier("meta")), factory.createIdentifier("url")) + factory.createPropertyAccessExpression(factory.createMetaProperty(SyntaxKind.ImportKeyword, factory.createIdentifier("meta")), factory.createIdentifier("url")), ]) - ) + ), ], /*flags*/ languageVersion >= ScriptTarget.ES2015 ? NodeFlags.Const : NodeFlags.None ) @@ -206,7 +206,7 @@ export function transformECMAScriptModule(context: TransformationContext): (x: S /*exclamationToken*/ undefined, /*type*/ undefined, createRequireCall(node) - ) + ), ], /*flags*/ languageVersion >= ScriptTarget.ES2015 ? NodeFlags.Const : NodeFlags.None ) diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index b6339fcc15a90..01e7664869679 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -184,7 +184,7 @@ export function transformModule(context: TransformationContext): (x: SourceFile getEmitHelperFactory: emitHelpers, startLexicalEnvironment, endLexicalEnvironment, - hoistVariableDeclaration + hoistVariableDeclaration, } = context; const compilerOptions = context.getCompilerOptions(); @@ -341,7 +341,7 @@ export function transformModule(context: TransformationContext): (x: SourceFile factory.createStringLiteral("require"), factory.createStringLiteral("exports"), ...aliasedModuleNames, - ...unaliasedModuleNames + ...unaliasedModuleNames, ]), // Add the module body function argument: @@ -357,14 +357,14 @@ export function transformModule(context: TransformationContext): (x: SourceFile [ factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "require"), factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "exports"), - ...importAliasNames + ...importAliasNames, ], /*type*/ undefined, transformAsynchronousModuleBody(node) - ) + ), ] ) - ) + ), ]), /*location*/ node.statements ) @@ -410,10 +410,10 @@ export function transformModule(context: TransformationContext): (x: SourceFile /*typeArguments*/ undefined, [ factory.createIdentifier("require"), - factory.createIdentifier("exports") + factory.createIdentifier("exports"), ] ) - ) + ), ] ), setEmitFlags( @@ -430,7 +430,7 @@ export function transformModule(context: TransformationContext): (x: SourceFile ) ), EmitFlags.SingleLine - ) + ), ]), factory.createIfStatement( factory.createLogicalAnd( @@ -449,15 +449,15 @@ export function transformModule(context: TransformationContext): (x: SourceFile factory.createStringLiteral("require"), factory.createStringLiteral("exports"), ...aliasedModuleNames, - ...unaliasedModuleNames + ...unaliasedModuleNames, ]), - factory.createIdentifier("factory") + factory.createIdentifier("factory"), ] ) - ) + ), ]) ) - ) + ), ], /*multiLine*/ true ), @@ -497,14 +497,14 @@ export function transformModule(context: TransformationContext): (x: SourceFile [ factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "require"), factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "exports"), - ...importAliasNames + ...importAliasNames, ], /*type*/ undefined, transformAsynchronousModuleBody(node) - ) + ), ] ) - ) + ), ]), /*location*/ node.statements ) @@ -1205,7 +1205,7 @@ export function transformModule(context: TransformationContext): (x: SourceFile const reject = factory.createUniqueName("reject"); const parameters = [ factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotDotDotToken*/ undefined, /*name*/ resolve), - factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotDotDotToken*/ undefined, /*name*/ reject) + factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotDotDotToken*/ undefined, /*name*/ reject), ]; const body = factory.createBlock([ factory.createExpressionStatement( @@ -1214,7 +1214,7 @@ export function transformModule(context: TransformationContext): (x: SourceFile /*typeArguments*/ undefined, [factory.createArrayLiteralExpression([arg || factory.createOmittedExpression()]), resolve, reject] ) - ) + ), ]); let func: FunctionExpression | ArrowFunction; @@ -1434,7 +1434,7 @@ export function transformModule(context: TransformationContext): (x: SourceFile ), /*location*/ node), /*original*/ node - ) + ), ], languageVersion >= ScriptTarget.ES2015 ? NodeFlags.Const : NodeFlags.None ) @@ -1499,7 +1499,7 @@ export function transformModule(context: TransformationContext): (x: SourceFile /*exclamationToken*/ undefined, /*type*/ undefined, createRequireCall(node) - ) + ), ], /*flags*/ languageVersion >= ScriptTarget.ES2015 ? NodeFlags.Const : NodeFlags.None ) @@ -1558,7 +1558,7 @@ export function transformModule(context: TransformationContext): (x: SourceFile /*exclamationToken*/ undefined, /*type*/ undefined, createRequireCall(node) - ) + ), ]) ), /*location*/ node), @@ -2062,8 +2062,8 @@ export function transformModule(context: TransformationContext): (x: SourceFile factory.createIdentifier("exports"), factory.createStringLiteral("__esModule"), factory.createObjectLiteralExpression([ - factory.createPropertyAssignment("value", factory.createTrue()) - ]) + factory.createPropertyAssignment("value", factory.createTrue()), + ]), ] ) ); @@ -2118,8 +2118,8 @@ export function transformModule(context: TransformationContext): (x: SourceFile /*parameters*/ [], /*type*/ undefined, factory.createBlock([factory.createReturnStatement(value)]) - )) - ]) + )), + ]), ] ) : factory.createAssignment( factory.createPropertyAccessExpression( @@ -2414,5 +2414,5 @@ const dynamicImportUMDHelper: EmitHelper = { name: "typescript:dynamicimport-sync-require", scoped: true, text: ` - var __syncRequire = typeof module === "object" && typeof module.exports === "object";` + var __syncRequire = typeof module === "object" && typeof module.exports === "object";`, }; diff --git a/src/compiler/transformers/module/system.ts b/src/compiler/transformers/module/system.ts index b83bf5244a7f3..3f915e5f8fb02 100644 --- a/src/compiler/transformers/module/system.ts +++ b/src/compiler/transformers/module/system.ts @@ -142,7 +142,7 @@ export function transformSystemModule(context: TransformationContext): (x: Sourc factory, startLexicalEnvironment, endLexicalEnvironment, - hoistVariableDeclaration + hoistVariableDeclaration, } = context; const compilerOptions = context.getCompilerOptions(); @@ -219,7 +219,7 @@ export function transformSystemModule(context: TransformationContext): (x: Sourc /*typeParameters*/ undefined, [ factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotDotDotToken*/ undefined, exportFunction), - factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotDotDotToken*/ undefined, contextObject) + factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotDotDotToken*/ undefined, contextObject), ], /*type*/ undefined, moduleBodyBlock @@ -243,7 +243,7 @@ export function transformSystemModule(context: TransformationContext): (x: Sourc ? [moduleName, dependencies, moduleBodyFunction] : [dependencies, moduleBodyFunction] ) - ) + ), ]), node.statements ) @@ -288,7 +288,7 @@ export function transformSystemModule(context: TransformationContext): (x: Sourc groupIndices.set(text, dependencyGroups.length); dependencyGroups.push({ name: externalModuleName, - externalImports: [externalImport] + externalImports: [externalImport], }); } } @@ -369,7 +369,7 @@ export function transformSystemModule(context: TransformationContext): (x: Sourc contextObject, factory.createPropertyAccessExpression(contextObject, "id") ) - ) + ), ]) ) ); @@ -410,7 +410,7 @@ export function transformSystemModule(context: TransformationContext): (x: Sourc /*type*/ undefined, factory.createBlock(executeStatements, /*multiLine*/ true) ) - ) + ), ], /*multiLine*/ true); statements.push(factory.createReturnStatement(moduleObject)); @@ -479,7 +479,7 @@ export function transformSystemModule(context: TransformationContext): (x: Sourc /*exclamationToken*/ undefined, /*type*/ undefined, factory.createObjectLiteralExpression(exportedNames, /*multiLine*/ true) - ) + ), ]) ) ); @@ -531,12 +531,12 @@ export function transformSystemModule(context: TransformationContext): (x: Sourc /*exclamationToken*/ undefined, /*type*/ undefined, factory.createObjectLiteralExpression([]) - ) + ), ]) ), factory.createForInStatement( factory.createVariableDeclarationList([ - factory.createVariableDeclaration(n) + factory.createVariableDeclaration(n), ]), m, factory.createBlock([ @@ -551,7 +551,7 @@ export function transformSystemModule(context: TransformationContext): (x: Sourc ) ), EmitFlags.SingleLine - ) + ), ]) ), factory.createExpressionStatement( @@ -560,7 +560,7 @@ export function transformSystemModule(context: TransformationContext): (x: Sourc /*typeArguments*/ undefined, [exports] ) - ) + ), ], /*multiLine*/ true) ); } @@ -656,7 +656,7 @@ export function transformSystemModule(context: TransformationContext): (x: Sourc /*typeArguments*/ undefined, [ factory.createStringLiteral(idText(entry.exportClause.name)), - parameterName + parameterName, ] ) ) diff --git a/src/compiler/transformers/namedEvaluation.ts b/src/compiler/transformers/namedEvaluation.ts index 5af5d90781e63..9511b51885c63 100644 --- a/src/compiler/transformers/namedEvaluation.ts +++ b/src/compiler/transformers/namedEvaluation.ts @@ -47,7 +47,7 @@ import { SyntaxKind, TransformationContext, VariableDeclaration, - WrappedExpression + WrappedExpression, } from "../_namespaces/ts"; /** @@ -124,7 +124,7 @@ export type ClassNamedEvaluationHelperBlock = ClassStaticBlockDeclaration & { readonly expression: CallExpression & { readonly expression: Identifier; }; - } + }, ]; }; }; diff --git a/src/compiler/transformers/taggedTemplate.ts b/src/compiler/transformers/taggedTemplate.ts index ca23140c0d448..e745c201079ad 100644 --- a/src/compiler/transformers/taggedTemplate.ts +++ b/src/compiler/transformers/taggedTemplate.ts @@ -28,7 +28,7 @@ import { /** @internal */ export enum ProcessLevel { LiftRestriction, - All + All, } /** @internal */ diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 04e56401f9dba..2f59b2872c943 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -196,7 +196,7 @@ import { visitNode, visitNodes, visitParameterList, - VisitResult + VisitResult, } from "../_namespaces/ts"; /** @@ -208,7 +208,7 @@ const enum TypeScriptSubstitutionFlags { /** Enables substitutions for namespace exports. */ NamespaceExports = 1 << 1, /* Enables substitutions for unqualified enum members */ - NonQualifiedEnumMembers = 1 << 3 + NonQualifiedEnumMembers = 1 << 3, } const enum ClassFacts { @@ -951,19 +951,19 @@ export function transformTypeScript(context: TransformationContext) { if (facts & ClassFacts.IsExportOfNamespace) { return [ statement, - createExportMemberAssignmentStatement(node) + createExportMemberAssignmentStatement(node), ]; } if (facts & ClassFacts.IsDefaultExternalExport) { return [ statement, - factory.createExportDefault(factory.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) + factory.createExportDefault(factory.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)), ]; } if (facts & ClassFacts.IsNamedExternalExport) { return [ statement, - factory.createExternalModuleExport(factory.getDeclarationName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) + factory.createExternalModuleExport(factory.getDeclarationName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)), ]; } } @@ -2410,7 +2410,7 @@ export function transformTypeScript(context: TransformationContext) { moduleReference ), node - ) + ), ]) ), node diff --git a/src/compiler/transformers/typeSerializer.ts b/src/compiler/transformers/typeSerializer.ts index 831a581b8258b..128b907ac9d2e 100644 --- a/src/compiler/transformers/typeSerializer.ts +++ b/src/compiler/transformers/typeSerializer.ts @@ -137,7 +137,7 @@ export interface RuntimeTypeSerializer { export function createRuntimeTypeSerializer(context: TransformationContext): RuntimeTypeSerializer { const { factory, - hoistVariableDeclaration + hoistVariableDeclaration, } = context; const resolver = context.getEmitResolver(); diff --git a/src/compiler/transformers/utilities.ts b/src/compiler/transformers/utilities.ts index d01206af9057f..e72c3a99cd68a 100644 --- a/src/compiler/transformers/utilities.ts +++ b/src/compiler/transformers/utilities.ts @@ -86,7 +86,7 @@ import { TransformationContext, unorderedRemoveItem, VariableDeclaration, - VariableStatement + VariableStatement, } from "../_namespaces/ts"; /** @internal */ @@ -642,7 +642,7 @@ export function getAllDecoratorsOfClass(node: ClassLikeDeclaration): AllDecorato return { decorators, - parameters + parameters, }; } @@ -705,7 +705,7 @@ function getAllDecoratorsOfAccessors(accessor: AccessorDeclaration, parent: Clas decorators, parameters, getDecorators: getAccessor && getDecorators(getAccessor), - setDecorators: setAccessor && getDecorators(setAccessor) + setDecorators: setAccessor && getDecorators(setAccessor), }; } diff --git a/src/compiler/tsbuildPublic.ts b/src/compiler/tsbuildPublic.ts index b734ca7eed949..8ba8f8c5c781d 100644 --- a/src/compiler/tsbuildPublic.ts +++ b/src/compiler/tsbuildPublic.ts @@ -185,7 +185,7 @@ enum BuildResultFlags { DeclarationEmitErrors = 1 << 5, EmitErrors = 1 << 6, - AnyErrors = ConfigFileErrors | SyntaxErrors | TypeErrors | DeclarationEmitErrors | EmitErrors + AnyErrors = ConfigFileErrors | SyntaxErrors | TypeErrors | DeclarationEmitErrors | EmitErrors, } /** @internal */ @@ -745,7 +745,7 @@ function enableCache(state: SolutionBuilderState) { const { originalReadFile, originalFileExists, originalDirectoryExists, originalCreateDirectory, originalWriteFile, - getSourceFileWithCache, readFileWithCache + getSourceFileWithCache, readFileWithCache, } = changeCompilerHostLikeToUseCache( host, fileName => toPath(state, fileName), @@ -821,7 +821,7 @@ function setupInitialBuild(state: SolutionBuilderState export enum InvalidatedProjectKind { Build, /** @deprecated */ UpdateBundle, - UpdateOutputFileStamps + UpdateOutputFileStamps, } export interface InvalidatedProjectBase { @@ -915,7 +915,7 @@ function createUpdateOutputFileStampsProject( } performance.mark("SolutionBuilder::Timestamps only updates"); return doneInvalidatedProject(state, projectPath); - } + }, }; } @@ -928,7 +928,7 @@ enum BuildStep { EmitBuildInfo, /** @deprecated */ BuildInvalidatedProjectOfBundle, QueueReferencingProjects, - Done + Done, } function createBuildOrUpdateInvalidedProject( @@ -1009,7 +1009,7 @@ function createBuildOrUpdateInvalidedProject( if (step !== BuildStep.Emit) return undefined; return emit(writeFile, cancellationToken, customTransformers); }, - done + done, } : { kind, @@ -1111,7 +1111,7 @@ function createBuildOrUpdateInvalidedProject( ...program.getConfigFileParsingDiagnostics(), ...program.getOptionsDiagnostics(cancellationToken), ...program.getGlobalDiagnostics(cancellationToken), - ...program.getSyntacticDiagnostics(/*sourceFile*/ undefined, cancellationToken) + ...program.getSyntacticDiagnostics(/*sourceFile*/ undefined, cancellationToken), ], BuildResultFlags.SyntaxErrors, "Syntactic" @@ -1158,7 +1158,7 @@ function createBuildOrUpdateInvalidedProject( )); return { emitSkipped: true, - diagnostics: emitResult.diagnostics + diagnostics: emitResult.diagnostics, }; } @@ -1244,7 +1244,7 @@ function createBuildOrUpdateInvalidedProject( state.diagnostics.delete(projectPath); state.projectStatus.set(projectPath, { type: UpToDateStatusType.UpToDate, - oldestOutputFileName + oldestOutputFileName, }); afterProgramDone(state, program, config); step = BuildStep.QueueReferencingProjects; @@ -1446,7 +1446,7 @@ function getNextInvalidatedProjectCreateInfo( project, projectPath, projectIndex, - config + config, }; } } @@ -1632,7 +1632,7 @@ function watchFile(state: SolutionBuilderState, fil else { unorderedRemoveItem(existing.callbacks, callback); } - } + }, }; } @@ -1694,7 +1694,7 @@ function checkConfigFileUpToDateStatus(state: Solution return { type: UpToDateStatusType.OutOfDateWithSelf, outOfDateOutputFileName: oldestOutputFileName, - newerInputFileName: configFile + newerInputFileName: configFile, }; } } @@ -1703,7 +1703,7 @@ function getUpToDateStatusWorker(state: SolutionBuilde // Container if no files are specified in the project if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) { return { - type: UpToDateStatusType.ContainerOnly + type: UpToDateStatusType.ContainerOnly, }; } @@ -1730,7 +1730,7 @@ function getUpToDateStatusWorker(state: SolutionBuilde return { type: UpToDateStatusType.UpstreamBlocked, upstreamProjectName: ref.path, - upstreamProjectBlocked: refStatus.type === UpToDateStatusType.UpstreamBlocked + upstreamProjectBlocked: refStatus.type === UpToDateStatusType.UpstreamBlocked, }; } @@ -1738,7 +1738,7 @@ function getUpToDateStatusWorker(state: SolutionBuilde if (refStatus.type !== UpToDateStatusType.UpToDate) { return { type: UpToDateStatusType.UpstreamOutOfDate, - upstreamProjectName: ref.path + upstreamProjectName: ref.path, }; } @@ -1763,12 +1763,12 @@ function getUpToDateStatusWorker(state: SolutionBuilde state.buildInfoCache.set(resolvedPath, { path: toPath(state, buildInfoPath), buildInfo: false, - modifiedTime: buildInfoTime + modifiedTime: buildInfoTime, }); } return { type: UpToDateStatusType.OutputMissing, - missingOutputFileName: buildInfoPath + missingOutputFileName: buildInfoPath, }; } @@ -1777,13 +1777,13 @@ function getUpToDateStatusWorker(state: SolutionBuilde // Error reading buildInfo return { type: UpToDateStatusType.ErrorReadingFile, - fileName: buildInfoPath + fileName: buildInfoPath, }; } if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== version) { return { type: UpToDateStatusType.TsVersionOutputOfDate, - version: buildInfo.version + version: buildInfo.version, }; } @@ -1801,14 +1801,14 @@ function getUpToDateStatusWorker(state: SolutionBuilde ) { return { type: UpToDateStatusType.OutOfDateBuildInfo, - buildInfoFile: buildInfoPath + buildInfoFile: buildInfoPath, }; } if (!project.options.noEmit && getPendingEmitKind(project.options, buildInfo.program.options || {})) { return { type: UpToDateStatusType.OutOfDateOptions, - buildInfoFile: buildInfoPath + buildInfoFile: buildInfoPath, }; } buildInfoProgram = buildInfo.program; @@ -1830,7 +1830,7 @@ function getUpToDateStatusWorker(state: SolutionBuilde if (inputTime === missingFileModifiedTime) { return { type: UpToDateStatusType.Unbuildable, - reason: `${inputFile} does not exist` + reason: `${inputFile} does not exist`, }; } @@ -1851,7 +1851,7 @@ function getUpToDateStatusWorker(state: SolutionBuilde return { type: UpToDateStatusType.OutOfDateWithSelf, outOfDateOutputFileName: buildInfoPath!, - newerInputFileName: inputFile + newerInputFileName: inputFile, }; } } @@ -1896,7 +1896,7 @@ function getUpToDateStatusWorker(state: SolutionBuilde if (outputTime === missingFileModifiedTime) { return { type: UpToDateStatusType.OutputMissing, - missingOutputFileName: output + missingOutputFileName: output, }; } @@ -1905,7 +1905,7 @@ function getUpToDateStatusWorker(state: SolutionBuilde return { type: UpToDateStatusType.OutOfDateWithSelf, outOfDateOutputFileName: output, - newerInputFileName: newestInputFileName + newerInputFileName: newestInputFileName, }; } @@ -1937,7 +1937,7 @@ function getUpToDateStatusWorker(state: SolutionBuilde return { type: UpToDateStatusType.OutOfDateWithUpstream, outOfDateOutputFileName: buildInfoPath!, - newerProjectName: ref.path + newerProjectName: ref.path, }; } @@ -1955,7 +1955,7 @@ function getUpToDateStatusWorker(state: SolutionBuilde return { type: UpToDateStatusType.OutOfDateWithUpstream, outOfDateOutputFileName: oldestOutputFileName, - newerProjectName: ref.path + newerProjectName: ref.path, }; } } @@ -1979,7 +1979,7 @@ function getUpToDateStatusWorker(state: SolutionBuilde return { type: UpToDateStatusType.OutOfDateWithPrepend, outOfDateOutputFileName: oldestOutputFileName!, - newerProjectName: upstreamChangedProject! + newerProjectName: upstreamChangedProject!, }; } @@ -1992,7 +1992,7 @@ function getUpToDateStatusWorker(state: SolutionBuilde UpToDateStatusType.UpToDate, newestInputFileTime, newestInputFileName, - oldestOutputFileName: oldestOutputFileName! + oldestOutputFileName: oldestOutputFileName!, }; } @@ -2087,7 +2087,7 @@ function updateOutputTimestamps(state: SolutionBuilder updateOutputTimestampsWorker(state, proj, resolvedPath, Diagnostics.Updating_output_timestamps_of_project_0); state.projectStatus.set(resolvedPath, { type: UpToDateStatusType.UpToDate, - oldestOutputFileName: getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames()) + oldestOutputFileName: getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames()), }); } @@ -2127,7 +2127,7 @@ function queueReferencingProjects( state.projectStatus.set(nextProjectPath, { type: UpToDateStatusType.OutOfDateWithPrepend, outOfDateOutputFileName: status.oldestOutputFileName, - newerProjectName: project + newerProjectName: project, }); } else { @@ -2144,7 +2144,7 @@ function queueReferencingProjects( state.projectStatus.set(nextProjectPath, { type: UpToDateStatusType.OutOfDateWithUpstream, outOfDateOutputFileName: status.type === UpToDateStatusType.OutOfDateWithPrepend ? status.outOfDateOutputFileName : status.oldestOutputFileName, - newerProjectName: project + newerProjectName: project, }); } break; @@ -2373,7 +2373,7 @@ function watchWildCardDirectories(state: SolutionBuild program: state.builderPrograms.get(resolvedPath) || getCachedParsedConfigFile(state, resolvedPath)?.fileNames, useCaseSensitiveFileNames: state.parseConfigFileHost.useCaseSensitiveFileNames, writeLog: s => state.writeLog(s), - toPath: fileName => toPath(state, fileName) + toPath: fileName => toPath(state, fileName), })) return; invalidateProjectAndScheduleBuilds(state, resolvedPath, ConfigFileProgramReloadLevel.Partial); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 5432adf33ebb5..2249c2c8ac37a 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -887,7 +887,7 @@ export const enum ModifierFlags { TypeScriptModifier = Ambient | Public | Private | Protected | Readonly | Abstract | Const | Override | In | Out, ExportDefault = Export | Default, All = Export | Ambient | Public | Private | Protected | Static | Readonly | Abstract | Accessor | Async | Default | Const | Deprecated | Override | In | Out | Decorator, - Modifier = All & ~Decorator + Modifier = All & ~Decorator, } export const enum JsxFlags { @@ -908,7 +908,7 @@ export const enum RelationComparisonResult { ReportsUnmeasurable = 1 << 3, ReportsUnreliable = 1 << 4, - ReportsMask = ReportsUnmeasurable | ReportsUnreliable + ReportsMask = ReportsUnmeasurable | ReportsUnreliable, } /** @internal */ @@ -4618,7 +4618,7 @@ export enum FileIncludeKind { TypeReferenceDirective, LibFile, LibReferenceDirective, - AutomaticTypeDirectiveFile + AutomaticTypeDirectiveFile, } /** @internal */ @@ -5313,7 +5313,7 @@ export interface TypeChecker { export const enum MemberOverrideStatus { Ok, NeedsOverride, - HasInvalidOverride + HasInvalidOverride, } /** @internal */ @@ -5416,7 +5416,7 @@ export const enum TypeFormatFlags { NodeBuilderFlagsMask = NoTruncation | WriteArrayAsGenericType | UseStructuralFallback | WriteTypeArgumentsOfSignature | UseFullyQualifiedType | SuppressAnyReturnType | MultilineObjectLiterals | WriteClassExpressionAsTypeLiteral | UseTypeOfFunction | OmitParameterModifiers | UseAliasDefinedOutsideCurrentScope | AllowUniqueESSymbolType | InTypeAlias | - UseSingleQuotesForStringLiteralType | NoTypeReduction | OmitThisParameter + UseSingleQuotesForStringLiteralType | NoTypeReduction | OmitThisParameter, } export const enum SymbolFormatFlags { @@ -5475,20 +5475,20 @@ export interface SymbolWriter { export const enum SymbolAccessibility { Accessible, NotAccessible, - CannotBeNamed + CannotBeNamed, } /** @internal */ export const enum SyntheticSymbolKind { UnionOrIntersection, - Spread + Spread, } export const enum TypePredicateKind { This, Identifier, AssertsThis, - AssertsIdentifier + AssertsIdentifier, } export interface TypePredicateBase { @@ -5889,7 +5889,7 @@ export interface SymbolLinks { /** @internal */ export const enum EnumKind { Numeric, // Numeric enum (each member has a TypeFlags.Enum type) - Literal // Literal enum (each member has a TypeFlags.EnumLiteral type) + Literal, // Literal enum (each member has a TypeFlags.EnumLiteral type) } /** @internal */ @@ -5918,7 +5918,7 @@ export const enum CheckFlags { Unresolved = 1 << 20, // Unresolved type alias symbol Synthetic = SyntheticProperty | SyntheticMethod, Discriminant = HasNonUniformType | HasLiteralType, - Partial = ReadPartial | WritePartial + Partial = ReadPartial | WritePartial, } /** @internal */ @@ -6700,7 +6700,7 @@ export interface SubstitutionType extends InstantiableType { export const enum JsxReferenceKind { Component, Function, - Mixed + Mixed, } export const enum SignatureKind { @@ -6857,7 +6857,7 @@ export const enum Ternary { False = 0, Unknown = 1, Maybe = 3, - True = -1 + True = -1, } /** @internal */ @@ -7002,7 +7002,7 @@ export enum DiagnosticCategory { Warning, Error, Suggestion, - Message + Message, } /** @internal */ export function diagnosticCategoryName(d: { category: DiagnosticCategory }, lowerCase = true): string { @@ -7289,7 +7289,7 @@ export const enum ImportsNotUsedAsValues { export const enum NewLineKind { CarriageReturnLineFeed = 0, - LineFeed = 1 + LineFeed = 1, } export interface LineAndCharacter { @@ -7313,7 +7313,7 @@ export const enum ScriptKind { * Used on extensions that doesn't define the ScriptKind but the content defines it. * Deferred extensions are going to be included in all project contexts. */ - Deferred = 7 + Deferred = 7, } export const enum ScriptTarget { @@ -7334,7 +7334,7 @@ export const enum ScriptTarget { export const enum LanguageVariant { Standard, - JSX + JSX, } /** Either a parsed command line or a parsed tsconfig.json */ @@ -9078,7 +9078,7 @@ export interface NodeFactory { export const enum LexicalEnvironmentFlags { None = 0, InParameters = 1 << 0, // currently visiting a parameter list - VariablesHoistedInParameters = 1 << 1 // a temp variable was hoisted while visiting a parameter list + VariablesHoistedInParameters = 1 << 1, // a temp variable was hoisted while visiting a parameter list } export interface CoreTransformationContext { @@ -9858,39 +9858,39 @@ export const commentPragmas = { { name: "lib", optional: true, captureSpan: true }, { name: "path", optional: true, captureSpan: true }, { name: "no-default-lib", optional: true }, - { name: "resolution-mode", optional: true } + { name: "resolution-mode", optional: true }, ], - kind: PragmaKindFlags.TripleSlashXML + kind: PragmaKindFlags.TripleSlashXML, }, "amd-dependency": { args: [{ name: "path" }, { name: "name", optional: true }], - kind: PragmaKindFlags.TripleSlashXML + kind: PragmaKindFlags.TripleSlashXML, }, "amd-module": { args: [{ name: "name" }], - kind: PragmaKindFlags.TripleSlashXML + kind: PragmaKindFlags.TripleSlashXML, }, "ts-check": { - kind: PragmaKindFlags.SingleLine + kind: PragmaKindFlags.SingleLine, }, "ts-nocheck": { - kind: PragmaKindFlags.SingleLine + kind: PragmaKindFlags.SingleLine, }, "jsx": { args: [{ name: "factory" }], - kind: PragmaKindFlags.MultiLine + kind: PragmaKindFlags.MultiLine, }, "jsxfrag": { args: [{ name: "factory" }], - kind: PragmaKindFlags.MultiLine + kind: PragmaKindFlags.MultiLine, }, "jsximportsource": { args: [{ name: "factory" }], - kind: PragmaKindFlags.MultiLine + kind: PragmaKindFlags.MultiLine, }, "jsxruntime": { args: [{ name: "factory" }], - kind: PragmaKindFlags.MultiLine + kind: PragmaKindFlags.MultiLine, }, } as const; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index f00b10dbc7bb6..6ee7bcb4a933a 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1287,21 +1287,21 @@ export function getScriptTargetFeatures(): ScriptTargetFeatures { "copyWithin", "entries", "keys", - "values" + "values", ], es2016: [ - "includes" + "includes", ], es2019: [ "flat", - "flatMap" + "flatMap", ], es2022: [ - "at" + "at", ], es2023: [ "findLastIndex", - "findLast" + "findLast", ], })), Iterator: new Map(Object.entries({ @@ -1332,11 +1332,11 @@ export function getScriptTargetFeatures(): ScriptTargetFeatures { es2015: [ "flags", "sticky", - "unicode" + "unicode", ], es2018: [ - "dotAll" - ] + "dotAll", + ], })), Reflect: new Map(Object.entries({ es2015: [ @@ -1352,14 +1352,14 @@ export function getScriptTargetFeatures(): ScriptTargetFeatures { "ownKeys", "preventExtensions", "set", - "setPrototypeOf" - ] + "setPrototypeOf", + ], })), ArrayConstructor: new Map(Object.entries({ es2015: [ "from", - "of" - ] + "of", + ], })), ObjectConstructor: new Map(Object.entries({ es2015: [ @@ -1367,19 +1367,19 @@ export function getScriptTargetFeatures(): ScriptTargetFeatures { "getOwnPropertySymbols", "keys", "is", - "setPrototypeOf" + "setPrototypeOf", ], es2017: [ "values", "entries", - "getOwnPropertyDescriptors" + "getOwnPropertyDescriptors", ], es2019: [ - "fromEntries" + "fromEntries", ], es2022: [ - "hasOwn" - ] + "hasOwn", + ], })), NumberConstructor: new Map(Object.entries({ es2015: [ @@ -1388,8 +1388,8 @@ export function getScriptTargetFeatures(): ScriptTargetFeatures { "isNaN", "isSafeInteger", "parseFloat", - "parseInt" - ] + "parseInt", + ], })), Math: new Map(Object.entries({ es2015: [ @@ -1409,59 +1409,59 @@ export function getScriptTargetFeatures(): ScriptTargetFeatures { "hypot", "trunc", "fround", - "cbrt" - ] + "cbrt", + ], })), Map: new Map(Object.entries({ es2015: [ "entries", "keys", - "values" - ] + "values", + ], })), Set: new Map(Object.entries({ es2015: [ "entries", "keys", - "values" - ] + "values", + ], })), PromiseConstructor: new Map(Object.entries({ es2015: [ "all", "race", "reject", - "resolve" + "resolve", ], es2020: [ - "allSettled" + "allSettled", ], es2021: [ - "any" - ] + "any", + ], })), Symbol: new Map(Object.entries({ es2015: [ "for", - "keyFor" + "keyFor", ], es2019: [ - "description" - ] + "description", + ], })), WeakMap: new Map(Object.entries({ es2015: [ "entries", "keys", - "values" - ] + "values", + ], })), WeakSet: new Map(Object.entries({ es2015: [ "entries", "keys", - "values" - ] + "values", + ], })), String: new Map(Object.entries({ es2015: [ @@ -1483,193 +1483,193 @@ export function getScriptTargetFeatures(): ScriptTargetFeatures { "small", "strike", "sub", - "sup" + "sup", ], es2017: [ "padStart", - "padEnd" + "padEnd", ], es2019: [ "trimStart", "trimEnd", "trimLeft", - "trimRight" + "trimRight", ], es2020: [ - "matchAll" + "matchAll", ], es2021: [ - "replaceAll" + "replaceAll", ], es2022: [ - "at" - ] + "at", + ], })), StringConstructor: new Map(Object.entries({ es2015: [ "fromCodePoint", - "raw" - ] + "raw", + ], })), DateTimeFormat: new Map(Object.entries({ es2017: [ - "formatToParts" - ] + "formatToParts", + ], })), Promise: new Map(Object.entries({ es2015: emptyArray, es2018: [ - "finally" - ] + "finally", + ], })), RegExpMatchArray: new Map(Object.entries({ es2018: [ - "groups" - ] + "groups", + ], })), RegExpExecArray: new Map(Object.entries({ es2018: [ - "groups" - ] + "groups", + ], })), Intl: new Map(Object.entries({ es2018: [ - "PluralRules" - ] + "PluralRules", + ], })), NumberFormat: new Map(Object.entries({ es2018: [ - "formatToParts" - ] + "formatToParts", + ], })), SymbolConstructor: new Map(Object.entries({ es2020: [ - "matchAll" - ] + "matchAll", + ], })), DataView: new Map(Object.entries({ es2020: [ "setBigInt64", "setBigUint64", "getBigInt64", - "getBigUint64" - ] + "getBigUint64", + ], })), BigInt: new Map(Object.entries({ - es2020: emptyArray + es2020: emptyArray, })), RelativeTimeFormat: new Map(Object.entries({ es2020: [ "format", "formatToParts", - "resolvedOptions" - ] + "resolvedOptions", + ], })), Int8Array: new Map(Object.entries({ es2022: [ - "at" + "at", ], es2023: [ "findLastIndex", - "findLast" + "findLast", ], })), Uint8Array: new Map(Object.entries({ es2022: [ - "at" + "at", ], es2023: [ "findLastIndex", - "findLast" + "findLast", ], })), Uint8ClampedArray: new Map(Object.entries({ es2022: [ - "at" + "at", ], es2023: [ "findLastIndex", - "findLast" + "findLast", ], })), Int16Array: new Map(Object.entries({ es2022: [ - "at" + "at", ], es2023: [ "findLastIndex", - "findLast" + "findLast", ], })), Uint16Array: new Map(Object.entries({ es2022: [ - "at" + "at", ], es2023: [ "findLastIndex", - "findLast" + "findLast", ], })), Int32Array: new Map(Object.entries({ es2022: [ - "at" + "at", ], es2023: [ "findLastIndex", - "findLast" + "findLast", ], })), Uint32Array: new Map(Object.entries({ es2022: [ - "at" + "at", ], es2023: [ "findLastIndex", - "findLast" + "findLast", ], })), Float32Array: new Map(Object.entries({ es2022: [ - "at" + "at", ], es2023: [ "findLastIndex", - "findLast" + "findLast", ], })), Float64Array: new Map(Object.entries({ es2022: [ - "at" + "at", ], es2023: [ "findLastIndex", - "findLast" + "findLast", ], })), BigInt64Array: new Map(Object.entries({ es2020: emptyArray, es2022: [ - "at" + "at", ], es2023: [ "findLastIndex", - "findLast" + "findLast", ], })), BigUint64Array: new Map(Object.entries({ es2020: emptyArray, es2022: [ - "at" + "at", ], es2023: [ "findLastIndex", - "findLast" + "findLast", ], })), Error: new Map(Object.entries({ es2022: [ - "cause" - ] + "cause", + ], })), })); } @@ -1680,7 +1680,7 @@ export const enum GetLiteralTextFlags { NeverAsciiEscape = 1 << 0, JsxAttributeEscape = 1 << 1, TerminateUnterminatedLiterals = 1 << 2, - AllowNumericSeparator = 1 << 3 + AllowNumericSeparator = 1 << 3, } /** @internal */ @@ -2166,7 +2166,7 @@ export function createFileDiagnosticFromMessageChain(file: SourceFile, start: nu code: messageChain.code, category: messageChain.category, messageText: messageChain.next ? messageChain : messageChain.messageText, - relatedInformation + relatedInformation, }; } @@ -2179,7 +2179,7 @@ export function createDiagnosticForFileFromMessageChain(sourceFile: SourceFile, code: messageChain.code, category: messageChain.category, messageText: messageChain.next ? messageChain : messageChain.messageText, - relatedInformation + relatedInformation, }; } @@ -4464,7 +4464,7 @@ export function hasTypeArguments(node: Node): node is HasTypeArguments { /** @internal */ export const enum AssignmentKind { - None, Definite, Compound + None, Definite, Compound, } type AssignmentTarget = @@ -5326,7 +5326,7 @@ export function getOriginalSourceFile(sourceFile: SourceFile) { /** @internal */ export const enum Associativity { Left, - Right + Right, } /** @internal */ @@ -5925,7 +5925,7 @@ const jsxDoubleQuoteEscapedCharsRegExp = /["\u0000-\u001f\u2028\u2029\u0085]/g; const jsxSingleQuoteEscapedCharsRegExp = /['\u0000-\u001f\u2028\u2029\u0085]/g; const jsxEscapedCharsMap = new Map(Object.entries({ "\"": """, - "'": "'" + "'": "'", })); function encodeJsxCharacterEntity(charCode: number): string { @@ -6107,7 +6107,7 @@ export function createTextWriter(newLine: string): EmitTextWriter { writeSymbol: (s, _) => write(s), writeTrailingSemicolon: write, writeComment, - getTextPosWithWriteLine + getTextPosWithWriteLine, }; } @@ -6542,7 +6542,7 @@ export function getAllAccessorDeclarations(declarations: readonly Declaration[], firstAccessor, secondAccessor, getAccessor, - setAccessor + setAccessor, }; } @@ -7684,7 +7684,7 @@ const enum AccessKind { /** Only writes to a variable without ever reading it. E.g.: `x=1;`. */ Write, /** Reads from and writes to a variable. E.g.: `f(x++);`, `x/=1`. */ - ReadWrite + ReadWrite, } function accessKind(node: Node): AccessKind { const { parent } = node; @@ -8230,7 +8230,7 @@ function attachFileToDiagnostic(diagnostic: DiagnosticWithDetachedLocation, file messageText: diagnostic.messageText, category: diagnostic.category, code: diagnostic.code, - reportsUnnecessary: diagnostic.reportsUnnecessary + reportsUnnecessary: diagnostic.reportsUnnecessary, }; if (diagnostic.relatedInformation) { diagnosticWithLocation.relatedInformation = []; @@ -8276,7 +8276,7 @@ export function createFileDiagnostic(file: SourceFile, start: number, length: nu category: message.category, code: message.code, reportsUnnecessary: message.reportsUnnecessary, - reportsDeprecated: message.reportsDeprecated + reportsDeprecated: message.reportsDeprecated, }; } @@ -8308,7 +8308,7 @@ export function createCompilerDiagnostic(message: DiagnosticMessage, ...args: Di category: message.category, code: message.code, reportsUnnecessary: message.reportsUnnecessary, - reportsDeprecated: message.reportsDeprecated + reportsDeprecated: message.reportsDeprecated, }; } @@ -8322,7 +8322,7 @@ export function createCompilerDiagnosticFromMessageChain(chain: DiagnosticMessag code: chain.code, category: chain.category, messageText: chain.next ? chain : chain.messageText, - relatedInformation + relatedInformation, }; } @@ -8338,7 +8338,7 @@ export function chainDiagnosticMessages(details: DiagnosticMessageChain | Diagno category: message.category, code: message.code, - next: details === undefined || Array.isArray(details) ? details : [details] + next: details === undefined || Array.isArray(details) ? details : [details], }; } @@ -8917,7 +8917,7 @@ const filesMatcher: WildcardMatcher = { * files or directories, does not match subdirectories that start with a . character */ doubleAsteriskRegexFragment: `(/${implicitExcludePathRegexPattern}[^/.][^/]*)*?`, - replaceWildcardCharacter: match => replaceWildcardCharacter(match, filesMatcher.singleAsteriskRegexFragment) + replaceWildcardCharacter: match => replaceWildcardCharacter(match, filesMatcher.singleAsteriskRegexFragment), }; const directoriesMatcher: WildcardMatcher = { @@ -8927,19 +8927,19 @@ const directoriesMatcher: WildcardMatcher = { * files or directories, does not match subdirectories that start with a . character */ doubleAsteriskRegexFragment: `(/${implicitExcludePathRegexPattern}[^/.][^/]*)*?`, - replaceWildcardCharacter: match => replaceWildcardCharacter(match, directoriesMatcher.singleAsteriskRegexFragment) + replaceWildcardCharacter: match => replaceWildcardCharacter(match, directoriesMatcher.singleAsteriskRegexFragment), }; const excludeMatcher: WildcardMatcher = { singleAsteriskRegexFragment: "[^/]*", doubleAsteriskRegexFragment: "(/.+?)?", - replaceWildcardCharacter: match => replaceWildcardCharacter(match, excludeMatcher.singleAsteriskRegexFragment) + replaceWildcardCharacter: match => replaceWildcardCharacter(match, excludeMatcher.singleAsteriskRegexFragment), }; const wildcardMatchers = { files: filesMatcher, directories: directoriesMatcher, - exclude: excludeMatcher + exclude: excludeMatcher, }; /** @internal */ @@ -9093,7 +9093,7 @@ export function getFileMatcherPatterns(path: string, excludes: readonly string[] includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"), includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"), excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"), - basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames) + basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames), }; } @@ -9286,7 +9286,7 @@ export function getSupportedExtensions(options?: CompilerOptions, extraFileExten const flatBuiltins = flatten(builtins); const extensions = [ ...builtins, - ...mapDefined(extraFileExtensions, x => x.scriptKind === ScriptKind.Deferred || needJsExtensions && isJSLike(x.scriptKind) && flatBuiltins.indexOf(x.extension as Extension) === -1 ? [x.extension] : undefined) + ...mapDefined(extraFileExtensions, x => x.scriptKind === ScriptKind.Deferred || needJsExtensions && isJSLike(x.scriptKind) && flatBuiltins.indexOf(x.extension as Extension) === -1 ? [x.extension] : undefined), ]; return extensions; @@ -9478,7 +9478,7 @@ export function tryParsePattern(pattern: string): string | Pattern | undefined { ? undefined : { prefix: pattern.substr(0, indexOfStar), - suffix: pattern.substr(indexOfStar + 1) + suffix: pattern.substr(indexOfStar + 1), }; } @@ -9537,7 +9537,7 @@ export function isCheckJsEnabledForFile(sourceFile: SourceFile, compilerOptions: /** @internal */ export const emptyFileSystemEntries: FileSystemEntries = { files: emptyArray, - directories: emptyArray + directories: emptyArray, }; @@ -10181,7 +10181,7 @@ export function getNodeModulePathParts(fullPath: string): NodeModulePathParts | BeforeNodeModules, NodeModules, Scope, - PackageContent + PackageContent, } let partStart = 0; diff --git a/src/compiler/visitorPublic.ts b/src/compiler/visitorPublic.ts index 08475d5c0ae7a..87ec454c20e08 100644 --- a/src/compiler/visitorPublic.ts +++ b/src/compiler/visitorPublic.ts @@ -492,7 +492,7 @@ function addDefaultValueAssignmentForInitializer(parameter: ParameterDeclaration ), EmitFlags.NoComments ) - ) + ), ]), parameter ), diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index a829f95d17fbd..b8e0f967ecac3 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -111,7 +111,7 @@ import { const sysFormatDiagnosticsHost: FormatDiagnosticsHost | undefined = sys ? { getCurrentDirectory: () => sys.getCurrentDirectory(), getNewLine: () => sys.newLine, - getCanonicalFileName: createGetCanonicalFileName(sys.useCaseSensitiveFileNames) + getCanonicalFileName: createGetCanonicalFileName(sys.useCaseSensitiveFileNames), } : undefined; /** @@ -665,7 +665,7 @@ export function createWatchHost(system = sys, reportWatchStatus?: WatchStatusRep watchFile: maybeBind(system, system.watchFile) || returnNoopFileWatcher, watchDirectory: maybeBind(system, system.watchDirectory) || returnNoopFileWatcher, setTimeout: maybeBind(system, system.setTimeout) || noop, - clearTimeout: maybeBind(system, system.clearTimeout) || noop + clearTimeout: maybeBind(system, system.clearTimeout) || noop, }; } @@ -908,7 +908,7 @@ export interface CreateWatchCompilerHostOfConfigFileInput({ configFileName, optionsToExtend, watchOptionsToExtend, extraFileExtensions, - system, createProgram, reportDiagnostic, reportWatchStatus + system, createProgram, reportDiagnostic, reportWatchStatus, }: CreateWatchCompilerHostOfConfigFileInput): WatchCompilerHostOfConfigFile { const diagnosticReporter = reportDiagnostic || createDiagnosticReporter(system); const host = createWatchCompilerHost(system, createProgram, diagnosticReporter, reportWatchStatus) as WatchCompilerHostOfConfigFile; @@ -934,7 +934,7 @@ export interface CreateWatchCompilerHostOfFilesAndCompilerOptionsInput({ rootFiles, options, watchOptions, projectReferences, - system, createProgram, reportDiagnostic, reportWatchStatus + system, createProgram, reportDiagnostic, reportWatchStatus, }: CreateWatchCompilerHostOfFilesAndCompilerOptionsInput): WatchCompilerHostOfFilesAndCompilerOptions { const host = createWatchCompilerHost(system, createProgram, reportDiagnostic || createDiagnosticReporter(system), reportWatchStatus) as WatchCompilerHostOfFilesAndCompilerOptions; host.rootFiles = rootFiles; diff --git a/src/compiler/watchPublic.ts b/src/compiler/watchPublic.ts index b216c8cb75de0..66098dacb99c9 100644 --- a/src/compiler/watchPublic.ts +++ b/src/compiler/watchPublic.ts @@ -137,7 +137,7 @@ export interface IncrementalProgramOptions { } export function createIncrementalProgram({ - rootNames, options, configFileParsingDiagnostics, projectReferences, host, createProgram + rootNames, options, configFileParsingDiagnostics, projectReferences, host, createProgram, }: IncrementalProgramOptions): T { host = host || createIncrementalCompilerHost(options); createProgram = createProgram || createEmitAndSemanticDiagnosticsBuilderProgram as any as CreateProgram; @@ -611,7 +611,7 @@ export function createWatchProgram(host: WatchCompiler const { hasInvalidatedResolutions, hasInvalidatedLibResolutions } = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions, customHasInvalidLibResolutions); const { originalReadFile, originalFileExists, originalDirectoryExists, - originalCreateDirectory, originalWriteFile, readFileWithCache + originalCreateDirectory, originalWriteFile, readFileWithCache, } = changeCompilerHostLikeToUseCache(compilerHost, toPath); if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, path => getSourceVersion(path, readFileWithCache), fileName => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { if (hasChangedConfigFileParsingErrors) { diff --git a/src/compiler/watchUtilities.ts b/src/compiler/watchUtilities.ts index 1c7eb04b1193f..3e8e921f326bb 100644 --- a/src/compiler/watchUtilities.ts +++ b/src/compiler/watchUtilities.ts @@ -129,7 +129,7 @@ export function createCachedDirectoryStructureHost(host: DirectoryStructureHost, addOrDeleteFileOrDirectory, addOrDeleteFile, clearCache, - realpath: host.realpath && realpath + realpath: host.realpath && realpath, }; function toPath(fileName: string) { @@ -162,7 +162,7 @@ export function createCachedDirectoryStructureHost(host: DirectoryStructureHost, if (!host.realpath || ensureTrailingDirectorySeparator(toPath(host.realpath(rootDir))) === rootDirPath) { const resultFromHost: MutableFileSystemEntries = { files: map(host.readDirectory!(rootDir, /*extensions*/ undefined, /*exclude*/ undefined, /*include*/["*.*"]), getBaseNameOfFileName) || [], - directories: host.getDirectories!(rootDir) || [] + directories: host.getDirectories!(rootDir) || [], }; cachedReadDirectoryResult.set(ensureTrailingDirectorySeparator(rootDirPath), resultFromHost); @@ -276,7 +276,7 @@ export function createCachedDirectoryStructureHost(host: DirectoryStructureHost, if (rootSymLinkResult && path === rootDirPath) return rootSymLinkResult; const result: FileSystemEntries = { files: map(host.readDirectory!(dir, /*extensions*/ undefined, /*exclude*/ undefined, /*include*/["*.*"]), getBaseNameOfFileName) || emptyArray, - directories: host.getDirectories!(dir) || emptyArray + directories: host.getDirectories!(dir) || emptyArray, }; if (path === rootDirPath) rootSymLinkResult = result; return result; @@ -313,7 +313,7 @@ export function createCachedDirectoryStructureHost(host: DirectoryStructureHost, const baseName = getBaseNameOfFileName(fileOrDirectory); const fsQueryResult: FileAndDirectoryExistence = { fileExists: host.fileExists(fileOrDirectoryPath), - directoryExists: host.directoryExists(fileOrDirectoryPath) + directoryExists: host.directoryExists(fileOrDirectoryPath), }; if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) { // Folder added or removed, clear the cache instead of updating the folder and its structure @@ -369,7 +369,7 @@ export enum ConfigFileProgramReloadLevel { /** Update the file name list from the disk */ Partial, /** Reload completely by re-reading contents of config file from disk and updating program */ - Full + Full, } /** @internal */ @@ -468,7 +468,7 @@ export function updatePackageJsonWatch( newMap, { createNewValue: createPackageJsonWatch, - onDeleteValue: closeFileWatcher + onDeleteValue: closeFileWatcher, } ); } @@ -495,7 +495,7 @@ export function updateMissingFilePathsWatch( createNewValue: createMissingFileWatch, // Files that are no longer missing (e.g. because they are no longer required) // should no longer be watched. - onDeleteValue: closeFileWatcher + onDeleteValue: closeFileWatcher, } ); } @@ -528,7 +528,7 @@ export function updateWatchingWildcardDirectories( // Close existing watch thats not needed any more onDeleteValue: closeFileWatcherOf, // Close existing watch that doesnt match in the flags - onExistingValue: updateWildcardDirectoryWatcher + onExistingValue: updateWildcardDirectoryWatcher, } ); @@ -536,7 +536,7 @@ export function updateWatchingWildcardDirectories( // Create new watch and recursive info return { watcher: watchDirectory(directory, flags), - flags + flags, }; } @@ -645,7 +645,7 @@ export function isEmittedFileOfProgram(program: Program | undefined, file: strin export enum WatchLogLevel { None, TriggerOnly, - Verbose + Verbose, } /** @internal */ @@ -674,13 +674,13 @@ export function getWatchFactory(host: WatchFactoryHost, watchL const triggerInvokingFactory: WatchFactory | undefined = watchLogLevel !== WatchLogLevel.None ? { watchFile: createTriggerLoggingAddWatch("watchFile"), - watchDirectory: createTriggerLoggingAddWatch("watchDirectory") + watchDirectory: createTriggerLoggingAddWatch("watchDirectory"), } : undefined; const factory = watchLogLevel === WatchLogLevel.Verbose ? { watchFile: createFileWatcherWithLogging, - watchDirectory: createDirectoryWatcherWithLogging + watchDirectory: createDirectoryWatcherWithLogging, } : triggerInvokingFactory || plainInvokeFactory; const excludeWatcherFactory = watchLogLevel === WatchLogLevel.Verbose ? @@ -689,7 +689,7 @@ export function getWatchFactory(host: WatchFactoryHost, watchL return { watchFile: createExcludeHandlingAddWatch("watchFile"), - watchDirectory: createExcludeHandlingAddWatch("watchDirectory") + watchDirectory: createExcludeHandlingAddWatch("watchDirectory"), }; function createExcludeHandlingAddWatch>(key: T): WatchFactory[T] { @@ -720,7 +720,7 @@ export function getWatchFactory(host: WatchFactoryHost, watchL ) { log(`ExcludeWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo)}`); return { - close: () => log(`ExcludeWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo)}`) + close: () => log(`ExcludeWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo)}`), }; } @@ -738,7 +738,7 @@ export function getWatchFactory(host: WatchFactoryHost, watchL close: () => { log(`FileWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo)}`); watcher.close(); - } + }, }; } @@ -764,7 +764,7 @@ export function getWatchFactory(host: WatchFactoryHost, watchL watcher.close(); const elapsed = timestamp() - start; log(`Elapsed:: ${elapsed}ms ${watchInfo}`); - } + }, }; } @@ -797,7 +797,7 @@ export function getFallbackOptions(options: WatchOptions | undefined): WatchOpti return { watchFile: fallbackPolling !== undefined ? fallbackPolling as unknown as WatchFileKind : - WatchFileKind.PriorityPollingInterval + WatchFileKind.PriorityPollingInterval, }; } diff --git a/src/deprecatedCompat/5.0/identifierProperties.ts b/src/deprecatedCompat/5.0/identifierProperties.ts index fbbfc5ee55d15..d75ef8ef1a8bc 100644 --- a/src/deprecatedCompat/5.0/identifierProperties.ts +++ b/src/deprecatedCompat/5.0/identifierProperties.ts @@ -29,8 +29,8 @@ addObjectAllocatorPatcher(objectAllocator => { since: "5.0", warnAfter: "5.1", errorAfter: "5.2", - message: "Use 'identifierToKeywordKind(identifier)' instead." - }) + message: "Use 'identifierToKeywordKind(identifier)' instead.", + }), }); } @@ -44,8 +44,8 @@ addObjectAllocatorPatcher(objectAllocator => { since: "5.0", warnAfter: "5.1", errorAfter: "5.2", - message: "Use '.parent' or the surrounding context to determine this instead." - }) + message: "Use '.parent' or the surrounding context to determine this instead.", + }), }); } }); diff --git a/src/deprecatedCompat/deprecations.ts b/src/deprecatedCompat/deprecations.ts index 8682631b07830..71974c817fc10 100644 --- a/src/deprecatedCompat/deprecations.ts +++ b/src/deprecatedCompat/deprecations.ts @@ -145,9 +145,9 @@ export function buildOverload(name: string): OverloadBuilder { bind: binder => ({ finish: () => createOverload(name, overloads, binder), deprecate: deprecations => ({ - finish: () => createOverload(name, overloads, binder, deprecations) - }) - }) - }) + finish: () => createOverload(name, overloads, binder, deprecations), + }), + }), + }), }; } diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index 660effc571d48..c0c1d9bae7442 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -185,7 +185,7 @@ function createColors(sys: System) { bold: (str: string) => str, blue: (str: string) => str, blueBackground: (str: string) => str, - brightWhite: (str: string) => str + brightWhite: (str: string) => str, }; } @@ -226,7 +226,7 @@ function createColors(sys: System) { bold, blue, brightWhite, - blueBackground + blueBackground, }; } @@ -361,7 +361,7 @@ function generateOptionOutput(sys: System, option: CommandLineOption, rightAlign return { valueType: getValueType(option), - possibleValues: getPossibleValues(option) + possibleValues: getPossibleValues(option), }; function getValueType(option: CommandLineOption) { @@ -486,7 +486,7 @@ function printEasyHelp(sys: System, simpleOptions: readonly CommandLineOption[]) output = [ ...output, ...generateSectionOptionsOutput(sys, getDiagnosticText(Diagnostics.COMMAND_LINE_FLAGS), cliCommands, /*subCategory*/ false, /*beforeOptionsDescription*/ undefined, /*afterOptionsDescription*/ undefined), - ...generateSectionOptionsOutput(sys, getDiagnosticText(Diagnostics.COMMON_COMPILER_OPTIONS), configOpts, /*subCategory*/ false, /*beforeOptionsDescription*/ undefined, formatMessage(Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsc")) + ...generateSectionOptionsOutput(sys, getDiagnosticText(Diagnostics.COMMON_COMPILER_OPTIONS), configOpts, /*subCategory*/ false, /*beforeOptionsDescription*/ undefined, formatMessage(Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsc")), ]; for (const line of output) { @@ -901,7 +901,7 @@ function performCompilation( options, projectReferences, host, - configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config) + configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config), }; const program = createProgram(programOptions); const exitStatus = emitFilesAndReportErrorsAndGetExitStatus( @@ -936,7 +936,7 @@ function performIncrementalCompilation( afterProgramEmitAndDiagnostics: builderProgram => { reportStatistics(sys, builderProgram.getProgram(), /*solutionPerformance*/ undefined); cb(builderProgram); - } + }, }); return sys.exit(exitStatus); } @@ -1003,7 +1003,7 @@ function createWatchOfConfigFile( watchOptionsToExtend, system, reportDiagnostic, - reportWatchStatus: createWatchStatusReporter(system, configParseResult.options) + reportWatchStatus: createWatchStatusReporter(system, configParseResult.options), }); updateWatchCompilationHost(system, cb, watchCompilerHost); watchCompilerHost.configFileParsingResult = configParseResult; @@ -1025,7 +1025,7 @@ function createWatchOfFilesAndCompilerOptions( watchOptions, system, reportDiagnostic, - reportWatchStatus: createWatchStatusReporter(system, options) + reportWatchStatus: createWatchStatusReporter(system, options), }); updateWatchCompilationHost(system, cb, watchCompilerHost); return createWatchProgram(watchCompilerHost); diff --git a/src/harness/client.ts b/src/harness/client.ts index 76004edf58f10..586ce36670fd1 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -149,7 +149,7 @@ export class SessionClient implements LanguageService { const lineOffset = computeLineAndCharacterOfPosition(this.getLineMap(fileName), position); return { line: lineOffset.line + 1, - offset: lineOffset.character + 1 + offset: lineOffset.character + 1, }; } @@ -162,7 +162,7 @@ export class SessionClient implements LanguageService { seq: this.sequence, type: "request", arguments: args, - command + command, }; this.sequence++; @@ -263,7 +263,7 @@ export class SessionClient implements LanguageService { textSpan: this.decodeSpan(body, fileName), displayParts: [{ kind: "text", text: body.displayString }], documentation: typeof body.documentation === "string" ? [{ kind: "text", text: body.documentation }] : body.documentation, - tags: this.decodeLinkDisplayParts(body.tags) + tags: this.decodeLinkDisplayParts(body.tags), }; } @@ -275,7 +275,7 @@ export class SessionClient implements LanguageService { return { configFileName: response.body!.configFileName, // TODO: GH#18217 - fileNames: response.body!.fileNames + fileNames: response.body!.fileNames, }; } @@ -297,7 +297,7 @@ export class SessionClient implements LanguageService { } return entry as { name: string, kind: ScriptElementKind, kindModifiers: string, sortText: string }; // TODO: GH#18217 - }) + }), }; } @@ -317,7 +317,7 @@ export class SessionClient implements LanguageService { getNavigateToItems(searchValue: string): NavigateToItem[] { const args: protocol.NavtoRequestArgs = { searchValue, - file: this.host.getScriptFileNames()[0] + file: this.host.getScriptFileNames()[0], }; const request = this.processRequest(protocol.CommandTypes.Navto, args); @@ -373,7 +373,7 @@ export class SessionClient implements LanguageService { fileName: entry.file, textSpan: this.decodeSpan(entry), kind: ScriptElementKind.unknown, - name: "" + name: "", })); } @@ -394,7 +394,7 @@ export class SessionClient implements LanguageService { name: "", unverified: entry.unverified, })), - textSpan: this.decodeSpan(body.textSpan, request.arguments.file) + textSpan: this.decodeSpan(body.textSpan, request.arguments.file), }; } @@ -410,7 +410,7 @@ export class SessionClient implements LanguageService { fileName: entry.file, textSpan: this.decodeSpan(entry), kind: ScriptElementKind.unknown, - name: "" + name: "", })); } @@ -441,7 +441,7 @@ export class SessionClient implements LanguageService { fileName: entry.file, textSpan: this.decodeSpan(entry), kind: ScriptElementKind.unknown, - displayParts: [] + displayParts: [], })); } @@ -537,7 +537,7 @@ export class SessionClient implements LanguageService { ...(contextStart !== undefined ? { contextSpan: this.decodeSpan({ start: contextStart, end: contextEnd! }, fileName) } : undefined), - ...prefixSuffixText + ...prefixSuffixText, }); } } @@ -609,7 +609,7 @@ export class SessionClient implements LanguageService { childItems: this.decodeNavigationBarItems(item.childItems, fileName, lineMap), indent: item.indent, bolded: false, - grayed: false + grayed: false, })); } @@ -628,7 +628,7 @@ export class SessionClient implements LanguageService { kindModifiers: tree.kindModifiers, spans: tree.spans.map(span => this.decodeSpan(span, fileName, lineMap)), nameSpan: tree.nameSpan && this.decodeSpan(tree.nameSpan, fileName, lineMap), - childItems: map(tree.childItems, item => this.decodeNavigationTree(item, fileName, lineMap)) + childItems: map(tree.childItems, item => this.decodeNavigationTree(item, fileName, lineMap)), }; } @@ -656,7 +656,7 @@ export class SessionClient implements LanguageService { private decodeLinkDisplayParts(tags: (protocol.JSDocTagInfo | JSDocTagInfo)[]): JSDocTagInfo[] { return tags.map(tag => typeof tag.text === "string" ? { ...tag, - text: [textPart(tag.text)] + text: [textPart(tag.text)], } : (tag as JSDocTagInfo)); } @@ -696,7 +696,7 @@ export class SessionClient implements LanguageService { fileName: item.file, highlightSpans: item.highlightSpans.map(span => ({ textSpan: this.decodeSpan(span, item.file), - kind: span.kind + kind: span.kind, })), })); } @@ -710,7 +710,7 @@ export class SessionClient implements LanguageService { hintSpan: this.decodeSpan(item.hintSpan, file), bannerText: item.bannerText, autoCollapse: item.autoCollapse, - kind: item.kind + kind: item.kind, })); } @@ -772,7 +772,7 @@ export class SessionClient implements LanguageService { start: this.lineOffsetToPosition(span.file, span.start), length: this.lineOffsetToPosition(span.file, span.end) - this.lineOffsetToPosition(span.file, span.start), }, - file: span && span.file + file: span && span.file, })), }); }); @@ -888,7 +888,7 @@ export class SessionClient implements LanguageService { const fileName = edit.fileName; return { fileName, - textChanges: edit.textChanges.map(t => this.convertTextChangeToCodeEdit(t, fileName)) + textChanges: edit.textChanges.map(t => this.convertTextChangeToCodeEdit(t, fileName)), }; }); } @@ -896,14 +896,14 @@ export class SessionClient implements LanguageService { private convertChanges(changes: protocol.FileCodeEdits[], fileName: string): FileTextChanges[] { return changes.map(change => ({ fileName: change.fileName, - textChanges: change.textChanges.map(textChange => this.convertTextChangeToCodeEdit(textChange, fileName)) + textChanges: change.textChanges.map(textChange => this.convertTextChangeToCodeEdit(textChange, fileName)), })); } convertTextChangeToCodeEdit(change: protocol.CodeEdit, fileName: string): TextChange { return { span: this.decodeSpan(change, fileName), - newText: change.newText ? change.newText : "" + newText: change.newText ? change.newText : "", }; } @@ -951,7 +951,7 @@ export class SessionClient implements LanguageService { kindModifiers: item.kindModifiers, containerName: item.containerName, span: this.decodeSpan(item.span, item.file), - selectionSpan: this.decodeSpan(item.selectionSpan, item.file) + selectionSpan: this.decodeSpan(item.selectionSpan, item.file), }; } @@ -965,7 +965,7 @@ export class SessionClient implements LanguageService { private convertCallHierarchyIncomingCall(item: protocol.CallHierarchyIncomingCall): CallHierarchyIncomingCall { return { from: this.convertCallHierarchyItem(item.from), - fromSpans: item.fromSpans.map(span => this.decodeSpan(span, item.from.file)) + fromSpans: item.fromSpans.map(span => this.decodeSpan(span, item.from.file)), }; } @@ -979,7 +979,7 @@ export class SessionClient implements LanguageService { private convertCallHierarchyOutgoingCall(file: string, item: protocol.CallHierarchyOutgoingCall): CallHierarchyOutgoingCall { return { to: this.convertCallHierarchyItem(item.to), - fromSpans: item.fromSpans.map(span => this.decodeSpan(span, file)) + fromSpans: item.fromSpans.map(span => this.decodeSpan(span, file)), }; } diff --git a/src/harness/compilerImpl.ts b/src/harness/compilerImpl.ts index f60a429fc567f..2d6476a334fba 100644 --- a/src/harness/compilerImpl.ts +++ b/src/harness/compilerImpl.ts @@ -22,7 +22,7 @@ export function readProject(host: fakes.ParseConfigHost, project: string | undef } else { [project] = host.vfs.scanSync(".", "ancestors-or-self", { - accept: (path, stats) => stats.isFile() && host.vfs.stringComparer(vpath.basename(path), "tsconfig.json") === 0 + accept: (path, stats) => stats.isFile() && host.vfs.stringComparer(vpath.basename(path), "tsconfig.json") === 0, }); } @@ -109,7 +109,7 @@ export class CompilationResult { inputs, js: js.get(outFile), dts: dts.get(vpath.changeExtension(outFile, ".d.ts")), - map: maps.get(outFile + ".map") + map: maps.get(outFile + ".map"), }; if (outputs.js) this._inputsAndOutputs.set(outputs.js.file, outputs); @@ -131,7 +131,7 @@ export class CompilationResult { inputs: [input], js: js.get(this.getOutputPath(sourceFile.fileName, extname)), dts: dts.get(this.getOutputPath(sourceFile.fileName, ts.getDeclarationEmitExtensionForPath(sourceFile.fileName))), - map: maps.get(this.getOutputPath(sourceFile.fileName, extname + ".map")) + map: maps.get(this.getOutputPath(sourceFile.fileName, extname + ".map")), }; this._inputsAndOutputs.set(sourceFile.fileName, outputs); @@ -279,16 +279,16 @@ export function compileFiles(host: fakes.CompilerHost, rootFiles: string[] | und category: ts.DiagnosticCategory.Error, code: -1, key: "-1", - message: `Pre-emit (${preErrors.length}) and post-emit (${postErrors.length}) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here!` + message: `Pre-emit (${preErrors.length}) and post-emit (${postErrors.length}) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here!`, }), ts.createCompilerDiagnostic({ category: ts.DiagnosticCategory.Error, code: -1, key: "-1", - message: `The excess diagnostics are:` + message: `The excess diagnostics are:`, }), ...ts.filter(longerErrors!, p => !ts.some(shorterErrors, p2 => ts.compareDiagnostics(p, p2) === ts.Comparison.EqualTo)) - ) + ), ] : postErrors; return new CompilationResult(host, compilerOptions, program, emitResult, errors); } diff --git a/src/harness/documentsUtil.ts b/src/harness/documentsUtil.ts index fa00ff2d06213..4b5d0a29c14dd 100644 --- a/src/harness/documentsUtil.ts +++ b/src/harness/documentsUtil.ts @@ -35,7 +35,7 @@ export class TextDocument { unitName: this.file, content: this.text, fileOptions: ts.arrayFrom(this.meta) - .reduce((obj, [key, value]) => (obj[key] = value, obj), {} as Record) + .reduce((obj, [key, value]) => (obj[key] = value, obj), {} as Record), }); } } diff --git a/src/harness/evaluatorImpl.ts b/src/harness/evaluatorImpl.ts index 00a4d80e90c73..e370c6dd32905 100644 --- a/src/harness/evaluatorImpl.ts +++ b/src/harness/evaluatorImpl.ts @@ -40,7 +40,7 @@ export function evaluateTypeScript(source: string | { files: vfs.FileSet, rootFi target: ts.ScriptTarget.ES5, module: ts.ModuleKind.CommonJS, lib: ["lib.esnext.d.ts", "lib.dom.d.ts"], - ...options + ...options, }; const host = new fakes.CompilerHost(fs, compilerOptions); const result = compiler.compileFiles(host, source.rootFiles, compilerOptions); @@ -48,7 +48,7 @@ export function evaluateTypeScript(source: string | { files: vfs.FileSet, rootFi assert.ok(/*value*/ false, "Syntax error in evaluation source text:\n" + ts.formatDiagnostics(result.diagnostics, { getCanonicalFileName: file => file, getCurrentDirectory: () => "", - getNewLine: () => "\n" + getNewLine: () => "\n", })); } @@ -256,7 +256,7 @@ class SystemLoader extends Loader { dependers: [], setters: [], hasExports: false, - state: SystemModuleState.Uninstantiated + state: SystemModuleState.Uninstantiated, }; } @@ -294,7 +294,7 @@ class SystemLoader extends Loader { } } const localSystem: SystemGlobal = { - register: (dependencies, declare) => this.instantiateModule(module, dependencies, declare) + register: (dependencies, declare) => this.instantiateModule(module, dependencies, declare), }; const evaluateText = `(function (System, ${globalNames.join(", ")}) { ${text}\n})`; try { @@ -332,8 +332,8 @@ class SystemLoader extends Loader { const context: SystemModuleContext = { import: (_id) => { throw new Error("Dynamic import not implemented."); }, meta: { - url: ts.isUrl(module.file) ? module.file : `file:///${ts.normalizeSlashes(module.file).replace(/^\//, "").split("/").map(encodeURIComponent).join("/")}` - } + url: ts.isUrl(module.file) ? module.file : `file:///${ts.normalizeSlashes(module.file).replace(/^\//, "").split("/").map(encodeURIComponent).join("/")}`, + }, }; module.requestedDependencies = dependencies; diff --git a/src/harness/fakesHosts.ts b/src/harness/fakesHosts.ts index 6155a2622b13f..d82ab4fe0363e 100644 --- a/src/harness/fakesHosts.ts +++ b/src/harness/fakesHosts.ts @@ -425,7 +425,7 @@ export interface ExpectedDiagnosticRelatedInformation extends ExpectedDiagnostic export enum DiagnosticKind { Error = "Error", - Status = "Status" + Status = "Status", } export interface ExpectedErrorDiagnostic extends ExpectedDiagnosticRelatedInformation { relatedInformation?: ExpectedDiagnosticRelatedInformation[]; diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts index 634a80bdf0871..9ed14a14af084 100644 --- a/src/harness/fourslashImpl.ts +++ b/src/harness/fourslashImpl.ts @@ -12,7 +12,7 @@ export const enum FourSlashTestType { Native, Shims, ShimsWithPreprocess, - Server + Server, } // Represents a parsed source file with metadata @@ -199,7 +199,7 @@ function createScriptSnapShot(sourceText: string): ts.IScriptSnapshot { const enum CallHierarchyItemDirection { Root, Incoming, - Outgoing + Outgoing, } export class TestState { @@ -860,7 +860,7 @@ export class TestState { return { andApplyCodeAction: () => { this.raiseError(`Cannot apply code action when multiple markers are specified.`); - } + }, }; } this.goToMarker(options.marker); @@ -982,7 +982,7 @@ export class TestState { this.raiseError(`No completion entry found for '${options.name}' from '${options.source}'`); } this.applyCodeActionFromCompletion(/*markerName*/ undefined, { name, source, data, description, newFileContent, newRangeContent, preferences }); - } + }, }; } @@ -1738,7 +1738,7 @@ export class TestState { code: e.code, ...ts.createTextSpanFromRange(range), reportsUnnecessary: e.reportsUnnecessary, - reportsDeprecated: e.reportsDeprecated + reportsDeprecated: e.reportsDeprecated, }; })); } @@ -1825,7 +1825,7 @@ export class TestState { findInStrings = false, findInComments = false, providePrefixAndSuffixTextForRename = true, - quotePreference = "double" + quotePreference = "double", } = options || {}; const locations = this.languageService.findRenameLocations( fileName, @@ -1963,7 +1963,7 @@ export class TestState { "isVariadic", "tags", "argumentCount", - "overrideSelectedItemIndex" + "overrideSelectedItemIndex", ]; for (const key in options) { if (!ts.contains(allKeys, key)) { @@ -2254,7 +2254,7 @@ export class TestState { private getCompilerTestFiles() { return ts.map(this.testData.files, ({ content, fileName }) => ({ - content, unitName: fileName + content, unitName: fileName, })); } @@ -2291,7 +2291,7 @@ export class TestState { const baselineFile = this.getBaselineFileNameForContainingTestFile(); const result = ts.arrayFrom(this.testData.markerPositions.entries(), ([name, marker]) => ({ marker: { ...marker, name }, - item: this.languageService.getQuickInfoAtPosition(marker.fileName, marker.position) + item: this.languageService.getQuickInfoAtPosition(marker.fileName, marker.position), })); const annotations = this.annotateContentWithTooltips( result, @@ -2300,7 +2300,7 @@ export class TestState { ({ displayParts, documentation, tags }) => [ ...(displayParts ? displayParts.map(p => p.text).join("").split("\n") : []), ...(documentation?.length ? documentation.map(p => p.text).join("").split("\n") : []), - ...(tags?.length ? tags.map(p => `@${p.name} ${p.text?.map(dp => dp.text).join("") ?? ""}`).join("\n").split("\n") : []) + ...(tags?.length ? tags.map(p => `@${p.name} ${p.text?.map(dp => dp.text).join("") ?? ""}`).join("\n").split("\n") : []), ]); Harness.Baseline.runBaseline(baselineFile, annotations + "\n\n" + stringify(result)); } @@ -2309,7 +2309,7 @@ export class TestState { const baselineFile = this.getBaselineFileNameForContainingTestFile(); const result = ts.arrayFrom(this.testData.markerPositions.entries(), ([name, marker]) => ({ marker: { ...marker, name }, - item: this.languageService.getSignatureHelpItems(marker.fileName, marker.position, /*options*/ undefined) + item: this.languageService.getSignatureHelpItems(marker.fileName, marker.position, /*options*/ undefined), })); const annotations = this.annotateContentWithTooltips( result, @@ -2351,9 +2351,9 @@ export class TestState { ...completions, entries: completions?.entries.map(entry => ({ ...entry, - ...this.getCompletionEntryDetails(entry.name, entry.source, entry.data, preferences) + ...this.getCompletionEntryDetails(entry.name, entry.source, entry.data, preferences), })), - } + }, }; }); const annotations = this.annotateContentWithTooltips( @@ -2531,7 +2531,7 @@ export class TestState { private getSignatureHelp({ triggerReason }: FourSlashInterface.VerifySignatureHelpOptions): ts.SignatureHelpItems | undefined { return this.languageService.getSignatureHelpItems(this.activeFile.fileName, this.currentCaretPosition, { - triggerReason + triggerReason, }); } @@ -2645,8 +2645,8 @@ export class TestState { this.languageService.getSignatureHelpItems(this.activeFile.fileName, offset, { triggerReason: { kind: "characterTyped", - triggerCharacter: ch - } + triggerCharacter: ch, + }, }); } else if (prevChar === " " && /A-Za-z_/.test(ch)) { @@ -3361,7 +3361,7 @@ export class TestState { const diagnosticsForCodeFix = this.getDiagnostics(fileName, /*includeSuggestions*/ true).map(diagnostic => ({ start: diagnostic.start, length: diagnostic.length, - code: diagnostic.code + code: diagnostic.code, })); return ts.flatMap(ts.deduplicate(diagnosticsForCodeFix, ts.equalOwnProperties), diagnostic => { @@ -3485,7 +3485,7 @@ export class TestState { "'": ts.CharacterCodes.singleQuote, '"': ts.CharacterCodes.doubleQuote, "`": ts.CharacterCodes.backtick, - "<": ts.CharacterCodes.lessThan + "<": ts.CharacterCodes.lessThan, })); const charCode = openBraceMap.get(openingBrace); @@ -3514,7 +3514,7 @@ export class TestState { includeCompletionsWithInsertText: true, allowIncompleteCompletions: true, includeCompletionsWithSnippetText: true, - ...preferences + ...preferences, }; this.goToMarker(marker); @@ -3851,7 +3851,7 @@ export class TestState { private getSelection(): ts.TextRange { return { pos: this.currentCaretPosition, - end: this.selectionEnd === -1 ? this.currentCaretPosition : this.selectionEnd + end: this.selectionEnd === -1 ? this.currentCaretPosition : this.selectionEnd, }; } @@ -4458,7 +4458,7 @@ function runCode(code: string, state: TestState, fileName: string): void { retrieveFile: path => { return path === generatedFile ? wrappedCode : undefined!; - } + }, }); try { @@ -4614,7 +4614,7 @@ function parseTestData(basePath: string, contents: string, fileName: string): Fo globalOptions, files, symlinks, - ranges + ranges, }; } @@ -4643,7 +4643,7 @@ function getNonFileNameOptionInObject(optionObject: { [s: string]: string }): st const enum State { none, inSlashStarMarker, - inObjectMarker + inObjectMarker, } function reportError(fileName: string, line: number, col: number, message: string): never { @@ -4668,7 +4668,7 @@ function recordObjectMarker(fileName: string, location: LocationInformation, tex const marker: Marker = { fileName, position: location.position, - data: markerValue + data: markerValue, }; // Object markers can be anonymous @@ -4684,7 +4684,7 @@ function recordObjectMarker(fileName: string, location: LocationInformation, tex function recordMarker(fileName: string, location: LocationInformation, name: string, markerMap: Map, markers: Marker[]): Marker | undefined { const marker: Marker = { fileName, - position: location.position + position: location.position, }; // Verify markers for uniqueness @@ -4764,7 +4764,7 @@ function parseFileContent(content: string, fileName: string, markerMap: Map ({ name, @@ -1012,24 +1012,24 @@ export namespace Completion { name, kind: "var", kindModifiers: "declare", - sortText: SortText.GlobalsOrKeywords + sortText: SortText.GlobalsOrKeywords, }); const moduleEntry = (name: string): ExpectedCompletionEntryObject => ({ name, kind: "module", kindModifiers: "declare", - sortText: SortText.GlobalsOrKeywords + sortText: SortText.GlobalsOrKeywords, }); const keywordEntry = (name: string): ExpectedCompletionEntryObject => ({ name, kind: "keyword", - sortText: SortText.GlobalsOrKeywords + sortText: SortText.GlobalsOrKeywords, }); const methodEntry = (name: string): ExpectedCompletionEntryObject => ({ name, kind: "method", kindModifiers: "declare", - sortText: SortText.LocationPriority + sortText: SortText.LocationPriority, }); const deprecatedMethodEntry = (name: string): ExpectedCompletionEntryObject => ({ name, @@ -1041,19 +1041,19 @@ export namespace Completion { name, kind: "property", kindModifiers: "declare", - sortText: SortText.LocationPriority + sortText: SortText.LocationPriority, }); const interfaceEntry = (name: string): ExpectedCompletionEntryObject => ({ name, kind: "interface", kindModifiers: "declare", - sortText: SortText.GlobalsOrKeywords + sortText: SortText.GlobalsOrKeywords, }); const typeEntry = (name: string): ExpectedCompletionEntryObject => ({ name, kind: "type", kindModifiers: "declare", - sortText: SortText.GlobalsOrKeywords + sortText: SortText.GlobalsOrKeywords, }); const res: ExpectedCompletionEntryObject[] = []; @@ -1061,7 +1061,7 @@ export namespace Completion { res.push({ name: ts.Debug.checkDefined(ts.tokenToString(i)), kind: "keyword", - sortText: SortText.GlobalsOrKeywords + sortText: SortText.GlobalsOrKeywords, }); } export const keywordsWithUndefined: readonly ExpectedCompletionEntryObject[] = res; @@ -1234,7 +1234,7 @@ export namespace Completion { export const globalThisEntry: ExpectedCompletionEntry = { name: "globalThis", kind: "module", - sortText: SortText.GlobalsOrKeywords + sortText: SortText.GlobalsOrKeywords, }; export const globalTypes = globalTypesPlus([]); export function globalTypesPlus(plus: readonly ExpectedCompletionEntry[]) { @@ -1307,7 +1307,7 @@ export namespace Completion { ["override", "private", "protected", "public", "readonly"].map((name): ExpectedCompletionEntryObject => ({ name, kind: "keyword", - sortText: SortText.GlobalsOrKeywords + sortText: SortText.GlobalsOrKeywords, })); export const functionMembers: readonly ExpectedCompletionEntryObject[] = [ @@ -1548,7 +1548,7 @@ export namespace Completion { export const undefinedVarEntry: ExpectedCompletionEntryObject = { name: "undefined", kind: "var", - sortText: SortText.GlobalsOrKeywords + sortText: SortText.GlobalsOrKeywords, }; // TODO: many of these are inappropriate to always provide export const globalsInsideFunction = (plus: readonly ExpectedCompletionEntry[], options?: { noLib?: boolean }): readonly ExpectedCompletionEntry[] => [ @@ -1697,14 +1697,14 @@ export namespace Completion { globalThisEntry, ...globalsVars, undefinedVarEntry, - ...globalKeywords + ...globalKeywords, ].sort(compareExpectedCompletionEntries); export const globalsInJs: readonly ExpectedCompletionEntryObject[] = [ globalThisEntry, ...globalsVars, undefinedVarEntry, - ...globalInJsKeywords + ...globalInJsKeywords, ].sort(compareExpectedCompletionEntries); export function globalsPlus(plus: readonly ExpectedCompletionEntry[], options?: { noLib?: boolean }) { diff --git a/src/harness/harnessIO.ts b/src/harness/harnessIO.ts index d727cd82e928d..3211fac549bec 100644 --- a/src/harness/harnessIO.ts +++ b/src/harness/harnessIO.ts @@ -174,7 +174,7 @@ function createNodeIO(): IO { tryEnableSourceMapsForHost: () => ts.sys.tryEnableSourceMapsForHost && ts.sys.tryEnableSourceMapsForHost(), getMemoryUsage: () => ts.sys.getMemoryUsage && ts.sys.getMemoryUsage(), getEnvironmentVariable: name => ts.sys.getEnvironmentVariable(name), - joinPath + joinPath, }; } @@ -270,7 +270,7 @@ export namespace Compiler { if (!libFileNameSourceFileMap) { libFileNameSourceFileMap = new Map(Object.entries({ - [defaultLibFileName]: createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + "lib.es5.d.ts")!, /*languageVersion*/ ts.ScriptTarget.Latest) + [defaultLibFileName]: createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + "lib.es5.d.ts")!, /*languageVersion*/ ts.ScriptTarget.Latest), })); } @@ -503,7 +503,7 @@ export namespace Compiler { if (declFile && !findUnit(declFile.file, declInputFiles) && !findUnit(declFile.file, declOtherFiles)) { dtsFiles.push({ unitName: declFile.file, - content: Utils.removeByteOrderMark(declFile.text) + content: Utils.removeByteOrderMark(declFile.text), }); } } @@ -1110,7 +1110,7 @@ function getVaryByStarSettingValues(varyBy: string): ReadonlyMap testUnitData.some(data => data.name.toLowerCase() === fileName.toLowerCase()), - readFile: (name) => ts.forEach(testUnitData, data => data.name.toLowerCase() === name.toLowerCase() ? data.content : undefined) + readFile: (name) => ts.forEach(testUnitData, data => data.name.toLowerCase() === name.toLowerCase() ? data.content : undefined), }; // check if project has tsconfig.json in the list of files diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index e059aad96f1f5..54e1c691465b6 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -59,7 +59,7 @@ export class ScriptInfo { this.editRanges.push({ length: this.content.length, textChangeRange: ts.createTextChangeRange( - ts.createTextSpanFromBounds(start, end), newText.length) + ts.createTextSpanFromBounds(start, end), newText.length), }); // Update version # @@ -356,7 +356,7 @@ class ShimLanguageServiceHost extends LanguageServiceAdapterHost implements ts.L const scriptInfo = this.getScriptInfo(fileName); return scriptInfo && scriptInfo.content; }, - useCaseSensitiveFileNames: this.useCaseSensitiveFileNames() + useCaseSensitiveFileNames: this.useCaseSensitiveFileNames(), }; this.getModuleResolutionsForFile = (fileName) => { const scriptInfo = this.getScriptInfo(fileName)!; @@ -443,7 +443,7 @@ class ClassifierShimProxy implements ts.Classifier { for (; i < result.length - 1; i += 2) { const t = entries[i / 2] = { length: parseInt(result[i]), - classification: parseInt(result[i + 1]) + classification: parseInt(result[i + 1]), }; assert.isTrue(t.length > 0, "Result length should be greater than 0, got :" + t.length); @@ -455,7 +455,7 @@ class ClassifierShimProxy implements ts.Classifier { return { finalLexState, - entries + entries, }; } } @@ -706,14 +706,14 @@ export class ShimLanguageServiceAdapter implements LanguageServiceAdapter { ambientExternalModules: [], isLibFile: shimResult.isLibFile, typeReferenceDirectives: [], - libReferenceDirectives: [] + libReferenceDirectives: [], }; ts.forEach(shimResult.referencedFiles, refFile => { convertResult.referencedFiles.push({ fileName: refFile.path, pos: refFile.position, - end: refFile.position + refFile.length + end: refFile.position + refFile.length, }); }); @@ -721,7 +721,7 @@ export class ShimLanguageServiceAdapter implements LanguageServiceAdapter { convertResult.importedFiles.push({ fileName: importedFile.path, pos: importedFile.position, - end: importedFile.position + importedFile.length + end: importedFile.position + importedFile.length, }); }); @@ -729,7 +729,7 @@ export class ShimLanguageServiceAdapter implements LanguageServiceAdapter { convertResult.importedFiles.push({ fileName: typeRefDirective.path, pos: typeRefDirective.position, - end: typeRefDirective.position + typeRefDirective.length + end: typeRefDirective.position + typeRefDirective.length, }); }); return convertResult; @@ -912,9 +912,9 @@ class SessionServerHost implements ts.server.ServerHost, ts.server.Logger { }; return proxy; - } + }, }), - error: undefined + error: undefined, }; // Throws during initialization @@ -923,9 +923,9 @@ class SessionServerHost implements ts.server.ServerHost, ts.server.Logger { module: () => ({ create() { throw new Error("I am not a well-behaved plugin"); - } + }, }), - error: undefined + error: undefined, }; // Adds another diagnostic @@ -943,14 +943,14 @@ class SessionServerHost implements ts.server.ServerHost, ts.server.Logger { code: 9999, length: 3, messageText: `Plugin diagnostic`, - start: 0 + start: 0, }); return prev; }; return proxy; - } + }, }), - error: undefined + error: undefined, }; // Accepts configurations @@ -970,7 +970,7 @@ class SessionServerHost implements ts.server.ServerHost, ts.server.Logger { code: 9999, length: 3, messageText: customMessage, - start: 0 + start: 0, }); return prev; }; @@ -978,15 +978,15 @@ class SessionServerHost implements ts.server.ServerHost, ts.server.Logger { }, onConfigurationChanged(config: any) { customMessage = config.message; - } + }, }), - error: undefined + error: undefined, }; default: return { module: undefined, - error: new Error("Could not resolve module") + error: new Error("Could not resolve module"), }; } } @@ -1053,7 +1053,7 @@ export class ServerLanguageServiceAdapter implements LanguageServiceAdapter { "\x1b[1mClient\x1b[0m\x1b[31m:", clientText, "", - "This probably means something is wrong with the fourslash infrastructure, not with the test." + "This probably means something is wrong with the fourslash infrastructure, not with the test.", ].join(ts.sys.newLine)); } } diff --git a/src/harness/harnessUtils.ts b/src/harness/harnessUtils.ts index beee8048030a8..fd4a30e0e1eb3 100644 --- a/src/harness/harnessUtils.ts +++ b/src/harness/harnessUtils.ts @@ -160,7 +160,7 @@ function convertDiagnostic(diagnostic: ts.Diagnostic) { length: diagnostic.length, messageText: ts.flattenDiagnosticMessageText(diagnostic.messageText, Harness.IO.newLine()), category: ts.diagnosticCategoryName(diagnostic, /*lowerCase*/ false), - code: diagnostic.code + code: diagnostic.code, }; } diff --git a/src/harness/typeWriter.ts b/src/harness/typeWriter.ts index 3d3602b32decd..57e3fd976232b 100644 --- a/src/harness/typeWriter.ts +++ b/src/harness/typeWriter.ts @@ -147,7 +147,7 @@ export class TypeWriterWalker { line: lineAndCharacter.line, syntaxKind: node.kind, sourceText, - type: typeString + type: typeString, }; } const symbol = this.checker.getSymbolAtLocation(node); @@ -182,7 +182,7 @@ export class TypeWriterWalker { line: lineAndCharacter.line, syntaxKind: node.kind, sourceText, - symbol: symbolString + symbol: symbolString, }; } } diff --git a/src/harness/vfsUtil.ts b/src/harness/vfsUtil.ts index 6968b34914d81..eb32f8b04be51 100644 --- a/src/harness/vfsUtil.ts +++ b/src/harness/vfsUtil.ts @@ -871,7 +871,7 @@ export class FileSystem { mtimeMs: time, ctimeMs: time, birthtimeMs: time, - nlink: 0 + nlink: 0, }; } @@ -964,7 +964,7 @@ export class FileSystem { ctimeMs: root.ctimeMs, birthtimeMs: root.birthtimeMs, nlink: root.nlink, - shadowRoot: root + shadowRoot: root, }; if (isSymlink(root)) (shadow as SymlinkInode).symlink = root.symlink; @@ -1218,7 +1218,7 @@ export function createResolver(host: FileSystemResolverHost): FileSystemResolver }, readFileSync(path: string): Buffer { return ts.sys.bufferFrom!(host.readFile(path)!, "utf8") as Buffer; // TODO: GH#18217 - } + }, }; } @@ -1330,7 +1330,7 @@ export const IOErrorMessages = Object.freeze({ EINVAL: "invalid value", ENOTEMPTY: "directory not empty", EPERM: "operation not permitted", - EROFS: "file system is read-only" + EROFS: "file system is read-only", }); export function createIOError(code: keyof typeof IOErrorMessages, details = "") { @@ -1519,10 +1519,10 @@ function getBuiltLocal(host: FileSystemResolverHost, ignoreCase: boolean): FileS [builtFolder]: new Mount(vpath.resolve(host.getWorkspaceRoot(), "built/local"), resolver), [testLibFolder]: new Mount(vpath.resolve(host.getWorkspaceRoot(), "tests/lib"), resolver), [projectsFolder]: new Mount(vpath.resolve(host.getWorkspaceRoot(), "tests/projects"), resolver), - [srcFolder]: {} + [srcFolder]: {}, }, cwd: srcFolder, - meta: { defaultLibLocation: builtFolder } + meta: { defaultLibLocation: builtFolder }, }); builtLocalCI.makeReadonly(); } diff --git a/src/jsTyping/jsTyping.ts b/src/jsTyping/jsTyping.ts index 1983107b35548..26c23f2688fb5 100644 --- a/src/jsTyping/jsTyping.ts +++ b/src/jsTyping/jsTyping.ts @@ -107,7 +107,7 @@ const unprefixedNodeCoreModuleList = [ "vm", "wasi", "worker_threads", - "zlib" + "zlib", ]; /** @internal */ @@ -383,7 +383,7 @@ export const enum NameValidationResult { NameTooLong, NameStartsWithDot, NameStartsWithUnderscore, - NameContainsNonURISafeCharacters + NameContainsNonURISafeCharacters, } const maxPackageNameLength = 214; diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 354198918b5e8..aa36411be2d53 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -358,7 +358,7 @@ const watchOptionsConverters = prepareConvertersForEnumLikeCompilerOptions(optio const indentStyle = new Map(Object.entries({ none: IndentStyle.None, block: IndentStyle.Block, - smart: IndentStyle.Smart + smart: IndentStyle.Smart, })); export interface TypesMapFile { @@ -388,30 +388,30 @@ const defaultTypeSafeList: SafeList = { "jquery": { // jquery files can have names like "jquery-1.10.2.min.js" (or "jquery.intellisense.js") match: /jquery(-[\d.]+)?(\.intellisense)?(\.min)?\.js$/i, - types: ["jquery"] + types: ["jquery"], }, "WinJS": { // e.g. c:/temp/UWApp1/lib/winjs-4.0.1/js/base.js match: /^(.*\/winjs-[.\d]+)\/js\/base\.js$/i, // If the winjs/base.js file is found.. exclude: [["^", 1, "/.*"]], // ..then exclude all files under the winjs folder - types: ["winjs"] // And fetch the @types package for WinJS + types: ["winjs"], // And fetch the @types package for WinJS }, "Kendo": { // e.g. /Kendo3/wwwroot/lib/kendo/kendo.all.min.js match: /^(.*\/kendo(-ui)?)\/kendo\.all(\.min)?\.js$/i, exclude: [["^", 1, "/.*"]], - types: ["kendo-ui"] + types: ["kendo-ui"], }, "Office Nuget": { // e.g. /scripts/Office/1/excel-15.debug.js match: /^(.*\/office\/1)\/excel-\d+\.debug\.js$/i, // Office NuGet package is installed under a "1/office" folder exclude: [["^", 1, "/.*"]], // Exclude that whole folder if the file indicated above is found in it - types: ["office"] // @types package to fetch instead + types: ["office"], // @types package to fetch instead }, "References": { match: /^(.*\/_references\.js)$/i, - exclude: [["^", 1, "$"]] - } + exclude: [["^", 1, "$"]], + }, }; export function convertFormatOptions(protocolOptions: protocol.FormatCodeSettings): FormatCodeSettings { @@ -623,7 +623,7 @@ export enum ProjectReferenceProjectLoadKind { /** Find existing project or create one for the project reference */ FindCreate, /** Find existing project or create and load it for the project reference */ - FindCreateLoad + FindCreateLoad, } /** @internal */ @@ -1105,7 +1105,7 @@ export class ProjectService { } const event: ProjectLanguageServiceStateEvent = { eventName: ProjectLanguageServiceStateEvent, - data: { project, languageServiceEnabled } + data: { project, languageServiceEnabled }, }; this.eventHandler(event); } @@ -1209,8 +1209,8 @@ export class ProjectService { const event: ProjectsUpdatedInBackgroundEvent = { eventName: ProjectsUpdatedInBackgroundEvent, data: { - openFiles: arrayFrom(this.openFiles.keys(), path => this.getScriptInfoForPath(path as Path)!.fileName) - } + openFiles: arrayFrom(this.openFiles.keys(), path => this.getScriptInfoForPath(path as Path)!.fileName), + }, }; this.eventHandler(event); } @@ -1223,7 +1223,7 @@ export class ProjectService { const event: LargeFileReferencedEvent = { eventName: LargeFileReferencedEvent, - data: { file, fileSize, maxFileSize } + data: { file, fileSize, maxFileSize }, }; this.eventHandler(event); } @@ -1236,7 +1236,7 @@ export class ProjectService { project.sendLoadingProjectFinish = true; const event: ProjectLoadingStartEvent = { eventName: ProjectLoadingStartEvent, - data: { project, reason } + data: { project, reason }, }; this.eventHandler(event); } @@ -1250,7 +1250,7 @@ export class ProjectService { project.sendLoadingProjectFinish = false; const event: ProjectLoadingFinishEvent = { eventName: ProjectLoadingFinishEvent, - data: { project } + data: { project }, }; this.eventHandler(event); } @@ -1520,7 +1520,7 @@ export class ProjectService { program: configuredProjectForConfig?.getCurrentProgram() || config.parsedCommandLine!.fileNames, useCaseSensitiveFileNames: this.host.useCaseSensitiveFileNames, writeLog: s => this.logger.info(s), - toPath: s => this.toPath(s) + toPath: s => this.toPath(s), })) return; // Reload is pending, do the reload @@ -1647,7 +1647,7 @@ export class ProjectService { { fileName: info.fileName, projects: info.containingProjects.map(p => p.projectName), - hasMixedContent: info.hasMixedContent + hasMixedContent: info.hasMixedContent, } : undefined ) ), @@ -2280,7 +2280,7 @@ export class ProjectService { configFileExistenceInfo.config = { cachedDirectoryStructureHost: createCachedDirectoryStructureHost(this.host, this.host.getCurrentDirectory(), this.host.useCaseSensitiveFileNames)!, projects: new Map(), - reloadLevel: ConfigFileProgramReloadLevel.Full + reloadLevel: ConfigFileProgramReloadLevel.Full, }; } @@ -2344,7 +2344,7 @@ export class ProjectService { configHasExtendsProperty: parsedCommandLine.raw.extends !== undefined, configHasFilesProperty: parsedCommandLine.raw.files !== undefined, configHasIncludeProperty: parsedCommandLine.raw.include !== undefined, - configHasExcludeProperty: parsedCommandLine.raw.exclude !== undefined + configHasExcludeProperty: parsedCommandLine.raw.exclude !== undefined, }; } project.canConfigFileJsonReportNoInputFiles = canJsonReportNoInputFiles(parsedCommandLine.raw); @@ -2406,7 +2406,7 @@ export class ProjectService { rootNames: parsedCommandLine.fileNames, options: parsedCommandLine.options, watchOptions: parsedCommandLine.watchOptions, - projectReferences: parsedCommandLine.projectReferences + projectReferences: parsedCommandLine.projectReferences, }, /*replacer*/ undefined, " ")}`); const oldCommandLine = configFileExistenceInfo.config?.parsedCommandLine; @@ -2656,7 +2656,7 @@ export class ProjectService { this.eventHandler({ eventName: ConfigFileDiagEvent, - data: { configFileName: project.getConfigFilePath(), diagnostics, triggerFile } + data: { configFileName: project.getConfigFilePath(), diagnostics, triggerFile }, } satisfies ConfigFileDiagEvent); } @@ -3102,7 +3102,7 @@ export class ProjectService { getNormalizedAbsolutePath(mapFileNameFromDeclarationInfo, project.currentDirectory), declarationInfo.path ), - sourceInfos: this.addSourceInfoToSourceMap(sourceFileName, project) + sourceInfos: this.addSourceInfoToSourceMap(sourceFileName, project), }; } else { @@ -3174,7 +3174,7 @@ export class ProjectService { const lineOffset = info.positionToLineOffset(pos); return { line: lineOffset.line - 1, character: lineOffset.offset - 1 }; }, - getPositionOfLineAndCharacter: (line, character, allowEdits) => info.lineOffsetToPosition(line + 1, character + 1, allowEdits) + getPositionOfLineAndCharacter: (line, character, allowEdits) => info.lineOffsetToPosition(line + 1, character + 1, allowEdits), }; } return info.sourceFileLike; @@ -3649,7 +3649,7 @@ export class ProjectService { const configFileName = this.getConfigFileNameForFile({ fileName: project.getConfigFilePath(), path: info.path, - configFileInfo: true + configFileInfo: true, }); if (!configFileName) return; @@ -4524,7 +4524,7 @@ function createIncompleteCompletionsCache(): IncompleteCompletionsCache { }, clear() { info = undefined; - } + }, }; } diff --git a/src/server/moduleSpecifierCache.ts b/src/server/moduleSpecifierCache.ts index 2f2142a5bb0fe..7a4499c434874 100644 --- a/src/server/moduleSpecifierCache.ts +++ b/src/server/moduleSpecifierCache.ts @@ -76,7 +76,7 @@ export function createModuleSpecifierCache(host: ModuleSpecifierResolutionCacheH }, count() { return cache ? cache.size : 0; - } + }, }; if (Debug.isDebugging) { Object.defineProperty(result, "__cache", { get: () => cache }); diff --git a/src/server/project.ts b/src/server/project.ts index 1c9e985c83c50..cd3db58db24a6 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -295,7 +295,7 @@ export interface EmitResult { const enum TypingWatcherType { FileWatcher = "FileWatcher", - DirectoryWatcher = "DirectoryWatcher" + DirectoryWatcher = "DirectoryWatcher", } type TypingWatchers = Map & { isInvoked?: boolean; }; @@ -1185,7 +1185,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo getFileNamesWithRedirectInfo(includeProjectReferenceRedirectInfo: boolean) { return this.getFileNames().map((fileName): protocol.FileWithProjectReferenceRedirectInfo => ({ fileName, - isSourceOfProjectReferenceRedirect: includeProjectReferenceRedirectInfo && this.isSourceOfProjectReferenceRedirect(fileName) + isSourceOfProjectReferenceRedirect: includeProjectReferenceRedirectInfo && this.isSourceOfProjectReferenceRedirect(fileName), })); } @@ -1734,7 +1734,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo this.projectService.getWatchOptions(this), WatchType.MissingGeneratedFile, this - ) + ), }; } @@ -1846,7 +1846,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo includeProjectReferenceRedirectInfo ? (files: Map) => arrayFrom(files.entries(), ([fileName, isSourceOfProjectReferenceRedirect]): protocol.FileWithProjectReferenceRedirectInfo => ({ fileName, - isSourceOfProjectReferenceRedirect + isSourceOfProjectReferenceRedirect, })) : (files: Map) => arrayFrom(files.keys()); @@ -1861,7 +1861,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo isInferred: isInferredProject(this), options: this.getCompilationSettings(), languageServiceDisabled: !this.languageServiceEnabled, - lastFileExceededProgramSize: this.lastFileExceededProgramSize + lastFileExceededProgramSize: this.lastFileExceededProgramSize, }; const updatedFileNames = this.updatedFileNames; this.updatedFileNames = undefined; @@ -1875,7 +1875,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo const lastReportedFileNames = this.lastReportedFileNames; const externalFiles = this.getExternalFiles().map((f): protocol.FileWithProjectReferenceRedirectInfo => ({ fileName: toNormalizedPath(f), - isSourceOfProjectReferenceRedirect: false + isSourceOfProjectReferenceRedirect: false, })); const currentFiles = arrayToMap( this.getFileNamesWithRedirectInfo(!!includeProjectReferenceRedirectInfo).concat(externalFiles), @@ -1896,7 +1896,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo else if (includeProjectReferenceRedirectInfo && isSourceOfProjectReferenceRedirect !== lastReportedFileNames.get(fileName)) { updatedRedirects.push({ fileName, - isSourceOfProjectReferenceRedirect + isSourceOfProjectReferenceRedirect, }); } }); @@ -1915,12 +1915,12 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo updated: includeProjectReferenceRedirectInfo ? updated.map((fileName): protocol.FileWithProjectReferenceRedirectInfo => ({ fileName, - isSourceOfProjectReferenceRedirect: this.isSourceOfProjectReferenceRedirect(fileName) + isSourceOfProjectReferenceRedirect: this.isSourceOfProjectReferenceRedirect(fileName), })) : updated, - updatedRedirects: includeProjectReferenceRedirectInfo ? updatedRedirects : undefined + updatedRedirects: includeProjectReferenceRedirectInfo ? updatedRedirects : undefined, }, - projectErrors: this.getGlobalProjectErrors() + projectErrors: this.getGlobalProjectErrors(), }; } else { @@ -1928,7 +1928,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo const projectFileNames = this.getFileNamesWithRedirectInfo(!!includeProjectReferenceRedirectInfo); const externalFiles = this.getExternalFiles().map((f): protocol.FileWithProjectReferenceRedirectInfo => ({ fileName: toNormalizedPath(f), - isSourceOfProjectReferenceRedirect: false + isSourceOfProjectReferenceRedirect: false, })); const allFiles = projectFileNames.concat(externalFiles); this.lastReportedFileNames = arrayToMap( @@ -1940,7 +1940,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo return { info, files: includeProjectReferenceRedirectInfo ? allFiles : allFiles.map(f => f.fileName), - projectErrors: this.getGlobalProjectErrors() + projectErrors: this.getGlobalProjectErrors(), }; } } @@ -2009,7 +2009,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo languageService: this.languageService, languageServiceHost: this, serverHost: this.projectService.host, - session: this.projectService.session + session: this.projectService.session, }; const pluginModule = pluginModuleFactory({ typescript: ts }); @@ -2350,7 +2350,7 @@ export class InferredProject extends Project { return this.typeAcquisition || { enable: allRootFilesAreJsOrDts(this), include: ts.emptyArray, - exclude: ts.emptyArray + exclude: ts.emptyArray, }; } } diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 50fbe3deb139f..fa0ad4210512f 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -172,7 +172,7 @@ export const enum CommandTypes { PrepareCallHierarchy = "prepareCallHierarchy", ProvideCallHierarchyIncomingCalls = "provideCallHierarchyIncomingCalls", ProvideCallHierarchyOutgoingCalls = "provideCallHierarchyOutgoingCalls", - ProvideInlayHints = "provideInlayHints" + ProvideInlayHints = "provideInlayHints", } /** @@ -3695,7 +3695,7 @@ export const enum ModuleKind { System = "System", ES6 = "ES6", ES2015 = "ES2015", - ESNext = "ESNext" + ESNext = "ESNext", } export const enum ModuleResolutionKind { @@ -3720,7 +3720,7 @@ export const enum ScriptTarget { ES2020 = "ES2020", ES2021 = "ES2021", ES2022 = "ES2022", - ESNext = "ESNext" + ESNext = "ESNext", } export const enum ClassificationType { diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index 114e3f33d3518..7ab134c9d8979 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -329,7 +329,7 @@ export class TextStorage { if (svc) { return { getLineCount: () => svc.getLineCount(), - getLineText: line => svc.getAbsolutePositionAndLineText(line + 1).lineText! + getLineText: line => svc.getAbsolutePositionAndLineText(line + 1).lineText!, }; } const lineMap = this.getLineMap(); diff --git a/src/server/scriptVersionCache.ts b/src/server/scriptVersionCache.ts index af5faff067112..5f6f6711ab2a0 100644 --- a/src/server/scriptVersionCache.ts +++ b/src/server/scriptVersionCache.ts @@ -37,7 +37,7 @@ export const enum CharRangeSection { Entire, Mid, End, - PostEnd + PostEnd, } /** @internal */ @@ -462,7 +462,7 @@ export class LineIndex { done: false, leaf: (relativeStart: number, relativeLength: number, ll: LineLeaf) => { accum = accum.concat(ll.text.substring(relativeStart, relativeStart + relativeLength)); - } + }, }); } return accum; @@ -483,7 +483,7 @@ export class LineIndex { if (!f(ll, relativeStart, relativeLength)) { this.done = true; } - } + }, }; this.walk(rangeStart, rangeEnd - rangeStart, walkFns); return !walkFns.done; diff --git a/src/server/session.ts b/src/server/session.ts index ed3872c8f4038..298266395653a 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -193,7 +193,7 @@ export interface ServerCancellationToken extends HostCancellationToken { export const nullCancellationToken: ServerCancellationToken = { isCancellationRequested: () => false, setRequest: () => void 0, - resetRequest: () => void 0 + resetRequest: () => void 0, }; function hrTimeToMilliseconds(time: [number, number]): number { @@ -249,18 +249,18 @@ function formatRelatedInformation(info: DiagnosticRelatedInformation): protocol. return { message: flattenDiagnosticMessageText(info.messageText, "\n"), category: diagnosticCategoryName(info), - code: info.code + code: info.code, }; } return { span: { start: convertToLocation(getLineAndCharacterOfPosition(info.file, info.start!)), end: convertToLocation(getLineAndCharacterOfPosition(info.file, info.start! + info.length!)), // TODO: GH#18217 - file: info.file.fileName + file: info.file.fileName, }, message: flattenDiagnosticMessageText(info.messageText, "\n"), category: diagnosticCategoryName(info), - code: info.code + code: info.code, }; } @@ -453,7 +453,7 @@ export function toEvent(eventName: string, body: object): protocol.Event { seq: 0, type: "event", event: eventName, - body + body, }; } @@ -634,7 +634,7 @@ function getReferencesWorker( ...referencedSymbol.definition, textSpan: createTextSpan(mappedDefinitionFile.pos, referencedSymbol.definition.textSpan.length), // Why would the length be the same in the original? fileName: mappedDefinitionFile.fileName, - contextSpan: getMappedContextSpanForProject(referencedSymbol.definition, project) + contextSpan: getMappedContextSpanForProject(referencedSymbol.definition, project), }; let symbolToAddTo = find(results, o => documentSpansEqual(o.definition, definition)); @@ -993,7 +993,7 @@ export class Session implements EventSender { getServerHost: () => this.host, logError: (err, cmd) => this.logError(err, cmd), sendRequestCompletedEvent: requestId => this.sendRequestCompletedEvent(requestId), - isCancellationRequested: () => this.cancellationToken.isCancellationRequested() + isCancellationRequested: () => this.cancellationToken.isCancellationRequested(), }; this.errorCheck = new MultistepOperation(multistepOperationHost); const settings: ProjectServiceOptions = { @@ -1089,14 +1089,14 @@ export class Session implements EventSender { this.event({ triggerFile, configFile, - diagnostics: bakedDiags + diagnostics: bakedDiags, }, ConfigFileDiagEvent); break; case ProjectLanguageServiceStateEvent: { const eventName: protocol.ProjectLanguageServiceStateEventName = ProjectLanguageServiceStateEvent; this.event({ projectName: event.data.project.getProjectName(), - languageServiceEnabled: event.data.languageServiceEnabled + languageServiceEnabled: event.data.languageServiceEnabled, }, eventName); break; } @@ -1121,7 +1121,7 @@ export class Session implements EventSender { // Send project changed event this.event({ - openFiles + openFiles, }, ProjectsUpdatedInBackgroundEvent); } } @@ -1200,7 +1200,7 @@ export class Session implements EventSender { command: cmdName, request_seq: reqSeq, success, - performanceData: this.performanceData + performanceData: this.performanceData, }; if (success) { @@ -1376,7 +1376,7 @@ export class Session implements EventSender { return { configFile: project && project.hasConfigFile(file) ? file : undefined, - project + project, }; } @@ -1407,7 +1407,7 @@ export class Session implements EventSender { endLocation: (d.file && convertToLocation(getLineAndCharacterOfPosition(d.file, d.start! + d.length!)))!, // TODO: GH#18217 reportsUnnecessary: d.reportsUnnecessary, reportsDeprecated: d.reportsDeprecated, - relatedInformation: map(d.relatedInformation, formatRelatedInformation) + relatedInformation: map(d.relatedInformation, formatRelatedInformation), })); } @@ -1487,7 +1487,7 @@ export class Session implements EventSender { if (!unmappedDefinitionAndBoundSpan || !unmappedDefinitionAndBoundSpan.definitions) { return { definitions: emptyArray, - textSpan: undefined! // TODO: GH#18217 + textSpan: undefined!, // TODO: GH#18217 }; } @@ -1497,7 +1497,7 @@ export class Session implements EventSender { if (simplifiedResult) { return { definitions: this.mapDefinitionInfo(definitions, project), - textSpan: toProtocolTextSpan(textSpan, scriptInfo) + textSpan: toProtocolTextSpan(textSpan, scriptInfo), }; } @@ -1610,7 +1610,7 @@ export class Session implements EventSender { ?.filter(d => toNormalizedPath(d.fileName) !== file && d.isAmbient) .map(d => ({ fileName: d.fileName, - name: getTextOfIdentifierOrLiteral(initialNode) + name: getTextOfIdentifierOrLiteral(initialNode), })); if (some(candidates)) { return candidates; @@ -1669,7 +1669,7 @@ export class Session implements EventSender { ...result, diagnostics: args.includeLinePosition ? this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(result.diagnostics) : - result.diagnostics.map(d => formatDiagnosticToProtocol(d, /*includeFileName*/ true)) + result.diagnostics.map(d => formatDiagnosticToProtocol(d, /*includeFileName*/ true)), } : result; } @@ -1677,7 +1677,7 @@ export class Session implements EventSender { private mapJSDocTagInfo(tags: JSDocTagInfo[] | undefined, project: Project, richResponse: boolean): protocol.JSDocTagInfo[] { return tags ? tags.map(tag => ({ ...tag, - text: richResponse ? this.mapDisplayParts(tag.text, project) : tag.text?.map(part => part.text).join("") + text: richResponse ? this.mapDisplayParts(tag.text, project) : tag.text?.map(part => part.text).join(""), })) : []; } @@ -1721,7 +1721,7 @@ export class Session implements EventSender { targetFileName: def.fileName, targetTextSpan: def.textSpan, contextSpan: def.originalContextSpan, - targetContextSpan: def.contextSpan + targetContextSpan: def.contextSpan, }; } return def; @@ -1735,7 +1735,7 @@ export class Session implements EventSender { return { file: fileName, start: { line: start.line + 1, offset: start.character + 1 }, - end: { line: end.line + 1, offset: end.character + 1 } + end: { line: end.line + 1, offset: end.character + 1 }, }; } @@ -1833,8 +1833,8 @@ export class Session implements EventSender { file: fileName, highlightSpans: highlightSpans.map(({ textSpan, kind, contextSpan }) => ({ ...toProtocolTextSpanWithContext(textSpan, contextSpan, scriptInfo), - kind - })) + kind, + })), }; }); } @@ -1855,8 +1855,8 @@ export class Session implements EventSender { span: span && { start: scriptInfo.positionToLineOffset(span.start), end: scriptInfo.positionToLineOffset(span.start + span.length), - file: file! - } + file: file!, + }, })), }; }); @@ -1876,7 +1876,7 @@ export class Session implements EventSender { const projectInfo = { configFileName: project.getProjectName(), languageServiceDisabled: !project.languageServiceEnabled, - fileNames: needFileNameList ? project.getFileNames(/*excludeFilesFromExternalLibraries*/ false, excludeConfigFiles) : undefined + fileNames: needFileNameList ? project.getFileNames(/*excludeFilesFromExternalLibraries*/ false, excludeConfigFiles) : undefined, }; return projectInfo; } @@ -2034,7 +2034,7 @@ export class Session implements EventSender { const refs = references.map(entry => referenceEntryToReferencesResponseItem(this.projectService, entry, preferences)); return { refs, - symbolName: `"${args.file}"` + symbolName: `"${args.file}"`, }; } @@ -2063,7 +2063,7 @@ export class Session implements EventSender { const { file, project } = this.getFileAndProject(args); return { file, - languageService: project.getLanguageService(/*ensureSynchronized*/ false) + languageService: project.getLanguageService(/*ensureSynchronized*/ false), }; } @@ -2083,7 +2083,7 @@ export class Session implements EventSender { hintSpan: toProtocolTextSpan(s.hintSpan, scriptInfo), bannerText: s.bannerText, autoCollapse: s.autoCollapse, - kind: s.kind + kind: s.kind, })); } else { @@ -2159,7 +2159,7 @@ export class Session implements EventSender { else { return useDisplayParts ? quickInfo : { ...quickInfo, - tags: this.mapJSDocTagInfo(quickInfo.tags, project, /*richResponse*/ false) as JSDocTagInfo[] + tags: this.mapJSDocTagInfo(quickInfo.tags, project, /*richResponse*/ false) as JSDocTagInfo[], }; } } @@ -2233,7 +2233,7 @@ export class Session implements EventSender { const firstNoWhiteSpacePosition = absolutePosition + i; edits.push({ span: createTextSpanFromBounds(absolutePosition, firstNoWhiteSpacePosition), - newText: formatting.getIndentationString(preferredIndent, formatOptions) + newText: formatting.getIndentationString(preferredIndent, formatOptions), }); } } @@ -2247,7 +2247,7 @@ export class Session implements EventSender { return { start: scriptInfo.positionToLineOffset(edit.span.start), end: scriptInfo.positionToLineOffset(textSpanEnd(edit.span)), - newText: edit.newText ? edit.newText : "" + newText: edit.newText ? edit.newText : "", }; }); } @@ -2311,7 +2311,7 @@ export class Session implements EventSender { isRecommended, isPackageJsonImport, isImportStatementCompletion, - data + data, }; } }); @@ -2376,7 +2376,7 @@ export class Session implements EventSender { return { projectFileName: project.getProjectName(), fileNames: project.getCompileOnSaveAffectedFileList(info), - projectUsesOutFile: !!outFile(compilationSettings) + projectUsesOutFile: !!outFile(compilationSettings), }; } ); @@ -2397,7 +2397,7 @@ export class Session implements EventSender { emitSkipped, diagnostics: args.includeLinePosition ? this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(diagnostics) : - diagnostics.map(d => formatDiagnosticToProtocol(d, /*includeFileName*/ true)) + diagnostics.map(d => formatDiagnosticToProtocol(d, /*includeFileName*/ true)), } : !emitSkipped; } @@ -2414,7 +2414,7 @@ export class Session implements EventSender { ...helpItems, applicableSpan: { start: scriptInfo.positionToLineOffset(span.start), - end: scriptInfo.positionToLineOffset(span.start + span.length) + end: scriptInfo.positionToLineOffset(span.start + span.length), }, items: this.mapSignatureHelpItems(helpItems.items, project, useDisplayParts), }; @@ -2425,7 +2425,7 @@ export class Session implements EventSender { else { return { ...helpItems, - items: helpItems.items.map(item => ({ ...item, tags: this.mapJSDocTagInfo(item.tags, project, /*richResponse*/ false) as JSDocTagInfo[] })) + items: helpItems.items.map(item => ({ ...item, tags: this.mapJSDocTagInfo(item.tags, project, /*richResponse*/ false) as JSDocTagInfo[] })), }; } } @@ -2457,7 +2457,7 @@ export class Session implements EventSender { this.changeSeq++; this.projectService.applyChangesToFile(scriptInfo, singleIterator({ span: { start, length: end - start }, - newText: args.insertString! // TODO: GH#18217 + newText: args.insertString!, // TODO: GH#18217 })); } } @@ -2497,7 +2497,7 @@ export class Session implements EventSender { kindModifiers: item.kindModifiers, spans: item.spans.map(span => toProtocolTextSpan(span, scriptInfo)), childItems: this.mapLocationNavigationBarItems(item.childItems, scriptInfo), - indent: item.indent + indent: item.indent, })); } @@ -2518,7 +2518,7 @@ export class Session implements EventSender { kindModifiers: tree.kindModifiers, spans: tree.spans.map(span => toProtocolTextSpan(span, scriptInfo)), nameSpan: tree.nameSpan && toProtocolTextSpan(tree.nameSpan, scriptInfo), - childItems: map(tree.childItems, item => this.toLocationNavigationTree(item, scriptInfo)) + childItems: map(tree.childItems, item => this.toLocationNavigationTree(item, scriptInfo)), }; } @@ -2548,7 +2548,7 @@ export class Session implements EventSender { matchKind: navItem.matchKind, file: navItem.fileName, start: scriptInfo.positionToLineOffset(navItem.textSpan.start), - end: scriptInfo.positionToLineOffset(textSpanEnd(navItem.textSpan)) + end: scriptInfo.positionToLineOffset(textSpanEnd(navItem.textSpan)), }; if (navItem.kindModifiers && (navItem.kindModifiers !== "")) { bakedItem.kindModifiers = navItem.kindModifiers; @@ -2710,7 +2710,7 @@ export class Session implements EventSender { if (result === undefined) { return { - edits: [] + edits: [], }; } @@ -2802,7 +2802,7 @@ export class Session implements EventSender { const existingDiagCodes = [ ...ls.getSyntacticDiagnostics(file), ...ls.getSemanticDiagnostics(file), - ...ls.getSuggestionDiagnostics(file) + ...ls.getSuggestionDiagnostics(file), ].map(d => decodedTextSpanIntersectsWith(startPosition, endPosition - startPosition, d.start!, d.length!) && d.code); @@ -2889,7 +2889,7 @@ export class Session implements EventSender { return { start: scriptInfo.positionToLineOffset(change.span.start), end: scriptInfo.positionToLineOffset(change.span.start + change.span.length), - newText: change.newText ? change.newText : "" + newText: change.newText ? change.newText : "", }; } @@ -3065,7 +3065,7 @@ export class Session implements EventSender { file: item.file, containerName: item.containerName, span: toProtocolTextSpan(item.span, scriptInfo), - selectionSpan: toProtocolTextSpan(item.selectionSpan, scriptInfo) + selectionSpan: toProtocolTextSpan(item.selectionSpan, scriptInfo), }; } @@ -3073,14 +3073,14 @@ export class Session implements EventSender { const scriptInfo = this.getScriptInfoFromProjectService(incomingCall.from.file); return { from: this.toProtocolCallHierarchyItem(incomingCall.from), - fromSpans: incomingCall.fromSpans.map(fromSpan => toProtocolTextSpan(fromSpan, scriptInfo)) + fromSpans: incomingCall.fromSpans.map(fromSpan => toProtocolTextSpan(fromSpan, scriptInfo)), }; } private toProtocolCallHierarchyOutgoingCall(outgoingCall: CallHierarchyOutgoingCall, scriptInfo: ScriptInfo): protocol.CallHierarchyOutgoingCall { return { to: this.toProtocolCallHierarchyItem(outgoingCall.to), - fromSpans: outgoingCall.fromSpans.map(fromSpan => toProtocolTextSpan(fromSpan, scriptInfo)) + fromSpans: outgoingCall.fromSpans.map(fromSpan => toProtocolTextSpan(fromSpan, scriptInfo)), }; } @@ -3157,7 +3157,7 @@ export class Session implements EventSender { info: p.info, changes: p.changes, files: p.files, - projectErrors: this.convertToDiagnosticsWithLinePosition(p.projectErrors, /*scriptInfo*/ undefined) + projectErrors: this.convertToDiagnosticsWithLinePosition(p.projectErrors, /*scriptInfo*/ undefined), }; }); return this.requiredResponse(converted); @@ -3169,7 +3169,7 @@ export class Session implements EventSender { fileName: file.file, content: file.fileContent, scriptKind: file.scriptKindName, - projectRootPath: file.projectRootPath + projectRootPath: file.projectRootPath, })), request.arguments.changedFiles && mapIterator(request.arguments.changedFiles, file => ({ fileName: file.fileName, @@ -3178,7 +3178,7 @@ export class Session implements EventSender { const start = scriptInfo.lineOffsetToPosition(change.start.line, change.start.offset); const end = scriptInfo.lineOffsetToPosition(change.end.line, change.end.offset); return start >= 0 ? { span: { start, length: end - start }, newText: change.newText } : undefined; - }) + }), })), request.arguments.closedFiles ); @@ -3191,7 +3191,7 @@ export class Session implements EventSender { request.arguments.changedFiles && mapIterator(request.arguments.changedFiles, file => ({ fileName: file.fileName, // apply changes in reverse order - changes: arrayReverseIterator(file.changes) + changes: arrayReverseIterator(file.changes), })), request.arguments.closedFiles ); @@ -3521,7 +3521,7 @@ export class Session implements EventSender { }, [protocol.CommandTypes.ProvideInlayHints]: (request: protocol.InlayHintsRequest) => { return this.requiredResponse(this.provideInlayHints(request.arguments)); - } + }, })); public addProtocolHandler(command: string, handler: (request: protocol.Request) => HandlerResponse) { @@ -3671,7 +3671,7 @@ interface FileAndProject { function toProtocolTextSpan(textSpan: TextSpan, scriptInfo: ScriptInfo): protocol.TextSpan { return { start: scriptInfo.positionToLineOffset(textSpan.start), - end: scriptInfo.positionToLineOffset(textSpanEnd(textSpan)) + end: scriptInfo.positionToLineOffset(textSpanEnd(textSpan)), }; } @@ -3751,7 +3751,7 @@ function referenceEntryToReferencesResponseItem(projectService: ProjectService, ...span, lineText, isWriteAccess, - isDefinition + isDefinition, }; } diff --git a/src/server/typingsCache.ts b/src/server/typingsCache.ts index 42c91be6047d1..c3ff135b6bb95 100644 --- a/src/server/typingsCache.ts +++ b/src/server/typingsCache.ts @@ -41,7 +41,7 @@ export const nullTypingsInstaller: ITypingsInstaller = { enqueueInstallTypingsRequest: noop, attach: noop, onProjectClosed: noop, - globalTypingsCacheLocation: undefined! // TODO: GH#18217 + globalTypingsCacheLocation: undefined!, // TODO: GH#18217 }; interface TypingsCacheEntry { @@ -135,7 +135,7 @@ export class TypingsCache { typeAcquisition, typings: entry ? entry.typings : emptyArray, unresolvedImports, - poisoned: true + poisoned: true, }); // something has been changed, issue a request to update typings this.installer.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports); @@ -149,7 +149,7 @@ export class TypingsCache { typeAcquisition, typings, unresolvedImports, - poisoned: false + poisoned: false, }); return !typeAcquisition || !typeAcquisition.enable ? emptyArray : typings; } diff --git a/src/server/utilitiesPublic.ts b/src/server/utilitiesPublic.ts index b6b6b8d11f7bf..64a1fb48684bf 100644 --- a/src/server/utilitiesPublic.ts +++ b/src/server/utilitiesPublic.ts @@ -16,7 +16,7 @@ export enum LogLevel { terse, normal, requestTime, - verbose + verbose, } export const emptyArray: SortedReadonlyArray = createSortedArray(); @@ -50,7 +50,7 @@ export function createInstallTypingsRequest(project: Project, typeAcquisition: T unresolvedImports, projectRootPath: project.getCurrentDirectory() as Path, cachePath, - kind: "discover" + kind: "discover", }; } @@ -102,7 +102,7 @@ export function createNormalizedPathMap(): NormalizedPathMap { }, remove(path) { map.delete(path); - } + }, }; } diff --git a/src/services/classifier.ts b/src/services/classifier.ts index 9e2a34583e5cb..5d190ae179a83 100644 --- a/src/services/classifier.ts +++ b/src/services/classifier.ts @@ -667,7 +667,7 @@ function convertClassificationsToSpans(classifications: Classifications): Classi for (let i = 0; i < dense.length; i += 3) { result.push({ textSpan: createTextSpan(dense[i], dense[i + 1]), - classificationType: getClassificationTypeName(dense[i + 2]) + classificationType: getClassificationTypeName(dense[i + 2]), }); } diff --git a/src/services/classifier2020.ts b/src/services/classifier2020.ts index 96e246a85db80..ca9c4b14d5410 100644 --- a/src/services/classifier2020.ts +++ b/src/services/classifier2020.ts @@ -48,17 +48,17 @@ import { /** @internal */ export const enum TokenEncodingConsts { typeOffset = 8, - modifierMask = (1 << typeOffset) - 1 + modifierMask = (1 << typeOffset) - 1, } /** @internal */ export const enum TokenType { - class, enum, interface, namespace, typeParameter, type, parameter, variable, enumMember, property, function, member + class, enum, interface, namespace, typeParameter, type, parameter, variable, enumMember, property, function, member, } /** @internal */ export const enum TokenModifier { - declaration, static, async, readonly, defaultLibrary, local + declaration, static, async, readonly, defaultLibrary, local, } /** @@ -75,7 +75,7 @@ export function getSemanticClassifications(program: Program, cancellationToken: for (let i = 0; i < dense.length; i += 3) { result.push({ textSpan: createTextSpan(dense[i], dense[i + 1]), - classificationType: dense[i + 2] + classificationType: dense[i + 2], }); } @@ -86,7 +86,7 @@ export function getSemanticClassifications(program: Program, cancellationToken: export function getEncodedSemanticClassifications(program: Program, cancellationToken: CancellationToken, sourceFile: SourceFile, span: TextSpan): Classifications { return { spans: getSemanticTokens(program, sourceFile, span, cancellationToken), - endOfLineState: EndOfLineState.None + endOfLineState: EndOfLineState.None, }; } @@ -296,5 +296,5 @@ const tokenFromDeclarationMapping = new Map([ [SyntaxKind.TypeAliasDeclaration, TokenType.type], [SyntaxKind.TypeParameter, TokenType.typeParameter], [SyntaxKind.PropertyAssignment, TokenType.property], - [SyntaxKind.ShorthandPropertyAssignment, TokenType.property] + [SyntaxKind.ShorthandPropertyAssignment, TokenType.property], ]); diff --git a/src/services/codeFixProvider.ts b/src/services/codeFixProvider.ts index 67dbdbc9a9280..7ca63871fb2de 100644 --- a/src/services/codeFixProvider.ts +++ b/src/services/codeFixProvider.ts @@ -127,6 +127,6 @@ function getDiagnostics({ program, sourceFile, cancellationToken }: CodeFixConte return [ ...program.getSemanticDiagnostics(sourceFile, cancellationToken), ...program.getSyntacticDiagnostics(sourceFile, cancellationToken), - ...computeSuggestionDiagnostics(sourceFile, program, cancellationToken) + ...computeSuggestionDiagnostics(sourceFile, program, cancellationToken), ]; } diff --git a/src/services/codefixes/addMissingAsync.ts b/src/services/codefixes/addMissingAsync.ts index bb0510a90d0ad..18807585b273b 100644 --- a/src/services/codefixes/addMissingAsync.ts +++ b/src/services/codefixes/addMissingAsync.ts @@ -40,7 +40,7 @@ const fixId = "addMissingAsync"; const errorCodes = [ Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code, Diagnostics.Type_0_is_not_assignable_to_type_1.code, - Diagnostics.Type_0_is_not_comparable_to_type_1.code + Diagnostics.Type_0_is_not_comparable_to_type_1.code, ]; registerCodeFix({ diff --git a/src/services/codefixes/addMissingConst.ts b/src/services/codefixes/addMissingConst.ts index 8a848c2616f80..a744203cb21ac 100644 --- a/src/services/codefixes/addMissingConst.ts +++ b/src/services/codefixes/addMissingConst.ts @@ -27,7 +27,7 @@ import { const fixId = "addMissingConst"; const errorCodes = [ Diagnostics.Cannot_find_name_0.code, - Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code + Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code, ]; registerCodeFix({ diff --git a/src/services/codefixes/addOptionalPropertyUndefined.ts b/src/services/codefixes/addOptionalPropertyUndefined.ts index 7664bea35be10..2800fcbd6b5f5 100644 --- a/src/services/codefixes/addOptionalPropertyUndefined.ts +++ b/src/services/codefixes/addOptionalPropertyUndefined.ts @@ -107,7 +107,7 @@ function getSourceTarget(errorNode: Node | undefined, checker: TypeChecker): { s if (!declaration) return undefined; return { source: isPropertyAssignment(errorNode.parent) ? errorNode.parent.initializer : errorNode.parent.name, - target: declaration + target: declaration, }; } return undefined; @@ -119,7 +119,7 @@ function addUndefinedToOptionalProperty(changes: textChanges.ChangeTracker, toAd if (d && (isPropertySignature(d) || isPropertyDeclaration(d)) && d.type) { const t = factory.createUnionTypeNode([ ...d.type.kind === SyntaxKind.UnionType ? (d.type as UnionTypeNode).types : [d.type], - factory.createTypeReferenceNode("undefined") + factory.createTypeReferenceNode("undefined"), ]); changes.replaceNode(d.getSourceFile(), d.type, t); } diff --git a/src/services/codefixes/convertConstToLet.ts b/src/services/codefixes/convertConstToLet.ts index d9817ab8250b2..fb1cefbc859b3 100644 --- a/src/services/codefixes/convertConstToLet.ts +++ b/src/services/codefixes/convertConstToLet.ts @@ -50,7 +50,7 @@ registerCodeFix({ }); })); }, - fixIds: [fixId] + fixIds: [fixId], }); interface Info { diff --git a/src/services/codefixes/convertLiteralTypeToMappedType.ts b/src/services/codefixes/convertLiteralTypeToMappedType.ts index 1e68d28758d1c..0fcbca0c1410c 100644 --- a/src/services/codefixes/convertLiteralTypeToMappedType.ts +++ b/src/services/codefixes/convertLiteralTypeToMappedType.ts @@ -38,7 +38,7 @@ registerCodeFix({ if (info) { doChange(changes, diag.file, info); } - }) + }), }); interface Info { diff --git a/src/services/codefixes/convertToAsyncFunction.ts b/src/services/codefixes/convertToAsyncFunction.ts index 734f1b09ec44a..e74a02f384142 100644 --- a/src/services/codefixes/convertToAsyncFunction.ts +++ b/src/services/codefixes/convertToAsyncFunction.ts @@ -606,7 +606,7 @@ function maybeAnnotateAndReturn(expressionToReturn: Expression | undefined, type const name = factory.createUniqueName("result", GeneratedIdentifierFlags.Optimistic); return [ ...createVariableOrAssignmentOrExpressionStatement(createSynthIdentifier(name), expressionToReturn, typeAnnotation), - factory.createReturnStatement(name) + factory.createReturnStatement(name), ]; } return [factory.createReturnStatement(expressionToReturn)]; diff --git a/src/services/codefixes/convertToEsModule.ts b/src/services/codefixes/convertToEsModule.ts index b15a0521c1cb1..ba73883cbb3b1 100644 --- a/src/services/codefixes/convertToEsModule.ts +++ b/src/services/codefixes/convertToEsModule.ts @@ -678,6 +678,6 @@ interface ConvertedImports { function convertedImports(newImports: readonly Node[], useSitesToUnqualify?: Map): ConvertedImports { return { newImports, - useSitesToUnqualify + useSitesToUnqualify, }; } diff --git a/src/services/codefixes/convertToMappedObjectType.ts b/src/services/codefixes/convertToMappedObjectType.ts index 1a3b8498a49f5..83b5920200527 100644 --- a/src/services/codefixes/convertToMappedObjectType.ts +++ b/src/services/codefixes/convertToMappedObjectType.ts @@ -47,7 +47,7 @@ registerCodeFix({ getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => { const info = getInfo(diag.file, diag.start); if (info) doChange(changes, diag.file, info); - }) + }), }); interface Info { readonly indexSignature: IndexSignatureDeclaration; readonly container: FixableDeclaration; } diff --git a/src/services/codefixes/convertToTypeOnlyExport.ts b/src/services/codefixes/convertToTypeOnlyExport.ts index b0e67f43b4cbd..09fc5d46b7f1f 100644 --- a/src/services/codefixes/convertToTypeOnlyExport.ts +++ b/src/services/codefixes/convertToTypeOnlyExport.ts @@ -43,7 +43,7 @@ registerCodeFix({ fixSingleExportDeclaration(changes, exportSpecifier, context); } }); - } + }, }); function getExportSpecifierForDiagnosticSpan(span: TextSpan, sourceFile: SourceFile) { @@ -80,7 +80,7 @@ function fixSingleExportDeclaration(changes: textChanges.ChangeTracker, exportSp changes.replaceNode(context.sourceFile, exportDeclaration, valueExportDeclaration, { leadingTriviaOption: textChanges.LeadingTriviaOption.IncludeAll, - trailingTriviaOption: textChanges.TrailingTriviaOption.Exclude + trailingTriviaOption: textChanges.TrailingTriviaOption.Exclude, }); changes.insertNodeAfter(context.sourceFile, exportDeclaration, typeExportDeclaration); } diff --git a/src/services/codefixes/convertToTypeOnlyImport.ts b/src/services/codefixes/convertToTypeOnlyImport.ts index fd5cd3cc2eefc..151ba0495ac23 100644 --- a/src/services/codefixes/convertToTypeOnlyImport.ts +++ b/src/services/codefixes/convertToTypeOnlyImport.ts @@ -52,7 +52,7 @@ registerCodeFix({ if (some(importDeclarationChanges)) { return [ createCodeFixActionWithoutFixAll(fixId, importDeclarationChanges, Diagnostics.Use_import_type), - mainAction + mainAction, ]; } return [mainAction]; @@ -79,7 +79,7 @@ registerCodeFix({ doChange(changes, diag.file, errorDeclaration); } }); - } + }, }); function getDeclaration(sourceFile: SourceFile, pos: number) { diff --git a/src/services/codefixes/convertTypedefToType.ts b/src/services/codefixes/convertTypedefToType.ts index ea233c1d2d1d1..a06d90726c9a3 100644 --- a/src/services/codefixes/convertTypedefToType.ts +++ b/src/services/codefixes/convertTypedefToType.ts @@ -62,7 +62,7 @@ registerCodeFix({ const fixAll = true; if (node) doChange(changes, node, diag.file, newLineCharacter, fixAll); } - ) + ), }); function doChange( diff --git a/src/services/codefixes/fixAddMissingConstraint.ts b/src/services/codefixes/fixAddMissingConstraint.ts index c5b2bd3573789..df99139e709c7 100644 --- a/src/services/codefixes/fixAddMissingConstraint.ts +++ b/src/services/codefixes/fixAddMissingConstraint.ts @@ -76,7 +76,7 @@ registerCodeFix({ return undefined; }); })); - } + }, }); interface Info { diff --git a/src/services/codefixes/fixAddMissingMember.ts b/src/services/codefixes/fixAddMissingMember.ts index 5c9efb68258fe..9046a71fbc4b0 100644 --- a/src/services/codefixes/fixAddMissingMember.ts +++ b/src/services/codefixes/fixAddMissingMember.ts @@ -138,7 +138,7 @@ const errorCodes = [ Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2.code, Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more.code, Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code, - Diagnostics.Cannot_find_name_0.code + Diagnostics.Cannot_find_name_0.code, ]; enum InfoKind { @@ -588,7 +588,7 @@ function addEnumMemberDeclaration(changes: textChanges.ChangeTracker, checker: T concatenate(parentDeclaration.members, singleElementArray(enumMember)) ), { leadingTriviaOption: textChanges.LeadingTriviaOption.IncludeAll, - trailingTriviaOption: textChanges.TrailingTriviaOption.Exclude + trailingTriviaOption: textChanges.TrailingTriviaOption.Exclude, }); } @@ -640,7 +640,7 @@ function addObjectLiteralProperties(changes: textChanges.ChangeTracker, context: const options = { leadingTriviaOption: textChanges.LeadingTriviaOption.Exclude, trailingTriviaOption: textChanges.TrailingTriviaOption.Exclude, - indentation: info.indentation + indentation: info.indentation, }; changes.replaceNode(context.sourceFile, info.parentDeclaration, factory.createObjectLiteralExpression([...info.parentDeclaration.properties, ...props], /*multiLine*/ true), options); importAdder.writeFixes(changes); diff --git a/src/services/codefixes/fixAddVoidToPromise.ts b/src/services/codefixes/fixAddVoidToPromise.ts index 4abb3cdedda2d..82114594c92fb 100644 --- a/src/services/codefixes/fixAddVoidToPromise.ts +++ b/src/services/codefixes/fixAddVoidToPromise.ts @@ -35,7 +35,7 @@ const fixName = "addVoidToPromise"; const fixId = "addVoidToPromise"; const errorCodes = [ Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments.code, - Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code + Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code, ]; registerCodeFix({ errorCodes, @@ -48,7 +48,7 @@ registerCodeFix({ }, getAllCodeActions(context: CodeFixAllContext) { return codeFixAll(context, errorCodes, (changes, diag) => makeChange(changes, diag.file, diag, context.program, new Set())); - } + }, }); function makeChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, span: TextSpan, program: Program, seen?: Set) { diff --git a/src/services/codefixes/fixAwaitInSyncFunction.ts b/src/services/codefixes/fixAwaitInSyncFunction.ts index ee1f5f73a4c31..0c38ba90103b9 100644 --- a/src/services/codefixes/fixAwaitInSyncFunction.ts +++ b/src/services/codefixes/fixAwaitInSyncFunction.ts @@ -31,7 +31,7 @@ const errorCodes = [ Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code, Diagnostics.await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code, Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code, - Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function.code + Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function.code, ]; registerCodeFix({ errorCodes, @@ -90,7 +90,7 @@ function getNodes(sourceFile: SourceFile, start: number): { insertBefore: Node, return insertBefore && { insertBefore, - returnType: getReturnType(containingFunction) + returnType: getReturnType(containingFunction), }; } diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index f91c49c9bece9..7c5e3652af32a 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -40,7 +40,7 @@ import { const errorCodes = [ Diagnostics.Class_0_incorrectly_implements_interface_1.code, - Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code + Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code, ]; const fixId = "fixClassIncorrectlyImplementsInterface"; // TODO: share a group with fixClassDoesntImplementInheritedAbstractMember? registerCodeFix({ diff --git a/src/services/codefixes/fixEnableJsxFlag.ts b/src/services/codefixes/fixEnableJsxFlag.ts index 4870e021120f7..0589acd30bff4 100644 --- a/src/services/codefixes/fixEnableJsxFlag.ts +++ b/src/services/codefixes/fixEnableJsxFlag.ts @@ -25,7 +25,7 @@ registerCodeFix({ doChange(changeTracker, configFile) ); return [ - createCodeFixActionWithoutFixAll(fixID, changes, Diagnostics.Enable_the_jsx_flag_in_your_configuration_file) + createCodeFixActionWithoutFixAll(fixID, changes, Diagnostics.Enable_the_jsx_flag_in_your_configuration_file), ]; }, fixIds: [fixID], @@ -37,7 +37,7 @@ registerCodeFix({ } doChange(changes, configFile); - }) + }), }); function doChange(changeTracker: textChanges.ChangeTracker, configFile: TsConfigSourceFile) { diff --git a/src/services/codefixes/fixImportNonExportedMember.ts b/src/services/codefixes/fixImportNonExportedMember.ts index ba25afcbf5505..48d39c2ee3d05 100644 --- a/src/services/codefixes/fixImportNonExportedMember.ts +++ b/src/services/codefixes/fixImportNonExportedMember.ts @@ -91,7 +91,7 @@ registerCodeFix({ } }); })); - } + }, }); interface ModuleExports { diff --git a/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts b/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts index f7e8345b217f0..0510ea4d4a7c4 100644 --- a/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts +++ b/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts @@ -19,7 +19,7 @@ import { const fixId = "fixIncorrectNamedTupleSyntax"; const errorCodes = [ Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type.code, - Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type.code + Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type.code, ]; registerCodeFix({ @@ -30,7 +30,7 @@ registerCodeFix({ const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, namedTupleMember)); return [createCodeFixAction(fixId, changes, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels, fixId, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels)]; }, - fixIds: [fixId] + fixIds: [fixId], }); function getNamedTupleMember(sourceFile: SourceFile, pos: number) { diff --git a/src/services/codefixes/fixInvalidImportSyntax.ts b/src/services/codefixes/fixInvalidImportSyntax.ts index bae3f2d2c0f16..9bb3563197559 100644 --- a/src/services/codefixes/fixInvalidImportSyntax.ts +++ b/src/services/codefixes/fixInvalidImportSyntax.ts @@ -64,7 +64,7 @@ registerCodeFix({ Diagnostics.This_expression_is_not_callable.code, Diagnostics.This_expression_is_not_constructable.code, ], - getCodeActions: getActionsForUsageOfInvalidImport + getCodeActions: getActionsForUsageOfInvalidImport, }); function getActionsForUsageOfInvalidImport(context: CodeFixContext): CodeFixAction[] | undefined { @@ -93,7 +93,7 @@ registerCodeFix({ Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property.code, Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1.code, ], - getCodeActions: getActionsForInvalidImportLocation + getCodeActions: getActionsForInvalidImportLocation, }); function getActionsForInvalidImportLocation(context: CodeFixContext): CodeFixAction[] | undefined { diff --git a/src/services/codefixes/fixInvalidJsxCharacters.ts b/src/services/codefixes/fixInvalidJsxCharacters.ts index aea34c0c42cef..744354c7fb87b 100644 --- a/src/services/codefixes/fixInvalidJsxCharacters.ts +++ b/src/services/codefixes/fixInvalidJsxCharacters.ts @@ -17,7 +17,7 @@ const fixIdHtmlEntity = "fixInvalidJsxCharacters_htmlEntity"; const errorCodes = [ Diagnostics.Unexpected_token_Did_you_mean_or_gt.code, - Diagnostics.Unexpected_token_Did_you_mean_or_rbrace.code + Diagnostics.Unexpected_token_Did_you_mean_or_rbrace.code, ]; registerCodeFix({ @@ -30,12 +30,12 @@ registerCodeFix({ return [ createCodeFixAction(fixIdExpression, changeToExpression, Diagnostics.Wrap_invalid_character_in_an_expression_container, fixIdExpression, Diagnostics.Wrap_all_invalid_characters_in_an_expression_container), - createCodeFixAction(fixIdHtmlEntity, changeToHtmlEntity, Diagnostics.Convert_invalid_character_to_its_html_entity_code, fixIdHtmlEntity, Diagnostics.Convert_all_invalid_characters_to_HTML_entity_code) + createCodeFixAction(fixIdHtmlEntity, changeToHtmlEntity, Diagnostics.Convert_invalid_character_to_its_html_entity_code, fixIdHtmlEntity, Diagnostics.Convert_all_invalid_characters_to_HTML_entity_code), ]; }, getAllCodeActions(context) { return codeFixAll(context, errorCodes, (changes, diagnostic) => doChange(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity)); - } + }, }); const htmlEntity = { diff --git a/src/services/codefixes/fixJSDocTypes.ts b/src/services/codefixes/fixJSDocTypes.ts index 3a50e7579675c..24d568e097501 100644 --- a/src/services/codefixes/fixJSDocTypes.ts +++ b/src/services/codefixes/fixJSDocTypes.ts @@ -78,7 +78,7 @@ registerCodeFix({ const fixedType = typeNode.kind === SyntaxKind.JSDocNullableType && fixId === fixIdNullable ? checker.getNullableType(type, TypeFlags.Undefined) : type; doChange(changes, sourceFile, typeNode, fixedType, checker); }); - } + }, }); function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, oldTypeNode: TypeNode, newType: Type, checker: TypeChecker): void { diff --git a/src/services/codefixes/fixMissingCallParentheses.ts b/src/services/codefixes/fixMissingCallParentheses.ts index 4fcc89c87fcc0..fb158aae7ce05 100644 --- a/src/services/codefixes/fixMissingCallParentheses.ts +++ b/src/services/codefixes/fixMissingCallParentheses.ts @@ -34,7 +34,7 @@ registerCodeFix({ getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => { const callName = getCallName(diag.file, diag.start); if (callName) doChange(changes, diag.file, callName); - }) + }), }); function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, name: Identifier | PrivateIdentifier): void { diff --git a/src/services/codefixes/fixModuleAndTargetOptions.ts b/src/services/codefixes/fixModuleAndTargetOptions.ts index 0cc3e489ab25d..7446e4babe1d2 100644 --- a/src/services/codefixes/fixModuleAndTargetOptions.ts +++ b/src/services/codefixes/fixModuleAndTargetOptions.ts @@ -60,5 +60,5 @@ registerCodeFix({ } return codeFixes.length ? codeFixes : undefined; - } + }, }); diff --git a/src/services/codefixes/fixNaNEquality.ts b/src/services/codefixes/fixNaNEquality.ts index 4370bd0d1c584..93d796def394f 100644 --- a/src/services/codefixes/fixNaNEquality.ts +++ b/src/services/codefixes/fixNaNEquality.ts @@ -46,7 +46,7 @@ registerCodeFix({ doChange(changes, diag.file, info.arg, info.expression); } }); - } + }, }); interface Info { diff --git a/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts b/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts index 7a35126032924..718e16ea03d6b 100644 --- a/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts +++ b/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts @@ -20,7 +20,7 @@ import { const fixId = "fixNoPropertyAccessFromIndexSignature"; const errorCodes = [ - Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0.code + Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0.code, ]; registerCodeFix({ @@ -33,7 +33,7 @@ registerCodeFix({ return [createCodeFixAction(fixId, changes, [Diagnostics.Use_element_access_for_0, property.name.text], fixId, Diagnostics.Use_element_access_for_all_undeclared_properties)]; }, getAllCodeActions: context => - codeFixAll(context, errorCodes, (changes, diag) => doChange(changes, diag.file, getPropertyAccessExpression(diag.file, diag.start), context.preferences)) + codeFixAll(context, errorCodes, (changes, diag) => doChange(changes, diag.file, getPropertyAccessExpression(diag.file, diag.start), context.preferences)), }); function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, node: PropertyAccessExpression, preferences: UserPreferences): void { diff --git a/src/services/codefixes/fixOverrideModifier.ts b/src/services/codefixes/fixOverrideModifier.ts index f76a8420e0699..c44b23748d420 100644 --- a/src/services/codefixes/fixOverrideModifier.ts +++ b/src/services/codefixes/fixOverrideModifier.ts @@ -78,7 +78,7 @@ const errorCodeFixIdMap: Record = { [Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code]: { descriptions: Diagnostics.Add_override_modifier, fixId: fixAddOverrideId, - fixAllDescriptions: Diagnostics.Add_all_missing_override_modifiers + fixAllDescriptions: Diagnostics.Add_all_missing_override_modifiers, }, // case #2: [Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code]: { @@ -89,7 +89,7 @@ const errorCodeFixIdMap: Record = { [Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class.code]: { descriptions: Diagnostics.Remove_override_modifier, fixId: fixRemoveOverrideId, - fixAllDescriptions: Diagnostics.Remove_override_modifier + fixAllDescriptions: Diagnostics.Remove_override_modifier, }, // case #3: [Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code]: { @@ -118,7 +118,7 @@ const errorCodeFixIdMap: Record = { descriptions: Diagnostics.Remove_override_modifier, fixId: fixRemoveOverrideId, fixAllDescriptions: Diagnostics.Remove_all_unnecessary_override_modifiers, - } + }, }; registerCodeFix({ @@ -133,7 +133,7 @@ registerCodeFix({ const changes = textChanges.ChangeTracker.with(context, changes => dispatchChanges(changes, context, errorCode, span.start)); return [ - createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId, fixAllDescriptions) + createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId, fixAllDescriptions), ]; }, fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId], @@ -146,7 +146,7 @@ registerCodeFix({ } dispatchChanges(changes, context, code, start); - }) + }), }); function dispatchChanges( diff --git a/src/services/codefixes/fixPropertyAssignment.ts b/src/services/codefixes/fixPropertyAssignment.ts index 2f1ef5a198044..e8b3105b28a30 100644 --- a/src/services/codefixes/fixPropertyAssignment.ts +++ b/src/services/codefixes/fixPropertyAssignment.ts @@ -17,7 +17,7 @@ import { const fixId = "fixPropertyAssignment"; const errorCodes = [ - Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern.code + Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern.code, ]; registerCodeFix({ @@ -30,7 +30,7 @@ registerCodeFix({ return [createCodeFixAction(fixId, changes, [Diagnostics.Change_0_to_1, "=", ":"], fixId, [Diagnostics.Switch_each_misused_0_to_1, "=", ":"])]; }, getAllCodeActions: context => - codeFixAll(context, errorCodes, (changes, diag) => doChange(changes, diag.file, getProperty(diag.file, diag.start))) + codeFixAll(context, errorCodes, (changes, diag) => doChange(changes, diag.file, getProperty(diag.file, diag.start))), }); function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, node: ShorthandPropertyAssignment): void { diff --git a/src/services/codefixes/fixReturnTypeInAsyncFunction.ts b/src/services/codefixes/fixReturnTypeInAsyncFunction.ts index a7071d6e143f4..915c3c3f5725d 100644 --- a/src/services/codefixes/fixReturnTypeInAsyncFunction.ts +++ b/src/services/codefixes/fixReturnTypeInAsyncFunction.ts @@ -52,7 +52,7 @@ registerCodeFix({ if (info) { doChange(changes, diag.file, info.returnTypeNode, info.promisedTypeNode); } - }) + }), }); function getInfo(sourceFile: SourceFile, checker: TypeChecker, pos: number): Info | undefined { diff --git a/src/services/codefixes/fixUnmatchedParameter.ts b/src/services/codefixes/fixUnmatchedParameter.ts index 267e207a6ccac..92be08a44d5d6 100644 --- a/src/services/codefixes/fixUnmatchedParameter.ts +++ b/src/services/codefixes/fixUnmatchedParameter.ts @@ -68,7 +68,7 @@ registerCodeFix({ } }); })); - } + }, }); function getDeleteAction(context: CodeFixContext, { name, jsDocHost, jsDocParameterTag }: Info) { diff --git a/src/services/codefixes/fixUnreachableCode.ts b/src/services/codefixes/fixUnreachableCode.ts index 17afabda71a93..61c363c3fc868 100644 --- a/src/services/codefixes/fixUnreachableCode.ts +++ b/src/services/codefixes/fixUnreachableCode.ts @@ -43,7 +43,7 @@ function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, st tokenKind: Debug.formatSyntaxKind(token.kind), errorCode, start, - length + length, }); Debug.fail("Token and statement should start at the same point. " + logData); } diff --git a/src/services/codefixes/fixUnusedIdentifier.ts b/src/services/codefixes/fixUnusedIdentifier.ts index 4da1d6ce22d9c..2e7cf9fc4f031 100644 --- a/src/services/codefixes/fixUnusedIdentifier.ts +++ b/src/services/codefixes/fixUnusedIdentifier.ts @@ -112,11 +112,11 @@ registerCodeFix({ const elements = token.parent.elements; const diagnostic: [DiagnosticMessage, string] = [ elements.length > 1 ? Diagnostics.Remove_unused_declarations_for_Colon_0 : Diagnostics.Remove_unused_declaration_for_Colon_0, - map(elements, e => e.getText(sourceFile)).join(", ") + map(elements, e => e.getText(sourceFile)).join(", "), ]; return [ createDeleteFix(textChanges.ChangeTracker.with(context, t => - deleteDestructuringElements(t, sourceFile, token.parent as ObjectBindingPattern | ArrayBindingPattern)), diagnostic) + deleteDestructuringElements(t, sourceFile, token.parent as ObjectBindingPattern | ArrayBindingPattern)), diagnostic), ]; } return [ @@ -128,7 +128,7 @@ registerCodeFix({ if (canDeleteEntireVariableStatement(sourceFile, token)) { return [ createDeleteFix(textChanges.ChangeTracker.with(context, t => - deleteEntireVariableStatement(t, sourceFile, token.parent as VariableDeclarationList)), Diagnostics.Remove_variable_statement) + deleteEntireVariableStatement(t, sourceFile, token.parent as VariableDeclarationList)), Diagnostics.Remove_variable_statement), ]; } diff --git a/src/services/codefixes/generateAccessors.ts b/src/services/codefixes/generateAccessors.ts index 772abe45614af..783e7402e676a 100644 --- a/src/services/codefixes/generateAccessors.ts +++ b/src/services/codefixes/generateAccessors.ts @@ -177,19 +177,19 @@ export function getAccessorConvertiblePropertyAtPosition(file: SourceFile, progr if (!declaration || (!(nodeOverlapsWithStartEnd(declaration.name, file, start, end) || cursorRequest))) { return { - error: getLocaleSpecificMessage(Diagnostics.Could_not_find_property_for_which_to_generate_accessor) + error: getLocaleSpecificMessage(Diagnostics.Could_not_find_property_for_which_to_generate_accessor), }; } if (!isConvertibleName(declaration.name)) { return { - error: getLocaleSpecificMessage(Diagnostics.Name_is_not_valid) + error: getLocaleSpecificMessage(Diagnostics.Name_is_not_valid), }; } if (((getEffectiveModifierFlags(declaration) & ModifierFlags.Modifier) | meaning) !== meaning) { return { - error: getLocaleSpecificMessage(Diagnostics.Can_only_convert_property_with_modifier) + error: getLocaleSpecificMessage(Diagnostics.Can_only_convert_property_with_modifier), }; } @@ -206,7 +206,7 @@ export function getAccessorConvertiblePropertyAtPosition(file: SourceFile, progr declaration, fieldName, accessorName, - renameAccessor: startWithUnderscore + renameAccessor: startWithUnderscore, }; } @@ -219,7 +219,7 @@ function generateGetAccessor(fieldName: AcceptedNameType, accessorName: Accepted factory.createBlock([ factory.createReturnStatement( createAccessorAccessExpression(fieldName, isStatic, container) - ) + ), ], /*multiLine*/ true) ); } @@ -241,7 +241,7 @@ function generateSetAccessor(fieldName: AcceptedNameType, accessorName: Accepted createAccessorAccessExpression(fieldName, isStatic, container), factory.createIdentifier("value") ) - ) + ), ], /*multiLine*/ true) ); } diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index 1116d70c19ccf..c51a2ba81e0d3 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -160,7 +160,7 @@ export type AddNode = PropertyDeclaration | GetAccessorDeclaration | SetAccessor export const enum PreserveOptionalFlags { Method = 1 << 0, Property = 1 << 1, - All = Method | Property + All = Method | Property, } /** diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index e6f0eb91405e3..28551ccf9427f 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -327,7 +327,7 @@ function createImportAdderWorker(sourceFile: SourceFile, program: Program, useAu defaultImport: undefined, namedImports: undefined, namespaceLikeImport: undefined, - useRequire + useRequire, }; if (importKind === ImportKind.Default && addAsTypeOnly === AddAsTypeOnly.Required) { if (typeOnlyEntry) return typeOnlyEntry; @@ -543,7 +543,7 @@ export function getImportCompletionAction( fix, /*includeSymbolNameInDescription*/ false, compilerOptions, - preferences)) + preferences)), }; } @@ -794,7 +794,7 @@ function createExistingImportMap(checker: TypeChecker, importingFile: SourceFile if (!matchingDeclarations) return emptyArray; const importKind = getImportKind(importingFile, exportKind, compilerOptions); return matchingDeclarations.map(declaration => ({ declaration, importKind, symbol, targetFlags })); - } + }, }; } diff --git a/src/services/codefixes/inferFromUsage.ts b/src/services/codefixes/inferFromUsage.ts index af21562a22a27..3194e641bfdea 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -509,7 +509,7 @@ function inferTypeForParametersFromUsage(func: SignatureDeclaration, sourceFile: return references && inferTypeFromReferences(program, references, cancellationToken).parameters(func) || func.parameters.map(p => ({ declaration: p, - type: isIdentifier(p.name) ? inferTypeForVariableFromUsage(p.name, program, cancellationToken) : program.getTypeChecker().getAnyType() + type: isIdentifier(p.name) ? inferTypeForVariableFromUsage(p.name, program, cancellationToken) : program.getTypeChecker().getAnyType(), })); } @@ -676,7 +676,7 @@ function inferTypeFromReferences(program: Program, references: readonly Identifi return { type: isRest ? checker.createArrayType(type) : type, isOptional: isOptional && !isRest, - declaration: parameter + declaration: parameter, }; }); } @@ -907,7 +907,7 @@ function inferTypeFromReferences(program: Program, references: readonly Identifi function inferTypeFromCallExpression(parent: CallExpression | NewExpression, usage: Usage): void { const call: CallUsage = { argumentTypes: [], - return_: createEmptyUsage() + return_: createEmptyUsage(), }; if (parent.arguments) { @@ -996,15 +996,15 @@ function inferTypeFromReferences(program: Program, references: readonly Identifi const priorities: Priority[] = [ { high: t => t === checker.getStringType() || t === checker.getNumberType(), - low: t => t === stringNumber + low: t => t === stringNumber, }, { high: t => !(t.flags & (TypeFlags.Any | TypeFlags.Void)), - low: t => !!(t.flags & (TypeFlags.Any | TypeFlags.Void)) + low: t => !!(t.flags & (TypeFlags.Any | TypeFlags.Void)), }, { high: t => !(t.flags & (TypeFlags.Nullable | TypeFlags.Any | TypeFlags.Void)) && !(getObjectFlags(t) & ObjectFlags.Anonymous), - low: t => !!(getObjectFlags(t) & ObjectFlags.Anonymous) + low: t => !!(getObjectFlags(t) & ObjectFlags.Anonymous), }]; let good = removeLowPriorityInferences(inferences, priorities); const anons = good.filter(i => getObjectFlags(i) & ObjectFlags.Anonymous) as AnonymousType[]; diff --git a/src/services/codefixes/requireInTs.ts b/src/services/codefixes/requireInTs.ts index 940cc8b690f92..fe95c9980aaca 100644 --- a/src/services/codefixes/requireInTs.ts +++ b/src/services/codefixes/requireInTs.ts @@ -79,7 +79,7 @@ function getInfo(sourceFile: SourceFile, program: Program, pos: number): Info | defaultImportName, namedImports, statement: cast(decl.parent.parent, isVariableStatement), - required: first(parent.arguments) + required: first(parent.arguments), }; } } diff --git a/src/services/codefixes/returnValueCorrect.ts b/src/services/codefixes/returnValueCorrect.ts index 5bca2c5788b91..fda2a434f102d 100644 --- a/src/services/codefixes/returnValueCorrect.ts +++ b/src/services/codefixes/returnValueCorrect.ts @@ -53,12 +53,12 @@ const fixIdWrapTheBlockWithParen = "fixWrapTheBlockWithParen"; const errorCodes = [ Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value.code, Diagnostics.Type_0_is_not_assignable_to_type_1.code, - Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code + Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code, ]; enum ProblemKind { MissingReturnStatement, - MissingParentheses + MissingParentheses, } interface MissingReturnInfo { @@ -135,7 +135,7 @@ function getFixInfo(checker: TypeChecker, declaration: FunctionLikeDeclaration, kind: ProblemKind.MissingReturnStatement, expression: firstStatement.expression, statement: firstStatement, - commentSource: firstStatement.expression + commentSource: firstStatement.expression, }; } else if (isLabeledStatement(firstStatement) && isExpressionStatement(firstStatement.statement)) { @@ -147,13 +147,13 @@ function getFixInfo(checker: TypeChecker, declaration: FunctionLikeDeclaration, kind: ProblemKind.MissingParentheses, expression: node, statement: firstStatement, - commentSource: firstStatement.statement.expression + commentSource: firstStatement.statement.expression, } : { declaration, kind: ProblemKind.MissingReturnStatement, expression: node, statement: firstStatement, - commentSource: firstStatement.statement.expression + commentSource: firstStatement.statement.expression, }; } } @@ -168,7 +168,7 @@ function getFixInfo(checker: TypeChecker, declaration: FunctionLikeDeclaration, kind: ProblemKind.MissingReturnStatement, expression: node, statement: firstStatement, - commentSource: firstBlockStatement + commentSource: firstBlockStatement, }; } } @@ -257,7 +257,7 @@ function addReturnStatement(changes: textChanges.ChangeTracker, sourceFile: Sour changes.replaceNode(sourceFile, statement, factory.createReturnStatement(expression), { leadingTriviaOption: textChanges.LeadingTriviaOption.Exclude, trailingTriviaOption: textChanges.TrailingTriviaOption.Exclude, - suffix: probablyNeedSemi ? ";" : undefined + suffix: probablyNeedSemi ? ";" : undefined, }); } diff --git a/src/services/completions.ts b/src/services/completions.ts index 33ed264c3b620..fbeac03855d96 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -585,7 +585,7 @@ const enum KeywordCompletionFilters { TypeAssertionKeywords, TypeKeywords, TypeKeyword, // Literally just `type` - Last = TypeKeyword + Last = TypeKeyword, } const enum GlobalsSearch { Continue, Success, Fail } @@ -1000,7 +1000,7 @@ function generateJSDocParamTagsForDestructuring( checker, options, preferences, - { tabstop: 1 }) + { tabstop: 1 }), ]; } return patternWorker(path, pattern, initializer, dotDotDotToken, { tabstop: 1 }); @@ -1053,7 +1053,7 @@ function generateJSDocParamTagsForDestructuring( checker, options, preferences, - counter) + counter), ]; } @@ -1136,7 +1136,7 @@ function getJSDocParamAnnotation( : createPrinter({ removeComments: true, module: options.module, - target: options.target + target: options.target, }); setEmitFlags(typeNode, EmitFlags.SingleLine); type = printer.printNode(EmitHint.Unspecified, typeNode, sourceFile); @@ -1422,7 +1422,7 @@ function getExhaustiveCaseSnippets( removeComments: true, module: options.module, target: options.target, - newLine: getNewLineKind(newLineChar) + newLine: getNewLineKind(newLineChar), }); const printNode = formatContext ? (node: Node) => printer.printAndFormatNode(EmitHint.Unspecified, node, sourceFile, formatContext) @@ -1579,7 +1579,7 @@ function getJSCompletionEntries( kind: ScriptElementKind.warning, kindModifiers: "", sortText: SortText.JavascriptIdentifiers, - isFromUncheckedFile: true + isFromUncheckedFile: true, }, compareCompletionEntries); } }); @@ -1812,7 +1812,7 @@ function createCompletionEntry( isPackageJsonImport: originIsPackageJsonImport(origin) || undefined, isImportStatementCompletion: !!importStatementCompletion || undefined, data, - ...includeSymbol ? { symbol } : undefined + ...includeSymbol ? { symbol } : undefined, }; } @@ -2631,7 +2631,7 @@ function getLabelStatementCompletions(node: Node): CompletionEntry[] { name, kindModifiers: ScriptElementKindModifier.none, kind: ScriptElementKind.label, - sortText: SortText.LocationPriority + sortText: SortText.LocationPriority, }); } } @@ -5080,7 +5080,7 @@ const allKeywordsCompletions: () => readonly CompletionEntry[] = memoize(() => { name: tokenToString(i)!, kind: ScriptElementKind.keyword, kindModifiers: ScriptElementKindModifier.none, - sortText: SortText.GlobalsOrKeywords + sortText: SortText.GlobalsOrKeywords, }); } return res; diff --git a/src/services/documentHighlights.ts b/src/services/documentHighlights.ts index 1d4848c641851..3bc2b22363e83 100644 --- a/src/services/documentHighlights.ts +++ b/src/services/documentHighlights.ts @@ -107,7 +107,7 @@ export namespace DocumentHighlights { return { fileName: sourceFile.fileName, textSpan: createTextSpanFromNode(node, sourceFile), - kind: HighlightSpanKind.none + kind: HighlightSpanKind.none, }; } @@ -550,7 +550,7 @@ export namespace DocumentHighlights { result.push({ fileName: sourceFile.fileName, textSpan: createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), - kind: HighlightSpanKind.reference + kind: HighlightSpanKind.reference, }); i++; // skip the next keyword continue; diff --git a/src/services/documentRegistry.ts b/src/services/documentRegistry.ts index b8ef0757b7700..b9da6d70f7694 100644 --- a/src/services/documentRegistry.ts +++ b/src/services/documentRegistry.ts @@ -200,7 +200,7 @@ export function createDocumentRegistryInternal(useCaseSensitiveFileNames?: boole sourceFiles.push({ name, scriptKind: entry.sourceFile.scriptKind, - refCount: entry.languageServiceRefCount + refCount: entry.languageServiceRefCount, }); } else { @@ -210,7 +210,7 @@ export function createDocumentRegistryInternal(useCaseSensitiveFileNames?: boole sourceFiles.sort((x, y) => y.refCount - x.refCount); return { bucket: name, - sourceFiles + sourceFiles, }; }); return JSON.stringify(bucketInfoArray, undefined, 2); @@ -269,7 +269,7 @@ export function createDocumentRegistryInternal(useCaseSensitiveFileNames?: boole { languageVersion: scriptTarget, impliedNodeFormat: host && getImpliedNodeFormatForFile(path, host.getCompilerHost?.()?.getModuleResolutionCache?.()?.getPackageJsonInfoCache(), host, compilationSettings), - setExternalModuleIndicator: getSetExternalModuleIndicator(compilationSettings) + setExternalModuleIndicator: getSetExternalModuleIndicator(compilationSettings), }; sourceFileOptions.languageVersion = scriptTarget; const oldBucketCount = buckets.size; @@ -301,7 +301,7 @@ export function createDocumentRegistryInternal(useCaseSensitiveFileNames?: boole Debug.assert(acquiring); entry = { sourceFile, - languageServiceRefCount: 0 + languageServiceRefCount: 0, }; setBucketEntry(); } diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 1aa55a6cbc2cf..930d997bd0caf 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -308,7 +308,7 @@ export function nodeEntry(node: Node, kind: NodeEntryKind = EntryKind.Node): Nod return { kind, node: (node as NamedDeclaration).name || node, - context: getContextNodeForNodeEntry(node) + context: getContextNodeForNodeEntry(node), }; } @@ -419,7 +419,7 @@ export function getContextNode(node: NamedDeclaration | BinaryExpression | ForIn case SyntaxKind.ForInStatement: return { start: (node as ForInOrOfStatement).initializer, - end: (node as ForInOrOfStatement).expression + end: (node as ForInOrOfStatement).expression, }; case SyntaxKind.PropertyAssignment: @@ -494,7 +494,7 @@ export function findReferencedSymbols(program: Program, cancellationToken: Cance // Only include referenced symbols that have a valid definition. definition && { definition: checker.runWithCancellationToken(cancellationToken, checker => definitionToReferencedSymbolDefinitionInfo(definition, checker, node)), - references: references.map(r => toReferencedSymbolEntry(r, symbol)) + references: references.map(r => toReferencedSymbolEntry(r, symbol)), }); } @@ -605,7 +605,7 @@ function definitionToReferencedSymbolDefinitionInfo(def: Definition, checker: Ty name, kind, displayParts, - context: getContextNode(declaration) + context: getContextNode(declaration), }; } case DefinitionKind.Label: { @@ -630,7 +630,7 @@ function definitionToReferencedSymbolDefinitionInfo(def: Definition, checker: Ty ...getFileAndTextSpanFromNode(node), name: node.text, kind: ScriptElementKind.variableElement, - displayParts: [displayPart(getTextOfNode(node), SymbolDisplayPartKind.stringLiteral)] + displayParts: [displayPart(getTextOfNode(node), SymbolDisplayPartKind.stringLiteral)], }; } case DefinitionKind.TripleSlashReference: { @@ -639,7 +639,7 @@ function definitionToReferencedSymbolDefinitionInfo(def: Definition, checker: Ty sourceFile: def.file, name: def.reference.fileName, kind: ScriptElementKind.string, - displayParts: [displayPart(`"${def.reference.fileName}"`, SymbolDisplayPartKind.stringLiteral)] + displayParts: [displayPart(`"${def.reference.fileName}"`, SymbolDisplayPartKind.stringLiteral)], }; } default: @@ -656,7 +656,7 @@ function definitionToReferencedSymbolDefinitionInfo(def: Definition, checker: Ty name, textSpan, displayParts, - ...toContextSpan(textSpan, sourceFile, context) + ...toContextSpan(textSpan, sourceFile, context), }; } @@ -664,7 +664,7 @@ function getFileAndTextSpanFromNode(node: Node) { const sourceFile = node.getSourceFile(); return { sourceFile, - textSpan: getTextSpan(isComputedPropertyName(node) ? node.expression : node, sourceFile) + textSpan: getTextSpan(isComputedPropertyName(node) ? node.expression : node, sourceFile), }; } @@ -686,7 +686,7 @@ function toReferencedSymbolEntry(entry: Entry, symbol: Symbol | undefined): Refe if (!symbol) return referenceEntry; return { ...referenceEntry, - isDefinition: entry.kind !== EntryKind.Span && isDeclarationOfSymbol(entry.node, symbol) + isDefinition: entry.kind !== EntryKind.Span && isDeclarationOfSymbol(entry.node, symbol), }; } @@ -714,7 +714,7 @@ function entryToDocumentSpan(entry: Entry): DocumentSpan { return { textSpan, fileName: sourceFile.fileName, - ...toContextSpan(textSpan, sourceFile, entry.context) + ...toContextSpan(textSpan, sourceFile, entry.context), }; } } @@ -779,7 +779,7 @@ function toImplementationLocation(entry: Entry, checker: TypeChecker): Implement const { node } = entry; return { ...documentSpan, - ...implementationKindDisplayParts(node, checker) + ...implementationKindDisplayParts(node, checker), }; } else { @@ -795,13 +795,13 @@ function implementationKindDisplayParts(node: Node, checker: TypeChecker): { kin else if (node.kind === SyntaxKind.ObjectLiteralExpression) { return { kind: ScriptElementKind.interfaceElement, - displayParts: [punctuationPart(SyntaxKind.OpenParenToken), textPart("object literal"), punctuationPart(SyntaxKind.CloseParenToken)] + displayParts: [punctuationPart(SyntaxKind.OpenParenToken), textPart("object literal"), punctuationPart(SyntaxKind.CloseParenToken)], }; } else if (node.kind === SyntaxKind.ClassExpression) { return { kind: ScriptElementKind.localClassElement, - displayParts: [punctuationPart(SyntaxKind.OpenParenToken), textPart("anonymous local class"), punctuationPart(SyntaxKind.CloseParenToken)] + displayParts: [punctuationPart(SyntaxKind.OpenParenToken), textPart("anonymous local class"), punctuationPart(SyntaxKind.CloseParenToken)], }; } else { @@ -817,8 +817,8 @@ export function toHighlightSpan(entry: Entry): { fileName: string, span: Highlig fileName: documentSpan.fileName, span: { textSpan: documentSpan.textSpan, - kind: HighlightSpanKind.reference - } + kind: HighlightSpanKind.reference, + }, }; } @@ -827,7 +827,7 @@ export function toHighlightSpan(entry: Entry): { fileName: string, span: Highlig textSpan: documentSpan.textSpan, kind: writeAccess ? HighlightSpanKind.writtenReference : HighlightSpanKind.reference, isInString: entry.kind === EntryKind.StringLiteral ? true : undefined, - ...documentSpan.contextSpan && { contextSpan: documentSpan.contextSpan } + ...documentSpan.contextSpan && { contextSpan: documentSpan.contextSpan }, }; return { fileName: documentSpan.fileName, span }; } @@ -960,7 +960,7 @@ export namespace Core { } return [{ definition: { type: DefinitionKind.TripleSlashReference, reference: resolvedRef.reference, file: node }, - references: getReferencesForNonModule(resolvedRef.file, fileIncludeReasons, program) || emptyArray + references: getReferencesForNonModule(resolvedRef.file, fileIncludeReasons, program) || emptyArray, }]; } @@ -1043,7 +1043,7 @@ export namespace Core { entries = append(entries, { kind: EntryKind.Span, fileName: referencingFile.fileName, - textSpan: createTextSpanFromRange(location) + textSpan: createTextSpanFromRange(location), }); } } @@ -1115,7 +1115,7 @@ export namespace Core { return entry1Span.start !== entry2Span.start ? compareValues(entry1Span.start, entry2Span.start) : compareValues(entry1Span.length, entry2Span.length); - }) + }), }; } } @@ -1454,7 +1454,7 @@ export namespace Core { addStringOrCommentReference(fileName: string, textSpan: TextSpan): void { this.result.push({ definition: undefined, - references: [{ kind: EntryKind.Span, fileName, textSpan }] + references: [{ kind: EntryKind.Span, fileName, textSpan }], }); } @@ -2396,7 +2396,7 @@ export namespace Core { const thisParameter = firstDefined(references, r => isParameter(r.node.parent) ? r.node : undefined); return [{ definition: { type: DefinitionKind.This, node: thisParameter || thisOrSuperKeyword }, - references + references, }]; } @@ -2422,7 +2422,7 @@ export namespace Core { return [{ definition: { type: DefinitionKind.String, node }, - references + references, }]; } diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 0f066e4807ebe..5bee395b3521e 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -112,7 +112,7 @@ export function createTextRangeWithKind(pos: number, end: } const enum Constants { - Unknown = -1 + Unknown = -1, } /* @@ -182,7 +182,7 @@ export function formatOnEnter(position: number, sourceFile: SourceFile, formatCo // get start position for the previous line pos: getStartPositionOfLine(line - 1, sourceFile), // end value is exclusive so add 1 to the result - end: endOfFormatSpan + 1 + end: endOfFormatSpan + 1, }; return formatSpan(span, sourceFile, formatContext, FormattingRequestKind.FormatOnEnter); } @@ -216,7 +216,7 @@ export function formatOnOpeningCurly(position: number, sourceFile: SourceFile, f */ const textRange: TextRange = { pos: getLineStartPositionForPosition(outermostNode!.getStart(sourceFile), sourceFile), // TODO: GH#18217 - end: position + end: position, }; return formatSpan(textRange, sourceFile, formatContext, FormattingRequestKind.FormatOnOpeningCurlyBrace); @@ -232,7 +232,7 @@ export function formatOnClosingCurly(position: number, sourceFile: SourceFile, f export function formatDocument(sourceFile: SourceFile, formatContext: FormatContext): TextChange[] { const span = { pos: 0, - end: sourceFile.text.length + end: sourceFile.text.length, }; return formatSpan(span, sourceFile, formatContext, FormattingRequestKind.FormatDocument); } @@ -454,7 +454,7 @@ function formatNodeLines(node: Node | undefined, sourceFile: SourceFile, formatC const span = { pos: getLineStartPositionForPosition(node.getStart(sourceFile), sourceFile), - end: node.end + end: node.end, }; return formatSpan(span, sourceFile, formatContext, requestKind); @@ -629,7 +629,7 @@ function formatSpanWorker( // - push children if either parent of node itself has non-zero delta return { indentation: startLine === lastIndentedLine ? indentationOnLastIndentedLine : parentDynamicIndentation.getIndentation(), - delta: Math.min(options.indentSize!, parentDynamicIndentation.getDelta(node) + delta) + delta: Math.min(options.indentSize!, parentDynamicIndentation.getDelta(node) + delta), }; } else if (inheritedIndentation === Constants.Unknown) { @@ -716,7 +716,7 @@ function formatSpanWorker( indentation += lineAdded ? options.indentSize! : -options.indentSize!; delta = SmartIndenter.shouldIndentChildNode(options, node) ? options.indentSize! : 0; } - } + }, }; function shouldAddDelta(line: number, kind: SyntaxKind, container: Node): boolean { diff --git a/src/services/formatting/formattingContext.ts b/src/services/formatting/formattingContext.ts index 435b2dec686e1..8538fb4213dcd 100644 --- a/src/services/formatting/formattingContext.ts +++ b/src/services/formatting/formattingContext.ts @@ -15,7 +15,7 @@ export const enum FormattingRequestKind { FormatOnEnter, FormatOnSemicolon, FormatOnOpeningCurlyBrace, - FormatOnClosingCurlyBrace + FormatOnClosingCurlyBrace, } /** @internal */ diff --git a/src/services/formatting/formattingScanner.ts b/src/services/formatting/formattingScanner.ts index 6a8087390461d..78890ad3a29b3 100644 --- a/src/services/formatting/formattingScanner.ts +++ b/src/services/formatting/formattingScanner.ts @@ -113,7 +113,7 @@ export function getFormattingScanner(text: string, languageVariant: LanguageV const item: TextRangeWithTriviaKind = { pos, end: scanner.getTokenFullStart(), - kind: t + kind: t, }; pos = scanner.getTokenFullStart(); diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 3d9c201a5050b..03883934e46fe 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -246,7 +246,7 @@ export function getAllRules(): RuleSpec[] { isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext, isNotFunctionDeclContext /*To prevent an interference with the SpaceBeforeOpenParenInFuncDecl rule*/, - isNonTypeAssertionContext + isNonTypeAssertionContext, ], RuleAction.DeleteSpace), // decorators diff --git a/src/services/formatting/rulesMap.ts b/src/services/formatting/rulesMap.ts index 8970be77c18a5..3face7256f1f9 100644 --- a/src/services/formatting/rulesMap.ts +++ b/src/services/formatting/rulesMap.ts @@ -110,7 +110,7 @@ enum RulesPosition { ContextRulesSpecific = maskBitSize * 2, ContextRulesAny = maskBitSize * 3, NoContextRulesSpecific = maskBitSize * 4, - NoContextRulesAny = maskBitSize * 5 + NoContextRulesAny = maskBitSize * 5, } // The Rules list contains all the inserted rules into a rulebucket in the following order: diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 1ab72e8c99bb2..05aa76dfeb160 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -62,7 +62,7 @@ import { export namespace SmartIndenter { const enum Value { - Unknown = -1 + Unknown = -1, } /** @@ -368,7 +368,7 @@ export namespace SmartIndenter { const enum NextTokenKind { Unknown, OpenBrace, - CloseBrace + CloseBrace, } function nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken: Node, current: Node, lineAtPosition: number, sourceFile: SourceFile): NextTokenKind { diff --git a/src/services/goToDefinition.ts b/src/services/goToDefinition.ts index 3688a688c53d8..d8959aa536676 100644 --- a/src/services/goToDefinition.ts +++ b/src/services/goToDefinition.ts @@ -342,7 +342,7 @@ export function getReferenceAtPosition(sourceFile: SourceFile, position: number, reference: { pos: node.getStart(), end: node.getEnd(), - fileName: node.text + fileName: node.text, }, unverified: !verifiedFileName, }; diff --git a/src/services/inlayHints.ts b/src/services/inlayHints.ts index b7c8f87b7250a..6b741dcf9506e 100644 --- a/src/services/inlayHints.ts +++ b/src/services/inlayHints.ts @@ -441,7 +441,7 @@ export function provideInlayHints(context: InlayHintsContext): InlayHint[] { return { text, span: createTextSpanFromNode(node, sourceFile), - file: sourceFile.fileName + file: sourceFile.fileName, }; } } diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 6d23f64be662a..f0e42f30198db 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -173,7 +173,7 @@ const jsDocTagNames = [ "variation", "version", "virtual", - "yields" + "yields", ]; let jsDocTagNameCompletionEntries: CompletionEntry[]; let jsDocTagCompletionEntries: CompletionEntry[]; @@ -368,7 +368,7 @@ export function getJSDocTagCompletions(): CompletionEntry[] { name: `@${tagName}`, kind: ScriptElementKind.keyword, kindModifiers: "", - sortText: Completions.SortText.LocationPriority + sortText: Completions.SortText.LocationPriority, }; })); } diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index c0dae08dd2b34..fce5af352b91f 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -234,7 +234,7 @@ function emptyNavigationBarNode(node: Node, name?: DeclarationName): NavigationB additionalNodes: undefined, parent, children: undefined, - indent: parent.indent + 1 + indent: parent.indent + 1, }; } @@ -936,7 +936,7 @@ function convertToTree(n: NavigationBarNode): NavigationTree { kindModifiers: getModifiers(n.node), spans: getSpans(n), nameSpan: n.name && getNodeSpan(n.name), - childItems: map(n.children, convertToTree) + childItems: map(n.children, convertToTree), }; } @@ -949,7 +949,7 @@ function convertToPrimaryNavBarMenuItem(n: NavigationBarNode): NavigationBarItem childItems: map(n.children, convertToSecondaryNavBarMenuItem) || emptyChildItemArray, indent: n.indent, bolded: false, - grayed: false + grayed: false, }; function convertToSecondaryNavBarMenuItem(n: NavigationBarNode): NavigationBarItem { @@ -961,7 +961,7 @@ function convertToPrimaryNavBarMenuItem(n: NavigationBarNode): NavigationBarItem childItems: emptyChildItemArray, indent: 0, bolded: false, - grayed: false + grayed: false, }; } } diff --git a/src/services/patternMatcher.ts b/src/services/patternMatcher.ts index 212369a9df165..37658bfc45ed0 100644 --- a/src/services/patternMatcher.ts +++ b/src/services/patternMatcher.ts @@ -18,7 +18,7 @@ export enum PatternMatchKind { exact, prefix, substring, - camelCase + camelCase, } // Information about a match made by the pattern matcher between a candidate and the @@ -108,7 +108,7 @@ interface TextChunk { function createPatternMatch(kind: PatternMatchKind, isCaseSensitive: boolean): PatternMatch { return { kind, - isCaseSensitive + isCaseSensitive, }; } @@ -127,7 +127,7 @@ export function createPatternMatcher(pattern: string): PatternMatcher | undefine return { getFullMatch: (containers, candidate) => getFullMatch(containers, candidate, dotSeparatedSegments, stringToWordSpans), getMatchForLastSegmentOfPattern: candidate => matchSegment(candidate, last(dotSeparatedSegments), stringToWordSpans), - patternContainsDots: dotSeparatedSegments.length > 1 + patternContainsDots: dotSeparatedSegments.length > 1, }; } @@ -366,7 +366,7 @@ function tryCamelCaseMatch(candidate: string, candidateParts: TextSpan[], chunk: function createSegment(text: string): Segment { return { totalTextChunk: createTextChunk(text), - subWordTextChunks: breakPatternIntoTextChunks(text) + subWordTextChunks: breakPatternIntoTextChunks(text), }; } @@ -473,7 +473,7 @@ function createTextChunk(text: string): TextChunk { text, textLowerCase, isLowerCase: text === textLowerCase, - characterSpans: breakIntoCharacterSpans(text) + characterSpans: breakIntoCharacterSpans(text), }; } diff --git a/src/services/preProcess.ts b/src/services/preProcess.ts index 91bbe396a2fd6..1fd6a52bba1d4 100644 --- a/src/services/preProcess.ts +++ b/src/services/preProcess.ts @@ -23,7 +23,7 @@ export function preProcessFile(sourceText: string, readImportFiles = true, detec libReferenceDirectives: [], amdDependencies: [], hasNoDefaultLib: undefined, - moduleName: undefined + moduleName: undefined, }; const importedFiles: FileReference[] = []; let ambientExternalModules: { ref: FileReference, depth: number }[] | undefined; diff --git a/src/services/refactors/addOrRemoveBracesToArrowFunction.ts b/src/services/refactors/addOrRemoveBracesToArrowFunction.ts index 40640dc73ef55..0d7489554cf8f 100644 --- a/src/services/refactors/addOrRemoveBracesToArrowFunction.ts +++ b/src/services/refactors/addOrRemoveBracesToArrowFunction.ts @@ -45,12 +45,12 @@ const addBracesAction = { const removeBracesAction = { name: "Remove braces from arrow function", description: getLocaleSpecificMessage(Diagnostics.Remove_braces_from_arrow_function), - kind: "refactor.rewrite.arrow.braces.remove" + kind: "refactor.rewrite.arrow.braces.remove", }; registerRefactor(refactorName, { kinds: [removeBracesAction.kind], getEditsForAction: getRefactorEditsToRemoveFunctionBraces, - getAvailableActions: getRefactorActionsToRemoveFunctionBraces + getAvailableActions: getRefactorActionsToRemoveFunctionBraces, }); interface FunctionBracesInfo { @@ -70,8 +70,8 @@ function getRefactorActionsToRemoveFunctionBraces(context: RefactorContext): rea name: refactorName, description: refactorDescription, actions: [ - info.addBraces ? addBracesAction : removeBracesAction - ] + info.addBraces ? addBracesAction : removeBracesAction, + ], }]; } @@ -82,7 +82,7 @@ function getRefactorActionsToRemoveFunctionBraces(context: RefactorContext): rea actions: [ { ...addBracesAction, notApplicableReason: info.error }, { ...removeBracesAction, notApplicableReason: info.error }, - ] + ], }]; } @@ -127,13 +127,13 @@ function getConvertibleArrowFunctionAtPosition(file: SourceFile, startPosition: if (!func) { return { - error: getLocaleSpecificMessage(Diagnostics.Could_not_find_a_containing_arrow_function) + error: getLocaleSpecificMessage(Diagnostics.Could_not_find_a_containing_arrow_function), }; } if (!isArrowFunction(func)) { return { - error: getLocaleSpecificMessage(Diagnostics.Containing_function_is_not_an_arrow_function) + error: getLocaleSpecificMessage(Diagnostics.Containing_function_is_not_an_arrow_function), }; } diff --git a/src/services/refactors/convertArrowFunctionOrFunctionExpression.ts b/src/services/refactors/convertArrowFunctionOrFunctionExpression.ts index 414ef006bc926..3de28d6ce0747 100644 --- a/src/services/refactors/convertArrowFunctionOrFunctionExpression.ts +++ b/src/services/refactors/convertArrowFunctionOrFunctionExpression.ts @@ -80,10 +80,10 @@ registerRefactor(refactorName, { kinds: [ toAnonymousFunctionAction.kind, toNamedFunctionAction.kind, - toArrowFunctionAction.kind + toArrowFunctionAction.kind, ], getEditsForAction: getRefactorEditsToConvertFunctionExpressions, - getAvailableActions: getRefactorActionsToConvertFunctionExpressions + getAvailableActions: getRefactorActionsToConvertFunctionExpressions, }); interface FunctionInfo { @@ -142,7 +142,7 @@ function getRefactorActionsToConvertFunctionExpressions(context: RefactorContext name: refactorName, description: refactorDescription, actions: possibleActions.length === 0 && context.preferences.provideRefactorNotApplicableReason ? - errors : possibleActions + errors : possibleActions, }]; } diff --git a/src/services/refactors/convertExport.ts b/src/services/refactors/convertExport.ts index 0509e1e0c512b..d1fcb41cb6ecb 100644 --- a/src/services/refactors/convertExport.ts +++ b/src/services/refactors/convertExport.ts @@ -62,18 +62,18 @@ const refactorName = "Convert export"; const defaultToNamedAction = { name: "Convert default export to named export", description: getLocaleSpecificMessage(Diagnostics.Convert_default_export_to_named_export), - kind: "refactor.rewrite.export.named" + kind: "refactor.rewrite.export.named", }; const namedToDefaultAction = { name: "Convert named export to default export", description: getLocaleSpecificMessage(Diagnostics.Convert_named_export_to_default_export), - kind: "refactor.rewrite.export.default" + kind: "refactor.rewrite.export.default", }; registerRefactor(refactorName, { kinds: [ defaultToNamedAction.kind, - namedToDefaultAction.kind + namedToDefaultAction.kind, ], getAvailableActions: function getRefactorActionsToConvertBetweenNamedAndDefaultExports(context): readonly ApplicableRefactorInfo[] { const info = getInfo(context, context.triggerReason === "invoked"); @@ -89,7 +89,7 @@ registerRefactor(refactorName, { { name: refactorName, description: getLocaleSpecificMessage(Diagnostics.Convert_default_export_to_named_export), actions: [ { ...defaultToNamedAction, notApplicableReason: info.error }, { ...namedToDefaultAction, notApplicableReason: info.error }, - ]} + ]}, ]; } diff --git a/src/services/refactors/convertImport.ts b/src/services/refactors/convertImport.ts index 319487ddb1968..ecf40e6055b7c 100644 --- a/src/services/refactors/convertImport.ts +++ b/src/services/refactors/convertImport.ts @@ -85,7 +85,7 @@ registerRefactor(refactorName, { return getOwnValues(actions).map(action => ({ name: refactorName, description: action.description, - actions: [{ ...action, notApplicableReason: info.error }] + actions: [{ ...action, notApplicableReason: info.error }], })); } @@ -97,7 +97,7 @@ registerRefactor(refactorName, { Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); const edits = textChanges.ChangeTracker.with(context, t => doChange(context.file, context.program, t, info)); return { edits, renameFilename: undefined, renameLocation: undefined }; - } + }, }); // Can convert imports of the form `import * as m from "m";` or `import d, { x, y } from "m";`. diff --git a/src/services/refactors/convertOverloadListToSingleSignature.ts b/src/services/refactors/convertOverloadListToSingleSignature.ts index 1a54a297eb772..da5006a78c190 100644 --- a/src/services/refactors/convertOverloadListToSingleSignature.ts +++ b/src/services/refactors/convertOverloadListToSingleSignature.ts @@ -53,7 +53,7 @@ const functionOverloadAction = { registerRefactor(refactorName, { kinds: [functionOverloadAction.kind], getEditsForAction: getRefactorEditsToConvertOverloadsToOneSignature, - getAvailableActions: getRefactorActionsToConvertOverloadsToOneSignature + getAvailableActions: getRefactorActionsToConvertOverloadsToOneSignature, }); function getRefactorActionsToConvertOverloadsToOneSignature(context: RefactorContext): readonly ApplicableRefactorInfo[] { @@ -64,7 +64,7 @@ function getRefactorActionsToConvertOverloadsToOneSignature(context: RefactorCon return [{ name: refactorName, description: refactorDescription, - actions: [functionOverloadAction] + actions: [functionOverloadAction], }]; } @@ -170,7 +170,7 @@ function getRefactorEditsToConvertOverloadsToOneSignature(context: RefactorConte "args", /*questionToken*/ undefined, factory.createUnionTypeNode(map(signatureDeclarations, convertSignatureParametersToTuple)) - ) + ), ]); } diff --git a/src/services/refactors/convertParamsToDestructuredObject.ts b/src/services/refactors/convertParamsToDestructuredObject.ts index a86e190d2d8cd..87a2769544c57 100644 --- a/src/services/refactors/convertParamsToDestructuredObject.ts +++ b/src/services/refactors/convertParamsToDestructuredObject.ts @@ -113,12 +113,12 @@ const refactorDescription = getLocaleSpecificMessage(Diagnostics.Convert_paramet const toDestructuredAction = { name: refactorName, description: refactorDescription, - kind: "refactor.rewrite.parameters.toDestructured" + kind: "refactor.rewrite.parameters.toDestructured", }; registerRefactor(refactorName, { kinds: [toDestructuredAction.kind], getEditsForAction: getRefactorEditsToConvertParametersToDestructuredObject, - getAvailableActions: getRefactorActionsToConvertParametersToDestructuredObject + getAvailableActions: getRefactorActionsToConvertParametersToDestructuredObject, }); function getRefactorActionsToConvertParametersToDestructuredObject(context: RefactorContext): readonly ApplicableRefactorInfo[] { @@ -131,7 +131,7 @@ function getRefactorActionsToConvertParametersToDestructuredObject(context: Refa return [{ name: refactorName, description: refactorDescription, - actions: [toDestructuredAction] + actions: [toDestructuredAction], }]; } @@ -190,7 +190,7 @@ function doChange( // indentation is set to 0 because otherwise the object parameter will be indented if there is a `this` parameter indentation: 0, leadingTriviaOption: textChanges.LeadingTriviaOption.IncludeAll, - trailingTriviaOption: textChanges.TrailingTriviaOption.Include + trailingTriviaOption: textChanges.TrailingTriviaOption.Include, }); } } diff --git a/src/services/refactors/convertStringOrTemplateLiteral.ts b/src/services/refactors/convertStringOrTemplateLiteral.ts index 9611151953769..80a079b572497 100644 --- a/src/services/refactors/convertStringOrTemplateLiteral.ts +++ b/src/services/refactors/convertStringOrTemplateLiteral.ts @@ -44,12 +44,12 @@ const refactorDescription = getLocaleSpecificMessage(Diagnostics.Convert_to_temp const convertStringAction = { name: refactorName, description: refactorDescription, - kind: "refactor.rewrite.string" + kind: "refactor.rewrite.string", }; registerRefactor(refactorName, { kinds: [convertStringAction.kind], getEditsForAction: getRefactorEditsToConvertToTemplateString, - getAvailableActions: getRefactorActionsToConvertToTemplateString + getAvailableActions: getRefactorActionsToConvertToTemplateString, }); function getRefactorActionsToConvertToTemplateString(context: RefactorContext): readonly ApplicableRefactorInfo[] { @@ -64,7 +64,7 @@ function getRefactorActionsToConvertToTemplateString(context: RefactorContext): } else if (context.preferences.provideRefactorNotApplicableReason) { refactorInfo.actions.push({ ...convertStringAction, - notApplicableReason: getLocaleSpecificMessage(Diagnostics.Can_only_convert_string_concatenation) + notApplicableReason: getLocaleSpecificMessage(Diagnostics.Can_only_convert_string_concatenation), }); return [refactorInfo]; } diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts index 9efcce3006624..69021a39ad1a0 100644 --- a/src/services/refactors/extractSymbol.ts +++ b/src/services/refactors/extractSymbol.ts @@ -180,7 +180,7 @@ const extractFunctionAction = { registerRefactor(refactorName, { kinds: [ extractConstantAction.kind, - extractFunctionAction.kind + extractFunctionAction.kind, ], getEditsForAction: getRefactorEditsToExtractSymbol, getAvailableActions: getRefactorActionsToExtractSymbol, @@ -207,14 +207,14 @@ export function getRefactorActionsToExtractSymbol(context: RefactorContext): rea errors.push({ name: refactorName, description: extractFunctionAction.description, - actions: [{ ...extractFunctionAction, notApplicableReason: getStringError(rangeToExtract.errors) }] + actions: [{ ...extractFunctionAction, notApplicableReason: getStringError(rangeToExtract.errors) }], }); } if (refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) { errors.push({ name: refactorName, description: extractConstantAction.description, - actions: [{ ...extractConstantAction, notApplicableReason: getStringError(rangeToExtract.errors) }] + actions: [{ ...extractConstantAction, notApplicableReason: getStringError(rangeToExtract.errors) }], }); } return errors; @@ -247,7 +247,7 @@ export function getRefactorActionsToExtractSymbol(context: RefactorContext): rea functionActions.push({ description, name: `function_scope_${i}`, - kind: extractFunctionAction.kind + kind: extractFunctionAction.kind, }); } } @@ -256,7 +256,7 @@ export function getRefactorActionsToExtractSymbol(context: RefactorContext): rea description, name: `function_scope_${i}`, notApplicableReason: getStringError(functionExtraction.errors), - kind: extractFunctionAction.kind + kind: extractFunctionAction.kind, }; } } @@ -272,7 +272,7 @@ export function getRefactorActionsToExtractSymbol(context: RefactorContext): rea constantActions.push({ description, name: `constant_scope_${i}`, - kind: extractConstantAction.kind + kind: extractConstantAction.kind, }); } } @@ -281,7 +281,7 @@ export function getRefactorActionsToExtractSymbol(context: RefactorContext): rea description, name: `constant_scope_${i}`, notApplicableReason: getStringError(constantExtraction.errors), - kind: extractConstantAction.kind + kind: extractConstantAction.kind, }; } } @@ -304,7 +304,7 @@ export function getRefactorActionsToExtractSymbol(context: RefactorContext): rea infos.push({ name: refactorName, description: getLocaleSpecificMessage(Diagnostics.Extract_function), - actions: [ innermostErrorFunctionAction ] + actions: [ innermostErrorFunctionAction ], }); } @@ -312,14 +312,14 @@ export function getRefactorActionsToExtractSymbol(context: RefactorContext): rea infos.push({ name: refactorName, description: getLocaleSpecificMessage(Diagnostics.Extract_constant), - actions: constantActions + actions: constantActions, }); } else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorConstantAction) { infos.push({ name: refactorName, description: getLocaleSpecificMessage(Diagnostics.Extract_constant), - actions: [ innermostErrorConstantAction ] + actions: [ innermostErrorConstantAction ], }); } @@ -604,7 +604,7 @@ export function getRangeToExtract(sourceFile: SourceFile, span: TextSpan, invoke None = 0, Break = 1 << 0, Continue = 1 << 1, - Return = 1 << 2 + Return = 1 << 2, } // We believe it's true because the node is from the (unmodified) tree. @@ -1779,7 +1779,7 @@ const enum Usage { // value should be passed to extracted method Read = 1, // value should be passed to extracted method and propagated back - Write = 2 + Write = 2, } interface UsageEntry { diff --git a/src/services/refactors/extractType.ts b/src/services/refactors/extractType.ts index 02e5f10ba22d9..2bda6b217cad4 100644 --- a/src/services/refactors/extractType.ts +++ b/src/services/refactors/extractType.ts @@ -85,14 +85,14 @@ const extractToInterfaceAction = { const extractToTypeDefAction = { name: "Extract to typedef", description: getLocaleSpecificMessage(Diagnostics.Extract_to_typedef), - kind: "refactor.extract.typedef" + kind: "refactor.extract.typedef", }; registerRefactor(refactorName, { kinds: [ extractToTypeAliasAction.kind, extractToInterfaceAction.kind, - extractToTypeDefAction.kind + extractToTypeDefAction.kind, ], getAvailableActions: function getRefactorActionsToExtractType(context): readonly ApplicableRefactorInfo[] { const info = getRangeToExtract(context, context.triggerReason === "invoked"); @@ -103,7 +103,7 @@ registerRefactor(refactorName, { name: refactorName, description: getLocaleSpecificMessage(Diagnostics.Extract_type), actions: info.isJS ? - [extractToTypeDefAction] : append([extractToTypeAliasAction], info.typeElements && extractToInterfaceAction) + [extractToTypeDefAction] : append([extractToTypeAliasAction], info.typeElements && extractToInterfaceAction), }]; } @@ -115,7 +115,7 @@ registerRefactor(refactorName, { { ...extractToTypeDefAction, notApplicableReason: info.error }, { ...extractToTypeAliasAction, notApplicableReason: info.error }, { ...extractToInterfaceAction, notApplicableReason: info.error }, - ] + ], }]; } @@ -146,7 +146,7 @@ registerRefactor(refactorName, { const renameFilename = file.fileName; const renameLocation = getRenameLocation(edits, renameFilename, name, /*preferLastLocation*/ false); return { edits, renameFilename, renameLocation }; - } + }, }); interface TypeAliasInfo { @@ -323,7 +323,7 @@ function doTypedefChange(changes: textChanges.ChangeTracker, context: RefactorCo const pos = enclosingNode.getStart(file); const newLineCharacter = getNewLineOrDefaultFromHost(context.host, context.formatContext?.options); changes.insertNodeAt(file, enclosingNode.getStart(file), jsDoc, { - suffix: newLineCharacter + newLineCharacter + file.text.slice(getPrecedingNonSpaceCharacterPosition(file.text, pos - 1), pos) + suffix: newLineCharacter + newLineCharacter + file.text.slice(getPrecedingNonSpaceCharacterPosition(file.text, pos - 1), pos), }); } else { diff --git a/src/services/refactors/generateGetAccessorAndSetAccessor.ts b/src/services/refactors/generateGetAccessorAndSetAccessor.ts index 86ca118d2c935..2756ae20471ed 100644 --- a/src/services/refactors/generateGetAccessorAndSetAccessor.ts +++ b/src/services/refactors/generateGetAccessorAndSetAccessor.ts @@ -61,5 +61,5 @@ registerRefactor(actionName, { } return emptyArray; - } + }, }); diff --git a/src/services/refactors/inferFunctionReturnType.ts b/src/services/refactors/inferFunctionReturnType.ts index 1e54133c1ff61..d4f4a5c871cfc 100644 --- a/src/services/refactors/inferFunctionReturnType.ts +++ b/src/services/refactors/inferFunctionReturnType.ts @@ -40,12 +40,12 @@ const refactorDescription = getLocaleSpecificMessage(Diagnostics.Infer_function_ const inferReturnTypeAction = { name: refactorName, description: refactorDescription, - kind: "refactor.rewrite.function.returnType" + kind: "refactor.rewrite.function.returnType", }; registerRefactor(refactorName, { kinds: [inferReturnTypeAction.kind], getEditsForAction: getRefactorEditsToInferReturnType, - getAvailableActions: getRefactorActionsToInferReturnType + getAvailableActions: getRefactorActionsToInferReturnType, }); function getRefactorEditsToInferReturnType(context: RefactorContext): RefactorEditInfo | undefined { @@ -64,14 +64,14 @@ function getRefactorActionsToInferReturnType(context: RefactorContext): readonly return [{ name: refactorName, description: refactorDescription, - actions: [inferReturnTypeAction] + actions: [inferReturnTypeAction], }]; } if (context.preferences.provideRefactorNotApplicableReason) { return [{ name: refactorName, description: refactorDescription, - actions: [{ ...inferReturnTypeAction, notApplicableReason: info.error }] + actions: [{ ...inferReturnTypeAction, notApplicableReason: info.error }], }]; } return emptyArray; diff --git a/src/services/refactors/inlineVariable.ts b/src/services/refactors/inlineVariable.ts index c5e8660462eba..3a5a74d181b23 100644 --- a/src/services/refactors/inlineVariable.ts +++ b/src/services/refactors/inlineVariable.ts @@ -46,7 +46,7 @@ const refactorDescription = getLocaleSpecificMessage(Diagnostics.Inline_variable const inlineVariableAction = { name: refactorName, description: refactorDescription, - kind: "refactor.inline.variable" + kind: "refactor.inline.variable", }; interface InliningInfo { @@ -64,7 +64,7 @@ registerRefactor(refactorName, { program, preferences, startPosition, - triggerReason + triggerReason, } = context; // tryWithReferenceToken is true below when triggerReason === "invoked", since we want to @@ -79,7 +79,7 @@ registerRefactor(refactorName, { return [{ name: refactorName, description: refactorDescription, - actions: [inlineVariableAction] + actions: [inlineVariableAction], }]; } @@ -89,8 +89,8 @@ registerRefactor(refactorName, { description: refactorDescription, actions: [{ ...inlineVariableAction, - notApplicableReason: info.error - }] + notApplicableReason: info.error, + }], }]; } @@ -118,7 +118,7 @@ registerRefactor(refactorName, { }); return { edits }; - } + }, }); function getInliningInfo(file: SourceFile, startPosition: number, tryWithReferenceToken: boolean, program: Program): InliningInfo | RefactorErrorInfo | undefined { diff --git a/src/services/refactors/moveToFile.ts b/src/services/refactors/moveToFile.ts index b0b02a3484278..15300db4641b3 100644 --- a/src/services/refactors/moveToFile.ts +++ b/src/services/refactors/moveToFile.ts @@ -164,7 +164,7 @@ registerRefactor(refactorNameForMoveToFile, { } if (context.preferences.provideRefactorNotApplicableReason) { return [{ name: refactorNameForMoveToFile, description, actions: - [{ ...moveToFileAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_statement_or_statements) }] + [{ ...moveToFileAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_statement_or_statements) }], }]; } return emptyArray; @@ -183,7 +183,7 @@ registerRefactor(refactorNameForMoveToFile, { return { edits, renameFilename: undefined, renameLocation: undefined }; } return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid)); - } + }, }); function error(notApplicableReason: string) { @@ -258,7 +258,7 @@ function getNewStatementsAndRemoveFromOldFile( ...prologueDirectives, ...imports, SyntaxKind.NewLineTrivia as const, - ...body + ...body, ]; } @@ -936,7 +936,7 @@ function getRangeToMove(context: RefactorContext): RangeToMove | undefined { return { toMove: statements.slice(startNodeIndex, endNodeIndex === -1 ? statements.length : endNodeIndex + 1), - afterLast: endNodeIndex === -1 ? undefined : statements[endNodeIndex + 1] + afterLast: endNodeIndex === -1 ? undefined : statements[endNodeIndex + 1], }; } diff --git a/src/services/refactors/moveToNewFile.ts b/src/services/refactors/moveToNewFile.ts index 10183ad20acc4..4b249a61f2d4a 100644 --- a/src/services/refactors/moveToNewFile.ts +++ b/src/services/refactors/moveToNewFile.ts @@ -49,7 +49,7 @@ import { SupportedImportStatement, ToMove, updateImportsInOtherFiles, - UsageInfo + UsageInfo, } from "../_namespaces/ts.refactor"; const refactorName = "Move to a new file"; @@ -69,7 +69,7 @@ registerRefactor(refactorName, { } if (context.preferences.provideRefactorNotApplicableReason) { return [{ name: refactorName, description, actions: - [{ ...moveToNewFileAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_statement_or_statements) }] + [{ ...moveToNewFileAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_statement_or_statements) }], }]; } return emptyArray; @@ -79,7 +79,7 @@ registerRefactor(refactorName, { const statements = Debug.checkDefined(getStatementsToMove(context)); const edits = textChanges.ChangeTracker.with(context, t => doChange(context.file, context.program, statements, t, context.host, context.preferences, context)); return { edits, renameFilename: undefined, renameLocation: undefined }; - } + }, }); function doChange(oldFile: SourceFile, program: Program, toMove: ToMove, changes: textChanges.ChangeTracker, host: LanguageServiceHost, preferences: UserPreferences, context: RefactorContext): void { @@ -122,7 +122,7 @@ function getNewStatementsAndRemoveFromOldFile( ...prologueDirectives, ...imports, SyntaxKind.NewLineTrivia as const, - ...body + ...body, ]; } diff --git a/src/services/rename.ts b/src/services/rename.ts index 094e22b15a0f9..f071e39c4f166 100644 --- a/src/services/rename.ts +++ b/src/services/rename.ts @@ -206,7 +206,7 @@ function getRenameInfoSuccess(displayName: string, fullDisplayName: string, kind displayName, fullDisplayName, kindModifiers, - triggerSpan: createTriggerSpanForNode(node, sourceFile) + triggerSpan: createTriggerSpanForNode(node, sourceFile), }; } diff --git a/src/services/services.ts b/src/services/services.ts index b0e56cc06453f..d6c18d39bd1eb 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1319,7 +1319,7 @@ export function getDefaultCompilerOptions(): CompilerOptions { // Always default to "ScriptTarget.ES5" for the language service return { target: ScriptTarget.ES5, - jsx: JsxEmit.Preserve + jsx: JsxEmit.Preserve, }; } @@ -1359,7 +1359,7 @@ class SyntaxTreeCache { this.host, this.host.getCompilationSettings() ), - setExternalModuleIndicator: getSetExternalModuleIndicator(this.host.getCompilationSettings()) + setExternalModuleIndicator: getSetExternalModuleIndicator(this.host.getCompilationSettings()), }; sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, options, version, /*setNodeParents*/ true, scriptKind); } @@ -1595,7 +1595,7 @@ export function createLanguageService( readFile: maybeBind(host, host.readFile), getDocumentPositionMapper: maybeBind(host, host.getDocumentPositionMapper), getSourceFileLike: maybeBind(host, host.getSourceFileLike), - log + log, }); function getValidSourceFile(fileName: string): SourceFile { @@ -1737,7 +1737,7 @@ export function createLanguageService( options: newSettings, host: compilerHost, oldProgram: program, - projectReferences + projectReferences, }; program = createProgram(options); @@ -2057,7 +2057,7 @@ export function createLanguageService( textSpan: createTextSpanFromNode(nodeForQuickInfo, sourceFile), displayParts: typeChecker.runWithCancellationToken(cancellationToken, typeChecker => typeToDisplayParts(typeChecker, type, getContainerNode(nodeForQuickInfo))), documentation: type.symbol ? type.symbol.getDocumentationComment(typeChecker) : undefined, - tags: type.symbol ? type.symbol.getJsDocTags(typeChecker) : undefined + tags: type.symbol ? type.symbol.getJsDocTags(typeChecker) : undefined, }; } @@ -2156,7 +2156,7 @@ export function createLanguageService( return { fileName: sourceFile.fileName, textSpan, - ...FindAllReferences.toContextSpan(textSpan, sourceFile, node.parent) + ...FindAllReferences.toContextSpan(textSpan, sourceFile, node.parent), }; }); } @@ -2570,7 +2570,7 @@ export function createLanguageService( return { lineStarts: sourceFile.getLineStarts(), firstLine: sourceFile.getLineAndCharacterOfPosition(textRange.pos).line, - lastLine: sourceFile.getLineAndCharacterOfPosition(textRange.end).line + lastLine: sourceFile.getLineAndCharacterOfPosition(textRange.end).line, }; } @@ -2621,8 +2621,8 @@ export function createLanguageService( newText: openComment, span: { length: 0, - start: lineStarts[i] + leftMostPosition - } + start: lineStarts[i] + leftMostPosition, + }, }); } else if (sourceFile.text.substr(lineStarts[i] + lineTextStart, openComment.length) === openComment) { @@ -2630,8 +2630,8 @@ export function createLanguageService( newText: "", span: { length: openComment.length, - start: lineStarts[i] + lineTextStart - } + start: lineStarts[i] + lineTextStart, + }, }); } } @@ -2704,8 +2704,8 @@ export function createLanguageService( newText: openMultiline, span: { length: 0, - start: firstPos - } + start: firstPos, + }, }); } @@ -2716,8 +2716,8 @@ export function createLanguageService( newText: closeMultiline, span: { length: 0, - start: positions[i] - } + start: positions[i], + }, }); } @@ -2726,8 +2726,8 @@ export function createLanguageService( newText: openMultiline, span: { length: 0, - start: positions[i] - } + start: positions[i], + }, }); } } @@ -2738,8 +2738,8 @@ export function createLanguageService( newText: closeMultiline, span: { length: 0, - start: positions[positions.length - 1] - } + start: positions[positions.length - 1], + }, }); } } @@ -2752,8 +2752,8 @@ export function createLanguageService( newText: "", span: { length: openMultiline.length, - start: pos - offset - } + start: pos - offset, + }, }); } } @@ -2980,7 +2980,7 @@ export function createLanguageService( cancellationToken, preferences, triggerReason, - kind + kind, }; } diff --git a/src/services/shims.ts b/src/services/shims.ts index 1c3bdae55e9f0..a6d41101c6f7e 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -711,7 +711,7 @@ function realizeDiagnostic(diagnostic: Diagnostic, newLine: string): RealizedDia category: diagnosticCategoryName(diagnostic), code: diagnostic.code, reportsUnnecessary: diagnostic.reportsUnnecessary, - reportsDeprecated: diagnostic.reportsDeprecated + reportsDeprecated: diagnostic.reportsDeprecated, }; } @@ -1269,7 +1269,7 @@ class CoreServicesShimObject extends ShimBase implements CoreServicesShim { return { resolvedFileName: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.resolvedFileName : undefined, primary: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.primary : true, - failedLookupLocations: result.failedLookupLocations + failedLookupLocations: result.failedLookupLocations, }; }); } @@ -1286,7 +1286,7 @@ class CoreServicesShimObject extends ShimBase implements CoreServicesShim { ambientExternalModules: result.ambientExternalModules, isLibFile: result.isLibFile, typeReferenceDirectives: this.convertFileReferences(result.typeReferenceDirectives), - libReferenceDirectives: this.convertFileReferences(result.libReferenceDirectives) + libReferenceDirectives: this.convertFileReferences(result.libReferenceDirectives), }; }); } @@ -1310,7 +1310,7 @@ class CoreServicesShimObject extends ShimBase implements CoreServicesShim { result.push({ path: normalizeSlashes(ref.fileName), position: ref.pos, - length: ref.end - ref.pos + length: ref.end - ref.pos, }); } return result; @@ -1329,7 +1329,7 @@ class CoreServicesShimObject extends ShimBase implements CoreServicesShim { typeAcquisition: configFile.typeAcquisition, files: configFile.fileNames, raw: configFile.raw, - errors: realizeDiagnostics([...result.parseDiagnostics, ...configFile.errors], "\r\n") + errors: realizeDiagnostics([...result.parseDiagnostics, ...configFile.errors], "\r\n"), }; }); } diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 9d3c350943987..f0f8b66feb58f 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -365,7 +365,7 @@ function getImmediatelyContainingArgumentInfo(node: Node, position: number, sour invocation: { kind: InvocationKind.Call, node: parent }, argumentsSpan: createTextSpan(attributeSpanStart, attributeSpanEnd - attributeSpanStart), argumentIndex: 0, - argumentCount: 1 + argumentCount: 1, }; } else { @@ -539,7 +539,7 @@ function getArgumentListInfoForTemplate(tagExpression: TaggedTemplateExpression, invocation: { kind: InvocationKind.Call, node: tagExpression }, argumentsSpan: getApplicableSpanForTaggedTemplate(tagExpression, sourceFile), argumentIndex, - argumentCount + argumentCount, }; } @@ -748,7 +748,7 @@ function itemInfoForParameters(candidateSignature: Signature, checker: TypeCheck isVariadic: isVariadic(parameterList), parameters: parameterList.map(p => createSignatureHelpParameterForParameter(p, checker, enclosingDeclaration, sourceFile, printer)), prefix: [...typeParameterParts, punctuationPart(SyntaxKind.OpenParenToken)], - suffix: [punctuationPart(SyntaxKind.CloseParenToken)] + suffix: [punctuationPart(SyntaxKind.CloseParenToken)], })); } diff --git a/src/services/smartSelection.ts b/src/services/smartSelection.ts index 887fe86c0cbb2..8c3e541038a13 100644 --- a/src/services/smartSelection.ts +++ b/src/services/smartSelection.ts @@ -51,7 +51,7 @@ import { /** @internal */ export function getSmartSelectionRange(pos: number, sourceFile: SourceFile): SelectionRange { let selectionRange: SelectionRange = { - textSpan: createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd()) + textSpan: createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd()), }; let parentNode: Node = sourceFile; diff --git a/src/services/sourcemaps.ts b/src/services/sourcemaps.ts index 9408098305551..7a6d89c5a9db1 100644 --- a/src/services/sourcemaps.ts +++ b/src/services/sourcemaps.ts @@ -227,6 +227,6 @@ function createSourceFileLike(text: string, lineMap?: SourceFileLike["lineMap"]) lineMap, getLineAndCharacterOfPosition(pos: number) { return computeLineAndCharacterOfPosition(getLineStarts(this), pos); - } + }, }; } diff --git a/src/services/stringCompletions.ts b/src/services/stringCompletions.ts index bb41bf4d594bc..095ab13f3e3ba 100644 --- a/src/services/stringCompletions.ts +++ b/src/services/stringCompletions.ts @@ -267,7 +267,7 @@ function convertStringLiteralCompletions( kindModifiers: ScriptElementKindModifier.none, kind: ScriptElementKind.string, sortText: SortText.LocationPriority, - replacementSpan: getReplacementSpanForContextToken(contextToken) + replacementSpan: getReplacementSpanForContextToken(contextToken), })); return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: completion.isNewIdentifier, optionalReplacementSpan, entries }; } @@ -506,7 +506,7 @@ function stringLiteralCompletionsFromProperties(type: Type | undefined): StringL return type && { kind: StringLiteralCompletionKind.Properties, symbols: filter(type.getApparentProperties(), prop => !(prop.valueDeclaration && isPrivateIdentifierClassElementDeclaration(prop.valueDeclaration))), - hasIndexSignature: hasIndexSignature(type) + hasIndexSignature: hasIndexSignature(type), }; } @@ -525,7 +525,7 @@ function stringLiteralCompletionsForObjectLiteral(checker: TypeChecker, objectLi return { kind: StringLiteralCompletionKind.Properties, symbols, - hasIndexSignature: hasIndexSignature(contextualType) + hasIndexSignature: hasIndexSignature(contextualType), }; } diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index fbfdba0f59bc3..52acb35f27c5f 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -703,7 +703,7 @@ export class ChangeTracker { for (const jsdoc of node.jsDoc) { this.deleteRange(sourceFile, { pos: getLineStartPositionForPosition(jsdoc.getStart(sourceFile), sourceFile), - end: getAdjustedEndPosition(sourceFile, jsdoc, /*options*/ {}) + end: getAdjustedEndPosition(sourceFile, jsdoc, /*options*/ {}), }); } } @@ -835,7 +835,7 @@ export class ChangeTracker { const pos = getAdjustedStartPosition(sourceFile, scope.getLastToken()!, {}); this.insertNodeAt(sourceFile, pos, newNode, { prefix: isLineBreak(sourceFile.text.charCodeAt(scope.getLastToken()!.pos)) ? this.newLineCharacter : this.newLineCharacter + this.newLineCharacter, - suffix: this.newLineCharacter + suffix: this.newLineCharacter, }); } @@ -903,7 +903,7 @@ export class ChangeTracker { return { indentation, prefix: (insertLeadingComma ? "," : "") + this.newLineCharacter, - suffix: insertTrailingComma ? "," : isInterfaceDeclaration(node) && isEmpty ? ";" : "" + suffix: insertTrailingComma ? "," : isInterfaceDeclaration(node) && isEmpty ? ";" : "", }; } @@ -1329,7 +1329,7 @@ namespace changesToText { text, getLineAndCharacterOfPosition(pos) { return getLineAndCharacterOfPosition(this, pos); - } + }, }; const changes = formatting.formatNodeGivenIndentation(node, file, targetSourceFile.languageVariant, initialIndentation, delta, { ...formatContext, options: formatOptions }); return applyChanges(text, changes); @@ -1343,7 +1343,7 @@ namespace changesToText { newLine, neverAsciiEscape: true, preserveSourceNewlines: true, - terminateUnterminatedLiterals: true + terminateUnterminatedLiterals: true, }, writer).writeNode(EmitHint.Unspecified, node, sourceFile, writer); return { text: writer.getText(), node: assignPositionsToNode(node) }; } @@ -1563,7 +1563,7 @@ export function createWriter(newLine: string): TextChangesWriter { isAtStartOfLine, hasTrailingComment: () => writer.hasTrailingComment(), hasTrailingWhitespace: () => writer.hasTrailingWhitespace(), - clear + clear, }; } diff --git a/src/services/transpile.ts b/src/services/transpile.ts index 0f7e2b238c002..e6a0a915079b9 100644 --- a/src/services/transpile.ts +++ b/src/services/transpile.ts @@ -46,7 +46,7 @@ export interface TranspileOutput { const optionsRedundantWithVerbatimModuleSyntax = new Set([ "isolatedModules", "preserveValueImports", - "importsNotUsedAsValues" + "importsNotUsedAsValues", ]); /* @@ -108,7 +108,7 @@ export function transpileModule(input: string, transpileOptions: TranspileOption fileExists: (fileName): boolean => fileName === inputFileName, readFile: () => "", directoryExists: () => true, - getDirectories: () => [] + getDirectories: () => [], }; // if jsx is specified then treat file as .tsx @@ -119,7 +119,7 @@ export function transpileModule(input: string, transpileOptions: TranspileOption { languageVersion: getEmitScriptTarget(options), impliedNodeFormat: getImpliedNodeFormatForFile(toPath(inputFileName, "", compilerHost.getCanonicalFileName), /*packageJsonInfoCache*/ undefined, compilerHost, options), - setExternalModuleIndicator: getSetExternalModuleIndicator(options) + setExternalModuleIndicator: getSetExternalModuleIndicator(options), } ); if (transpileOptions.moduleName) { diff --git a/src/services/types.ts b/src/services/types.ts index dc69092d3fe9a..a003038d745d6 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -436,7 +436,7 @@ export type WithMetadata = T & { metadata?: unknown; }; export const enum SemanticClassificationFormat { Original = "original", - TwentyTwenty = "2020" + TwentyTwenty = "2020", } // @@ -1181,7 +1181,7 @@ export function getDefaultFormatCodeSettings(newLineCharacter?: string): FormatC placeOpenBraceOnNewLineForControlBlocks: false, semicolons: SemicolonPreference.Ignore, trimTrailingWhitespace: true, - indentSwitchCase: true + indentSwitchCase: true, }; } @@ -1499,13 +1499,13 @@ export const enum OutliningSpanKind { Code = "code", /** Contiguous blocks of import declarations */ - Imports = "imports" + Imports = "imports", } export const enum OutputFileType { JavaScript, SourceMap, - Declaration + Declaration, } export const enum EndOfLineState { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 4d94041411e8b..d0bbcc372f563 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -386,7 +386,7 @@ export const enum SemanticMeaning { Value = 0x1, Type = 0x2, Namespace = 0x4, - All = Value | Type | Namespace + All = Value | Type | Namespace, } /** @internal */ @@ -1117,7 +1117,7 @@ export function findListItemInfo(node: Node): ListItemInfo | undefined { return { listItemIndex, - list + list, }; } @@ -2684,7 +2684,7 @@ export function getMappedDocumentSpan(documentSpan: DocumentSpan, sourceMapper: originalFileName: documentSpan.fileName, originalTextSpan: documentSpan.textSpan, contextSpan: getMappedContextSpan(documentSpan, sourceMapper, fileExists), - originalContextSpan: documentSpan.contextSpan + originalContextSpan: documentSpan.contextSpan, }; } @@ -3399,7 +3399,7 @@ export function getTypeNodeIfAccessible(type: Type, enclosingScope: Node, progra reportInaccessibleThisError: notAccessible, reportPrivateInBaseOfClassExpression: notAccessible, reportInaccessibleUniqueSymbolError: notAccessible, - moduleResolverHost: getModuleSpecifierResolverHost(program, host) + moduleResolverHost: getModuleSpecifierResolverHost(program, host), }); return typeIsAccessible ? res : undefined; } diff --git a/src/testRunner/compilerRunner.ts b/src/testRunner/compilerRunner.ts index c11c2645b02b4..1073ae256a938 100644 --- a/src/testRunner/compilerRunner.ts +++ b/src/testRunner/compilerRunner.ts @@ -355,7 +355,7 @@ class CompilerTest { return { unitName: unit.name, content: unit.content, - fileOptions: unit.fileOptions + fileOptions: unit.fileOptions, }; } } diff --git a/src/testRunner/parallel/host.ts b/src/testRunner/parallel/host.ts index b803324184558..df9bdfee2cdff 100644 --- a/src/testRunner/parallel/host.ts +++ b/src/testRunner/parallel/host.ts @@ -118,7 +118,7 @@ export function start() { incomplete, close, width, - noColors: options.noColors || false + noColors: options.noColors || false, }; this._progressBars = []; @@ -283,7 +283,7 @@ export function start() { process: fork(process.argv[1], [`--config="${configPath}"`], { stdio: ["pipe", "pipe", "pipe", "ipc"] }), accumulatedOutput: "", currentTasks: undefined, - timer: undefined + timer: undefined, }; const appendOutput = (d: Buffer) => { worker.accumulatedOutput += d.toString(); @@ -487,18 +487,18 @@ export function start() { start: { configurable: true, enumerable: true, get() { return startDate; }, - set(_: Date) { /*do nothing*/ } + set(_: Date) { /*do nothing*/ }, }, end: { configurable: true, enumerable: true, get() { return endDate; }, - set(_: Date) { /*do nothing*/ } + set(_: Date) { /*do nothing*/ }, }, duration: { configurable: true, enumerable: true, get() { return duration; }, - set(_: number) { /*do nothing*/ } - } + set(_: number) { /*do nothing*/ }, + }, }); } @@ -563,8 +563,8 @@ export function start() { xunitReporter = new Mocha.reporters.XUnit(replayRunner, { reporterOptions: { suiteName: "Tests", - output: "./TEST-results.xml" - } + output: "./TEST-results.xml", + }, }); patchStats(xunitReporter.stats); xunitReporter.write(`\n`); @@ -574,7 +574,7 @@ export function start() { reporterOptions: { file: path.resolve(".failed-tests"), keepFailed, - } + }, }); } diff --git a/src/testRunner/projectsRunner.ts b/src/testRunner/projectsRunner.ts index bae70f81f6590..e394b6cf95ac9 100644 --- a/src/testRunner/projectsRunner.ts +++ b/src/testRunner/projectsRunner.ts @@ -208,7 +208,7 @@ class ProjectTestCase { return [ { name: `@module: commonjs`, payload: { testCase, moduleKind: ts.ModuleKind.CommonJS, vfs: fs } }, - { name: `@module: amd`, payload: { testCase, moduleKind: ts.ModuleKind.AMD, vfs: fs } } + { name: `@module: amd`, payload: { testCase, moduleKind: ts.ModuleKind.AMD, vfs: fs } }, ]; } @@ -334,7 +334,7 @@ class ProjectTestCase { data.sourceMap = { ...data.sourceMap, sources: data.sourceMap.sources.map(source => this.cleanProjectUrl(source)), - sourceRoot: data.sourceMap.sourceRoot && this.cleanProjectUrl(data.sourceMap.sourceRoot) + sourceRoot: data.sourceMap.sourceRoot && this.cleanProjectUrl(data.sourceMap.sourceRoot), }; } } @@ -344,7 +344,7 @@ class ProjectTestCase { moduleKind, program, errors: ts.concatenate(errors, emitDiagnostics), - sourceMapData + sourceMapData, }; } @@ -393,7 +393,7 @@ class ProjectTestCase { const _vfs = vfs.createFromFileSystem(Harness.IO, /*ignoreCase*/ false, { documents: allInputFiles, - cwd: vpath.combine(vfs.srcFolder, this.testCase.projectRoot) + cwd: vpath.combine(vfs.srcFolder, this.testCase.projectRoot), }); // Dont allow config files since we are compiling existing source options @@ -425,7 +425,7 @@ function getErrorsBaseline(compilerResult: CompileProjectFilesResult) { unitName: ts.isRootedDiskPath(sourceFile.fileName) ? Harness.RunnerBase.removeFullPaths(sourceFile.fileName) : sourceFile.fileName, - content: sourceFile.text + content: sourceFile.text, })); return Harness.Compiler.getErrorBaseline(inputFiles, compilerResult.errors); @@ -445,7 +445,7 @@ function createCompilerOptions(testCase: ProjectRunnerTestCase & ts.CompilerOpti sourceRoot: testCase.resolveSourceRoot && testCase.sourceRoot ? vpath.resolve(vfs.srcFolder, testCase.sourceRoot) - : testCase.sourceRoot + : testCase.sourceRoot, }; // Set the values specified using json diff --git a/src/testRunner/runner.ts b/src/testRunner/runner.ts index 3331be003e784..65445a7eec993 100644 --- a/src/testRunner/runner.ts +++ b/src/testRunner/runner.ts @@ -232,7 +232,7 @@ function beginTests() { ts.Debug.loggingHost = { log(_level, s) { console.log(s || ""); - } + }, }; if (ts.Debug.isDebugging) { diff --git a/src/testRunner/unittests/config/commandLineParsing.ts b/src/testRunner/unittests/config/commandLineParsing.ts index 33a6ad5c24db9..51b2d68fa261f 100644 --- a/src/testRunner/unittests/config/commandLineParsing.ts +++ b/src/testRunner/unittests/config/commandLineParsing.ts @@ -121,14 +121,14 @@ describe("unittests:: config:: commandLineParsing:: parseCommandLine", () => { category: ts.Diagnostics.Backwards_Compatibility, description: ts.Diagnostics.Enable_project_compilation, defaultValueDescription: undefined, - } + }, ]; return { ...ts.compilerOptionsDidYouMeanDiagnostics, optionDeclarations, - getOptionsNameMap: () => ts.createOptionNameMap(optionDeclarations) + getOptionsNameMap: () => ts.createOptionNameMap(optionDeclarations), }; - } + }, }); } @@ -158,13 +158,13 @@ describe("unittests:: config:: commandLineParsing:: parseCommandLine", () => { verifyNullNonIncludedOption({ subScenario: "option of type string", type: () => "string", - nonNullValue: "hello" + nonNullValue: "hello", }); verifyNullNonIncludedOption({ subScenario: "option of type number", type: () => "number", - nonNullValue: "10" + nonNullValue: "10", }); verifyNullNonIncludedOption({ @@ -173,7 +173,7 @@ describe("unittests:: config:: commandLineParsing:: parseCommandLine", () => { node: ts.ModuleResolutionKind.Node10, classic: ts.ModuleResolutionKind.Classic, })), - nonNullValue: "node" + nonNullValue: "node", }); }); diff --git a/src/testRunner/unittests/config/configurationExtension.ts b/src/testRunner/unittests/config/configurationExtension.ts index 6fe4159834589..3bea90e12954a 100644 --- a/src/testRunner/unittests/config/configurationExtension.ts +++ b/src/testRunner/unittests/config/configurationExtension.ts @@ -13,58 +13,58 @@ function createFileSystem(ignoreCase: boolean, cwd: string, root: string) { name: "@foo/tsconfig", version: "1.0.0", exports: { - ".": "./src/tsconfig.json" - } + ".": "./src/tsconfig.json", + }, }), "dev/node_modules/@foo/tsconfig/src/tsconfig.json": JSON.stringify({ compilerOptions: { strict: true, - } + }, }), "dev/tsconfig.extendsFoo.json": JSON.stringify({ extends: "@foo/tsconfig", files: [ "main.ts", - ] + ], }), "dev/node_modules/config-box/package.json": JSON.stringify({ name: "config-box", version: "1.0.0", - tsconfig: "./strict.json" + tsconfig: "./strict.json", }), "dev/node_modules/config-box/strict.json": JSON.stringify({ compilerOptions: { strict: true, - } + }, }), "dev/node_modules/config-box/unstrict.json": JSON.stringify({ compilerOptions: { strict: false, - } + }, }), "dev/tsconfig.extendsBox.json": JSON.stringify({ extends: "config-box", files: [ "main.ts", - ] + ], }), "dev/tsconfig.extendsStrict.json": JSON.stringify({ extends: "config-box/strict", files: [ "main.ts", - ] + ], }), "dev/tsconfig.extendsUnStrict.json": JSON.stringify({ extends: "config-box/unstrict", files: [ "main.ts", - ] + ], }), "dev/tsconfig.extendsStrictExtension.json": JSON.stringify({ extends: "config-box/strict.json", files: [ "main.ts", - ] + ], }), "dev/node_modules/config-box-implied/package.json": JSON.stringify({ name: "config-box-implied", @@ -73,131 +73,131 @@ function createFileSystem(ignoreCase: boolean, cwd: string, root: string) { "dev/node_modules/config-box-implied/tsconfig.json": JSON.stringify({ compilerOptions: { strict: true, - } + }, }), "dev/node_modules/config-box-implied/unstrict/tsconfig.json": JSON.stringify({ compilerOptions: { strict: false, - } + }, }), "dev/tsconfig.extendsBoxImplied.json": JSON.stringify({ extends: "config-box-implied", files: [ "main.ts", - ] + ], }), "dev/tsconfig.extendsBoxImpliedUnstrict.json": JSON.stringify({ extends: "config-box-implied/unstrict", files: [ "main.ts", - ] + ], }), "dev/tsconfig.extendsBoxImpliedUnstrictExtension.json": JSON.stringify({ extends: "config-box-implied/unstrict/tsconfig", files: [ "main.ts", - ] + ], }), "dev/tsconfig.extendsBoxImpliedPath.json": JSON.stringify({ extends: "config-box-implied/tsconfig.json", files: [ "main.ts", - ] + ], }), "dev/tsconfig.json": JSON.stringify({ extends: "./configs/base", files: [ "main.ts", - "supplemental.ts" - ] + "supplemental.ts", + ], }), "dev/tsconfig.nostrictnull.json": JSON.stringify({ extends: "./tsconfig", compilerOptions: { - strictNullChecks: false - } + strictNullChecks: false, + }, }), "dev/configs/base.json": JSON.stringify({ compilerOptions: { allowJs: true, noImplicitAny: true, - strictNullChecks: true - } + strictNullChecks: true, + }, }), "dev/configs/tests.json": JSON.stringify({ compilerOptions: { preserveConstEnums: true, removeComments: false, - sourceMap: true + sourceMap: true, }, exclude: [ "../tests/baselines", - "../tests/scenarios" + "../tests/scenarios", ], include: [ - "../tests/**/*.ts" - ] + "../tests/**/*.ts", + ], }), "dev/circular.json": JSON.stringify({ extends: "./circular2", compilerOptions: { - module: "amd" - } + module: "amd", + }, }), "dev/circular2.json": JSON.stringify({ extends: "./circular", compilerOptions: { - module: "commonjs" - } + module: "commonjs", + }, }), "dev/missing.json": JSON.stringify({ extends: "./missing2", compilerOptions: { - types: [] - } + types: [], + }, }), "dev/failure.json": JSON.stringify({ extends: "./failure2.json", compilerOptions: { - typeRoots: [] - } + typeRoots: [], + }, }), "dev/failure2.json": JSON.stringify({ - excludes: ["*.js"] + excludes: ["*.js"], }), "dev/configs/first.json": JSON.stringify({ extends: "./base", compilerOptions: { - module: "commonjs" + module: "commonjs", }, - files: ["../main.ts"] + files: ["../main.ts"], }), "dev/configs/second.json": JSON.stringify({ extends: "./base", compilerOptions: { - module: "amd" + module: "amd", }, - include: ["../supplemental.*"] + include: ["../supplemental.*"], }), "dev/configs/third.json": JSON.stringify({ extends: "./second", compilerOptions: { - module: null // eslint-disable-line no-null/no-null + module: null, // eslint-disable-line no-null/no-null }, - include: ["../supplemental.*"] + include: ["../supplemental.*"], }), "dev/configs/fourth.json": JSON.stringify({ extends: "./third", compilerOptions: { - module: "system" + module: "system", }, include: null, // eslint-disable-line no-null/no-null - files: ["../main.ts"] + files: ["../main.ts"], }), "dev/configs/fifth.json": JSON.stringify({ extends: "./fourth", include: ["../tests/utils.ts"], - files: [] + files: [], }), "dev/extends.json": JSON.stringify({ extends: 42 }), "dev/extends2.json": JSON.stringify({ extends: "configs/base" }), @@ -213,30 +213,30 @@ function createFileSystem(ignoreCase: boolean, cwd: string, root: string) { compilerOptions: { allowJs: true, noImplicitAny: true, - strictNullChecks: true - } + strictNullChecks: true, + }, }), "dev/configs/extendsArraySecond.json": JSON.stringify({ compilerOptions: { - module: "amd" + module: "amd", }, - include: ["../supplemental.*"] + include: ["../supplemental.*"], }), "dev/configs/extendsArrayThird.json": JSON.stringify({ compilerOptions: { module: null, // eslint-disable-line no-null/no-null - noImplicitAny: false + noImplicitAny: false, }, extends: "./extendsArrayFirst", - include: ["../supplemental.*"] + include: ["../supplemental.*"], }), "dev/configs/extendsArrayFourth.json": JSON.stringify({ compilerOptions: { module: "system", - strictNullChecks: false + strictNullChecks: false, }, include: null, // eslint-disable-line no-null/no-null - files: ["../main.ts"] + files: ["../main.ts"], }), "dev/configs/extendsArrayFifth.json": JSON.stringify({ extends: ["./extendsArrayFirst", "./extendsArraySecond", "./extendsArrayThird", "./extendsArrayFourth"], @@ -245,12 +245,12 @@ function createFileSystem(ignoreCase: boolean, cwd: string, root: string) { "dev/extendsArrayFails.json": JSON.stringify({ extends: ["./missingFile"], compilerOptions: { - types: [] - } + types: [], + }, }), "dev/extendsArrayFails2.json": JSON.stringify({ extends: [42] }), - } - } + }, + }, }); } @@ -263,7 +263,7 @@ const caseSensitiveHost = new fakes.ParseConfigHost(createFileSystem(/*ignoreCas describe("unittests:: config:: configurationExtension", () => { ts.forEach<[string, string, fakes.ParseConfigHost], void>([ ["under a case insensitive host", caseInsensitiveBasePath, caseInsensitiveHost], - ["under a case sensitive host", caseSensitiveBasePath, caseSensitiveHost] + ["under a case sensitive host", caseSensitiveBasePath, caseSensitiveHost], ], ([testName, basePath, host]) => { const nameAndEntry: [name: string, entry: string][] = []; function baselineParsedCommandLine(name: string, entry: string) { diff --git a/src/testRunner/unittests/config/convertCompilerOptionsFromJson.ts b/src/testRunner/unittests/config/convertCompilerOptionsFromJson.ts index d636d07c4e449..ca78fc019ff06 100644 --- a/src/testRunner/unittests/config/convertCompilerOptionsFromJson.ts +++ b/src/testRunner/unittests/config/convertCompilerOptionsFromJson.ts @@ -25,7 +25,7 @@ describe("unittests:: config:: convertCompilerOptionsFromJson", () => { [`/apath/${configFileName}`]: jsonText, "/apath/a.ts": "", "/apath/b.js": "", - } + }, }, )), jsonText, @@ -44,8 +44,8 @@ describe("unittests:: config:: convertCompilerOptionsFromJson", () => { target: "es5", noImplicitAny: false, sourceMap: false, - lib: ["es5", "es2015.core", "es2015.symbol"] - } + lib: ["es5", "es2015.core", "es2015.symbol"], + }, }, "tsconfig.json"); baselineCompilerOptions("Convert correctly format tsconfig.json with allowJs is false to compiler-options", { @@ -55,8 +55,8 @@ describe("unittests:: config:: convertCompilerOptionsFromJson", () => { noImplicitAny: false, sourceMap: false, allowJs: false, - lib: ["es5", "es2015.core", "es2015.symbol"] - } + lib: ["es5", "es2015.core", "es2015.symbol"], + }, }, "tsconfig.json"); baselineCompilerOptions("Convert incorrect option of jsx to compiler-options", { @@ -65,8 +65,8 @@ describe("unittests:: config:: convertCompilerOptionsFromJson", () => { target: "es5", noImplicitAny: false, sourceMap: false, - jsx: "" - } + jsx: "", + }, }, "tsconfig.json"); baselineCompilerOptions("Convert incorrect option of module to compiler-options", { @@ -75,7 +75,7 @@ describe("unittests:: config:: convertCompilerOptionsFromJson", () => { target: "es5", noImplicitAny: false, sourceMap: false, - } + }, }, "tsconfig.json"); baselineCompilerOptions("Convert incorrect option of newLine to compiler-options", { @@ -84,7 +84,7 @@ describe("unittests:: config:: convertCompilerOptionsFromJson", () => { target: "es5", noImplicitAny: false, sourceMap: false, - } + }, }, "tsconfig.json"); baselineCompilerOptions("Convert incorrect option of target to compiler-options", { @@ -92,7 +92,7 @@ describe("unittests:: config:: convertCompilerOptionsFromJson", () => { target: "", noImplicitAny: false, sourceMap: false, - } + }, }, "tsconfig.json"); baselineCompilerOptions("Convert incorrect option of module-resolution to compiler-options", { @@ -100,7 +100,7 @@ describe("unittests:: config:: convertCompilerOptionsFromJson", () => { moduleResolution: "", noImplicitAny: false, sourceMap: false, - } + }, }, "tsconfig.json"); baselineCompilerOptions("Convert incorrect option of libs to compiler-options", { @@ -109,8 +109,8 @@ describe("unittests:: config:: convertCompilerOptionsFromJson", () => { target: "es5", noImplicitAny: false, sourceMap: false, - lib: ["es5", "es2015.core", "incorrectLib"] - } + lib: ["es5", "es2015.core", "incorrectLib"], + }, }, "tsconfig.json"); baselineCompilerOptions("Convert empty string option of libs to compiler-options", { @@ -119,8 +119,8 @@ describe("unittests:: config:: convertCompilerOptionsFromJson", () => { target: "es5", noImplicitAny: false, sourceMap: false, - lib: ["es5", ""] - } + lib: ["es5", ""], + }, }, "tsconfig.json"); baselineCompilerOptions("Convert empty string option of libs array to compiler-options", { @@ -129,8 +129,8 @@ describe("unittests:: config:: convertCompilerOptionsFromJson", () => { target: "es5", noImplicitAny: false, sourceMap: false, - lib: [""] - } + lib: [""], + }, }, "tsconfig.json"); baselineCompilerOptions("Convert trailing-whitespace string option of libs to compiler-options", { @@ -139,8 +139,8 @@ describe("unittests:: config:: convertCompilerOptionsFromJson", () => { target: "es5", noImplicitAny: false, sourceMap: false, - lib: [" "] - } + lib: [" "], + }, }, "tsconfig.json"); baselineCompilerOptions("Convert empty option of libs to compiler-options", { @@ -149,38 +149,38 @@ describe("unittests:: config:: convertCompilerOptionsFromJson", () => { target: "es5", noImplicitAny: false, sourceMap: false, - lib: [] - } + lib: [], + }, }, "tsconfig.json"); baselineCompilerOptions("Convert empty string option of moduleSuffixes to compiler-options", { compilerOptions: { - moduleSuffixes: [".ios", ""] - } + moduleSuffixes: [".ios", ""], + }, }, "tsconfig.json"); baselineCompilerOptions("Convert empty string option of moduleSuffixes single to compiler-options", { compilerOptions: { - moduleSuffixes: [""] - } + moduleSuffixes: [""], + }, }, "tsconfig.json"); baselineCompilerOptions("Convert trailing-whitespace string option of moduleSuffixes to compiler-options", { compilerOptions: { - moduleSuffixes: [" "] - } + moduleSuffixes: [" "], + }, }, "tsconfig.json"); baselineCompilerOptions("Convert empty option of moduleSuffixes to compiler-options", { compilerOptions: { - moduleSuffixes: [] - } + moduleSuffixes: [], + }, }, "tsconfig.json"); baselineCompilerOptions("Convert incorrectly format tsconfig.json to compiler-options", { compilerOptions: { modu: "commonjs", - } + }, }, "tsconfig.json"); baselineCompilerOptions("Convert default tsconfig.json to compiler-options", {}, "tsconfig.json"); @@ -188,8 +188,8 @@ describe("unittests:: config:: convertCompilerOptionsFromJson", () => { baselineCompilerOptions("Convert negative numbers in tsconfig.json", { compilerOptions: { allowJs: true, - maxNodeModuleJsDepth: -1 - } + maxNodeModuleJsDepth: -1, + }, }, "tsconfig.json"); // jsconfig.json @@ -199,8 +199,8 @@ describe("unittests:: config:: convertCompilerOptionsFromJson", () => { target: "es5", noImplicitAny: false, sourceMap: false, - lib: ["es5", "es2015.core", "es2015.symbol"] - } + lib: ["es5", "es2015.core", "es2015.symbol"], + }, }, "jsconfig.json"); baselineCompilerOptions("Convert correctly format jsconfig.json with allowJs is false to compiler-options", { @@ -210,14 +210,14 @@ describe("unittests:: config:: convertCompilerOptionsFromJson", () => { noImplicitAny: false, sourceMap: false, allowJs: false, - lib: ["es5", "es2015.core", "es2015.symbol"] - } + lib: ["es5", "es2015.core", "es2015.symbol"], + }, }, "jsconfig.json"); baselineCompilerOptions("Convert incorrectly format jsconfig.json to compiler-options", { compilerOptions: { modu: "commonjs", - } + }, }, "jsconfig.json"); baselineCompilerOptions("Convert default jsconfig.json to compiler-options", {}, "jsconfig.json"); diff --git a/src/testRunner/unittests/config/convertTypeAcquisitionFromJson.ts b/src/testRunner/unittests/config/convertTypeAcquisitionFromJson.ts index f506eab089061..c1f99c275477e 100644 --- a/src/testRunner/unittests/config/convertTypeAcquisitionFromJson.ts +++ b/src/testRunner/unittests/config/convertTypeAcquisitionFromJson.ts @@ -18,7 +18,7 @@ describe("unittests:: config:: convertTypeAcquisitionFromJson", () => { [`/apath/${configFileName}`]: jsonText, "/apath/a.ts": "", "/apath/b.js": "", - } + }, }, )), jsonText, @@ -36,8 +36,8 @@ describe("unittests:: config:: convertTypeAcquisitionFromJson", () => { { enable: true, include: ["0.d.ts", "1.d.ts"], - exclude: ["0.js", "1.js"] - } + exclude: ["0.js", "1.js"], + }, }, "tsconfig.json" ); @@ -47,7 +47,7 @@ describe("unittests:: config:: convertTypeAcquisitionFromJson", () => { typeAcquisition: { enableAutoDiscovy: true, - } + }, }, "tsconfig.json", ); @@ -57,8 +57,8 @@ describe("unittests:: config:: convertTypeAcquisitionFromJson", () => { { typeAcquisition: { - enable: true - } + enable: true, + }, }, "tsconfig.json", ); @@ -69,8 +69,8 @@ describe("unittests:: config:: convertTypeAcquisitionFromJson", () => { { enable: false, include: ["0.d.ts"], - exclude: ["0.js"] - } + exclude: ["0.js"], + }, }, "jsconfig.json", ); @@ -81,7 +81,7 @@ describe("unittests:: config:: convertTypeAcquisitionFromJson", () => { typeAcquisition: { enableAutoDiscovy: true, - } + }, }, "jsconfig.json", ); @@ -89,8 +89,8 @@ describe("unittests:: config:: convertTypeAcquisitionFromJson", () => { { typeAcquisition: { - enable: false - } + enable: false, + }, }, "jsconfig.json", ); }); diff --git a/src/testRunner/unittests/config/matchFiles.ts b/src/testRunner/unittests/config/matchFiles.ts index 33c21ff241011..852ded152eb00 100644 --- a/src/testRunner/unittests/config/matchFiles.ts +++ b/src/testRunner/unittests/config/matchFiles.ts @@ -122,7 +122,7 @@ function baselineMatches(subScenario: string, json: any, host: fakes.ParseConfig errors: undefined, wildcardDirectories, }, undefined, " ")); - } + }, }], header: baseline => baseline.push("config:", jsonText), }); @@ -134,23 +134,23 @@ describe("unittests:: config:: matchFiles", () => { baselineMatches("without exclusions with literal file list", { files: [ "a.ts", - "b.ts" - ] + "b.ts", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("missing files are still present", { files: [ "z.ts", - "x.ts" - ] + "x.ts", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("are not removed due to excludes", { files: [ "a.ts", - "b.ts" + "b.ts", ], exclude: [ - "b.ts" - ] + "b.ts", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); }); @@ -158,29 +158,29 @@ describe("unittests:: config:: matchFiles", () => { baselineMatches("without exclusions with literal include list", { include: [ "a.ts", - "b.ts" - ] + "b.ts", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("with non .ts file extensions are excluded", { include: [ "a.js", - "b.js" - ] + "b.js", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("with missing files are excluded with literal include list", { include: [ "z.ts", - "x.ts" - ] + "x.ts", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("with literal excludes", { include: [ "a.ts", - "b.ts" + "b.ts", ], exclude: [ - "b.ts" - ] + "b.ts", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("with wildcard excludes", { include: [ @@ -189,13 +189,13 @@ describe("unittests:: config:: matchFiles", () => { "z/a.ts", "z/abz.ts", "z/aba.ts", - "x/b.ts" + "x/b.ts", ], exclude: [ "*.ts", "z/??z.ts", - "*/b.ts" - ] + "*/b.ts", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("with recursive excludes", { include: [ @@ -204,19 +204,19 @@ describe("unittests:: config:: matchFiles", () => { "x/a.ts", "x/b.ts", "x/y/a.ts", - "x/y/b.ts" + "x/y/b.ts", ], exclude: [ - "**/b.ts" - ] + "**/b.ts", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("with case sensitive exclude", { include: [ - "B.ts" + "B.ts", ], exclude: [ - "**/b.ts" - ] + "**/b.ts", + ], }, caseSensitiveHost, caseSensitiveBasePath); baselineMatches("with common package folders and no exclusions", { include: [ @@ -224,8 +224,8 @@ describe("unittests:: config:: matchFiles", () => { "b.ts", "node_modules/a.ts", "bower_components/a.ts", - "jspm_packages/a.ts" - ] + "jspm_packages/a.ts", + ], }, caseInsensitiveCommonFoldersHost, caseInsensitiveBasePath); baselineMatches("with common package folders and exclusions", { include: [ @@ -233,12 +233,12 @@ describe("unittests:: config:: matchFiles", () => { "b.ts", "node_modules/a.ts", "bower_components/a.ts", - "jspm_packages/a.ts" + "jspm_packages/a.ts", ], exclude: [ "a.ts", - "b.ts" - ] + "b.ts", + ], }, caseInsensitiveCommonFoldersHost, caseInsensitiveBasePath); baselineMatches("with common package folders and empty exclude", { include: [ @@ -246,8 +246,8 @@ describe("unittests:: config:: matchFiles", () => { "b.ts", "node_modules/a.ts", "bower_components/a.ts", - "jspm_packages/a.ts" - ] + "jspm_packages/a.ts", + ], }, caseInsensitiveCommonFoldersHost, caseInsensitiveBasePath); }); @@ -255,279 +255,279 @@ describe("unittests:: config:: matchFiles", () => { baselineMatches("is sorted in include order, then in alphabetical order", { include: [ "z/*.ts", - "x/*.ts" - ] + "x/*.ts", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("same named declarations are excluded", { include: [ - "*.ts" - ] + "*.ts", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("star matches only ts files", { include: [ - "*" - ] + "*", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("question matches only a single character", { include: [ - "x/?.ts" - ] + "x/?.ts", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("with recursive directory", { include: [ - "**/a.ts" - ] + "**/a.ts", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("with multiple recursive directories", { include: [ "x/y/**/a.ts", "x/**/a.ts", - "z/**/a.ts" - ] + "z/**/a.ts", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("case sensitive", { include: [ - "**/A.ts" - ] + "**/A.ts", + ], }, caseSensitiveHost, caseSensitiveBasePath); baselineMatches("with missing files are excluded with wildcard include list", { include: [ - "*/z.ts" - ] + "*/z.ts", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("always include literal files", { files: [ - "a.ts" + "a.ts", ], include: [ - "*/z.ts" + "*/z.ts", ], exclude: [ - "**/a.ts" - ] + "**/a.ts", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("exclude folders", { include: [ - "**/*" + "**/*", ], exclude: [ "z", - "x" - ] + "x", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); describe("with common package folders", () => { baselineMatches("and no exclusions", { include: [ - "**/a.ts" - ] + "**/a.ts", + ], }, caseInsensitiveCommonFoldersHost, caseInsensitiveBasePath); baselineMatches("and exclusions", { include: [ - "**/?.ts" + "**/?.ts", ], exclude: [ - "a.ts" - ] + "a.ts", + ], }, caseInsensitiveCommonFoldersHost, caseInsensitiveBasePath); baselineMatches("and empty exclude", { include: [ - "**/a.ts" + "**/a.ts", ], - exclude: [] as string[] + exclude: [] as string[], }, caseInsensitiveCommonFoldersHost, caseInsensitiveBasePath); baselineMatches("and explicit recursive include", { include: [ "**/a.ts", - "**/node_modules/a.ts" - ] + "**/node_modules/a.ts", + ], }, caseInsensitiveCommonFoldersHost, caseInsensitiveBasePath); baselineMatches("and wildcard include", { include: [ - "*/a.ts" - ] + "*/a.ts", + ], }, caseInsensitiveCommonFoldersHost, caseInsensitiveBasePath); baselineMatches("and explicit wildcard include", { include: [ "*/a.ts", - "node_modules/a.ts" - ] + "node_modules/a.ts", + ], }, caseInsensitiveCommonFoldersHost, caseInsensitiveBasePath); }); baselineMatches("exclude .js files when allowJs=false", { compilerOptions: { - allowJs: false + allowJs: false, }, include: [ - "js/*" - ] + "js/*", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("include .js files when allowJs=true", { compilerOptions: { - allowJs: true + allowJs: true, }, include: [ - "js/*" - ] + "js/*", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("include explicitly listed .min.js files when allowJs=true", { compilerOptions: { - allowJs: true + allowJs: true, }, include: [ - "js/*.min.js" - ] + "js/*.min.js", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("include paths outside of the project", { include: [ "*", - "c:/ext/*" - ] + "c:/ext/*", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("include paths outside of the project using relative paths", { include: [ "*", - "../ext/*" + "../ext/*", ], exclude: [ - "**" - ] + "**", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("exclude paths outside of the project using relative paths", { include: [ - "c:/**/*" + "c:/**/*", ], exclude: [ - "../**" - ] + "../**", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("include files with .. in their name", { include: [ - "c:/ext/b/a..b.ts" + "c:/ext/b/a..b.ts", ], exclude: [ - "**" - ] + "**", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("exclude files with .. in their name", { include: [ - "c:/ext/**/*" + "c:/ext/**/*", ], exclude: [ - "c:/ext/b/a..b.ts" - ] + "c:/ext/b/a..b.ts", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("with jsx=none, allowJs=false", { compilerOptions: { - allowJs: false - } + allowJs: false, + }, }, caseInsensitiveMixedExtensionHost, caseInsensitiveBasePath); baselineMatches("with jsx=preserve, allowJs=false", { compilerOptions: { jsx: "preserve", - allowJs: false - } + allowJs: false, + }, }, caseInsensitiveMixedExtensionHost, caseInsensitiveBasePath); baselineMatches("with jsx=react-native, allowJs=false", { compilerOptions: { jsx: "react-native", - allowJs: false - } + allowJs: false, + }, }, caseInsensitiveMixedExtensionHost, caseInsensitiveBasePath); baselineMatches("with jsx=none, allowJs=true", { compilerOptions: { - allowJs: true - } + allowJs: true, + }, }, caseInsensitiveMixedExtensionHost, caseInsensitiveBasePath); baselineMatches("with jsx=preserve, allowJs=true", { compilerOptions: { jsx: "preserve", - allowJs: true - } + allowJs: true, + }, }, caseInsensitiveMixedExtensionHost, caseInsensitiveBasePath); baselineMatches("with jsx=react-native, allowJs=true", { compilerOptions: { jsx: "react-native", - allowJs: true - } + allowJs: true, + }, }, caseInsensitiveMixedExtensionHost, caseInsensitiveBasePath); baselineMatches("exclude .min.js files using wildcards", { compilerOptions: { - allowJs: true + allowJs: true, }, include: [ - "js/*.min.js" + "js/*.min.js", ], exclude: [ - "js/a*" - ] + "js/a*", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); describe("with trailing recursive directory", () => { baselineMatches("in includes with trailing recursive directory", { include: [ - "**" - ] + "**", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("in excludes with trailing recursive directory", { include: [ - "**/*" + "**/*", ], exclude: [ - "**" - ] + "**", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); }); describe("with multiple recursive directory patterns", () => { baselineMatches("in includes with multiple recursive directory patterns", { include: [ - "**/x/**/*" - ] + "**/x/**/*", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); }); baselineMatches("in excludes", { include: [ - "**/a.ts" + "**/a.ts", ], exclude: [ - "**/x/**" - ] + "**/x/**", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); describe("with parent directory symbols after a recursive directory pattern", () => { baselineMatches("in includes immediately after", { include: [ - "**/../*" - ] + "**/../*", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("in includes after a subdirectory", { include: [ - "**/y/../*" - ] + "**/y/../*", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("in excludes immediately after", { include: [ - "**/a.ts" + "**/a.ts", ], exclude: [ - "**/.." - ] + "**/..", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); baselineMatches("in excludes after a subdirectory", { include: [ - "**/a.ts" + "**/a.ts", ], exclude: [ - "**/y/.." - ] + "**/y/..", + ], }, caseInsensitiveHost, caseInsensitiveBasePath); }); describe("with implicit globbification", () => { baselineMatches("Expands z to z/starstart/star", { - include: ["z"] + include: ["z"], }, caseInsensitiveHost, caseInsensitiveBasePath); }); }); @@ -536,34 +536,34 @@ describe("unittests:: config:: matchFiles", () => { baselineMatches("that are not explicitly included", { include: [ "x/**/*", - "w/*/*" - ] + "w/*/*", + ], }, caseInsensitiveDottedFoldersHost, caseInsensitiveBasePath); describe("that are explicitly included", () => { baselineMatches("without wildcards", { include: [ "x/.y/a.ts", - "c:/dev/.z/.b.ts" - ] + "c:/dev/.z/.b.ts", + ], }, caseInsensitiveDottedFoldersHost, caseInsensitiveBasePath); baselineMatches("with recursive wildcards that match directories", { include: [ - "**/.*/*" - ] + "**/.*/*", + ], }, caseInsensitiveDottedFoldersHost, caseInsensitiveBasePath); baselineMatches("with recursive wildcards that match nothing", { include: [ "x/**/.y/*", - ".z/**/.*" - ] + ".z/**/.*", + ], }, caseInsensitiveDottedFoldersHost, caseInsensitiveBasePath); baselineMatches("with wildcard excludes that implicitly exclude dotted files", { include: [ - "**/.*/*" + "**/.*/*", ], exclude: [ - "**/*" - ] + "**/*", + ], }, caseInsensitiveDottedFoldersHost, caseInsensitiveBasePath); }); }); @@ -571,14 +571,14 @@ describe("unittests:: config:: matchFiles", () => { describe("exclude or include patterns which start with **", () => { baselineMatches("can exclude dirs whose pattern starts with starstar", { exclude: [ - "**/x" - ] + "**/x", + ], }, caseSensitiveHost, caseSensitiveBasePath); baselineMatches("can include dirs whose pattern starts with starstart", { include: [ "**/x", - "**/a/**/b" - ] + "**/a/**/b", + ], }, caseSensitiveHost, caseSensitiveBasePath); }); @@ -588,8 +588,8 @@ describe("unittests:: config:: matchFiles", () => { describe("when recursive symlinked directories are present", () => { const fs = new vfs.FileSystem(/*ignoreCase*/ true, { cwd: caseInsensitiveBasePath, files: { - "c:/dev/index.ts": "" - } + "c:/dev/index.ts": "", + }, }); fs.mkdirpSync("c:/dev/a/b/c"); fs.symlinkSync("c:/dev/A", "c:/dev/a/self"); diff --git a/src/testRunner/unittests/config/showConfig.ts b/src/testRunner/unittests/config/showConfig.ts index 5b5a7bc12c4bc..50546485b1c1d 100644 --- a/src/testRunner/unittests/config/showConfig.ts +++ b/src/testRunner/unittests/config/showConfig.ts @@ -64,14 +64,14 @@ describe("unittests:: config:: showConfig", () => { }, compileOnSave: true, exclude: [ - "dist" + "dist", ], files: [], include: [ - "src/*" + "src/*", ], references: [ - { path: "./test" } + { path: "./test" }, ], }); @@ -92,25 +92,25 @@ describe("unittests:: config:: showConfig", () => { "@common/*": ["src/common/*"], "*": [ "node_modules/*", - "src/types/*" - ] + "src/types/*", + ], }, experimentalDecorators: true, emitDecoratorMetadata: true, - resolveJsonModule: true + resolveJsonModule: true, }, include: [ - "./src/**/*" - ] + "./src/**/*", + ], }); showTSConfigCorrectly("Show TSConfig with watch options", ["-p", "tsconfig.json"], { watchOptions: { - watchFile: "DynamicPriorityPolling" + watchFile: "DynamicPriorityPolling", }, include: [ - "./src/**/*" - ] + "./src/**/*", + ], }); // Bulk validation of all option declarations diff --git a/src/testRunner/unittests/config/tsconfigParsing.ts b/src/testRunner/unittests/config/tsconfigParsing.ts index ee32fe5b58d26..8d3994fef92ae 100644 --- a/src/testRunner/unittests/config/tsconfigParsing.ts +++ b/src/testRunner/unittests/config/tsconfigParsing.ts @@ -46,7 +46,7 @@ describe("unittests:: config:: tsconfigParsing:: parseConfigFileTextToJson", () /*ignoreCase*/ false, { cwd: basePath, - files: { "/": {}, ...files } + files: { "/": {}, ...files }, })); }, jsonText, @@ -57,7 +57,7 @@ describe("unittests:: config:: tsconfigParsing:: parseConfigFileTextToJson", () baseline.push(parsed.fileNames.join()); }, })), - skipJson + skipJson, }); } @@ -72,7 +72,7 @@ describe("unittests:: config:: tsconfigParsing:: parseConfigFileTextToJson", () ]); baselineParseResult("returns empty config when config is empty object", () => [ - "{}" + "{}", ]); baselineParseResult("returns config object without comments", () => [ @@ -322,9 +322,9 @@ describe("unittests:: config:: tsconfigParsing:: parseConfigFileTextToJson", () files: [{ compilerOptions: { experimentalDecorators: true, - allowJs: true - } - }] + allowJs: true, + }, + }], }), configFileName: "/apath/tsconfig.json", basePath: "tests/cases/unittests", @@ -334,8 +334,8 @@ describe("unittests:: config:: tsconfigParsing:: parseConfigFileTextToJson", () baselinedParsed("generates errors when include is not string", () => [{ jsonText: JSON.stringify({ include: [ - ["./**/*.ts"] - ] + ["./**/*.ts"], + ], }), configFileName: "/apath/tsconfig.json", basePath: "tests/cases/unittests", @@ -346,7 +346,7 @@ describe("unittests:: config:: tsconfigParsing:: parseConfigFileTextToJson", () jsonText: JSON.stringify({ compilerOptions: { help: true, - } + }, }), configFileName: "/apath/tsconfig.json", basePath: "tests/cases/unittests", @@ -360,7 +360,7 @@ describe("unittests:: config:: tsconfigParsing:: parseConfigFileTextToJson", () input: () => scenario().map(({ jsonText, configFileName, basePath }) => ({ createHost: () => new fakes.ParseConfigHost(new vfs.FileSystem(/*ignoreCase*/ false, { cwd: basePath, - files: { [configFileName]: jsonText } + files: { [configFileName]: jsonText }, })), jsonText, configFileName, @@ -379,7 +379,7 @@ describe("unittests:: config:: tsconfigParsing:: parseConfigFileTextToJson", () baselineWildcards("parses wildcard directories even when parent directories have dots", () => [{ configFileName: "/foo.bar/tsconfig.json", jsonText: JSON.stringify({ - include: ["src"] + include: ["src"], }), basePath: "/foo.bar", }]); @@ -387,7 +387,7 @@ describe("unittests:: config:: tsconfigParsing:: parseConfigFileTextToJson", () baselineWildcards("correctly parses wild card directories from implicit glob when two keys differ only in directory seperator", () => [{ configFileName: "/foo.bar/tsconfig.json", jsonText: JSON.stringify({ - include: ["./", "./**/*.json"] + include: ["./", "./**/*.json"], }), basePath: "/foo", }]); diff --git a/src/testRunner/unittests/config/tsconfigParsingWatchOptions.ts b/src/testRunner/unittests/config/tsconfigParsingWatchOptions.ts index e87053dd5f546..8e16908340c0f 100644 --- a/src/testRunner/unittests/config/tsconfigParsingWatchOptions.ts +++ b/src/testRunner/unittests/config/tsconfigParsingWatchOptions.ts @@ -26,7 +26,7 @@ describe("unittests:: config:: tsconfigParsingWatchOptions:: parseConfigFileText "/a.ts": "", ...additionalFiles, "/tsconfig.json": jsonText, - } + }, } ) ), @@ -54,14 +54,14 @@ describe("unittests:: config:: tsconfigParsingWatchOptions:: parseConfigFileText { json: { extends: "./base.json", - watchOptions: { watchFile: "UseFsEvents" } + watchOptions: { watchFile: "UseFsEvents" }, }, - additionalFiles: { "/base.json": "{}" } + additionalFiles: { "/base.json": "{}" }, }, { - json: { extends: "./base.json", }, - additionalFiles: { "/base.json": "{}" } - } + json: { extends: "./base.json" }, + additionalFiles: { "/base.json": "{}" }, + }, ]); verifyWatchOptions("when extending config file with watchOptions", () => [ @@ -70,16 +70,16 @@ describe("unittests:: config:: tsconfigParsingWatchOptions:: parseConfigFileText extends: "./base.json", watchOptions: { watchFile: "UseFsEvents", - } + }, }, additionalFiles: { "/base.json": JSON.stringify({ watchOptions: { watchFile: "UseFsEventsOnParentDirectory", - watchDirectory: "FixedPollingInterval" - } - }) - } + watchDirectory: "FixedPollingInterval", + }, + }), + }, }, { json: { @@ -89,11 +89,11 @@ describe("unittests:: config:: tsconfigParsingWatchOptions:: parseConfigFileText "/base.json": JSON.stringify({ watchOptions: { watchFile: "UseFsEventsOnParentDirectory", - watchDirectory: "FixedPollingInterval" - } - }) - } - } + watchDirectory: "FixedPollingInterval", + }, + }), + }, + }, ]); verifyWatchOptions("different options", () => [ diff --git a/src/testRunner/unittests/customTransforms.ts b/src/testRunner/unittests/customTransforms.ts index c6cbf4391ed06..7fa4cf4c586c8 100644 --- a/src/testRunner/unittests/customTransforms.ts +++ b/src/testRunner/unittests/customTransforms.ts @@ -40,7 +40,7 @@ describe("unittests:: customTransforms", () => { enum e { } // leading function f2() { } // trailing - ` + `, }]; const before: ts.TransformerFactory = context => { @@ -86,17 +86,17 @@ describe("unittests:: customTransforms", () => { class B {} @dec export class C { constructor(b: B) { } } 'change' - ` + `, }], {before: [ context => node => ts.visitNode(node, function visitor(node: ts.Node): ts.Node { if (ts.isStringLiteral(node) && node.text === "change") return ts.factory.createStringLiteral("changed"); return ts.visitEachChild(node, visitor, context); - }, ts.isSourceFile) + }, ts.isSourceFile), ]}, { target: ts.ScriptTarget.ES5, module: ts.ModuleKind.ES2015, emitDecoratorMetadata: true, - experimentalDecorators: true + experimentalDecorators: true, }); emitsCorrectly("sourceMapExternalSourceFiles", @@ -106,7 +106,7 @@ describe("unittests:: customTransforms", () => { // The text of length 'changed' is made to be on two lines so we know the line map change text: `\`multi line\` -'change'` +'change'`, }, ], { @@ -120,14 +120,14 @@ describe("unittests:: customTransforms", () => { text, fileName: "another.html", lineMap, - getLineAndCharacterOfPosition: pos => ts.computeLineAndCharacterOfPosition(lineMap, pos) - } + getLineAndCharacterOfPosition: pos => ts.computeLineAndCharacterOfPosition(lineMap, pos), + }, }); return node; } return ts.visitEachChild(node, visitor, context); - }, ts.isSourceFile) - ] + }, ts.isSourceFile), + ], }, { sourceMap: true } ); @@ -137,7 +137,7 @@ describe("unittests:: customTransforms", () => { { file: "source.ts", // The source file contains preceding trivia (e.g. whitespace) to try to confuse the `skipSourceTrivia` function. - text: " original;" + text: " original;", }, ], { @@ -150,7 +150,7 @@ describe("unittests:: customTransforms", () => { pos: 0, end: 7, // Do not provide a custom skipTrivia function for `source`. - source: ts.createSourceMapSource("another.html", "changed;") + source: ts.createSourceMapSource("another.html", "changed;"), }); return newNode; } @@ -160,8 +160,8 @@ describe("unittests:: customTransforms", () => { transformSourceFile, transformBundle: node => ts.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends), }; - } - ] + }, + ], }, { sourceMap: true, outFile: "source.js" } ); diff --git a/src/testRunner/unittests/debugDeprecation.ts b/src/testRunner/unittests/debugDeprecation.ts index 9dd3b0fee319f..4019a021bb807 100644 --- a/src/testRunner/unittests/debugDeprecation.ts +++ b/src/testRunner/unittests/debugDeprecation.ts @@ -14,13 +14,13 @@ describe("unittests:: debugDeprecation", () => { it("silent deprecation", () => { const deprecation = deprecate(ts.noop, { warnAfter: "3.9", - typeScriptVersion: "3.8" + typeScriptVersion: "3.8", }); let logWritten = false; ts.Debug.loggingHost = { log() { logWritten = true; - } + }, }; deprecation(); assert.isFalse(logWritten); @@ -28,39 +28,39 @@ describe("unittests:: debugDeprecation", () => { it("warning deprecation with warnAfter", () => { const deprecation = deprecate(ts.noop, { warnAfter: "3.9", - typeScriptVersion: "3.9" + typeScriptVersion: "3.9", }); let logWritten = false; ts.Debug.loggingHost = { log() { logWritten = true; - } + }, }; deprecation(); assert.isTrue(logWritten); }); it("warning deprecation without warnAfter", () => { const deprecation = deprecate(ts.noop, { - typeScriptVersion: "3.9" + typeScriptVersion: "3.9", }); let logWritten = false; ts.Debug.loggingHost = { log() { logWritten = true; - } + }, }; deprecation(); assert.isTrue(logWritten); }); it("warning deprecation writes once", () => { const deprecation = deprecate(ts.noop, { - typeScriptVersion: "3.9" + typeScriptVersion: "3.9", }); let logWrites = 0; ts.Debug.loggingHost = { log() { logWrites++; - } + }, }; deprecation(); deprecation(); @@ -70,13 +70,13 @@ describe("unittests:: debugDeprecation", () => { const deprecation = deprecate(ts.noop, { warnAfter: "3.8", errorAfter: "3.9", - typeScriptVersion: "3.9" + typeScriptVersion: "3.9", }); let logWritten = false; ts.Debug.loggingHost = { log() { logWritten = true; - } + }, }; expect(deprecation).throws(); assert.isFalse(logWritten); @@ -89,7 +89,7 @@ describe("unittests:: debugDeprecation", () => { ts.Debug.loggingHost = { log() { logWritten = true; - } + }, }; expect(deprecation).throws(); assert.isFalse(logWritten); diff --git a/src/testRunner/unittests/evaluation/asyncGenerator.ts b/src/testRunner/unittests/evaluation/asyncGenerator.ts index d901223c86e46..2931a734bc5db 100644 --- a/src/testRunner/unittests/evaluation/asyncGenerator.ts +++ b/src/testRunner/unittests/evaluation/asyncGenerator.ts @@ -13,7 +13,7 @@ describe("unittests:: evaluation:: asyncGeneratorEvaluation", () => { }`); await result.main(); assert.deepEqual(result.output, [ - { value: 0, done: true } + { value: 0, done: true }, ]); }); it("return (es2015)", async () => { @@ -27,7 +27,7 @@ describe("unittests:: evaluation:: asyncGeneratorEvaluation", () => { }`, { target: ts.ScriptTarget.ES2015 }); await result.main(); assert.deepEqual(result.output, [ - { value: 0, done: true } + { value: 0, done: true }, ]); }); it("yields in finally block with async delegator (es2017)", async () => { @@ -53,7 +53,7 @@ describe("unittests:: evaluation:: asyncGeneratorEvaluation", () => { assert.deepEqual(result.output, [ { done: false, value: 1 }, { done: false, value: 2 }, - { done: true, value: undefined } + { done: true, value: undefined }, ]); }); }); diff --git a/src/testRunner/unittests/evaluation/autoAccessors.ts b/src/testRunner/unittests/evaluation/autoAccessors.ts index 0e73daf54f4b1..1df9a44b72304 100644 --- a/src/testRunner/unittests/evaluation/autoAccessors.ts +++ b/src/testRunner/unittests/evaluation/autoAccessors.ts @@ -79,7 +79,7 @@ describe("unittests:: evaluation:: autoAccessors", () => { `, { target, experimentalDecorators: true }); assert.deepEqual(actions, [ - { kind: "decorate", target: C.prototype, key: "x" } + { kind: "decorate", target: C.prototype, key: "x" }, ]); const obj = new C(); obj.x = 1; diff --git a/src/testRunner/unittests/evaluation/awaitUsingDeclarations.ts b/src/testRunner/unittests/evaluation/awaitUsingDeclarations.ts index c3e5c7e999637..770acdb9bde2d 100644 --- a/src/testRunner/unittests/evaluation/awaitUsingDeclarations.ts +++ b/src/testRunner/unittests/evaluation/awaitUsingDeclarations.ts @@ -40,7 +40,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "body", "exit block", "disposed", - "after block" + "after block", ]); }); @@ -82,7 +82,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "body", "disposed", "error", - "after try" + "after try", ]); }); @@ -125,7 +125,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "exit try", "disposed", "error", - "after try" + "after try", ]); }); @@ -169,9 +169,9 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "disposed", { error: "dispose error", - suppressed: "body error" + suppressed: "body error", }, - "after try" + "after try", ]); }); @@ -218,7 +218,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { assert.strictEqual(output[4].error, "dispose error"); assert.strictEqual(output[4].suppressed, "body error"); assert.deepEqual(output.slice(5), [ - "after try" + "after try", ]); }); @@ -254,7 +254,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "before block", "enter block", "body", - "disposed" + "disposed", ]); }); @@ -291,7 +291,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "enter block", "body", "disposed", - "after block" + "after block", ]); }); @@ -331,7 +331,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "enter block", "body", "disposed", - "after block" + "after block", ]); }); @@ -372,7 +372,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "body", "exit loop", "disposed", - "after loop" + "after loop", ]); }); @@ -415,7 +415,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "body", "disposed", "error", - "after loop" + "after loop", ]); }); @@ -462,7 +462,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "exit loop", "disposed", "error", - "after loop" + "after loop", ]); }); @@ -507,9 +507,9 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "disposed", { error: "dispose error", - suppressed: "body error" + suppressed: "body error", }, - "after loop" + "after loop", ]); }); @@ -545,7 +545,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "before loop", "enter loop", "body", - "disposed" + "disposed", ]); }); @@ -582,7 +582,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "enter loop", "body", "disposed", - "after loop" + "after loop", ]); }); @@ -621,7 +621,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "enter loop", "body", "disposed", - "after loop" + "after loop", ]); }); @@ -662,7 +662,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "body", "exit loop", "disposed", - "after loop" + "after loop", ]); }); @@ -710,7 +710,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "body", "exit loop", "b disposed", - "after loop" + "after loop", ]); }); @@ -863,7 +863,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "a disposed", { error: "dispose error", - suppressed: "body error" + suppressed: "body error", }, "after loop", ]); @@ -950,7 +950,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "enter loop", "body", "a disposed", - "after loop" + "after loop", ]); }); @@ -996,7 +996,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "enter loop", "body", "b disposed", - "after loop" + "after loop", ]); }); @@ -1044,7 +1044,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "body", "exit loop", "b disposed", - "after loop" + "after loop", ]); }); @@ -1197,7 +1197,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "a disposed", { error: "dispose error", - suppressed: "body error" + suppressed: "body error", }, "after loop", ]); @@ -1284,7 +1284,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "enter loop", "body", "a disposed", - "after loop" + "after loop", ]); }); @@ -1330,7 +1330,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "enter loop", "body", "b disposed", - "after loop" + "after loop", ]); }); @@ -1357,7 +1357,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "before using", "after using", "after export y", - "disposed" + "disposed", ]); }); @@ -1388,7 +1388,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "enter block", "body", "exit block", - "after block" + "after block", ]); }); @@ -1419,7 +1419,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "enter block", "body", "exit block", - "after block" + "after block", ]); }); @@ -1457,7 +1457,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "body", "exit block", "disposed", - "after block" + "after block", ]); }); @@ -1535,7 +1535,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "exit block", "disposed_2", "disposed_1", - "after block" + "after block", ]); }); @@ -1581,7 +1581,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "exit block", "disposed_2", "disposed_1", - "after block" + "after block", ]); }); @@ -1624,7 +1624,7 @@ describe("unittests:: evaluation:: awaitUsingDeclarations", () => { "body", "exit block", "interleave", - "after block" + "after block", ]); }); diff --git a/src/testRunner/unittests/evaluation/esDecorators.ts b/src/testRunner/unittests/evaluation/esDecorators.ts index 35be87f5a5c41..753a463257996 100644 --- a/src/testRunner/unittests/evaluation/esDecorators.ts +++ b/src/testRunner/unittests/evaluation/esDecorators.ts @@ -809,7 +809,7 @@ describe("unittests:: evaluation:: esDecorators", () => { `; assert.isTrue(context.access.has(C)); assert.isTrue(context.access.has({ - get x() { return 2; } + get x() { return 2; }, })); assert.isFalse(context.access.has({ })); }); @@ -2249,7 +2249,7 @@ describe("unittests:: evaluation:: esDecorators", () => { "post-super constructor evaluation", // and now evaluation has completed: - "done" + "done", ]); }); diff --git a/src/testRunner/unittests/evaluation/externalModules.ts b/src/testRunner/unittests/evaluation/externalModules.ts index 04a0b55abbf34..3a4b3263037c0 100644 --- a/src/testRunner/unittests/evaluation/externalModules.ts +++ b/src/testRunner/unittests/evaluation/externalModules.ts @@ -32,10 +32,10 @@ describe("unittests:: evaluation:: externalModules", () => { // 3 other.f(other); - ` + `, }, rootFiles: ["/.src/main.ts"], - main: "/.src/main.ts" + main: "/.src/main.ts", }); assert.equal(result.output[0], true); // `f(undefined)` inside module. Existing behavior is correct. assert.equal(result.output[1], true); // `f(undefined)` from import. New behavior to match first case. @@ -73,10 +73,10 @@ describe("unittests:: evaluation:: externalModules", () => { // 3 other.f(other); - ` + `, }, rootFiles: ["/.src/main.ts"], - main: "/.src/main.ts" + main: "/.src/main.ts", }); assert.equal(result.output[0], true); // `f(undefined)` inside module. Existing behavior is incorrect. assert.equal(result.output[1], true); // `f(undefined)` from import. New behavior to match first case. diff --git a/src/testRunner/unittests/evaluation/updateExpressionInModule.ts b/src/testRunner/unittests/evaluation/updateExpressionInModule.ts index 071a975b78856..821c038ae89f4 100644 --- a/src/testRunner/unittests/evaluation/updateExpressionInModule.ts +++ b/src/testRunner/unittests/evaluation/updateExpressionInModule.ts @@ -12,10 +12,10 @@ describe("unittests:: evaluation:: updateExpressionInModule", () => { let a = 1; export { a }; export const b = ++a; - ` + `, }, rootFiles: ["/.src/main.ts"], - main: "/.src/main.ts" + main: "/.src/main.ts", }, { module: ts.ModuleKind.CommonJS }); assert.equal(result.a, 2); assert.equal(result.b, 2); @@ -27,10 +27,10 @@ describe("unittests:: evaluation:: updateExpressionInModule", () => { let a = 1; export { a }; export const b = ++a; - ` + `, }, rootFiles: ["/.src/main.ts"], - main: "/.src/main.ts" + main: "/.src/main.ts", }, { module: ts.ModuleKind.System }); assert.equal(result.a, 2); assert.equal(result.b, 2); @@ -42,10 +42,10 @@ describe("unittests:: evaluation:: updateExpressionInModule", () => { let a = BigInt(1); export { a }; export const b = ++a; - ` + `, }, rootFiles: ["/.src/main.ts"], - main: "/.src/main.ts" + main: "/.src/main.ts", }, { module: ts.ModuleKind.CommonJS }, { BigInt }); assert.equal(result.a, BigInt(2)); assert.equal(result.b, BigInt(2)); @@ -57,10 +57,10 @@ describe("unittests:: evaluation:: updateExpressionInModule", () => { let a = BigInt(1); export { a }; export const b = ++a; - ` + `, }, rootFiles: ["/.src/main.ts"], - main: "/.src/main.ts" + main: "/.src/main.ts", }, { module: ts.ModuleKind.System }, { BigInt }); assert.equal(result.a, BigInt(2)); assert.equal(result.b, BigInt(2)); @@ -72,10 +72,10 @@ describe("unittests:: evaluation:: updateExpressionInModule", () => { let a = 1; export { a }; export const b = a++; - ` + `, }, rootFiles: ["/.src/main.ts"], - main: "/.src/main.ts" + main: "/.src/main.ts", }, { module: ts.ModuleKind.CommonJS }); assert.equal(result.a, 2); assert.equal(result.b, 1); @@ -87,10 +87,10 @@ describe("unittests:: evaluation:: updateExpressionInModule", () => { let a = 1; export { a }; export const b = a++; - ` + `, }, rootFiles: ["/.src/main.ts"], - main: "/.src/main.ts" + main: "/.src/main.ts", }, { module: ts.ModuleKind.System }); assert.equal(result.a, 2); assert.equal(result.b, 1); @@ -102,10 +102,10 @@ describe("unittests:: evaluation:: updateExpressionInModule", () => { let a = BigInt(1); export { a }; export const b = a++; - ` + `, }, rootFiles: ["/.src/main.ts"], - main: "/.src/main.ts" + main: "/.src/main.ts", }, { module: ts.ModuleKind.CommonJS }, { BigInt }); assert.equal(result.a, BigInt(2)); assert.equal(result.b, BigInt(1)); @@ -117,10 +117,10 @@ describe("unittests:: evaluation:: updateExpressionInModule", () => { let a = BigInt(1); export { a }; export const b = a++; - ` + `, }, rootFiles: ["/.src/main.ts"], - main: "/.src/main.ts" + main: "/.src/main.ts", }, { module: ts.ModuleKind.System }, { BigInt }); assert.equal(result.a, BigInt(2)); assert.equal(result.b, BigInt(1)); diff --git a/src/testRunner/unittests/evaluation/usingDeclarations.ts b/src/testRunner/unittests/evaluation/usingDeclarations.ts index 701daf7208f3c..8ce8e30409874 100644 --- a/src/testRunner/unittests/evaluation/usingDeclarations.ts +++ b/src/testRunner/unittests/evaluation/usingDeclarations.ts @@ -40,7 +40,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "body", "exit block", "disposed", - "after block" + "after block", ]); }); @@ -82,7 +82,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "body", "disposed", "error", - "after try" + "after try", ]); }); @@ -125,7 +125,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "exit try", "disposed", "error", - "after try" + "after try", ]); }); @@ -177,9 +177,9 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "disposed 1", { error: "error 1", - suppressed: "error 2" + suppressed: "error 2", }, - "after try" + "after try", ]); }); @@ -223,9 +223,9 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "disposed", { error: "dispose error", - suppressed: "body error" + suppressed: "body error", }, - "after try" + "after try", ]); }); @@ -279,10 +279,10 @@ describe("unittests:: evaluation:: usingDeclarations", () => { error: "dispose error 1", suppressed: { error: "dispose error 2", - suppressed: "body error" - } + suppressed: "body error", + }, }, - "after try" + "after try", ]); }); @@ -329,7 +329,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { assert.strictEqual(output[4].error, "dispose error"); assert.strictEqual(output[4].suppressed, "body error"); assert.deepEqual(output.slice(5), [ - "after try" + "after try", ]); }); @@ -365,7 +365,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "before block", "enter block", "body", - "disposed" + "disposed", ]); }); @@ -402,7 +402,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "enter block", "body", "disposed", - "after block" + "after block", ]); }); @@ -442,7 +442,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "enter block", "body", "disposed", - "after block" + "after block", ]); }); @@ -483,7 +483,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "body", "exit loop", "disposed", - "after loop" + "after loop", ]); }); @@ -526,7 +526,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "body", "disposed", "error", - "after loop" + "after loop", ]); }); @@ -573,7 +573,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "exit loop", "disposed", "error", - "after loop" + "after loop", ]); }); @@ -618,9 +618,9 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "disposed", { error: "dispose error", - suppressed: "body error" + suppressed: "body error", }, - "after loop" + "after loop", ]); }); @@ -656,7 +656,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "before loop", "enter loop", "body", - "disposed" + "disposed", ]); }); @@ -693,7 +693,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "enter loop", "body", "disposed", - "after loop" + "after loop", ]); }); @@ -732,7 +732,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "enter loop", "body", "disposed", - "after loop" + "after loop", ]); }); @@ -773,7 +773,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "body", "exit loop", "disposed", - "after loop" + "after loop", ]); }); @@ -821,7 +821,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "body", "exit loop", "b disposed", - "after loop" + "after loop", ]); }); @@ -974,7 +974,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "a disposed", { error: "dispose error", - suppressed: "body error" + suppressed: "body error", }, "after loop", ]); @@ -1061,7 +1061,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "enter loop", "body", "a disposed", - "after loop" + "after loop", ]); }); @@ -1107,7 +1107,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "enter loop", "body", "b disposed", - "after loop" + "after loop", ]); }); @@ -1155,7 +1155,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "body", "exit loop", "b disposed", - "after loop" + "after loop", ]); }); @@ -1308,7 +1308,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "a disposed", { error: "dispose error", - suppressed: "body error" + suppressed: "body error", }, "after loop", ]); @@ -1395,7 +1395,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "enter loop", "body", "a disposed", - "after loop" + "after loop", ]); }); @@ -1441,7 +1441,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "enter loop", "body", "b disposed", - "after loop" + "after loop", ]); }); @@ -1468,7 +1468,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "before using", "after using", "after export y", - "disposed" + "disposed", ]); }); @@ -1495,7 +1495,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "before using", "after using", "after export y", - "disposed" + "disposed", ]); }); @@ -1522,7 +1522,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "before using", "after using", "after export y", - "disposed" + "disposed", ]); }); @@ -1553,7 +1553,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "enter block", "body", "exit block", - "after block" + "after block", ]); }); @@ -1584,7 +1584,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "enter block", "body", "exit block", - "after block" + "after block", ]); }); @@ -1655,7 +1655,7 @@ describe("unittests:: evaluation:: usingDeclarations", () => { "exit block", "disposed 2", "disposed 1", - "after block" + "after block", ]); }); diff --git a/src/testRunner/unittests/helpers.ts b/src/testRunner/unittests/helpers.ts index 4e5f2046a416a..9cfbe49c2bece 100644 --- a/src/testRunner/unittests/helpers.ts +++ b/src/testRunner/unittests/helpers.ts @@ -4,7 +4,7 @@ const enum ChangedPart { none = 0, references = 1 << 0, importsAndExports = 1 << 1, - program = 1 << 2 + program = 1 << 2, } export const newLine = "\r\n"; diff --git a/src/testRunner/unittests/helpers/baseline.ts b/src/testRunner/unittests/helpers/baseline.ts index e3075686be24d..e76a430d91dd3 100644 --- a/src/testRunner/unittests/helpers/baseline.ts +++ b/src/testRunner/unittests/helpers/baseline.ts @@ -36,7 +36,7 @@ export function commandLineCallbacks( const result = programs || ts.emptyArray; programs = undefined; return result; - } + }, }; } @@ -221,7 +221,7 @@ function generateBuildInfoProgramBaseline(sys: ts.System, buildInfoPath: string, undefined : [ toReadableBuilderFileEmit(ts.toProgramEmitPending(pendingEmit, buildInfo.program.options)), - pendingEmit + pendingEmit, ], }; } diff --git a/src/testRunner/unittests/helpers/extends.ts b/src/testRunner/unittests/helpers/extends.ts index 397d4821047d5..2aaa8bbfaa374 100644 --- a/src/testRunner/unittests/helpers/extends.ts +++ b/src/testRunner/unittests/helpers/extends.ts @@ -12,7 +12,7 @@ export function getSymlinkedExtendsSys(forTsserver?: true): TestServerHost { extends: "@something/tsconfig-base/tsconfig.json", compilerOptions: { removeComments: true, - } + }, }), "/users/user/projects/myconfigs/node_modules/@something/tsconfig-base/tsconfig.json": JSON.stringify({ compilerOptions: { composite: true }, diff --git a/src/testRunner/unittests/helpers/libraryResolution.ts b/src/testRunner/unittests/helpers/libraryResolution.ts index 11bf63292c10a..b3a0bc6b8799b 100644 --- a/src/testRunner/unittests/helpers/libraryResolution.ts +++ b/src/testRunner/unittests/helpers/libraryResolution.ts @@ -45,7 +45,7 @@ function getFsContentsForLibResolution(libRedirection?: boolean): FsContents { "/home/src/projects/node_modules/@typescript/lib-dom/index.d.ts": "interface DOMInterface { }", "/home/src/projects/node_modules/@typescript/lib-webworker/index.d.ts": "interface WebworkerInterface { }", "/home/src/projects/node_modules/@typescript/lib-scripthost/index.d.ts": "interface ScriptHostInterface { }", - } : undefined + } : undefined, }; } diff --git a/src/testRunner/unittests/helpers/node10Result.ts b/src/testRunner/unittests/helpers/node10Result.ts index 5961d211f3f94..4bf1adea61dc7 100644 --- a/src/testRunner/unittests/helpers/node10Result.ts +++ b/src/testRunner/unittests/helpers/node10Result.ts @@ -10,9 +10,9 @@ export function getFsConentsForNode10ResultAtTypesPackageJson(packageName: strin exports: { ".": { ...(addTypesCondition ? { types: "./index.d.ts" } : {}), - require: "./index.d.ts" - } - } + require: "./index.d.ts", + }, + }, }, undefined, " "); } @@ -26,9 +26,9 @@ export function getFsContentsForNode10ResultPackageJson(packageName: string, add ".": { ...(addTypesCondition ? { types: "./index.d.ts" } : {}), import: "./index.mjs", - require: "./index.js" - } - } + require: "./index.js", + }, + }, }, undefined, " "); } @@ -78,7 +78,7 @@ export function getFsContentsForNode10Result(): FsContents { strict: true, types: [], }, - files: ["index.mts"] + files: ["index.mts"], }), [libFile.path]: libFile.content, }; diff --git a/src/testRunner/unittests/helpers/tsc.ts b/src/testRunner/unittests/helpers/tsc.ts index d6681047f9664..73c72b6649788 100644 --- a/src/testRunner/unittests/helpers/tsc.ts +++ b/src/testRunner/unittests/helpers/tsc.ts @@ -30,7 +30,7 @@ export type TscCompileSystem = fakes.System & { export const noChangeRun: TestTscEdit = { caption: "no-change-run", - edit: ts.noop + edit: ts.noop, }; export const noChangeOnlyRuns = [noChangeRun]; @@ -90,7 +90,7 @@ ${baseFsPatch ? vfs.formatPatch(baseFsPatch) : ""} Output:: ${sys.output.join("")} -${patch ? vfs.formatPatch(patch) : ""}` +${patch ? vfs.formatPatch(patch) : ""}`, }; }; return sys; @@ -125,7 +125,7 @@ export function testTscCompile(input: TestTscCompile) { return testTscCompileLike({ ...input, compile: commandLineCompile, - additionalBaseline + additionalBaseline, }); function commandLineCompile(sys: TscCompileSystem) { @@ -223,7 +223,7 @@ export function verifyTscCompileLike(verifier: ( describe(input.subScenario, () => { verifyTscBaseline(() => verifier({ ...input, - fs: () => input.fs().makeReadonly() + fs: () => input.fs().makeReadonly(), })); }); }); @@ -244,7 +244,7 @@ interface VerifyTscEditDiscrepanciesInput { function verifyTscEditDiscrepancies({ index, edits, scenario, commandLineArgs, environmentVariables, baselines, - modifyFs, baseFs, newSys + modifyFs, baseFs, newSys, }: VerifyTscEditDiscrepanciesInput): string[] | undefined { const { caption, discrepancyExplanation } = edits[index]; const sys = testTscCompile({ @@ -291,7 +291,7 @@ function verifyTscEditDiscrepancies({ `Incremental signature is neither dts signature nor file version for File:: ${key}`, `Incremental:: ${JSON.stringify(incrementalFileInfo, /*replacer*/ undefined, 2)}`, `Clean:: ${JSON.stringify(cleanFileInfo, /*replacer*/ undefined, 2)}`, - `Dts Signature:: $${JSON.stringify(dtsForKey?.signature)}` + `Dts Signature:: $${JSON.stringify(dtsForKey?.signature)}`, ]; } }, @@ -311,7 +311,7 @@ function verifyTscEditDiscrepancies({ `Incremental Reference set is neither from dts nor files reference map for File:: ${key}::`, `Incremental:: ${JSON.stringify(incrementalReferenceSet, /*replacer*/ undefined, 2)}`, `Clean:: ${JSON.stringify(cleanReferenceSet, /*replacer*/ undefined, 2)}`, - `DtsExportsMap:: ${JSON.stringify(dtsForKey?.exportedModules, /*replacer*/ undefined, 2)}` + `DtsExportsMap:: ${JSON.stringify(dtsForKey?.exportedModules, /*replacer*/ undefined, 2)}`, ]; } }, @@ -459,7 +459,7 @@ export interface VerifyTscWithEditsInput extends TestTscCompile { export function verifyTsc({ subScenario, fs, scenario, commandLineArgs, environmentVariables, baselineSourceMap, modifyFs, baselineReadFileCalls, baselinePrograms, - edits + edits, }: VerifyTscWithEditsInput) { describe(`tsc ${commandLineArgs.join(" ")} ${scenario}:: ${subScenario}`, () => { let sys: TscCompileSystem; @@ -516,7 +516,7 @@ export function verifyTsc({ text: `currentDirectory:: ${sys.getCurrentDirectory()} useCaseSensitiveFileNames: ${sys.useCaseSensitiveFileNames}\r\n` + texts.join("\r\n"), }; - } + }, })); if (edits?.length) { it("tsc invocation after edit and clean build correctness", () => { diff --git a/src/testRunner/unittests/helpers/tscWatch.ts b/src/testRunner/unittests/helpers/tscWatch.ts index 4b8a3a6076866..0cbfd940b728b 100644 --- a/src/testRunner/unittests/helpers/tscWatch.ts +++ b/src/testRunner/unittests/helpers/tscWatch.ts @@ -18,11 +18,11 @@ import { export const commonFile1: File = { path: "/a/b/commonFile1.ts", - content: "let x = 1" + content: "let x = 1", }; export const commonFile2: File = { path: "/a/b/commonFile2.ts", - content: "let y = 1" + content: "let y = 1", }; export type WatchOrSolution = void | ts.SolutionBuilder | ts.WatchOfConfigFile | ts.WatchOfFilesAndCompilerOptions; @@ -62,7 +62,7 @@ function tscWatchCompile(input: TscWatchCompile) { const { scenario, subScenario, commandLineArgs, edits, - baselineSourceMap, baselineDependencies + baselineSourceMap, baselineDependencies, } = input; if (!isWatch(commandLineArgs)) sys.exit = exitCode => sys.exitCode = exitCode; @@ -83,7 +83,7 @@ function tscWatchCompile(input: TscWatchCompile) { baselineSourceMap, baselineDependencies, edits, - watchOrSolution + watchOrSolution, }); }); } @@ -217,7 +217,7 @@ export function runWatchBaseline) { baseline.push(`${sys.getExecutingFilePath()} ${commandLineArgs.join(" ")}`); let programs = watchBaseline({ diff --git a/src/testRunner/unittests/helpers/tsserver.ts b/src/testRunner/unittests/helpers/tsserver.ts index 3a9b6c1e33505..ca77c90f5cb70 100644 --- a/src/testRunner/unittests/helpers/tsserver.ts +++ b/src/testRunner/unittests/helpers/tsserver.ts @@ -34,7 +34,7 @@ export const customTypesMap = { "react": "react", "lodash": "lodash" } - }` + }`, }; function replaceAll(source: string, searchValue: string, replaceValue: string): string { @@ -275,7 +275,7 @@ export class TestTypingsInstallerWorker extends ts.server.typingsInstaller.Typin ), undefined, " ", - ) + ), }); if (this.log.isEnabled()) { this.log.writeLine(`TI:: Updated ${typesRegistryPackageName} npm package`); @@ -333,7 +333,7 @@ export class TestTypingsInstallerWorker extends ts.server.typingsInstaller.Typin success: !!out, requestId, packageNames, - callback: cb + callback: cb, }; this.postExecActions.push(action); } @@ -395,7 +395,7 @@ function createTypesRegistryFileContent(list: readonly string[]): TypesRegistryF "ts2.4": "1.3.0", "ts2.5": "1.3.0", "ts2.6": "1.3.0", - "ts2.7": "1.3.0" + "ts2.7": "1.3.0", }; const entries: ts.MapLike> = {}; for (const l of list) { @@ -609,7 +609,7 @@ export class TestProjectService extends ts.server.ProjectService { typingsInstaller, typesMapLocation: customTypesMap.path, incrementalVerifier, - ...opts + ...opts, }); ts.Debug.assert(opts.allowNonBaseliningLogger || this.logger.hasLevel(ts.server.LogLevel.verbose), "Use Baselining logger and baseline tsserver log or create using allowNonBaseliningLogger"); this.testhost = patchHostTimeouts( @@ -735,7 +735,7 @@ export function openFilesForSession(files: readonly (string | File | { fileContent: file.content, scriptKindName: file.scriptKindName, } : - { file: file.path } + { file: file.path }, }); } } @@ -744,7 +744,7 @@ export function closeFilesForSession(files: readonly (File | string)[], session: for (const file of files) { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Close, - arguments: { file: ts.isString(file) ? file : file.path } + arguments: { file: ts.isString(file) ? file : file.path }, }); } } @@ -752,14 +752,14 @@ export function closeFilesForSession(files: readonly (File | string)[], session: export function openExternalProjectForSession(project: ts.server.protocol.ExternalProject, session: TestSession) { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.OpenExternalProject, - arguments: project + arguments: project, }); } export function openExternalProjectsForSession(projects: ts.server.protocol.ExternalProject[], session: TestSession) { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.OpenExternalProjects, - arguments: { projects } + arguments: { projects }, }); } @@ -771,7 +771,7 @@ export function setCompilerOptionsForInferredProjectsRequestForSession( command: ts.server.protocol.CommandTypes.CompilerOptionsForInferredProjects, arguments: "options" in options ? // eslint-disable-line local/no-in-operator options as ts.server.protocol.SetCompilerOptionsForInferredProjectsArgs : - { options } + { options }, }); } @@ -791,7 +791,7 @@ export function verifyGetErrRequest(request: VerifyGetErrRequest) { const { session, files } = request; session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Geterr, - arguments: { delay: 0, files: files.map(filePath) } + arguments: { delay: 0, files: files.map(filePath) }, }); checkAllErrors(request); } @@ -834,7 +834,7 @@ function verifyErrorsUsingGeterrForProject({ scenario, subScenario, allFiles, op for (const expected of getErrForProjectRequest()) { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.GeterrForProject, - arguments: { delay: 0, file: filePath(expected.project) } + arguments: { delay: 0, file: filePath(expected.project) }, }); checkAllErrors({ session, files: expected.files }); } @@ -851,15 +851,15 @@ function verifyErrorsUsingSyncMethods({ scenario, subScenario, allFiles, openFil const reqArgs = { file: filePath(file), projectFileName: project && filePath(project) }; session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.SyntacticDiagnosticsSync, - arguments: reqArgs + arguments: reqArgs, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.SemanticDiagnosticsSync, - arguments: reqArgs + arguments: reqArgs, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.SuggestionDiagnosticsSync, - arguments: reqArgs + arguments: reqArgs, }); } baselineTsserverLogs(scenario, `${subScenario} gerErr with sync commands`, session); diff --git a/src/testRunner/unittests/helpers/vfs.ts b/src/testRunner/unittests/helpers/vfs.ts index df8fc06f3c1f3..99a4763c442c1 100644 --- a/src/testRunner/unittests/helpers/vfs.ts +++ b/src/testRunner/unittests/helpers/vfs.ts @@ -26,7 +26,7 @@ export function loadProjectFromDisk( ): vfs.FileSystem { const resolver = vfs.createResolver(Harness.IO); return loadProjectFromFiles({ - ["/src"]: new vfs.Mount(vpath.resolve(Harness.IO.getWorkspaceRoot(), root), resolver) + ["/src"]: new vfs.Mount(vpath.resolve(Harness.IO.getWorkspaceRoot(), root), resolver), }, options); } diff --git a/src/testRunner/unittests/helpers/virtualFileSystemWithWatch.ts b/src/testRunner/unittests/helpers/virtualFileSystemWithWatch.ts index 5702e3bca76ee..4b5145f0bb1c7 100644 --- a/src/testRunner/unittests/helpers/virtualFileSystemWithWatch.ts +++ b/src/testRunner/unittests/helpers/virtualFileSystemWithWatch.ts @@ -58,7 +58,7 @@ interface Number { toExponential: any; } interface Object {} interface RegExp {} interface String { charAt: any; } -interface Array { length: number; [n: number]: T; }` +interface Array { length: number; [n: number]: T; }`, }; function getExecutingFilePathFromLibFile(): string { @@ -258,7 +258,7 @@ export enum Tsc_WatchFile { export enum Tsc_WatchDirectory { WatchFile = "RecursiveDirectoryUsingFsWatchFile", NonRecursiveWatchDirectory = "RecursiveDirectoryUsingNonRecursiveWatchDirectory", - DynamicPolling = "RecursiveDirectoryUsingDynamicPriorityPolling" + DynamicPolling = "RecursiveDirectoryUsingDynamicPriorityPolling", } export interface TestServerHostOptions { @@ -623,7 +623,7 @@ export class TestServerHost implements server.ServerHost, FormatDiagnosticsHost, map.remove(path, callback); this.hasWatchChanges = true; closed = true; - } + }, }; } @@ -649,7 +649,7 @@ export class TestServerHost implements server.ServerHost, FormatDiagnosticsHost, path, { cb, - inode: this.inodes?.get(path) + inode: this.inodes?.get(path), } ) as FsWatchWorkerWatcher; result.on = noop; @@ -708,7 +708,7 @@ export class TestServerHost implements server.ServerHost, FormatDiagnosticsHost, return { path: this.toPath(fullPath), fullPath, - modifiedTime: this.now() + modifiedTime: this.now(), }; } @@ -1184,6 +1184,6 @@ export function getTsBuildProjectFilePath(project: string, file: string) { export function getTsBuildProjectFile(project: string, file: string): File { return { path: getTsBuildProjectFilePath(project, file), - content: Harness.IO.readFile(`${Harness.IO.getWorkspaceRoot()}/tests/projects/${project}/${file}`)! + content: Harness.IO.readFile(`${Harness.IO.getWorkspaceRoot()}/tests/projects/${project}/${file}`)!, }; } diff --git a/src/testRunner/unittests/incrementalParser.ts b/src/testRunner/unittests/incrementalParser.ts index 37feb3778854c..857de63091ba8 100644 --- a/src/testRunner/unittests/incrementalParser.ts +++ b/src/testRunner/unittests/incrementalParser.ts @@ -837,7 +837,7 @@ module m3 { }\ for (const tsIgnoreComment of [ "// @ts-ignore", "/* @ts-ignore */", - "/*\n @ts-ignore */" + "/*\n @ts-ignore */", ]) { describe(`${tsIgnoreComment} comment directives`, () => { const textWithIgnoreComment = `const x = 10; diff --git a/src/testRunner/unittests/jsonParserRecovery.ts b/src/testRunner/unittests/jsonParserRecovery.ts index 41f4c98559542..3c3e67a67278a 100644 --- a/src/testRunner/unittests/jsonParserRecovery.ts +++ b/src/testRunner/unittests/jsonParserRecovery.ts @@ -10,7 +10,7 @@ describe("unittests:: jsonParserRecovery", () => { `jsonParserRecovery/${name.replace(/[^a-z0-9_-]/ig, "_")}.errors.txt`, Harness.Compiler.getErrorBaseline([{ content: text, - unitName: name + unitName: name, }], file.parseDiagnostics)); // Will throw if parse tree does not cover full input text diff --git a/src/testRunner/unittests/moduleResolution.ts b/src/testRunner/unittests/moduleResolution.ts index 560d68b7e954f..825bae65094e9 100644 --- a/src/testRunner/unittests/moduleResolution.ts +++ b/src/testRunner/unittests/moduleResolution.ts @@ -41,7 +41,7 @@ function createModuleResolutionHost(baselines: string[], hasDirectoryExists: boo assert.isTrue(directories.has(ts.getDirectoryPath(path)), `'fileExists' '${path}' request in non-existing directory`); return map.has(path); }, - useCaseSensitiveFileNames: true + useCaseSensitiveFileNames: true, }; } else { @@ -334,7 +334,7 @@ describe("unittests:: moduleResolution:: Node module resolution - non-relative p }, { name: "/sub/node_modules/a/package.json", - content: '{"version": "0.0.0", "main": "./index"}' + content: '{"version": "0.0.0", "main": "./index"}', } ); const compilerOptions: ts.CompilerOptions = { moduleResolution: ts.ModuleResolutionKind.Node10 }; @@ -438,17 +438,17 @@ export = B;`, import Shared = require('../first/shared'); class C {} export = C; - ` + `, }, "/a/b/c/first/second", ["class_a.ts"], ["../../../c/third/class_c.ts"]); test("should find modules in node_modules", { "/parent/node_modules/mod/index.d.ts": "export var x", - "/parent/app/myapp.ts": `import {x} from "mod"` + "/parent/app/myapp.ts": `import {x} from "mod"`, }, "/parent/app", ["myapp.ts"], []); test("should find file referenced via absolute and relative names", { "/a/b/c.ts": `/// `, - "/a/b/b.ts": "var x" + "/a/b/b.ts": "var x", }, "/a/b", ["c.ts", "/a/b/b.ts"], []); }); @@ -512,7 +512,7 @@ describe("unittests:: moduleResolution:: Files with different casing with forceC "same file is referenced using absolute and relative names", { "/a/b/c.ts": `/// `, - "/a/b/d.ts": "var x" + "/a/b/d.ts": "var x", }, { module: ts.ModuleKind.AMD }, "/a/b", @@ -523,7 +523,7 @@ describe("unittests:: moduleResolution:: Files with different casing with forceC "two files used in program differ only in casing (tripleslash references)", { "/a/b/c.ts": `/// `, - "/a/b/d.ts": "var x" + "/a/b/d.ts": "var x", }, { module: ts.ModuleKind.AMD, forceConsistentCasingInFileNames: true }, "/a/b", @@ -534,7 +534,7 @@ describe("unittests:: moduleResolution:: Files with different casing with forceC "two files used in program differ only in casing (imports)", { "/a/b/c.ts": `import {x} from "D"`, - "/a/b/d.ts": "export var x" + "/a/b/d.ts": "export var x", }, { module: ts.ModuleKind.AMD, forceConsistentCasingInFileNames: true }, "/a/b", @@ -545,7 +545,7 @@ describe("unittests:: moduleResolution:: Files with different casing with forceC "two files used in program differ only in casing (imports, relative module names)", { "moduleA.ts": `import {x} from "./ModuleB"`, - "moduleB.ts": "export var x" + "moduleB.ts": "export var x", }, { module: ts.ModuleKind.CommonJS, forceConsistentCasingInFileNames: true }, "", @@ -557,7 +557,7 @@ describe("unittests:: moduleResolution:: Files with different casing with forceC { "/a/b/c.ts": `import {x} from "D"`, "/a/b/D.ts": "export var x", - "/a/b/d.ts": "export var y" + "/a/b/d.ts": "export var y", }, { module: ts.ModuleKind.AMD }, "/a/b", @@ -569,7 +569,7 @@ describe("unittests:: moduleResolution:: Files with different casing with forceC { "moduleA.ts": `import a = require("./ModuleC")`, "moduleB.ts": `import a = require("./moduleC")`, - "moduleC.ts": "export var x" + "moduleC.ts": "export var x", }, { module: ts.ModuleKind.CommonJS, forceConsistentCasingInFileNames: true }, "", @@ -585,7 +585,7 @@ describe("unittests:: moduleResolution:: Files with different casing with forceC "/a/B/c/moduleD.ts": ` import a = require("./moduleA"); import b = require("./moduleB"); - ` + `, }, { module: ts.ModuleKind.CommonJS, forceConsistentCasingInFileNames: true }, "/a/B/c", @@ -601,7 +601,7 @@ import b = require("./moduleB"); "/a/B/c/moduleD.ts": ` import a = require("./moduleA"); import b = require("./moduleB"); - ` + `, }, { module: ts.ModuleKind.CommonJS, forceConsistentCasingInFileNames: true }, "/a/B/c", @@ -742,15 +742,15 @@ describe("unittests:: moduleResolution:: baseUrl augmented module resolution", ( paths: { "*": [ "*", - "generated/*" + "generated/*", ], "somefolder/*": [ - "someanotherfolder/*" + "someanotherfolder/*", ], "/rooted/*": [ - "generated/*" - ] - } + "generated/*", + ], + }, }; check("folder1/file1"); check("folder1/file2"); @@ -790,15 +790,15 @@ describe("unittests:: moduleResolution:: baseUrl augmented module resolution", ( paths: { "*": [ "*", - "generated/*" + "generated/*", ], "somefolder/*": [ - "someanotherfolder/*" + "someanotherfolder/*", ], "/rooted/*": [ - "generated/*" - ] - } + "generated/*", + ], + }, }; check("folder1/file1"); check("folder1/file2"); @@ -830,8 +830,8 @@ describe("unittests:: moduleResolution:: baseUrl augmented module resolution", ( moduleResolution: ts.ModuleResolutionKind.Node10, rootDirs: [ "/root", - "/root/generated/" - ] + "/root/generated/", + ], }; check("./file2", file1); check("../folder1/file1", file3); @@ -862,8 +862,8 @@ describe("unittests:: moduleResolution:: baseUrl augmented module resolution", ( jsx: ts.JsxEmit.React, rootDirs: [ "/root", - "/root/generated/" - ] + "/root/generated/", + ], }; check("./file2", file1); check("../folder1/file1", file3); @@ -893,8 +893,8 @@ describe("unittests:: moduleResolution:: baseUrl augmented module resolution", ( moduleResolution: ts.ModuleResolutionKind.Node10, baseUrl: "/root", paths: { - "libs/guid": [ "src/libs/guid" ] - } + "libs/guid": [ "src/libs/guid" ], + }, }; baselines.push(`Resolving "libs/guid" from ${app.name}${hasDirectoryExists ? "" : " with host that doesnt have directoryExists"}`); const result = ts.resolveModuleName("libs/guid", app.name, options, host); @@ -909,7 +909,7 @@ describe("unittests:: moduleResolution:: ModuleResolutionHost.directoryExists", const host: ts.ModuleResolutionHost = { readFile: ts.notImplemented, fileExists: ts.notImplemented, - directoryExists: _ => false + directoryExists: _ => false, }; const result = ts.resolveModuleName("someName", "/a/b/c/d", { moduleResolution: ts.ModuleResolutionKind.Node10 }, host); @@ -1053,7 +1053,7 @@ describe("unittests:: moduleResolution:: Type reference directive resolution: ", declare module "fs-client" { import { Stat } from "fs"; export function foo(): Stat; - }` + }`, }; const file = ts.createSourceFile(f.name, f.content, ts.ScriptTarget.ES2015); const compilerHost: ts.CompilerHost = { @@ -1082,7 +1082,7 @@ describe("unittests:: moduleResolution:: Type reference directive resolution: ", declare module "fs-client" { import { Stat } from "fs"; export function foo(): Stat; - }` + }`, }; const file = ts.createSourceFile(f.name, f.content, ts.ScriptTarget.ES2015); const compilerHost: ts.CompilerHost = { @@ -1099,7 +1099,7 @@ describe("unittests:: moduleResolution:: Type reference directive resolution: ", resolveModuleNames(moduleNames: string[], _containingFile: string) { assert.deepEqual(moduleNames, ["fs"]); return [undefined!]; // TODO: GH#18217 - } + }, }; ts.createProgram([f.name], {}, compilerHost); }); diff --git a/src/testRunner/unittests/printer.ts b/src/testRunner/unittests/printer.ts index 1ac368226f435..3374c53249ea4 100644 --- a/src/testRunner/unittests/printer.ts +++ b/src/testRunner/unittests/printer.ts @@ -101,8 +101,8 @@ describe("unittests:: PrinterAPI", () => { it("without statements", () => { const host = new fakes.CompilerHost(new vfs.FileSystem(/*ignoreCase*/ true, { files: { - "/test.d.ts": `/// \n/// \n/// { it("with statements", () => { const host = new fakes.CompilerHost(new vfs.FileSystem(/*ignoreCase*/ true, { files: { - "/test.d.ts": `/// \n/// \n/// { // comment1 const b = 2; - `, ts.ScriptTarget.ES2015) + `, ts.ScriptTarget.ES2015), ]); }); printsCorrectly("default", {}, printer => printer.printBundle(bundle)); diff --git a/src/testRunner/unittests/programApi.ts b/src/testRunner/unittests/programApi.ts index 29ee633f7d05e..0450281411beb 100644 --- a/src/testRunner/unittests/programApi.ts +++ b/src/testRunner/unittests/programApi.ts @@ -99,7 +99,7 @@ describe("unittests:: programApi:: Program.getMissingFilePaths", () => { // From no-extension reference "d:/pretend/nonexistent4.d.ts", "d:/pretend/nonexistent4.ts", - "d:/pretend/nonexistent4.tsx" + "d:/pretend/nonexistent4.tsx", ]); }); @@ -217,7 +217,7 @@ describe("unittests:: programApi:: CompilerOptions relative paths", () => { const fs = vfs.createFromFileSystem(Harness.IO, /*ignoreCase*/ false, { documents: [main, mod], cwd: "/" }); const program = ts.createProgram(["./main.ts"], { - paths: { "*": ["./lib/*"] } + paths: { "*": ["./lib/*"] }, }, new fakes.CompilerHost(fs, { newLine: ts.NewLineKind.LineFeed })); assert.isEmpty(program.getConfigFileParsingDiagnostics()); diff --git a/src/testRunner/unittests/publicApi.ts b/src/testRunner/unittests/publicApi.ts index e0facd0594d82..4ea00cee011af 100644 --- a/src/testRunner/unittests/publicApi.ts +++ b/src/testRunner/unittests/publicApi.ts @@ -92,7 +92,7 @@ describe("unittests:: Public APIs:: getTypeAtLocation", () => { const program = ts.createProgram({ host, rootNames: ["/file.ts"], - options: { noLib: true } + options: { noLib: true }, }); const checker = program.getTypeChecker(); @@ -114,7 +114,7 @@ describe("unittests:: Public APIs:: getTypeAtLocation", () => { const program = ts.createProgram({ host, rootNames: ["/file.ts"], - options: { noLib: true } + options: { noLib: true }, }); const checker = program.getTypeChecker(); @@ -138,7 +138,7 @@ describe("unittests:: Public APIs:: getTypeAtLocation", () => { const program = ts.createProgram({ host, rootNames: ["/file.ts"], - options: { noLib: true } + options: { noLib: true }, }); const checker = program.getTypeChecker(); @@ -158,7 +158,7 @@ describe("unittests:: Public APIs:: getTypeAtLocation", () => { const program = ts.createProgram({ host, rootNames: ["/file.ts"], - options: { noLib: true } + options: { noLib: true }, }); const checker = program.getTypeChecker(); @@ -187,7 +187,7 @@ describe("unittests:: Public APIs:: validateLocaleAndSetLanguage", () => { assert.isTrue(expectedToReadFile, `Locale : ${locale} ${expectedToReadFile ? "should" : "should not"} read ${fileName}.`); // Throw error here so that actual change to localized diagnostics messages doesnt take place throw new Error("cannot read file"); - } + }, }, errors); }); } diff --git a/src/testRunner/unittests/reuseProgramStructure.ts b/src/testRunner/unittests/reuseProgramStructure.ts index f5df90959ec39..c7286d2134d20 100644 --- a/src/testRunner/unittests/reuseProgramStructure.ts +++ b/src/testRunner/unittests/reuseProgramStructure.ts @@ -40,7 +40,7 @@ describe("unittests:: Reuse program structure:: General", () => { baselines.push(ts.formatDiagnostics(program.getSemanticDiagnostics(), { getCurrentDirectory: () => program.getCurrentDirectory(), getNewLine: () => "\n", - getCanonicalFileName: ts.createGetCanonicalFileName(program.useCaseSensitiveFileNames()) + getCanonicalFileName: ts.createGetCanonicalFileName(program.useCaseSensitiveFileNames()), })); baselines.push("", ""); } @@ -57,7 +57,7 @@ describe("unittests:: Reuse program structure:: General", () => { /// /// /// -`, "", `var x = 1`) +`, "", `var x = 1`), }, { name: "b.ts", text: SourceText.New(`/// `, "", `var y = 2`) }, { name: "c.ts", text: SourceText.New("", "", `var z = 1;`) }, @@ -268,7 +268,7 @@ describe("unittests:: Reuse program structure:: General", () => { ...host, getSourceFile(fileName) { return fileName === sourceFile.fileName ? sourceFile : program1.getSourceFile(fileName); - } + }, }; const program2 = ts.createProgram(["/a.ts"], options, updateHost, program1); baselineProgram(baselines, program2, updateHost); @@ -331,7 +331,7 @@ describe("unittests:: Reuse program structure:: General", () => { it("can reuse ambient module declarations from non-modified files", () => { const files = [ { name: "/a/b/app.ts", text: SourceText.New("", "import * as fs from 'fs'", "") }, - { name: "/a/b/node.d.ts", text: SourceText.New("", "", "declare module 'fs' {}") } + { name: "/a/b/node.d.ts", text: SourceText.New("", "", "declare module 'fs' {}") }, ]; const options = { target: ts.ScriptTarget.ES2015, traceResolution: true }; const program = newProgram(files, files.map(f => f.name), options); @@ -365,14 +365,14 @@ describe("unittests:: Reuse program structure:: General", () => { SourceText.New( `/// ${newLine}/// ${newLine}/// `, `import { B } from './b1';${newLine}export let BB = B;`, - "declare module './b1' { interface B { y: string; } }") + "declare module './b1' { interface B { y: string; } }"), }, { name: "f2.ts", text: SourceText.New( `/// ${newLine}/// `, `import { B } from './b2';${newLine}import { BB } from './f1';`, - "(new BB).x; (new BB).y;") + "(new BB).x; (new BB).y;"), }, ]; @@ -577,7 +577,7 @@ describe("unittests:: Reuse program structure:: isProgramUptoDate", () => { rootFiles, options, watchOptions: undefined, - system + system, })).getCurrentProgram().getProgram(); verifyProgramIsUptoDate(program, duplicate(rootFiles), duplicate(options)); } @@ -585,7 +585,7 @@ describe("unittests:: Reuse program structure:: isProgramUptoDate", () => { function verifyProgramWithConfigFile(system: ts.System, configFileName: string) { const program = ts.createWatchProgram(ts.createWatchCompilerHostOfConfigFile({ configFileName, - system + system, })).getCurrentProgram().getProgram(); const { fileNames, options } = ts.parseConfigFileWithSystem(configFileName, {}, /*extendedConfigCache*/ undefined, /*watchOptionsToExtend*/ undefined, system, ts.notImplemented)!; // TODO: GH#18217 verifyProgramIsUptoDate(program, fileNames, options); @@ -600,15 +600,15 @@ describe("unittests:: Reuse program structure:: isProgramUptoDate", () => { it("has empty options", () => { const file1: File = { path: "/a/b/file1.ts", - content: "let x = 1" + content: "let x = 1", }; const file2: File = { path: "/a/b/file2.ts", - content: "let y = 1" + content: "let y = 1", }; const configFile: File = { path: "/a/b/tsconfig.json", - content: "{}" + content: "{}", }; verifyProgram([file1, file2, libFile, configFile], [file1.path, file2.path], {}, configFile.path); }); @@ -617,19 +617,19 @@ describe("unittests:: Reuse program structure:: isProgramUptoDate", () => { const compilerOptions: ts.CompilerOptions = { lib: ["es5", "es2015.promise"] }; const app: File = { path: "/src/app.ts", - content: "var x: Promise;" + content: "var x: Promise;", }; const configFile: File = { path: "/src/tsconfig.json", - content: JSON.stringify({ compilerOptions }) + content: JSON.stringify({ compilerOptions }), }; const es5Lib: File = { path: "/compiler/lib.es5.d.ts", - content: "declare const eval: any" + content: "declare const eval: any", }; const es2015Promise: File = { path: "/compiler/lib.es2015.promise.d.ts", - content: "declare class Promise {}" + content: "declare class Promise {}", }; verifyProgram([app, configFile, es5Lib, es2015Promise], [app.path], compilerOptions, configFile.path); @@ -642,16 +642,16 @@ describe("unittests:: Reuse program structure:: isProgramUptoDate", () => { "*": [ "packages/mail/data/*", "packages/styles/*", - "*" - ] - } + "*", + ], + }, }; const app: File = { path: "/src/packages/framework/app.ts", content: 'import classc from "module1/lib/file1";\ import classD from "module3/file3";\ let x = new classc();\ - let y = new classD();' + let y = new classD();', }; const module1: File = { path: "/src/packages/mail/data/module1/lib/file1.ts", @@ -663,11 +663,11 @@ describe("unittests:: Reuse program structure:: isProgramUptoDate", () => { }; const module3: File = { path: "/src/packages/styles/module3/file3.ts", - content: "class classD { method() { return 10; } }\nexport default classD;" + content: "class classD { method() { return 10; } }\nexport default classD;", }; const configFile: File = { path: "/src/tsconfig.json", - content: JSON.stringify({ compilerOptions }) + content: JSON.stringify({ compilerOptions }), }; verifyProgram([app, module1, module2, module3, libFile, configFile], [app.path], compilerOptions, configFile.path); @@ -680,16 +680,16 @@ describe("unittests:: Reuse program structure:: isProgramUptoDate", () => { "*": [ "packages/mail/data/*", "packages/styles/*", - "*" - ] - } + "*", + ], + }, }; const app: File = { path: "/src/packages/framework/app.ts", content: 'import classc from "module1/lib/file1";\ import classD from "module3/file3";\ let x = new classc();\ - let y = new classD();' + let y = new classD();', }; const module1: File = { path: "/src/packages/mail/data/module1/lib/file1.ts", @@ -701,11 +701,11 @@ describe("unittests:: Reuse program structure:: isProgramUptoDate", () => { }; const module3: File = { path: "/src/packages/styles/module3/file3.ts", - content: "class classD { method() { return 10; } }\nexport default classD;" + content: "class classD { method() { return 10; } }\nexport default classD;", }; const configFile: File = { path: "/src/tsconfig.json", - content: JSON.stringify({ compilerOptions, include: ["packages/**/*.ts"] }) + content: JSON.stringify({ compilerOptions, include: ["packages/**/*.ts"] }), }; verifyProgramWithConfigFile(createWatchedSystem([app, module1, module2, module3, libFile, configFile]), configFile.path); }); @@ -720,7 +720,7 @@ describe("unittests:: Reuse program structure:: isProgramUptoDate", () => { }; const module3: File = { path: "/src/packages/styles/module3/file3.ts", - content: "class classD { method() { return 10; } }\nexport default classD;" + content: "class classD { method() { return 10; } }\nexport default classD;", }; const rootFiles = [module1.path, module2.path, module3.path]; const system = createWatchedSystem([module1, module2, module3]); @@ -729,7 +729,7 @@ describe("unittests:: Reuse program structure:: isProgramUptoDate", () => { rootFiles, options, watchOptions: undefined, - system + system, })).getCurrentProgram().getProgram(); verifyProgramIsUptoDate(program, duplicate(rootFiles), duplicate(options)); }); @@ -755,7 +755,7 @@ describe("unittests:: Reuse program structure:: isProgramUptoDate", () => { }; const module3: File = { path: "/src/packages/styles/module3/file3.ts", - content: "class classD { method() { return 10; } }\nexport default classD;" + content: "class classD { method() { return 10; } }\nexport default classD;", }; const rootFiles = [module1.path, module2.path]; const newRootFiles = [module1.path, module2.path, module3.path]; @@ -765,7 +765,7 @@ describe("unittests:: Reuse program structure:: isProgramUptoDate", () => { rootFiles, options, watchOptions: undefined, - system + system, })).getCurrentProgram().getProgram(); verifyProgramIsNotUptoDate(program, duplicate(newRootFiles), duplicate(options)); }); @@ -780,7 +780,7 @@ describe("unittests:: Reuse program structure:: isProgramUptoDate", () => { }; const module3: File = { path: "/src/packages/styles/module3/file3.ts", - content: "class classD { method() { return 10; } }\nexport default classD;" + content: "class classD { method() { return 10; } }\nexport default classD;", }; const rootFiles = [module1.path, module2.path]; const newRootFiles = [module2.path, module3.path]; @@ -790,7 +790,7 @@ describe("unittests:: Reuse program structure:: isProgramUptoDate", () => { rootFiles, options, watchOptions: undefined, - system + system, })).getCurrentProgram().getProgram(); verifyProgramIsNotUptoDate(program, duplicate(newRootFiles), duplicate(options)); }); diff --git a/src/testRunner/unittests/services/cancellableLanguageServiceOperations.ts b/src/testRunner/unittests/services/cancellableLanguageServiceOperations.ts index 7cc688965ad9c..8f3b2487e80c8 100644 --- a/src/testRunner/unittests/services/cancellableLanguageServiceOperations.ts +++ b/src/testRunner/unittests/services/cancellableLanguageServiceOperations.ts @@ -70,7 +70,7 @@ function verifyOperationCancelledAfter(content: string, cancelAfter: number, checks = -Infinity; // Cancel just once, then disable cancellation, effectively } return result; - } + }, }; const adapter = new Harness.LanguageService.NativeLanguageServiceAdapter(token, options); const host = adapter.getHost(); diff --git a/src/testRunner/unittests/services/convertToAsyncFunction.ts b/src/testRunner/unittests/services/convertToAsyncFunction.ts index 00b46896aaaa2..e3ffd371f9361 100644 --- a/src/testRunner/unittests/services/convertToAsyncFunction.ts +++ b/src/testRunner/unittests/services/convertToAsyncFunction.ts @@ -271,7 +271,7 @@ interface PromiseConstructor { declare var Promise: PromiseConstructor; interface RegExp {} interface String { charAt: any; } -interface Array {}` +interface Array {}`, }; const moduleFile: File = { @@ -279,7 +279,7 @@ const moduleFile: File = { content: `export function fn(res: any): any { return res; -}` +}`, }; type WithSkipAndOnly = ((...args: T) => void) & { @@ -344,7 +344,7 @@ function testConvertToAsyncFunction(it: Mocha.PendingTestFunction, caption: stri const f = { path, - content: t.source + content: t.source, }; const sourceFile = program.getSourceFile(path)!; @@ -356,7 +356,7 @@ function testConvertToAsyncFunction(it: Mocha.PendingTestFunction, caption: stri cancellationToken: { throwIfCancellationRequested: ts.noop, isCancellationRequested: ts.returnFalse }, preferences: ts.emptyOptions, host: notImplementedHost, - formatContext: ts.formatting.getFormatContext(ts.testFormatSettings, notImplementedHost) + formatContext: ts.formatting.getFormatContext(ts.testFormatSettings, notImplementedHost), }; const diagnostics = languageService.getSuggestionDiagnostics(f.path); diff --git a/src/testRunner/unittests/services/extract/helpers.ts b/src/testRunner/unittests/services/extract/helpers.ts index cc139c3f42a2c..f94fee9abcf58 100644 --- a/src/testRunner/unittests/services/extract/helpers.ts +++ b/src/testRunner/unittests/services/extract/helpers.ts @@ -80,7 +80,7 @@ export const notImplementedHost: ts.LanguageServiceHost = { getDefaultLibFileName: ts.notImplemented, getCurrentDirectory: ts.notImplemented, readFile: ts.notImplemented, - fileExists: ts.notImplemented + fileExists: ts.notImplemented, }; export function testExtractSymbol(caption: string, text: string, baselineFolder: string, description: ts.DiagnosticMessage, includeLib?: boolean) { @@ -160,7 +160,7 @@ export function testExtractSymbolFailed(caption: string, text: string, descripti } const f = { path: "/a.ts", - content: t.source + content: t.source, }; const host = createServerHost([f, libFile]); const projectService = createProjectService(host, { allowNonBaseliningLogger: true }); diff --git a/src/testRunner/unittests/services/extract/symbolWalker.ts b/src/testRunner/unittests/services/extract/symbolWalker.ts index 0c2285ceda6bc..ae1d5792fb5c2 100644 --- a/src/testRunner/unittests/services/extract/symbolWalker.ts +++ b/src/testRunner/unittests/services/extract/symbolWalker.ts @@ -6,7 +6,7 @@ describe("unittests:: services:: extract:: Symbol Walker", () => { it(description, () => { const result = Harness.Compiler.compileFiles([{ unitName: "main.ts", - content: source + content: source, }], [], {}, {}, "/"); const file = result.program!.getSourceFile("main.ts")!; const checker = result.program!.getTypeChecker(); diff --git a/src/testRunner/unittests/services/hostNewLineSupport.ts b/src/testRunner/unittests/services/hostNewLineSupport.ts index d5028708f6dfa..462eabaa14a64 100644 --- a/src/testRunner/unittests/services/hostNewLineSupport.ts +++ b/src/testRunner/unittests/services/hostNewLineSupport.ts @@ -31,7 +31,7 @@ describe("unittests:: services:: hostNewLineSupport", () => { const ls = testLSWithFiles(options, [{ content, fileOptions: {}, - unitName: "input.ts" + unitName: "input.ts", }]); const result = ls.getEmitOutput("input.ts"); assert(!result.emitSkipped, "emit was skipped"); @@ -50,7 +50,7 @@ describe("unittests:: services:: hostNewLineSupport", () => { const ls = testLSWithFiles(options, [{ content, fileOptions: {}, - unitName: "input.ts" + unitName: "input.ts", }]); const span = ls.getOutliningSpans("input.ts")[0]; const textAfterSpanCollapse = content.substring(span.textSpan.start + span.textSpan.length); diff --git a/src/testRunner/unittests/services/languageService.ts b/src/testRunner/unittests/services/languageService.ts index f34256c4fccbe..ffe6c07f57991 100644 --- a/src/testRunner/unittests/services/languageService.ts +++ b/src/testRunner/unittests/services/languageService.ts @@ -21,7 +21,7 @@ class Carousel extends Vue { "variables.ts": `export const vueTemplateHtml = \`
\`;`, "vue.d.ts": `export namespace Vue { export type Config = { template: string }; }`, "vue-class-component.d.ts": `import Vue from "./vue"; -export function Component(x: Config): any;` +export function Component(x: Config): any;`, }; function createLanguageService() { @@ -46,7 +46,7 @@ export function Component(x: Config): any;` return ts.getDefaultLibFilePath(options); }, fileExists: name => !!files[name], - readFile: name => files[name] + readFile: name => files[name], }); } // Regression test for GH #18245 - bug in single line comment writer caused a debug assertion when attempting @@ -83,7 +83,7 @@ export function Component(x: Config): any;` outputFiles: [{ name: "foo.d.ts", text: "export {};\n", - writeByteOrderMark: false + writeByteOrderMark: false, }], } ); @@ -109,7 +109,7 @@ export function Component(x: Config): any;` return text ? ts.ScriptSnapshot.fromString(text) : undefined; }, getCurrentDirectory: () => "/project", - getDefaultLibFileName: () => "/lib/lib.d.ts" + getDefaultLibFileName: () => "/lib/lib.d.ts", }; const ls = ts.createLanguageService(host); const program1 = ls.getProgram()!; @@ -153,34 +153,34 @@ export function Component(x: Config): any;` content: JSON.stringify({ compilerOptions: { module: "none", - composite: true + composite: true, }, - exclude: ["temp"] - }) + exclude: ["temp"], + }), }; const class1: File = { path: `/user/username/projects/myproject/projects/project1/class1.ts`, - content: `class class1 {}` + content: `class class1 {}`, }; const class1Dts: File = { path: `/user/username/projects/myproject/projects/project1/class1.d.ts`, - content: `declare class class1 {}` + content: `declare class class1 {}`, }; const config2: File = { path: `/user/username/projects/myproject/projects/project2/tsconfig.json`, content: JSON.stringify({ compilerOptions: { module: "none", - composite: true + composite: true, }, references: [ - { path: "../project1" } - ] - }) + { path: "../project1" }, + ], + }), }; const class2: File = { path: `/user/username/projects/myproject/projects/project2/class2.ts`, - content: `class class2 {}` + content: `class class2 {}`, }; const system = createServerHost([config1, class1, class1Dts, config2, class2, libFile]); const result = ts.getParsedCommandLineOfConfigFile(`/user/username/projects/myproject/projects/project2/tsconfig.json`, /*optionsToExtend*/ undefined, { diff --git a/src/testRunner/unittests/services/organizeImports.ts b/src/testRunner/unittests/services/organizeImports.ts index 9794bd1d68746..1d9ac2c8b7942 100644 --- a/src/testRunner/unittests/services/organizeImports.ts +++ b/src/testRunner/unittests/services/organizeImports.ts @@ -346,7 +346,7 @@ export const Other = 1; it("doesn't return any changes when the text would be identical", () => { const testFile = { path: "/a.ts", - content: `import { f } from 'foo';\nf();` + content: `import { f } from 'foo';\nf();`, }; const languageService = makeLanguageService(testFile); const changes = languageService.organizeImports({ type: "file", fileName: testFile.path }, ts.testFormatSettings, ts.emptyOptions); @@ -462,7 +462,7 @@ D; it("doesn't return any changes when the text would be identical", () => { const testFile = { path: "/a.ts", - content: `import { f } from 'foo';\nf();` + content: `import { f } from 'foo';\nf();`, }; const languageService = makeLanguageService(testFile); const changes = languageService.organizeImports({ type: "file", fileName: testFile.path }, ts.testFormatSettings, ts.emptyOptions); @@ -506,7 +506,7 @@ declare module 'caseless' { interface Caseless { test(name: KeyType): boolean; } -}` +}`, }); testOrganizeImports("Unused_preserve_imports_for_module_augmentation_in_non_declaration_file", @@ -522,7 +522,7 @@ declare module 'caseless' { interface Caseless { test(name: KeyType): boolean; } -}` +}`, }); it("Unused_false_positive_shorthand_assignment", () => { @@ -531,7 +531,7 @@ declare module 'caseless' { content: ` import { x } from "a"; const o = { x }; -` +`, }; const languageService = makeLanguageService(testFile); const changes = languageService.organizeImports({ type: "file", fileName: testFile.path }, ts.testFormatSettings, ts.emptyOptions); @@ -544,7 +544,7 @@ const o = { x }; content: ` import { x } from "a"; export { x }; -` +`, }; const languageService = makeLanguageService(testFile); const changes = languageService.organizeImports({ type: "file", fileName: testFile.path }, ts.testFormatSettings, ts.emptyOptions); @@ -597,7 +597,7 @@ import type Y from "lib"; import { Z } from "lib"; import type { A, B } from "lib"; -export { A, B, X, Y, Z };` +export { A, B, X, Y, Z };`, }); testOrganizeImports("CoalesceMultipleModules", @@ -834,7 +834,7 @@ export const App: React.FunctionComponent = _ =>

Hello!

;` +export function Global(props: any): ReactElement;`, }, { path: reactLibFile.path, @@ -843,7 +843,7 @@ export namespace React { interface FunctionComponent { } } -` +`, } ); @@ -862,7 +862,7 @@ const elem = <>
Foo
; path: "/@foo/core/index.d.ts", content: `export function h(): void; export function frag(): void; -` +`, } ); diff --git a/src/testRunner/unittests/services/preProcessFile.ts b/src/testRunner/unittests/services/preProcessFile.ts index 53332cebc5220..e92006574ee86 100644 --- a/src/testRunner/unittests/services/preProcessFile.ts +++ b/src/testRunner/unittests/services/preProcessFile.ts @@ -33,7 +33,7 @@ describe("unittests:: services:: PreProcessFile:", () => { typeReferenceDirectives: [], libReferenceDirectives: [], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); @@ -47,7 +47,7 @@ describe("unittests:: services:: PreProcessFile:", () => { typeReferenceDirectives: [], libReferenceDirectives: [], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); @@ -61,7 +61,7 @@ describe("unittests:: services:: PreProcessFile:", () => { typeReferenceDirectives: [], libReferenceDirectives: [], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); @@ -75,7 +75,7 @@ describe("unittests:: services:: PreProcessFile:", () => { typeReferenceDirectives: [], libReferenceDirectives: [], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); @@ -90,7 +90,7 @@ describe("unittests:: services:: PreProcessFile:", () => { importedFiles: [{ fileName: "r1.ts", pos: 20, end: 25 }, { fileName: "r2.ts", pos: 49, end: 54 }, { fileName: "r3.ts", pos: 78, end: 83 }, { fileName: "r4.ts", pos: 106, end: 111 }, { fileName: "r5.ts", pos: 138, end: 143 }], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); @@ -104,7 +104,7 @@ describe("unittests:: services:: PreProcessFile:", () => { libReferenceDirectives: [], importedFiles: [] as ts.FileReference[], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); @@ -118,7 +118,7 @@ describe("unittests:: services:: PreProcessFile:", () => { libReferenceDirectives: [], importedFiles: [{ fileName: "r3.ts", pos: 73, end: 78 }], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); @@ -132,7 +132,7 @@ describe("unittests:: services:: PreProcessFile:", () => { libReferenceDirectives: [], importedFiles: [{ fileName: "r1.ts", pos: 92, end: 97 }, { fileName: "r2.ts", pos: 121, end: 126 }], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); @@ -146,7 +146,7 @@ describe("unittests:: services:: PreProcessFile:", () => { libReferenceDirectives: [], importedFiles: [{ fileName: "r1.ts", pos: 91, end: 96 }, { fileName: "r3.ts", pos: 148, end: 153 }], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); @@ -171,10 +171,10 @@ describe("unittests:: services:: PreProcessFile:", () => { { fileName: "m4", pos: 95, end: 97 }, { fileName: "m5", pos: 122, end: 124 }, { fileName: "m6", pos: 160, end: 162 }, - { fileName: "m7", pos: 199, end: 201 } + { fileName: "m7", pos: 199, end: 201 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); @@ -202,7 +202,7 @@ describe("unittests:: services:: PreProcessFile:", () => { libReferenceDirectives: [], importedFiles: [], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); /* eslint-enable no-template-curly-in-string */ }); @@ -218,7 +218,7 @@ describe("unittests:: services:: PreProcessFile:", () => { libReferenceDirectives: [], importedFiles: [], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); /* eslint-enable no-template-curly-in-string */ }); @@ -233,10 +233,10 @@ describe("unittests:: services:: PreProcessFile:", () => { typeReferenceDirectives: [], libReferenceDirectives: [], importedFiles: [ - { fileName: "./foo", pos: 17, end: 22 } + { fileName: "./foo", pos: 17, end: 22 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); /* eslint-enable no-template-curly-in-string */ }); @@ -254,10 +254,10 @@ describe("unittests:: services:: PreProcessFile:", () => { libReferenceDirectives: [], importedFiles: [ { fileName: "a", pos: 39, end: 40 }, - { fileName: "b", pos: 53, end: 54 } + { fileName: "b", pos: 53, end: 54 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); /* eslint-enable no-template-curly-in-string */ }); @@ -278,7 +278,7 @@ describe("unittests:: services:: PreProcessFile:", () => { { fileName: "d", pos: 78, end: 79 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); /* eslint-enable no-template-curly-in-string */ }); @@ -300,7 +300,7 @@ describe("unittests:: services:: PreProcessFile:", () => { { fileName: "e", pos: 95, end: 96 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); /* eslint-enable no-template-curly-in-string */ }); @@ -320,7 +320,7 @@ describe("unittests:: services:: PreProcessFile:", () => { { fileName: "b", pos: 67, end: 68 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); /* eslint-enable no-template-curly-in-string */ }); @@ -344,7 +344,7 @@ describe("unittests:: services:: PreProcessFile:", () => { { fileName: "d", pos: 117, end: 118 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); /* eslint-enable no-template-curly-in-string */ }); @@ -359,7 +359,7 @@ describe("unittests:: services:: PreProcessFile:", () => { libReferenceDirectives: [], importedFiles: [], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); @@ -381,7 +381,7 @@ describe("unittests:: services:: PreProcessFile:", () => { { fileName: "m4", pos: 101, end: 103 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); @@ -419,7 +419,7 @@ describe("unittests:: services:: PreProcessFile:", () => { { fileName: "m12", pos: 392, end: 395 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); @@ -441,7 +441,7 @@ describe("unittests:: services:: PreProcessFile:", () => { { fileName: "m4", pos: 121, end: 123 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); @@ -461,7 +461,7 @@ describe("unittests:: services:: PreProcessFile:", () => { { fileName: "m3", pos: 109, end: 111 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); @@ -480,7 +480,7 @@ describe("unittests:: services:: PreProcessFile:", () => { libReferenceDirectives: [], importedFiles: [], ambientExternalModules: ["B"], - isLibFile: false + isLibFile: false, }); }); @@ -493,10 +493,10 @@ describe("unittests:: services:: PreProcessFile:", () => { typeReferenceDirectives: [], libReferenceDirectives: [], importedFiles: [ - { fileName: "m1", pos: 26, end: 28 } + { fileName: "m1", pos: 26, end: 28 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); it("Correctly handles export require calls in JavaScript files", () => { @@ -519,7 +519,7 @@ describe("unittests:: services:: PreProcessFile:", () => { { fileName: "m4", pos: 146, end: 148 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); it("Correctly handles dependency lists in define([deplist]) calls in JavaScript files", () => { @@ -538,7 +538,7 @@ describe("unittests:: services:: PreProcessFile:", () => { { fileName: "mod2", pos: 29, end: 33 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); @@ -558,7 +558,7 @@ describe("unittests:: services:: PreProcessFile:", () => { { fileName: "mod2", pos: 36, end: 40 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); @@ -577,10 +577,10 @@ describe("unittests:: services:: PreProcessFile:", () => { typeReferenceDirectives: [], libReferenceDirectives: [], importedFiles: [ - { fileName: "../Observable", pos: 28, end: 41 } + { fileName: "../Observable", pos: 28, end: 41 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); it("correctly handles augmentations in external modules - 2", () => { @@ -599,10 +599,10 @@ describe("unittests:: services:: PreProcessFile:", () => { libReferenceDirectives: [], importedFiles: [ { fileName: "m", pos: 123, end: 124 }, - { fileName: "../Observable", pos: 28, end: 41 } + { fileName: "../Observable", pos: 28, end: 41 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); it("correctly handles augmentations in external modules - 3", () => { @@ -621,10 +621,10 @@ describe("unittests:: services:: PreProcessFile:", () => { libReferenceDirectives: [], importedFiles: [ { fileName: "m", pos: 123, end: 124 }, - { fileName: "../Observable", pos: 28, end: 41 } + { fileName: "../Observable", pos: 28, end: 41 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); it("correctly handles augmentations in external modules - 4", () => { @@ -642,10 +642,10 @@ describe("unittests:: services:: PreProcessFile:", () => { typeReferenceDirectives: [], libReferenceDirectives: [], importedFiles: [ - { fileName: "../Observable", pos: 28, end: 41 } + { fileName: "../Observable", pos: 28, end: 41 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); it("correctly handles augmentations in external modules - 5", () => { @@ -663,10 +663,10 @@ describe("unittests:: services:: PreProcessFile:", () => { typeReferenceDirectives: [], libReferenceDirectives: [], importedFiles: [ - { fileName: "../Observable", pos: 28, end: 41 } + { fileName: "../Observable", pos: 28, end: 41 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); it("correctly handles augmentations in external modules - 6", () => { @@ -683,10 +683,10 @@ describe("unittests:: services:: PreProcessFile:", () => { typeReferenceDirectives: [], libReferenceDirectives: [], importedFiles: [ - { fileName: "../Observable", pos: 28, end: 41 } + { fileName: "../Observable", pos: 28, end: 41 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); it ("correctly handles augmentations in ambient external modules - 1", () => { @@ -706,10 +706,10 @@ describe("unittests:: services:: PreProcessFile:", () => { libReferenceDirectives: [], importedFiles: [ { fileName: "m2", pos: 65, end: 67 }, - { fileName: "augmentation", pos: 102, end: 114 } + { fileName: "augmentation", pos: 102, end: 114 }, ], ambientExternalModules: ["m1"], - isLibFile: false + isLibFile: false, }); }); it ("correctly handles augmentations in ambient external modules - 2", () => { @@ -731,10 +731,10 @@ describe("unittests:: services:: PreProcessFile:", () => { libReferenceDirectives: [], importedFiles: [ { fileName: "m2", pos: 127, end: 129 }, - { fileName: "augmentation", pos: 164, end: 176 } + { fileName: "augmentation", pos: 164, end: 176 }, ], ambientExternalModules: ["m1"], - isLibFile: false + isLibFile: false, }); }); it ("correctly recognizes type reference directives", () => { @@ -749,16 +749,16 @@ describe("unittests:: services:: PreProcessFile:", () => { { referencedFiles: [ { pos: 34, end: 35, fileName: "a" }, - { pos: 112, end: 114, fileName: "a2" } + { pos: 112, end: 114, fileName: "a2" }, ], typeReferenceDirectives: [ { pos: 73, end: 75, fileName: "a1" }, - { pos: 152, end: 154, fileName: "a3" } + { pos: 152, end: 154, fileName: "a3" }, ], libReferenceDirectives: [], importedFiles: [], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); it ("correctly recognizes lib reference directives", () => { @@ -773,17 +773,17 @@ describe("unittests:: services:: PreProcessFile:", () => { { referencedFiles: [ { pos: 34, end: 35, fileName: "a" }, - { pos: 110, end: 112, fileName: "a2" } + { pos: 110, end: 112, fileName: "a2" }, ], typeReferenceDirectives: [ ], libReferenceDirectives: [ { pos: 71, end: 73, fileName: "a1" }, - { pos: 148, end: 150, fileName: "a3" } + { pos: 148, end: 150, fileName: "a3" }, ], importedFiles: [], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); @@ -803,10 +803,10 @@ describe("unittests:: services:: PreProcessFile:", () => { { fileName: "mod2", pos: 45, end: 49 }, { fileName: "mod3", pos: 74, end: 78 }, { fileName: "mod4", pos: 90, end: 94 }, - { fileName: "mod5", pos: 142, end: 146 } + { fileName: "mod5", pos: 142, end: 146 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); @@ -823,10 +823,10 @@ describe("unittests:: services:: PreProcessFile:", () => { importedFiles: [ { fileName: "mod1", pos: 19, end: 23 }, { fileName: "mod2", pos: 38, end: 42 }, - { fileName: "mod3", pos: 71, end: 75 } + { fileName: "mod3", pos: 71, end: 75 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); @@ -843,7 +843,7 @@ describe("unittests:: services:: PreProcessFile:", () => { { fileName: "mod2", pos: 23, end: 27 }, ], ambientExternalModules: undefined, - isLibFile: false + isLibFile: false, }); }); }); diff --git a/src/testRunner/unittests/services/textChanges.ts b/src/testRunner/unittests/services/textChanges.ts index 0b45e947a2e55..55f0f143a06f8 100644 --- a/src/testRunner/unittests/services/textChanges.ts +++ b/src/testRunner/unittests/services/textChanges.ts @@ -185,7 +185,7 @@ var a = 4; // comment 7 function createTestClass() { return ts.factory.createClassDeclaration( [ - ts.factory.createToken(ts.SyntaxKind.PublicKeyword) + ts.factory.createToken(ts.SyntaxKind.PublicKeyword), ], "class1", /*typeParameters*/ undefined, @@ -193,9 +193,9 @@ var a = 4; // comment 7 ts.factory.createHeritageClause( ts.SyntaxKind.ImplementsKeyword, [ - ts.factory.createExpressionWithTypeArguments(ts.factory.createIdentifier("interface1"), /*typeArguments*/ undefined) + ts.factory.createExpressionWithTypeArguments(ts.factory.createIdentifier("interface1"), /*typeArguments*/ undefined), ] - ) + ), ], [ ts.factory.createPropertyDeclaration( @@ -204,7 +204,7 @@ var a = 4; // comment 7 /*questionOrExclamationToken*/ undefined, ts.factory.createKeywordTypeNode(ts.SyntaxKind.BooleanKeyword), /*initializer*/ undefined - ) + ), ] ); } diff --git a/src/testRunner/unittests/services/transpile.ts b/src/testRunner/unittests/services/transpile.ts index ae05aaa9bcd92..5b991356682e2 100644 --- a/src/testRunner/unittests/services/transpile.ts +++ b/src/testRunner/unittests/services/transpile.ts @@ -43,7 +43,7 @@ describe("unittests:: services:: Transpile", () => { const justName = "transpile/" + name.replace(/[^a-z0-9\-. ()=]/ig, "") + (transpileOptions.compilerOptions.jsx ? ts.Extension.Tsx : ts.Extension.Ts); const toBeCompiled = [{ unitName, - content: input + content: input, }]; const canUseOldTranspile = !transpileOptions.renamedDependencies; @@ -97,76 +97,76 @@ describe("unittests:: services:: Transpile", () => { ...testSettings.options, compilerOptions: { ...testSettings.options?.compilerOptions, - verbatimModuleSyntax: true - } - } + verbatimModuleSyntax: true, + }, + }, }); } } transpilesCorrectly("Generates no diagnostics with valid inputs", `var x = 0;`, { options: { compilerOptions: { module: ts.ModuleKind.CommonJS } }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Generates no diagnostics for missing file references", `/// var x = 0;`, { options: { compilerOptions: { module: ts.ModuleKind.CommonJS } }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Generates no diagnostics for missing module imports", `import {a} from "module2";`, { options: { compilerOptions: { module: ts.ModuleKind.CommonJS } }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Generates expected syntactic diagnostics", `a b`, { options: { compilerOptions: { module: ts.ModuleKind.CommonJS } }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Does not generate semantic diagnostics", `var x: string = 0;`, { options: { compilerOptions: { module: ts.ModuleKind.CommonJS } }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Generates module output", `var x = 0; export {};`, { - options: { compilerOptions: { module: ts.ModuleKind.AMD } } + options: { compilerOptions: { module: ts.ModuleKind.AMD } }, }); transpilesCorrectly("Uses correct newLine character", `var x = 0;`, { options: { compilerOptions: { module: ts.ModuleKind.CommonJS, newLine: ts.NewLineKind.LineFeed } }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Sets module name", "var x = 1; export {};", { - options: { compilerOptions: { module: ts.ModuleKind.System, newLine: ts.NewLineKind.LineFeed }, moduleName: "NamedModule" } + options: { compilerOptions: { module: ts.ModuleKind.System, newLine: ts.NewLineKind.LineFeed }, moduleName: "NamedModule" }, }); transpilesCorrectly("No extra errors for file without extension", `"use strict";\r\nvar x = 0;`, { options: { compilerOptions: { module: ts.ModuleKind.CommonJS }, fileName: "file" }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Rename dependencies - System", `import {foo} from "SomeName";\n` + `declare function use(a: any);\n` + `use(foo);`, { - options: { compilerOptions: { module: ts.ModuleKind.System, newLine: ts.NewLineKind.LineFeed }, renamedDependencies: { SomeName: "SomeOtherName" } } + options: { compilerOptions: { module: ts.ModuleKind.System, newLine: ts.NewLineKind.LineFeed }, renamedDependencies: { SomeName: "SomeOtherName" } }, }); transpilesCorrectly("Rename dependencies - AMD", `import {foo} from "SomeName";\n` + `declare function use(a: any);\n` + `use(foo);`, { - options: { compilerOptions: { module: ts.ModuleKind.AMD, newLine: ts.NewLineKind.LineFeed }, renamedDependencies: { SomeName: "SomeOtherName" } } + options: { compilerOptions: { module: ts.ModuleKind.AMD, newLine: ts.NewLineKind.LineFeed }, renamedDependencies: { SomeName: "SomeOtherName" } }, }); transpilesCorrectly("Rename dependencies - UMD", `import {foo} from "SomeName";\n` + `declare function use(a: any);\n` + `use(foo);`, { - options: { compilerOptions: { module: ts.ModuleKind.UMD, newLine: ts.NewLineKind.LineFeed }, renamedDependencies: { SomeName: "SomeOtherName" } } + options: { compilerOptions: { module: ts.ModuleKind.UMD, newLine: ts.NewLineKind.LineFeed }, renamedDependencies: { SomeName: "SomeOtherName" } }, }); transpilesCorrectly("Transpile with emit decorators and emit metadata", @@ -191,25 +191,25 @@ var x = 0;`, { emitDecoratorMetadata: true, experimentalDecorators: true, target: ts.ScriptTarget.ES5, - } + }, }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports backslashes in file name", "var x", { - options: { fileName: "a\\b.ts" } + options: { fileName: "a\\b.ts" }, }); transpilesCorrectly("transpile file as 'tsx' if 'jsx' is specified", `var x =
`, { - options: { compilerOptions: { jsx: ts.JsxEmit.React, newLine: ts.NewLineKind.LineFeed } } + options: { compilerOptions: { jsx: ts.JsxEmit.React, newLine: ts.NewLineKind.LineFeed } }, }); transpilesCorrectly("transpile .js files", "const a = 10;", { - options: { compilerOptions: { newLine: ts.NewLineKind.LineFeed, module: ts.ModuleKind.CommonJS }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { newLine: ts.NewLineKind.LineFeed, module: ts.ModuleKind.CommonJS }, fileName: "input.js", reportDiagnostics: true }, }); transpilesCorrectly("Supports urls in file name", "var x", { - options: { fileName: "http://somewhere/directory//directory2/file.ts" } + options: { fileName: "http://somewhere/directory//directory2/file.ts" }, }); transpilesCorrectly("Accepts string as enum values for compile-options", "export const x = 0", { @@ -217,301 +217,301 @@ var x = 0;`, { compilerOptions: { module: "es6" as any as ts.ModuleKind, // Capitalization and spaces ignored - target: " Es6 " as any as ts.ScriptTarget - } - } + target: " Es6 " as any as ts.ScriptTarget, + }, + }, }); transpilesCorrectly("Report an error when compiler-options module-kind is out-of-range", "", { - options: { compilerOptions: { module: 123 as any as ts.ModuleKind } } + options: { compilerOptions: { module: 123 as any as ts.ModuleKind } }, }); transpilesCorrectly("Report an error when compiler-options target-script is out-of-range", "", { - options: { compilerOptions: { module: 123 as any as ts.ModuleKind } } + options: { compilerOptions: { module: 123 as any as ts.ModuleKind } }, }); transpilesCorrectly("Support options with lib values", "const a = 10;", { options: { compilerOptions: { lib: ["es6", "dom"], module: ts.ModuleKind.CommonJS }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Support options with types values", "const a = 10;", { options: { compilerOptions: { types: ["jquery", "typescript"], module: ts.ModuleKind.CommonJS }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'allowJs'", "x;", { options: { compilerOptions: { allowJs: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'allowSyntheticDefaultImports'", "x;", { options: { compilerOptions: { allowSyntheticDefaultImports: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'allowUnreachableCode'", "x;", { options: { compilerOptions: { allowUnreachableCode: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'allowUnusedLabels'", "x;", { options: { compilerOptions: { allowUnusedLabels: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'alwaysStrict'", "x;", { options: { compilerOptions: { alwaysStrict: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'baseUrl'", "x;", { options: { compilerOptions: { baseUrl: "./folder/baseUrl" }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'charset'", "x;", { options: { compilerOptions: { charset: "en-us" }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'declaration'", "x;", { options: { compilerOptions: { declaration: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'declarationDir'", "x;", { options: { compilerOptions: { declarationDir: "out/declarations" }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'emitBOM'", "x;", { options: { compilerOptions: { emitBOM: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'emitDecoratorMetadata'", "x;", { options: { compilerOptions: { emitDecoratorMetadata: true, experimentalDecorators: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'experimentalDecorators'", "x;", { options: { compilerOptions: { experimentalDecorators: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'forceConsistentCasingInFileNames'", "x;", { options: { compilerOptions: { forceConsistentCasingInFileNames: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'isolatedModules'", "x;", { - options: { compilerOptions: { isolatedModules: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { isolatedModules: true }, fileName: "input.js", reportDiagnostics: true }, }); transpilesCorrectly("Does not support setting 'isolatedModules'", "x;", { options: { compilerOptions: { isolatedModules: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: "only" + testVerbatimModuleSyntax: "only", }); transpilesCorrectly("Supports setting 'jsx'", "x;", { options: { compilerOptions: { jsx: 1 }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'lib'", "x;", { options: { compilerOptions: { lib: ["es2015", "dom"] }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'locale'", "x;", { options: { compilerOptions: { locale: "en-us" }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'module'", "x;", { options: { compilerOptions: { module: ts.ModuleKind.CommonJS }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'moduleResolution'", "x;", { options: { compilerOptions: { moduleResolution: ts.ModuleResolutionKind.Node10 }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'newLine'", "x;", { options: { compilerOptions: { newLine: ts.NewLineKind.CarriageReturnLineFeed }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'noEmit'", "x;", { options: { compilerOptions: { noEmit: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'noEmitHelpers'", "x;", { options: { compilerOptions: { noEmitHelpers: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'noEmitOnError'", "x;", { options: { compilerOptions: { noEmitOnError: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'noErrorTruncation'", "x;", { options: { compilerOptions: { noErrorTruncation: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'noFallthroughCasesInSwitch'", "x;", { options: { compilerOptions: { noFallthroughCasesInSwitch: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'noImplicitAny'", "x;", { options: { compilerOptions: { noImplicitAny: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'noImplicitReturns'", "x;", { options: { compilerOptions: { noImplicitReturns: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'noImplicitThis'", "x;", { options: { compilerOptions: { noImplicitThis: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'noImplicitUseStrict'", "x;", { options: { compilerOptions: { noImplicitUseStrict: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'noLib'", "x;", { options: { compilerOptions: { noLib: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'noResolve'", "x;", { options: { compilerOptions: { noResolve: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'out'", "x;", { options: { compilerOptions: { out: "./out" }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'outDir'", "x;", { options: { compilerOptions: { outDir: "./outDir" }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'outFile'", "x;", { options: { compilerOptions: { outFile: "./outFile" }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'paths'", "x;", { options: { compilerOptions: { paths: { "*": ["./generated*"] } }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'preserveConstEnums'", "x;", { options: { compilerOptions: { preserveConstEnums: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'reactNamespace'", "x;", { options: { compilerOptions: { reactNamespace: "react" }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'jsxFactory'", "x;", { options: { compilerOptions: { jsxFactory: "createElement" }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'jsxFragmentFactory'", "x;", { options: { compilerOptions: { jsxFactory: "x", jsxFragmentFactory: "frag" }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'removeComments'", "x;", { options: { compilerOptions: { removeComments: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'rootDir'", "x;", { options: { compilerOptions: { rootDir: "./rootDir" }, fileName: "./rootDir/input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'rootDirs'", "x;", { options: { compilerOptions: { rootDirs: ["./a", "./b"] }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'skipLibCheck'", "x;", { options: { compilerOptions: { skipLibCheck: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'skipDefaultLibCheck'", "x;", { options: { compilerOptions: { skipDefaultLibCheck: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'strictNullChecks'", "x;", { options: { compilerOptions: { strictNullChecks: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'stripInternal'", "x;", { options: { compilerOptions: { stripInternal: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'suppressExcessPropertyErrors'", "x;", { options: { compilerOptions: { suppressExcessPropertyErrors: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'suppressImplicitAnyIndexErrors'", "x;", { options: { compilerOptions: { suppressImplicitAnyIndexErrors: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'target'", "x;", { options: { compilerOptions: { target: 2 }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'types'", "x;", { options: { compilerOptions: { types: ["jquery", "jasmine"] }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'typeRoots'", "x;", { options: { compilerOptions: { typeRoots: ["./folder"] }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'incremental'", "x;", { options: { compilerOptions: { incremental: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'composite'", "x;", { options: { compilerOptions: { composite: true }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports setting 'tsbuildinfo'", "x;", { options: { compilerOptions: { incremental: true, tsBuildInfoFile: "./folder/config.tsbuildinfo" }, fileName: "input.js", reportDiagnostics: true }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Correctly serialize metadata when transpile with CommonJS option", @@ -528,9 +528,9 @@ var x = 0;`, { moduleResolution: ts.ModuleResolutionKind.Node10, emitDecoratorMetadata: true, experimentalDecorators: true, - } + }, }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, } ); @@ -548,25 +548,25 @@ var x = 0;`, { moduleResolution: ts.ModuleResolutionKind.Node10, emitDecoratorMetadata: true, experimentalDecorators: true, - isolatedModules: true - } - } + isolatedModules: true, + }, + }, } ); transpilesCorrectly("Supports readonly keyword for arrays", "let x: readonly string[];", { options: { compilerOptions: { module: ts.ModuleKind.CommonJS } }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Supports 'as const' arrays", `([] as const).forEach(k => console.log(k));`, { options: { compilerOptions: { module: ts.ModuleKind.CommonJS } }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Infer correct file extension", `const fn = (a: T) => a`, { noSetFileName: true, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Export star as ns conflict does not crash", ` @@ -574,13 +574,13 @@ var a; export { a as alias }; export * as alias from './file';`, { noSetFileName: true, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); transpilesCorrectly("Elides import equals referenced only by export type", `import IFoo = Namespace.IFoo;` + `export type { IFoo };`, { - options: { compilerOptions: { module: ts.ModuleKind.CommonJS } } + options: { compilerOptions: { module: ts.ModuleKind.CommonJS } }, } ); @@ -588,14 +588,14 @@ export * as alias from './file';`, { `import IFoo = Namespace.IFoo;` + `export type { IFoo };`, { options: { compilerOptions: { module: ts.ModuleKind.CommonJS } }, - testVerbatimModuleSyntax: "only" + testVerbatimModuleSyntax: "only", } ); transpilesCorrectly("Elides import equals referenced only by type only export specifier", `import IFoo = Namespace.IFoo;` + `export { type IFoo };`, { - options: { compilerOptions: { module: ts.ModuleKind.CommonJS } } + options: { compilerOptions: { module: ts.ModuleKind.CommonJS } }, } ); @@ -603,21 +603,21 @@ export * as alias from './file';`, { `import IFoo = Namespace.IFoo;` + `export { type IFoo };`, { options: { compilerOptions: { module: ts.ModuleKind.CommonJS } }, - testVerbatimModuleSyntax: "only" + testVerbatimModuleSyntax: "only", } ); transpilesCorrectly("Can transpile .ts extensions without error", `import { foo } from "./foo.ts";`, { options: { compilerOptions: { module: ts.ModuleKind.ESNext, target: ts.ScriptTarget.ESNext } }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, } ); transpilesCorrectly("Ignores `allowImportingTsExtensions` without `noEmit` error", `import { foo } from "./foo.ts";`, { options: { compilerOptions: { module: ts.ModuleKind.ESNext, allowImportingTsExtensions: true, target: ts.ScriptTarget.ESNext } }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, } ); @@ -630,6 +630,6 @@ export * as alias from './file';`, { export {Foo}; `, { options: { compilerOptions: { module: ts.ModuleKind.ESNext, target: ts.ScriptTarget.ESNext } }, - testVerbatimModuleSyntax: true + testVerbatimModuleSyntax: true, }); }); diff --git a/src/testRunner/unittests/transform.ts b/src/testRunner/unittests/transform.ts index aa277bd21f536..e45199bf3b6a2 100644 --- a/src/testRunner/unittests/transform.ts +++ b/src/testRunner/unittests/transform.ts @@ -63,7 +63,7 @@ describe("unittests:: TransformAPI", () => { ts.factory.createTaggedTemplateExpression( ts.factory.createIdentifier("$tpl"), /*typeArguments*/ undefined, - ts.factory.createNoSubstitutionTemplateLiteral("foo", "foo"))) + ts.factory.createNoSubstitutionTemplateLiteral("foo", "foo"))), ]); } @@ -71,7 +71,7 @@ describe("unittests:: TransformAPI", () => { const transformed = ts.transform(ts.createSourceFile("source.ts", sourceText, ts.ScriptTarget.ES2015), transformers); const printer = ts.createPrinter({ newLine: ts.NewLineKind.CarriageReturnLineFeed }, { onEmitNode: transformed.emitNodeWithNotification, - substituteNode: transformed.substituteNode + substituteNode: transformed.substituteNode, }); const result = printer.printBundle(ts.factory.createBundle(transformed.transformed)); transformed.dispose(); @@ -110,7 +110,7 @@ describe("unittests:: TransformAPI", () => { return transformSourceFile(`let a: () => void`, [ context => file => ts.visitNode(file, function visitor(node: ts.Node): ts.VisitResult { return ts.visitEachChild(node, visitor, context); - }, ts.isSourceFile) + }, ts.isSourceFile), ]); }); @@ -121,7 +121,7 @@ describe("unittests:: TransformAPI", () => { return ts.factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword); } return ts.visitEachChild(node, visitor, context); - }, ts.isSourceFile) + }, ts.isSourceFile), ]); }); @@ -129,11 +129,11 @@ describe("unittests:: TransformAPI", () => { return ts.transpileModule(`var oldName = undefined;`, { transformers: { before: [replaceUndefinedWithVoid0], - after: [replaceIdentifiersNamedOldNameWithNewName] + after: [replaceIdentifiersNamedOldNameWithNewName], }, compilerOptions: { - newLine: ts.NewLineKind.CarriageReturnLineFeed - } + newLine: ts.NewLineKind.CarriageReturnLineFeed, + }, }).outputText; }); @@ -144,20 +144,20 @@ describe("unittests:: TransformAPI", () => { }, compilerOptions: { target: ts.ScriptTarget.ES5, - newLine: ts.NewLineKind.CarriageReturnLineFeed - } + newLine: ts.NewLineKind.CarriageReturnLineFeed, + }, }).outputText; }); testBaseline("issue27854", () => { return ts.transpileModule(`oldName<{ a: string; }>\` ... \`;`, { transformers: { - before: [replaceIdentifiersNamedOldNameWithNewName2] + before: [replaceIdentifiersNamedOldNameWithNewName2], }, compilerOptions: { newLine: ts.NewLineKind.CarriageReturnLineFeed, - target: ts.ScriptTarget.Latest - } + target: ts.ScriptTarget.Latest, + }, }).outputText; }); @@ -177,7 +177,7 @@ describe("unittests:: TransformAPI", () => { context.factory.createArrayLiteralExpression([firstVarName, secondVarName]) ), ])); - } + }, ]); }); @@ -188,7 +188,7 @@ describe("unittests:: TransformAPI", () => { }, compilerOptions: { newLine: ts.NewLineKind.CarriageReturnLineFeed, - } + }, }).outputText; }); @@ -204,7 +204,7 @@ describe("unittests:: TransformAPI", () => { target: ts.ScriptTarget.ESNext, newLine: ts.NewLineKind.CarriageReturnLineFeed, useDefineForClassFields: false, - } + }, }).outputText; }); @@ -218,7 +218,7 @@ describe("unittests:: TransformAPI", () => { compilerOptions: { target: ts.ScriptTarget.ESNext, newLine: ts.NewLineKind.CarriageReturnLineFeed, - } + }, }).outputText; }); @@ -230,7 +230,7 @@ describe("unittests:: TransformAPI", () => { compilerOptions: { target: ts.ScriptTarget.ESNext, newLine: ts.NewLineKind.CarriageReturnLineFeed, - } + }, }).outputText; function replaceWithClassAndNamespace() { @@ -240,7 +240,7 @@ describe("unittests:: TransformAPI", () => { sourceFile, ts.factory.createNodeArray([ ts.factory.createClassDeclaration(/*modifiers*/ undefined, "Foo", /*typeParameters*/ undefined, /*heritageClauses*/ undefined, /*members*/ undefined!), // TODO: GH#18217 - ts.factory.createModuleDeclaration(/*modifiers*/ undefined, ts.factory.createIdentifier("Foo"), ts.factory.createModuleBlock([ts.factory.createEmptyStatement()])) + ts.factory.createModuleDeclaration(/*modifiers*/ undefined, ts.factory.createIdentifier("Foo"), ts.factory.createModuleBlock([ts.factory.createEmptyStatement()])), ]) ); return result; @@ -271,7 +271,7 @@ describe("unittests:: TransformAPI", () => { compilerOptions: { target: ts.ScriptTarget.ESNext, newLine: ts.NewLineKind.CarriageReturnLineFeed, - } + }, }).outputText; function expandExportStar(context: ts.TransformationContext) { @@ -305,7 +305,7 @@ describe("unittests:: TransformAPI", () => { module: ts.ModuleKind.System, newLine: ts.NewLineKind.CarriageReturnLineFeed, moduleDetection: ts.ModuleDetectionKind.Force, - } + }, }).outputText; function transformAddImportStar(_context: ts.TransformationContext) { @@ -338,7 +338,7 @@ describe("unittests:: TransformAPI", () => { target: ScriptTarget.ES5, experimentalDecorators: true, newLine: NewLineKind.CarriageReturnLineFeed, - } + }, }).outputText; function transformAddDecoratedNode(_context: ts.TransformationContext) { @@ -348,7 +348,7 @@ describe("unittests:: TransformAPI", () => { function visitNode(sf: ts.SourceFile) { // produce `class Foo { @Bar baz() {} }`; const classDecl = ts.factory.createClassDeclaration(/*modifiers*/ undefined, "Foo", /*typeParameters*/ undefined, /*heritageClauses*/ undefined, [ - ts.factory.createMethodDeclaration([ts.factory.createDecorator(ts.factory.createIdentifier("Bar"))], /*asteriskToken*/ undefined, "baz", /*questionToken*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.factory.createBlock([])) + ts.factory.createMethodDeclaration([ts.factory.createDecorator(ts.factory.createIdentifier("Bar"))], /*asteriskToken*/ undefined, "baz", /*questionToken*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.factory.createBlock([])), ]); return ts.factory.updateSourceFile(sf, [classDecl]); } @@ -358,12 +358,12 @@ describe("unittests:: TransformAPI", () => { testBaseline("transformDeclarationFile", () => { return baselineDeclarationTransform(`var oldName = undefined;`, { transformers: { - afterDeclarations: [replaceIdentifiersNamedOldNameWithNewName] + afterDeclarations: [replaceIdentifiersNamedOldNameWithNewName], }, compilerOptions: { newLine: ts.NewLineKind.CarriageReturnLineFeed, - declaration: true - } + declaration: true, + }, }); }); @@ -377,7 +377,7 @@ describe("unittests:: TransformAPI", () => { target: ScriptTarget.ES5, newLine: NewLineKind.CarriageReturnLineFeed, experimentalDecorators: true, - } + }, }).outputText; function transformAddParameterProperty(_context: ts.TransformationContext) { @@ -389,7 +389,7 @@ describe("unittests:: TransformAPI", () => { // The decorator is required to trigger ts.ts transformations. const classDecl = ts.factory.createClassDeclaration([], "Foo", /*typeParameters*/ undefined, /*heritageClauses*/ undefined, [ ts.factory.createConstructorDeclaration(/*modifiers*/ undefined, [ - ts.factory.createParameterDeclaration([ts.factory.createDecorator(ts.factory.createIdentifier("Dec")), ts.factory.createModifier(ts.SyntaxKind.PrivateKeyword)], /*dotDotDotToken*/ undefined, "x")], ts.factory.createBlock([])) + ts.factory.createParameterDeclaration([ts.factory.createDecorator(ts.factory.createIdentifier("Dec")), ts.factory.createModifier(ts.SyntaxKind.PrivateKeyword)], /*dotDotDotToken*/ undefined, "x")], ts.factory.createBlock([])), ]); return ts.factory.updateSourceFile(sf, [classDecl]); } @@ -430,7 +430,7 @@ describe("unittests:: TransformAPI", () => { compilerOptions: { target: ts.ScriptTarget.ES5, newLine: ts.NewLineKind.CarriageReturnLineFeed, - } + }, }).outputText; }); @@ -446,7 +446,7 @@ export {exportedSeparately}; compilerOptions: { target: ts.ScriptTarget.ES5, newLine: ts.NewLineKind.CarriageReturnLineFeed, - } + }, }).outputText; }); @@ -467,7 +467,7 @@ export {Value}; compilerOptions: { target: ts.ScriptTarget.ES5, newLine: ts.NewLineKind.CarriageReturnLineFeed, - } + }, }).outputText; }); @@ -490,7 +490,7 @@ class Clazz { compilerOptions: { target: ts.ScriptTarget.ES2015, newLine: ts.NewLineKind.CarriageReturnLineFeed, - } + }, }).outputText; }); @@ -511,7 +511,7 @@ namespace Foo { compilerOptions: { target: ts.ScriptTarget.ES2015, newLine: ts.NewLineKind.CarriageReturnLineFeed, - } + }, }).outputText; }); @@ -528,7 +528,7 @@ module MyModule { compilerOptions: { target: ts.ScriptTarget.ES2015, newLine: ts.NewLineKind.CarriageReturnLineFeed, - } + }, }).outputText; function renameVariable(context: ts.TransformationContext) { @@ -555,7 +555,7 @@ module MyModule { const program = ts.createProgram(["source.ts"], { target: ts.ScriptTarget.ES3, module: ts.ModuleKind.None, - noLib: true + noLib: true, }, host); program.emit(transformedSourceFile, (_p, s, b) => host.writeFile("source.js", s, b)); return host.readFile("source.js")!.toString(); @@ -589,8 +589,8 @@ module MyModule { newLine: ts.NewLineKind.CarriageReturnLineFeed, }, transformers: { - before: [transformSourceFile] - } + before: [transformSourceFile], + }, }).outputText; function transformSourceFile(context: ts.TransformationContext): ts.Transformer { @@ -650,7 +650,7 @@ class MyClass { target: ScriptTarget.ES2015, experimentalDecorators: true, newLine: NewLineKind.CarriageReturnLineFeed, - } + }, }).outputText; }); @@ -666,7 +666,7 @@ const MyClass = class { target: ScriptTarget.ES2015, experimentalDecorators: true, newLine: NewLineKind.CarriageReturnLineFeed, - } + }, }).outputText; }); @@ -693,7 +693,7 @@ function test () { target: ScriptTarget.ES2015, experimentalDecorators: true, newLine: NewLineKind.CarriageReturnLineFeed, - } + }, }).outputText; }); }); diff --git a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts index 848b58933edef..8fb0a8d205b5a 100644 --- a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts +++ b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts @@ -13,7 +13,7 @@ import { enableStrict, loadProjectFromDisk, removeRest, - replaceText + replaceText, } from "../helpers/vfs"; describe("unittests:: tsbuild:: outFile:: on amd modules with --out", () => { @@ -34,7 +34,7 @@ describe("unittests:: tsbuild:: outFile:: on amd modules with --out", () => { function verifyOutFileScenario({ subScenario, modifyFs, - modifyAgainFs + modifyAgainFs, }: VerifyOutFileScenarioInput) { verifyTsc({ scenario: "amdModulesWithOut", @@ -46,13 +46,13 @@ describe("unittests:: tsbuild:: outFile:: on amd modules with --out", () => { edits: [ { caption: "incremental-declaration-doesnt-change", - edit: fs => appendText(fs, "/src/lib/file1.ts", "console.log(x);") + edit: fs => appendText(fs, "/src/lib/file1.ts", "console.log(x);"), }, ...(modifyAgainFs ? [{ caption: "incremental-headers-change-without-dts-changes", - edit: modifyAgainFs + edit: modifyAgainFs, }] : ts.emptyArray), - ] + ], }); } @@ -79,7 +79,7 @@ describe("unittests:: tsbuild:: outFile:: on amd modules with --out", () => { addTestPrologue(fs, "/src/app/file3.ts", `"myPrologue"`); addTestPrologue(fs, "/src/app/file4.ts", `"myPrologue2";`); }, - modifyAgainFs: fs => addTestPrologue(fs, "/src/lib/file1.ts", `"myPrologue5"`) + modifyAgainFs: fs => addTestPrologue(fs, "/src/lib/file1.ts", `"myPrologue5"`), }); }); @@ -106,7 +106,7 @@ describe("unittests:: tsbuild:: outFile:: on amd modules with --out", () => { addRest(fs, "app", "file3"); addSpread(fs, "app", "file4"); }, - modifyAgainFs: fs => removeRest(fs, "lib", "file1") + modifyAgainFs: fs => removeRest(fs, "lib", "file1"), }); }); @@ -118,7 +118,7 @@ describe("unittests:: tsbuild:: outFile:: on amd modules with --out", () => { modifyFs: fs => { addTripleSlashRef(fs, "lib", "file0"); addTripleSlashRef(fs, "app", "file4"); - } + }, }); }); diff --git a/src/testRunner/unittests/tsbuild/commandLine.ts b/src/testRunner/unittests/tsbuild/commandLine.ts index 6ad3d9a8ac5d9..8eaa582af6102 100644 --- a/src/testRunner/unittests/tsbuild/commandLine.ts +++ b/src/testRunner/unittests/tsbuild/commandLine.ts @@ -7,7 +7,7 @@ import { } from "../helpers/tsc"; import { appendText, - loadProjectFromFiles, replaceText + loadProjectFromFiles, replaceText, } from "../helpers/vfs"; describe("unittests:: tsbuild:: commandLine::", () => { @@ -16,7 +16,7 @@ describe("unittests:: tsbuild:: commandLine::", () => { return { caption, edit: ts.noop, - commandLineArgs: ["--b", "/src/project", "--verbose", ...options] + commandLineArgs: ["--b", "/src/project", "--verbose", ...options], }; } function noChangeWithSubscenario(caption: string): TestTscEdit { @@ -28,7 +28,7 @@ describe("unittests:: tsbuild:: commandLine::", () => { discrepancyExplanation: () => [ `Clean build tsbuildinfo will have compilerOptions with composite and ${option.replace(/-/g, "")}`, `Incremental build will detect that it doesnt need to rebuild so tsbuild info is from before which has option composite only`, - ] + ], }; } function withEmitDeclarationOnlyChangeAndDiscrepancyExplanation(caption: string): TestTscEdit { @@ -37,7 +37,7 @@ describe("unittests:: tsbuild:: commandLine::", () => { edit.discrepancyExplanation = () => [ ...discrepancyExplanation(), `Clean build info does not have js section because its fresh build`, - `Incremental build info has js section from old build` + `Incremental build info has js section from old build`, ]; return edit; } @@ -207,7 +207,7 @@ describe("unittests:: tsbuild:: commandLine::", () => { discrepancyExplanation: () => [ `Clean build tsbuildinfo for both projects will have compilerOptions with composite and emitDeclarationOnly`, `Incremental build will detect that it doesnt need to rebuild so tsbuild info for projects is from before which has option composite only`, - ] + ], }, { caption: "js emit with change without emitDeclarationOnly", @@ -256,7 +256,7 @@ describe("unittests:: tsbuild:: commandLine::", () => { discrepancyExplanation: () => [ `Clean build tsbuildinfo for both projects will have compilerOptions with composite and emitDeclarationOnly`, `Incremental build will detect that it doesnt need to rebuild so tsbuild info for projects is from before which has option composite as true but emitDeclrationOnly as false`, - ] + ], }, { caption: "no change run with js emit", diff --git a/src/testRunner/unittests/tsbuild/configFileErrors.ts b/src/testRunner/unittests/tsbuild/configFileErrors.ts index 63d9c2bb70dd2..4b85c7429e44f 100644 --- a/src/testRunner/unittests/tsbuild/configFileErrors.ts +++ b/src/testRunner/unittests/tsbuild/configFileErrors.ts @@ -6,7 +6,7 @@ import { import { appendText, loadProjectFromDisk, - loadProjectFromFiles, replaceText + loadProjectFromFiles, replaceText, } from "../helpers/vfs"; describe("unittests:: tsbuild:: configFileErrors:: when tsconfig extends the missing file", () => { @@ -34,7 +34,7 @@ describe("unittests:: tsbuild:: configFileErrors:: reports syntax errors in conf "a.ts" "b.ts" ] -}` +}`, }), commandLineArgs: ["--b", "/src/tsconfig.json"], edits: [ @@ -57,11 +57,11 @@ describe("unittests:: tsbuild:: configFileErrors:: reports syntax errors in conf "/src/tsconfig.json", JSON.stringify({ compilerOptions: { composite: true, declaration: true }, - files: ["a.ts", "b.ts"] + files: ["a.ts", "b.ts"], }) ), - caption: "builds after fixing config file errors" + caption: "builds after fixing config file errors", }, - ] + ], }); }); diff --git a/src/testRunner/unittests/tsbuild/configFileExtends.ts b/src/testRunner/unittests/tsbuild/configFileExtends.ts index 0344e78889721..57b34c55c4ac0 100644 --- a/src/testRunner/unittests/tsbuild/configFileExtends.ts +++ b/src/testRunner/unittests/tsbuild/configFileExtends.ts @@ -9,12 +9,12 @@ describe("unittests:: tsbuild:: configFileExtends:: when tsconfig extends anothe "/src/tsconfig.json": JSON.stringify({ references: [ { path: "./shared/tsconfig.json" }, - { path: "./webpack/tsconfig.json" } + { path: "./webpack/tsconfig.json" }, ], - files: [] + files: [], }), "/src/shared/tsconfig-base.json": JSON.stringify({ - include: ["./typings-base/"] + include: ["./typings-base/"], }), "/src/shared/typings-base/globals.d.ts": `type Unrestricted = any;`, "/src/shared/tsconfig.json": JSON.stringify({ @@ -22,9 +22,9 @@ describe("unittests:: tsbuild:: configFileExtends:: when tsconfig extends anothe compilerOptions: { composite: true, outDir: "../target-tsc-build/", - rootDir: ".." + rootDir: "..", }, - files: ["./index.ts"] + files: ["./index.ts"], }), "/src/shared/index.ts": `export const a: Unrestricted = 1;`, "/src/webpack/tsconfig.json": JSON.stringify({ @@ -32,10 +32,10 @@ describe("unittests:: tsbuild:: configFileExtends:: when tsconfig extends anothe compilerOptions: { composite: true, outDir: "../target-tsc-build/", - rootDir: ".." + rootDir: "..", }, files: ["./index.ts"], - references: [{ path: "../shared/tsconfig.json" }] + references: [{ path: "../shared/tsconfig.json" }], }), "/src/webpack/index.ts": `export const b: Unrestricted = 1;`, }); diff --git a/src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts b/src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts index 7936c58b6672e..c45834e7ea81a 100644 --- a/src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts +++ b/src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts @@ -4,7 +4,7 @@ import { } from "../helpers/tsc"; import { loadProjectFromDisk, - loadProjectFromFiles, replaceText + loadProjectFromFiles, replaceText, } from "../helpers/vfs"; describe("unittests:: tsbuild:: when containerOnly project is referenced", () => { @@ -13,7 +13,7 @@ describe("unittests:: tsbuild:: when containerOnly project is referenced", () => subScenario: "verify that subsequent builds after initial build doesnt build anything", fs: () => loadProjectFromDisk("tests/projects/containerOnlyReferenced"), commandLineArgs: ["--b", "/src", "--verbose"], - edits: noChangeOnlyRuns + edits: noChangeOnlyRuns, }); verifyTsc({ @@ -31,12 +31,12 @@ describe("unittests:: tsbuild:: when containerOnly project is referenced", () => "/src/project2/src/b.ts": "export const b = 10;", "/src/project3/tsconfig.json": JSON.stringify({ compilerOptions: { composite: true }, - references: [{ path: "../project1", }, { path: "../project2" }], + references: [{ path: "../project1" }, { path: "../project2" }], }), "/src/project3/src/c.ts": "export const c = 10;", "/src/project4/tsconfig.json": JSON.stringify({ compilerOptions: { composite: true }, - references: [{ path: "../project3" }] + references: [{ path: "../project3" }], }), "/src/project4/src/d.ts": "export const d = 10;", }), diff --git a/src/testRunner/unittests/tsbuild/declarationEmit.ts b/src/testRunner/unittests/tsbuild/declarationEmit.ts index 30c28dafd7c6f..3be319c4d6512 100644 --- a/src/testRunner/unittests/tsbuild/declarationEmit.ts +++ b/src/testRunner/unittests/tsbuild/declarationEmit.ts @@ -11,24 +11,24 @@ describe("unittests:: tsbuild:: declarationEmit", () => { "/src/solution/tsconfig.base.json": JSON.stringify({ compilerOptions: { rootDir: "./", - outDir: "lib" - } + outDir: "lib", + }, }), "/src/solution/tsconfig.json": JSON.stringify({ compilerOptions: { composite: true }, references: [{ path: "./src" }], - include: [] + include: [], }), "/src/solution/src/tsconfig.json": JSON.stringify({ compilerOptions: { composite: true }, references: [{ path: "./subProject" }, { path: "./subProject2" }], - include: [] + include: [], }), "/src/solution/src/subProject/tsconfig.json": JSON.stringify({ extends: "../../tsconfig.base.json", compilerOptions: { composite: true }, references: [{ path: "../common" }], - include: ["./index.ts"] + include: ["./index.ts"], }), "/src/solution/src/subProject/index.ts": Utils.dedent` import { Nominal } from '../common/nominal'; @@ -37,7 +37,7 @@ export type MyNominal = Nominal;`, extends: "../../tsconfig.base.json", compilerOptions: { composite: true }, references: [{ path: "../subProject" }], - include: ["./index.ts"] + include: ["./index.ts"], }), "/src/solution/src/subProject2/index.ts": Utils.dedent` import { MyNominal } from '../subProject/index'; @@ -50,7 +50,7 @@ export function getVar(): keyof typeof variable { "/src/solution/src/common/tsconfig.json": JSON.stringify({ extends: "../../tsconfig.base.json", compilerOptions: { composite: true }, - include: ["./nominal.ts"] + include: ["./nominal.ts"], }), "/src/solution/src/common/nominal.ts": Utils.dedent` /// @@ -65,7 +65,7 @@ declare type MyNominal = T & { scenario: "declarationEmit", subScenario: "when declaration file is referenced through triple slash", fs: () => loadProjectFromFiles(getFiles()), - commandLineArgs: ["--b", "/src/solution/tsconfig.json", "--verbose"] + commandLineArgs: ["--b", "/src/solution/tsconfig.json", "--verbose"], }); verifyTsc({ @@ -76,10 +76,10 @@ declare type MyNominal = T & { "/src/solution/tsconfig.json": JSON.stringify({ extends: "./tsconfig.base.json", compilerOptions: { composite: true }, - include: ["./src/**/*.ts"] + include: ["./src/**/*.ts"], }), }), - commandLineArgs: ["--b", "/src/solution/tsconfig.json", "--verbose"] + commandLineArgs: ["--b", "/src/solution/tsconfig.json", "--verbose"], }); verifyTsc({ @@ -90,8 +90,8 @@ declare type MyNominal = T & { compilerOptions: { composite: true, baseUrl: ".", - paths: { "@fluentui/*": ["packages/*/src"] } - } + paths: { "@fluentui/*": ["packages/*/src"] }, + }, }), "/src/packages/pkg1/src/index.ts": Utils.dedent` export interface IThing { @@ -103,7 +103,7 @@ export interface IThings { "/src/packages/pkg1/tsconfig.json": JSON.stringify({ extends: "../../tsconfig", compilerOptions: { outDir: "lib" }, - include: ["src"] + include: ["src"], }), "/src/packages/pkg2/src/index.ts": Utils.dedent` import { IThings } from '@fluentui/pkg1'; @@ -115,9 +115,9 @@ export function fn4() { extends: "../../tsconfig", compilerOptions: { outDir: "lib" }, include: ["src"], - references: [{ path: "../pkg1" }] + references: [{ path: "../pkg1" }], }), }), - commandLineArgs: ["--b", "/src/packages/pkg2/tsconfig.json", "--verbose"] + commandLineArgs: ["--b", "/src/packages/pkg2/tsconfig.json", "--verbose"], }); }); diff --git a/src/testRunner/unittests/tsbuild/demo.ts b/src/testRunner/unittests/tsbuild/demo.ts index c05cff7be93d1..6f186f9ce1999 100644 --- a/src/testRunner/unittests/tsbuild/demo.ts +++ b/src/testRunner/unittests/tsbuild/demo.ts @@ -5,7 +5,7 @@ import { import { loadProjectFromDisk, prependText, - replaceText + replaceText, } from "../helpers/vfs"; describe("unittests:: tsbuild:: on demo project", () => { @@ -22,7 +22,7 @@ describe("unittests:: tsbuild:: on demo project", () => { scenario: "demo", subScenario: "in master branch with everything setup correctly and reports no error", fs: () => projFs, - commandLineArgs: ["--b", "/src/tsconfig.json", "--verbose"] + commandLineArgs: ["--b", "/src/tsconfig.json", "--verbose"], }); verifyTsc({ @@ -40,7 +40,7 @@ describe("unittests:: tsbuild:: on demo project", () => { "path": "../zoo" } ]` - ) + ), }); verifyTsc({ scenario: "demo", @@ -52,6 +52,6 @@ describe("unittests:: tsbuild:: on demo project", () => { "/src/core/utilities.ts", `import * as A from '../animals'; ` - ) + ), }); }); diff --git a/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts b/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts index 5c4324e80a360..e88e1765428c0 100644 --- a/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts +++ b/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts @@ -4,7 +4,7 @@ import { } from "../helpers/tsc"; import { loadProjectFromDisk, - replaceText + replaceText, } from "../helpers/vfs"; describe("unittests:: tsbuild:: on project with emitDeclarationOnly set to true", () => { diff --git a/src/testRunner/unittests/tsbuild/exitCodeOnBogusFile.ts b/src/testRunner/unittests/tsbuild/exitCodeOnBogusFile.ts index 7bdf03df92d98..cb1a2da8f04e2 100644 --- a/src/testRunner/unittests/tsbuild/exitCodeOnBogusFile.ts +++ b/src/testRunner/unittests/tsbuild/exitCodeOnBogusFile.ts @@ -9,6 +9,6 @@ describe("unittests:: tsbuild:: exitCodeOnBogusFile:: test exit code", () => { scenario: "exitCodeOnBogusFile", subScenario: `test exit code`, fs: () => loadProjectFromFiles({}), - commandLineArgs: ["-b", "bogus.json"] + commandLineArgs: ["-b", "bogus.json"], }); }); diff --git a/src/testRunner/unittests/tsbuild/fileDelete.ts b/src/testRunner/unittests/tsbuild/fileDelete.ts index e8768911cad33..c35a0ef84c8e5 100644 --- a/src/testRunner/unittests/tsbuild/fileDelete.ts +++ b/src/testRunner/unittests/tsbuild/fileDelete.ts @@ -1,6 +1,6 @@ import * as ts from "../../_namespaces/ts"; import { - dedent + dedent, } from "../../_namespaces/Utils"; import { compilerOptionsToConfigJson } from "../helpers/contents"; import { @@ -54,7 +54,7 @@ describe("unittests:: tsbuild:: fileDelete::", () => { discrepancyExplanation: () => [ "Clean build will not have latestChangedDtsFile as there was no emit and emitSignatures as undefined for files", "Incremental will store the past latestChangedDtsFile and emitSignatures", - ] + ], }], }); @@ -65,7 +65,7 @@ describe("unittests:: tsbuild:: fileDelete::", () => { fs: () => fs({ composite: true, outFile: "../childResult.js", module: ts.ModuleKind.AMD }, { composite: true, outFile: "../mainResult.js", module: ts.ModuleKind.AMD }), edits: [{ caption: "delete child2 file", - edit: fs => fs.rimrafSync("/src/child/child2.ts") + edit: fs => fs.rimrafSync("/src/child/child2.ts"), }], }); @@ -79,7 +79,7 @@ describe("unittests:: tsbuild:: fileDelete::", () => { edit: fs => { fs.rimrafSync("/src/child/child2.ts"); fs.rimrafSync("/src/child/child2.js"); - } + }, }], }); diff --git a/src/testRunner/unittests/tsbuild/graphOrdering.ts b/src/testRunner/unittests/tsbuild/graphOrdering.ts index b5fefcf3386a7..65aa2243d7036 100644 --- a/src/testRunner/unittests/tsbuild/graphOrdering.ts +++ b/src/testRunner/unittests/tsbuild/graphOrdering.ts @@ -15,7 +15,7 @@ describe("unittests:: tsbuild - graph-ordering", () => { ["H", "I"], ["I", "J"], ["J", "H"], - ["J", "E"] + ["J", "E"], ]; before(() => { @@ -83,7 +83,7 @@ describe("unittests:: tsbuild - graph-ordering", () => { const configContent = JSON.stringify({ compilerOptions: { composite: true }, files: [`./${proj}.ts`], - references: deps.filter(d => d[0] === proj).map(d => ({ path: `../${d[1]}` })) + references: deps.filter(d => d[0] === proj).map(d => ({ path: `../${d[1]}` })), }, undefined, 2); fileSystem.writeFileSync(configFileName, configContent); projFileNames.push(configFileName); diff --git a/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts b/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts index 2c120f994aefe..7cb049ffcbc9e 100644 --- a/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts +++ b/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts @@ -5,7 +5,7 @@ import { import { appendText, loadProjectFromDisk, - replaceText + replaceText, } from "../helpers/vfs"; describe("unittests:: tsbuild:: inferredTypeFromTransitiveModule::", () => { @@ -43,13 +43,13 @@ describe("unittests:: tsbuild:: inferredTypeFromTransitiveModule::", () => { edits: [ { caption: "incremental-declaration-changes", - edit: changeBarParam + edit: changeBarParam, }, { caption: "incremental-declaration-changes", edit: changeBarParamBack, }, - ] + ], }); verifyTsc({ @@ -66,7 +66,7 @@ bar("hello");`); edits: [ { caption: "incremental-declaration-changes", - edit: changeBarParam + edit: changeBarParam, }, { caption: "incremental-declaration-changes", @@ -74,13 +74,13 @@ bar("hello");`); }, { caption: "incremental-declaration-changes", - edit: changeBarParam + edit: changeBarParam, }, { caption: "Fix Error", - edit: fs => replaceText(fs, "/src/lazyIndex.ts", `bar("hello")`, "bar()") + edit: fs => replaceText(fs, "/src/lazyIndex.ts", `bar("hello")`, "bar()"), }, - ] + ], }); }); diff --git a/src/testRunner/unittests/tsbuild/javascriptProjectEmit.ts b/src/testRunner/unittests/tsbuild/javascriptProjectEmit.ts index d07751ec262d8..9c01ca171514a 100644 --- a/src/testRunner/unittests/tsbuild/javascriptProjectEmit.ts +++ b/src/testRunner/unittests/tsbuild/javascriptProjectEmit.ts @@ -5,7 +5,7 @@ import { } from "../helpers/tsc"; import { loadProjectFromFiles, - replaceText + replaceText, } from "../helpers/vfs"; describe("unittests:: tsbuild:: javascriptProjectEmit::", () => { @@ -94,7 +94,7 @@ describe("unittests:: tsbuild:: javascriptProjectEmit::", () => { } }`, }, symbolLibContent), - commandLineArgs: ["-b", "/src"] + commandLineArgs: ["-b", "/src"], }); verifyTsc({ @@ -190,8 +190,8 @@ describe("unittests:: tsbuild:: javascriptProjectEmit::", () => { commandLineArgs: ["-b", "/src"], edits: [{ caption: "incremental-declaration-doesnt-change", - edit: fs => replaceText(fs, "/src/sub-project/index.js", "null", "undefined") - }] + edit: fs => replaceText(fs, "/src/sub-project/index.js", "null", "undefined"), + }], }); verifyTsc({ @@ -278,6 +278,6 @@ describe("unittests:: tsbuild:: javascriptProjectEmit::", () => { } }`, }, symbolLibContent), - commandLineArgs: ["-b", "/src"] + commandLineArgs: ["-b", "/src"], }); }); diff --git a/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts b/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts index bee588739366e..3d47aaad0207d 100644 --- a/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts +++ b/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts @@ -4,7 +4,7 @@ import { import { appendText, loadProjectFromDisk, - replaceText + replaceText, } from "../helpers/vfs"; describe("unittests:: tsbuild:: lateBoundSymbol:: interface is merged and contains late bound member", () => { @@ -22,6 +22,6 @@ describe("unittests:: tsbuild:: lateBoundSymbol:: interface is merged and contai caption: "incremental-declaration-doesnt-change", edit: fs => appendText(fs, "/src/src/main.ts", "const x = 10;"), }, - ] + ], }); }); diff --git a/src/testRunner/unittests/tsbuild/moduleResolution.ts b/src/testRunner/unittests/tsbuild/moduleResolution.ts index e6e718526c94d..ed67c125b182e 100644 --- a/src/testRunner/unittests/tsbuild/moduleResolution.ts +++ b/src/testRunner/unittests/tsbuild/moduleResolution.ts @@ -18,22 +18,22 @@ describe("unittests:: tsbuild:: moduleResolution:: handles the modules and optio path: `/user/username/projects/myproject/packages/pkg1/index.ts`, content: Utils.dedent` import type { TheNum } from 'pkg2' - export const theNum: TheNum = 42;` + export const theNum: TheNum = 42;`, }, { path: `/user/username/projects/myproject/packages/pkg1/tsconfig.json`, content: JSON.stringify({ compilerOptions: { outDir: "build", ...optionsToExtend }, - references: [{ path: "../pkg2" }] - }) + references: [{ path: "../pkg2" }], + }), }, { path: `/user/username/projects/myproject/packages/pkg2/const.ts`, - content: `export type TheNum = 42;` + content: `export type TheNum = 42;`, }, { path: `/user/username/projects/myproject/packages/pkg2/index.ts`, - content: `export type { TheNum } from 'const';` + content: `export type { TheNum } from 'const';`, }, { path: `/user/username/projects/myproject/packages/pkg2/tsconfig.json`, @@ -42,9 +42,9 @@ describe("unittests:: tsbuild:: moduleResolution:: handles the modules and optio composite: true, outDir: "build", baseUrl: ".", - ...optionsToExtend - } - }) + ...optionsToExtend, + }, + }), }, { path: `/user/username/projects/myproject/packages/pkg2/package.json`, @@ -52,13 +52,13 @@ describe("unittests:: tsbuild:: moduleResolution:: handles the modules and optio name: "pkg2", version: "1.0.0", main: "build/index.js", - }) + }), }, { path: `/user/username/projects/myproject/node_modules/pkg2`, symLink: `/user/username/projects/myproject/packages/pkg2`, }, - libFile + libFile, ], { currentDirectory: "/user/username/projects/myproject" }); } @@ -83,13 +83,13 @@ describe("unittests:: tsbuild:: moduleResolution:: handles the modules and optio "/src/packages/pkg1_index.ts": `export const theNum: TheNum = "type1";`, "/src/packages/pkg1.tsconfig.json": JSON.stringify({ compilerOptions: { composite: true, typeRoots: ["./typeroot1"] }, - files: ["./pkg1_index.ts"] + files: ["./pkg1_index.ts"], }), "/src/packages/typeroot1/sometype/index.d.ts": Utils.dedent`declare type TheNum = "type1";`, "/src/packages/pkg2_index.ts": `export const theNum: TheNum2 = "type2";`, "/src/packages/pkg2.tsconfig.json": JSON.stringify({ compilerOptions: { composite: true, typeRoots: ["./typeroot2"] }, - files: ["./pkg2_index.ts"] + files: ["./pkg2_index.ts"], }), "/src/packages/typeroot2/sometype/index.d.ts": Utils.dedent`declare type TheNum2 = "type2";`, }), @@ -104,18 +104,18 @@ describe("unittests:: tsbuild:: moduleResolution:: impliedNodeFormat differs bet fs: () => loadProjectFromFiles({ "/src/projects/a/src/index.ts": "", "/src/projects/a/tsconfig.json": JSON.stringify({ - compilerOptions: { strict: true } + compilerOptions: { strict: true }, }), "/src/projects/b/src/index.ts": Utils.dedent` import pg from "pg"; pg.foo(); `, "/src/projects/b/tsconfig.json": JSON.stringify({ - compilerOptions: { strict: true, module: "node16" } + compilerOptions: { strict: true, module: "node16" }, }), "/src/projects/b/package.json": JSON.stringify({ name: "b", - type: "module" + type: "module", }), "/src/projects/node_modules/@types/pg/index.d.ts": "export function foo(): void;", "/src/projects/node_modules/@types/pg/package.json": JSON.stringify({ @@ -125,6 +125,6 @@ describe("unittests:: tsbuild:: moduleResolution:: impliedNodeFormat differs bet }), modifyFs: fs => fs.writeFileSync("/lib/lib.es2022.full.d.ts", libFile.content), commandLineArgs: ["-b", "/src/projects/a", "/src/projects/b", "--verbose", "--traceResolution", "--explainFiles"], - edits: noChangeOnlyRuns + edits: noChangeOnlyRuns, }); }); \ No newline at end of file diff --git a/src/testRunner/unittests/tsbuild/moduleSpecifiers.ts b/src/testRunner/unittests/tsbuild/moduleSpecifiers.ts index b42439f099569..fbd4bf371bca2 100644 --- a/src/testRunner/unittests/tsbuild/moduleSpecifiers.ts +++ b/src/testRunner/unittests/tsbuild/moduleSpecifiers.ts @@ -90,9 +90,9 @@ describe("unittests:: tsbuild:: moduleSpecifiers:: synthesized module specifiers { "path": "./solution" } ], "include": [] - }` + }`, }, symbolLibContent), - commandLineArgs: ["-b", "/src", "--verbose"] + commandLineArgs: ["-b", "/src", "--verbose"], }); }); @@ -189,6 +189,6 @@ describe("unittests:: tsbuild:: moduleSpecifiers:: synthesized module specifiers fs.symlinkSync("/src", "/src/src-types/node_modules"); fs.symlinkSync("/src", "/src/src-dogs/node_modules"); }, - commandLineArgs: ["-b", "src/src-types", "src/src-dogs", "--verbose"] + commandLineArgs: ["-b", "src/src-types", "src/src-dogs", "--verbose"], }); }); diff --git a/src/testRunner/unittests/tsbuild/noEmit.ts b/src/testRunner/unittests/tsbuild/noEmit.ts index 3f0e6f278d949..77a0faf2e59a4 100644 --- a/src/testRunner/unittests/tsbuild/noEmit.ts +++ b/src/testRunner/unittests/tsbuild/noEmit.ts @@ -12,8 +12,8 @@ describe("unittests:: tsbuild:: noEmit", () => { fs: () => loadProjectFromFiles({ "/src/a.ts": aTsContent, "/src/tsconfig.json": JSON.stringify({ - compilerOptions: { noEmit: true } - }) + compilerOptions: { noEmit: true }, + }), }), commandLineArgs, edits: [ diff --git a/src/testRunner/unittests/tsbuild/outFile.ts b/src/testRunner/unittests/tsbuild/outFile.ts index 1c5a46885fee4..2a944e6e54251 100644 --- a/src/testRunner/unittests/tsbuild/outFile.ts +++ b/src/testRunner/unittests/tsbuild/outFile.ts @@ -21,7 +21,7 @@ import { changeStubToRest, enableStrict, loadProjectFromDisk, prependText, removeRest, - replaceText + replaceText, } from "../helpers/vfs"; describe("unittests:: tsbuild:: outFile::", () => { @@ -70,7 +70,7 @@ describe("unittests:: tsbuild:: outFile::", () => { if (modifyAgainFs) { (edits ??= []).push({ caption: "incremental-headers-change-without-dts-changes", - edit: modifyAgainFs + edit: modifyAgainFs, }); } verifyTsc({ @@ -93,7 +93,7 @@ describe("unittests:: tsbuild:: outFile::", () => { verifyOutFileScenario({ subScenario: "explainFiles", additionalCommandLineArgs: ["--explainFiles"], - baselineOnly: true + baselineOnly: true, }); // Verify baseline with build info + dts unChanged @@ -101,7 +101,7 @@ describe("unittests:: tsbuild:: outFile::", () => { subScenario: "when final project is not composite but uses project references", modifyFs: fs => replaceText(fs, "/src/third/tsconfig.json", `"composite": true,`, ""), ignoreDtsChanged: true, - baselineOnly: true + baselineOnly: true, }); // Verify baseline with build info @@ -110,7 +110,7 @@ describe("unittests:: tsbuild:: outFile::", () => { modifyFs: fs => replaceText(fs, "/src/third/tsconfig.json", `"composite": true,`, `"incremental": true,`), ignoreDtsChanged: true, ignoreDtsUnchanged: true, - baselineOnly: true + baselineOnly: true, }); // Verify baseline with build info @@ -120,7 +120,7 @@ describe("unittests:: tsbuild:: outFile::", () => { "tsBuildInfoFile": "./thirdjs/output/third.tsbuildinfo",`), ignoreDtsChanged: true, ignoreDtsUnchanged: true, - baselineOnly: true + baselineOnly: true, }); function getOutFileFsAfterBuild() { @@ -139,7 +139,7 @@ describe("unittests:: tsbuild:: outFile::", () => { subScenario: "clean projects", fs: getOutFileFsAfterBuild, commandLineArgs: ["--b", "/src/third", "--clean"], - edits: noChangeOnlyRuns + edits: noChangeOnlyRuns, }); verifyTsc({ @@ -168,7 +168,7 @@ describe("unittests:: tsbuild:: outFile::", () => { const buildHost = createSolutionBuilderHostForBaseline(sys, "FakeTSCurrentVersion"); const builder = ts.createSolutionBuilder(buildHost, ["/src/third"], { verbose: true }); sys.exit(builder.build()); - } + }, }); verifyTsc({ @@ -189,8 +189,8 @@ describe("unittests:: tsbuild:: outFile::", () => { caption: "Make incremental build with change in file that doesnt affect dts", edit: fs => appendText(fs, "/src/first/first_PART1.ts", "console.log(s);"), commandLineArgs: ["--b", "/src/third", "--verbose", "--incremental"], - } - ] + }, + ], }); verifyTsc({ @@ -206,7 +206,7 @@ describe("unittests:: tsbuild:: outFile::", () => { fs.utimesSync("/src/first/first_PART1.ts", time, time); }, }, - ] + ], }); verifyTscCompileLike(testTscCompileLike, { @@ -218,7 +218,7 @@ describe("unittests:: tsbuild:: outFile::", () => { const buildHost = createSolutionBuilderHostForBaseline(sys); const builder = ts.createSolutionBuilder(buildHost, ["/src/third/tsconfig.json"], {}); sys.exit(builder.build("/src/second/tsconfig.json")); - } + }, }); verifyTscCompileLike(testTscCompileLike, { @@ -230,7 +230,7 @@ describe("unittests:: tsbuild:: outFile::", () => { const buildHost = createSolutionBuilderHostForBaseline(sys); const builder = ts.createSolutionBuilder(buildHost, ["/src/third/tsconfig.json"], { verbose: true }); sys.exit(builder.clean("/src/second/tsconfig.json")); - } + }, }); describe("Prepend output with .tsbuildinfo", () => { @@ -244,7 +244,7 @@ describe("unittests:: tsbuild:: outFile::", () => { enableStrict(fs, "/src/second/tsconfig.json"); enableStrict(fs, "/src/third/tsconfig.json"); }, - modifyAgainFs: fs => addTestPrologue(fs, "/src/first/first_PART1.ts", `"myPrologue"`) + modifyAgainFs: fs => addTestPrologue(fs, "/src/first/first_PART1.ts", `"myPrologue"`), }); // Verify ignore dtsChanged @@ -253,7 +253,7 @@ describe("unittests:: tsbuild:: outFile::", () => { modifyFs: fs => enableStrict(fs, "/src/second/tsconfig.json"), modifyAgainFs: fs => addTestPrologue(fs, "src/first/first_PART1.ts", `"myPrologue"`), ignoreDtsChanged: true, - baselineOnly: true + baselineOnly: true, }); // Verify initial + incremental edits - sourcemap verification @@ -269,7 +269,7 @@ describe("unittests:: tsbuild:: outFile::", () => { addTestPrologue(fs, "/src/third/third_part1.ts", `"myPrologue";`); addTestPrologue(fs, "/src/third/third_part1.ts", `"myPrologue3";`); }, - modifyAgainFs: fs => addTestPrologue(fs, "/src/first/first_PART1.ts", `"myPrologue5"`) + modifyAgainFs: fs => addTestPrologue(fs, "/src/first/first_PART1.ts", `"myPrologue5"`), }); // Verify ignore dtsChanged @@ -283,7 +283,7 @@ describe("unittests:: tsbuild:: outFile::", () => { }, modifyAgainFs: fs => addTestPrologue(fs, "/src/first/first_PART1.ts", `"myPrologue5"`), ignoreDtsChanged: true, - baselineOnly: true + baselineOnly: true, }); }); @@ -306,7 +306,7 @@ describe("unittests:: tsbuild:: outFile::", () => { subScenario: "shebang in only one dependency project", modifyFs: fs => addShebang(fs, "second", "second_part1"), ignoreDtsChanged: true, - baselineOnly: true + baselineOnly: true, }); }); @@ -320,7 +320,7 @@ describe("unittests:: tsbuild:: outFile::", () => { addRest(fs, "second", "second_part1"); addRest(fs, "third", "third_part1"); }, - modifyAgainFs: fs => removeRest(fs, "first", "first_PART1") + modifyAgainFs: fs => removeRest(fs, "first", "first_PART1"), }); // Verify ignore dtsChanged @@ -332,7 +332,7 @@ describe("unittests:: tsbuild:: outFile::", () => { }, modifyAgainFs: fs => changeStubToRest(fs, "first", "first_PART1"), ignoreDtsChanged: true, - baselineOnly: true + baselineOnly: true, }); // Verify ignore dtsChanged @@ -348,7 +348,7 @@ describe("unittests:: tsbuild:: outFile::", () => { }, modifyAgainFs: fs => removeRest(fs, "first", "first_PART1"), ignoreDtsChanged: true, - baselineOnly: true + baselineOnly: true, }); // Verify ignore dtsChanged @@ -361,7 +361,7 @@ describe("unittests:: tsbuild:: outFile::", () => { }, modifyAgainFs: fs => removeRest(fs, "first", "first_PART1"), ignoreDtsChanged: true, - baselineOnly: true + baselineOnly: true, }); }); @@ -375,7 +375,7 @@ describe("unittests:: tsbuild:: outFile::", () => { addTripleSlashRef(fs, "first", "first_part2"); addTripleSlashRef(fs, "second", "second_part1"); addTripleSlashRef(fs, "third", "third_part1"); - } + }, }); // Verify ignore dtsChanged @@ -383,7 +383,7 @@ describe("unittests:: tsbuild:: outFile::", () => { subScenario: "triple slash refs in one project", modifyFs: fs => addTripleSlashRef(fs, "second", "second_part1"), ignoreDtsChanged: true, - baselineOnly: true + baselineOnly: true, }); }); @@ -451,7 +451,7 @@ ${internal} enum internalEnum { a, b, c }`); modifyFs: fs => stripInternalScenario(fs, /*removeCommentsDisabled*/ true), modifyAgainFs: fs => replaceText(fs, "/src/first/first_PART1.ts", `/*@internal*/ interface`, "interface"), ignoreDtsChanged: true, - baselineOnly: true + baselineOnly: true, }); // Verify ignore dtsChanged @@ -460,7 +460,7 @@ ${internal} enum internalEnum { a, b, c }`); modifyFs: fs => stripInternalScenario(fs, /*removeCommentsDisabled*/ false, /*jsDocStyle*/ true), modifyAgainFs: fs => replaceText(fs, "/src/first/first_PART1.ts", `/**@internal*/ interface`, "interface"), ignoreDtsChanged: true, - baselineOnly: true + baselineOnly: true, }); // Verify ignore dtsChanged @@ -468,7 +468,7 @@ ${internal} enum internalEnum { a, b, c }`); subScenario: "stripInternal jsdoc style with comments emit enabled", modifyFs: fs => stripInternalScenario(fs, /*removeCommentsDisabled*/ true, /*jsDocStyle*/ true), ignoreDtsChanged: true, - baselineOnly: true + baselineOnly: true, }); describe("with three levels of project dependency", () => { @@ -496,7 +496,7 @@ ${internal} enum internalEnum { a, b, c }`); modifyFs: fs => stripInternalWithDependentOrder(fs, /*removeCommentsDisabled*/ true), modifyAgainFs: fs => replaceText(fs, "/src/first/first_PART1.ts", `/*@internal*/ interface`, "interface"), ignoreDtsChanged: true, - baselineOnly: true + baselineOnly: true, }); // Verify ignore dtsChanged @@ -505,7 +505,7 @@ ${internal} enum internalEnum { a, b, c }`); modifyFs: fs => stripInternalWithDependentOrder(fs, /*removeCommentsDisabled*/ false, /*jsDocStyle*/ true), modifyAgainFs: fs => replaceText(fs, "/src/first/first_PART1.ts", `/**@internal*/ interface`, "interface"), ignoreDtsChanged: true, - baselineOnly: true + baselineOnly: true, }); // Verify ignore dtsChanged @@ -513,7 +513,7 @@ ${internal} enum internalEnum { a, b, c }`); subScenario: "stripInternal jsdoc style with comments emit enabled when one-two-three are prepended in order", modifyFs: fs => stripInternalWithDependentOrder(fs, /*removeCommentsDisabled*/ true, /*jsDocStyle*/ true), ignoreDtsChanged: true, - baselineOnly: true + baselineOnly: true, }); }); @@ -553,7 +553,7 @@ ${internal} enum internalEnum { a, b, c }`); }, ignoreDtsChanged: true, ignoreDtsUnchanged: true, - baselineOnly: true + baselineOnly: true, }); // only baseline @@ -587,7 +587,7 @@ ${internal} enum internalEnum { a, b, c }`); }, ignoreDtsChanged: true, ignoreDtsUnchanged: true, - baselineOnly: true + baselineOnly: true, }); verifyOutFileScenario({ @@ -605,9 +605,9 @@ ${internal} enum internalEnum { a, b, c }`); declarationMap: true, skipDefaultLibCheck: true, sourceMap: true, - outFile: "./bin/first-output.js" + outFile: "./bin/first-output.js", }, - files: ["/src/first/first_PART1.ts"] + files: ["/src/first/first_PART1.ts"], })); fs.writeFileSync("/src/third/tsconfig.json", JSON.stringify({ compilerOptions: { @@ -620,9 +620,9 @@ ${internal} enum internalEnum { a, b, c }`); outFile: "./thirdjs/output/third-output.js", }, references: [{ path: "../first", prepend: true }], - files: ["/src/third/third_part1.ts"] + files: ["/src/third/third_part1.ts"], })); - } + }, }); }); @@ -636,7 +636,7 @@ ${internal} enum internalEnum { a, b, c }`); subScenario: "when source files are empty in the own file", modifyFs: makeThirdEmptySourceFile, ignoreDtsChanged: true, - baselineOnly: true + baselineOnly: true, }); // only baseline @@ -650,7 +650,7 @@ ${internal} enum internalEnum { a, b, c }`); }, ignoreDtsChanged: true, ignoreDtsUnchanged: true, - baselineOnly: true + baselineOnly: true, }); }); }); diff --git a/src/testRunner/unittests/tsbuild/outputPaths.ts b/src/testRunner/unittests/tsbuild/outputPaths.ts index 15686987c2239..19e8200823d99 100644 --- a/src/testRunner/unittests/tsbuild/outputPaths.ts +++ b/src/testRunner/unittests/tsbuild/outputPaths.ts @@ -24,7 +24,7 @@ describe("unittests:: tsbuild - output file paths", () => { verifyTsc({ scenario: "outputPaths", commandLineArgs: ["--b", "/src/tsconfig.json", "-v"], - ...input + ...input, }); it("verify getOutputFileNames", () => { @@ -47,9 +47,9 @@ describe("unittests:: tsbuild - output file paths", () => { "/src/src/index.ts": "export const x = 10;", "/src/tsconfig.json": JSON.stringify({ compilerOptions: { - outDir: "dist" - } - }) + outDir: "dist", + }, + }), }), edits, }, ["/src/dist/index.js"]); @@ -61,9 +61,9 @@ describe("unittests:: tsbuild - output file paths", () => { "/src/tsconfig.json": JSON.stringify({ compilerOptions: { outDir: "dist", - composite: true - } - }) + composite: true, + }, + }), }), edits, }, ["/src/dist/src/index.js", "/src/dist/src/index.d.ts"]); @@ -75,9 +75,9 @@ describe("unittests:: tsbuild - output file paths", () => { "/src/tsconfig.json": JSON.stringify({ compilerOptions: { outDir: "dist", - rootDir: "src" - } - }) + rootDir: "src", + }, + }), }), edits, }, ["/src/dist/index.js"]); @@ -90,9 +90,9 @@ describe("unittests:: tsbuild - output file paths", () => { "/src/tsconfig.json": JSON.stringify({ compilerOptions: { outDir: "dist", - rootDir: "src" - } - }) + rootDir: "src", + }, + }), }), edits, }, ["/src/dist/index.js"]); @@ -106,9 +106,9 @@ describe("unittests:: tsbuild - output file paths", () => { compilerOptions: { outDir: "dist", rootDir: "src", - composite: true - } - }) + composite: true, + }, + }), }), edits, }, ["/src/dist/index.js", "/src/dist/index.d.ts"]); diff --git a/src/testRunner/unittests/tsbuild/publicApi.ts b/src/testRunner/unittests/tsbuild/publicApi.ts index 0359a62a7a42a..fbcdc7016916a 100644 --- a/src/testRunner/unittests/tsbuild/publicApi.ts +++ b/src/testRunner/unittests/tsbuild/publicApi.ts @@ -19,9 +19,9 @@ describe("unittests:: tsbuild:: Public API with custom transformers when passed "/src/tsconfig.json": JSON.stringify({ references: [ { path: "./shared/tsconfig.json" }, - { path: "./webpack/tsconfig.json" } + { path: "./webpack/tsconfig.json" }, ], - files: [] + files: [], }), "/src/shared/tsconfig.json": JSON.stringify({ compilerOptions: { composite: true }, @@ -35,7 +35,7 @@ export function f2() { } // trailing`, compilerOptions: { composite: true, }, - references: [{ path: "../shared/tsconfig.json" }] + references: [{ path: "../shared/tsconfig.json" }], }), "/src/webpack/index.ts": `export function f2() { } export class c2 { } @@ -88,7 +88,7 @@ ${baseFsPatch ? vfs.formatPatch(baseFsPatch) : ""} Output:: ${sys.output.join("")} -${patch ? vfs.formatPatch(patch) : ""}` +${patch ? vfs.formatPatch(patch) : ""}`, }; }; diff --git a/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts b/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts index 63d2fbaa35286..bec1f2de39045 100644 --- a/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts +++ b/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts @@ -4,7 +4,7 @@ import { } from "../helpers/tsc"; import { loadProjectFromDisk, - replaceText + replaceText, } from "../helpers/vfs"; describe("unittests:: tsbuild:: with rootDir of project reference in parentDirectory", () => { @@ -40,7 +40,7 @@ describe("unittests:: tsbuild:: with rootDir of project reference in parentDirec modifyFs: fs => { fs.writeFileSync("/src/src/main/tsconfig.json", JSON.stringify({ compilerOptions: { composite: true, outDir: "../../dist/" }, - references: [{ path: "../other" }] + references: [{ path: "../other" }], })); fs.writeFileSync("/src/src/other/tsconfig.json", JSON.stringify({ compilerOptions: { composite: true, outDir: "../../dist/" }, @@ -58,7 +58,7 @@ describe("unittests:: tsbuild:: with rootDir of project reference in parentDirec fs.renameSync("/src/src/other/tsconfig.json", "/src/src/other/tsconfig.other.json"); fs.writeFileSync("/src/src/main/tsconfig.main.json", JSON.stringify({ compilerOptions: { composite: true, outDir: "../../dist/" }, - references: [{ path: "../other/tsconfig.other.json" }] + references: [{ path: "../other/tsconfig.other.json" }], })); fs.writeFileSync("/src/src/other/tsconfig.other.json", JSON.stringify({ compilerOptions: { composite: true, outDir: "../../dist/" }, diff --git a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts index 7275c671f83ad..45a8ed52e6552 100644 --- a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts +++ b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts @@ -63,7 +63,7 @@ export default hello.hello`); fs: () => projFs, commandLineArgs: ["--b", "src/tsconfig_withFiles.json", "--verbose", "--explainFiles"], modifyFs: fs => replaceText(fs, "src/tsconfig_withFiles.json", `"composite": true,`, `"composite": true, "sourceMap": true,`), - edits: noChangeOnlyRuns + edits: noChangeOnlyRuns, }); verifyTsc({ @@ -72,7 +72,7 @@ export default hello.hello`); fs: () => projFs, commandLineArgs: ["--b", "src/tsconfig_withFiles.json", "--verbose"], modifyFs: fs => replaceText(fs, "src/tsconfig_withFiles.json", `"outDir": "dist",`, ""), - edits: noChangeOnlyRuns + edits: noChangeOnlyRuns, }); }); @@ -82,6 +82,6 @@ describe("unittests:: tsbuild:: with resolveJsonModule option on project importJ subScenario: "importing json module from project reference", fs: () => loadProjectFromDisk("tests/projects/importJsonFromProjectReference"), commandLineArgs: ["--b", "src/tsconfig.json", "--verbose", "--explainFiles"], - edits: noChangeOnlyRuns + edits: noChangeOnlyRuns, }); }); diff --git a/src/testRunner/unittests/tsbuild/roots.ts b/src/testRunner/unittests/tsbuild/roots.ts index 6d824635fc08d..0b28221cae1d2 100644 --- a/src/testRunner/unittests/tsbuild/roots.ts +++ b/src/testRunner/unittests/tsbuild/roots.ts @@ -14,8 +14,8 @@ describe("unittests:: tsbuild:: roots::", () => { "/src/file2.ts": `export const y = "world";`, "/src/tsconfig.json": JSON.stringify({ compilerOptions: { composite: true }, - include: ["*.ts"] - }) + include: ["*.ts"], + }), }), edits: [{ caption: "delete file1", @@ -38,8 +38,8 @@ describe("unittests:: tsbuild:: roots::", () => { "/src/file4.ts": `export const y = "world";`, "/src/tsconfig.json": JSON.stringify({ compilerOptions: { composite: true }, - include: ["*.ts"] - }) + include: ["*.ts"], + }), }), edits: [{ caption: "delete file1", @@ -64,8 +64,8 @@ describe("unittests:: tsbuild:: roots::", () => { `, "/src/tsconfig.json": JSON.stringify({ compilerOptions: { composite: true }, - include: ["file*.ts"] - }) + include: ["file*.ts"], + }), }), edits: [{ caption: "delete file1", @@ -103,8 +103,8 @@ describe("unittests:: tsbuild:: roots::", () => { `, "/src/tsconfig.json": JSON.stringify({ compilerOptions: { composite: true }, - include: ["file*.ts", "nonconsecutive*.ts", "asArray*.ts", "anotherNonConsecutive.ts"] - }) + include: ["file*.ts", "nonconsecutive*.ts", "asArray*.ts", "anotherNonConsecutive.ts"], + }), }), edits: [{ caption: "delete file1", diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 3eb0f4595bb2f..2a0d852077684 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -16,7 +16,7 @@ import { import { appendText, loadProjectFromDisk, loadProjectFromFiles, prependText, - replaceText + replaceText, } from "../helpers/vfs"; import { changeToHostTrackingWrittenFiles, @@ -42,7 +42,7 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => { function getTsBuildProjectFile(project: string, file: string): File { return { path: getTsBuildProjectFilePath(project, file), - content: projFs.readFileSync(`/src/${project}/${file}`, "utf8")! + content: projFs.readFileSync(`/src/${project}/${file}`, "utf8")!, }; } @@ -65,7 +65,7 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => { commandLineArgs: ["--b", "/src/tests"], modifyFs: fs => fs.writeFileSync("/src/logic/tsconfig.json", JSON.stringify({ compilerOptions: { composite: true, declaration: true, sourceMap: true, outDir: "outDir" }, - references: [{ path: "../core" }] + references: [{ path: "../core" }], })), }); @@ -76,7 +76,7 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => { commandLineArgs: ["--b", "/src/tests"], modifyFs: fs => fs.writeFileSync("/src/logic/tsconfig.json", JSON.stringify({ compilerOptions: { composite: true, declaration: true, sourceMap: true, declarationDir: "out/decls" }, - references: [{ path: "../core" }] + references: [{ path: "../core" }], })), }); @@ -104,7 +104,7 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => { subScenario: "removes all files it built", fs: getSampleFsAfterBuild, commandLineArgs: ["--b", "/src/tests", "--clean"], - edits: noChangeOnlyRuns + edits: noChangeOnlyRuns, }); verifyTscCompileLike(testTscCompileLike, { @@ -116,7 +116,7 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => { const buildHost = createSolutionBuilderHostForBaseline(sys); const builder = ts.createSolutionBuilder(buildHost, ["/src/third/tsconfig.json"], {}); sys.exit(builder.clean("/src/logic")); - } + }, }); verifyTscCompileLike(testTscCompileLike, { @@ -128,7 +128,7 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => { const buildHost = createSolutionBuilderHostForBaseline(sys); const builder = ts.createSolutionBuilder(buildHost, ["/src/third/tsconfig.json"], {}); sys.exit(builder.clean("/src/logic2")); - } + }, }); }); @@ -138,7 +138,7 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => { subScenario: "always builds under with force option", fs: () => projFs, commandLineArgs: ["--b", "/src/tests", "--force"], - edits: noChangeOnlyRuns + edits: noChangeOnlyRuns, }); }); @@ -166,7 +166,7 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => { fs.writeFileSync("/lib/lib.es2020.full.d.ts", libContent); }, }, - ] + ], }); verifyTsc({ @@ -182,7 +182,7 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => { fs.utimesSync("/src/core/index.ts", time, time); }, }, - ] + ], }); verifyTsc({ @@ -199,7 +199,7 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => { caption: "Enable declarationMap", edit: fs => replaceText(fs, "/src/core/tsconfig.json", `"declarationMap": false,`, `"declarationMap": true,`), }, - ] + ], }); verifyTsc({ @@ -228,7 +228,7 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => { edits: [{ caption: "tsbuildinfo written has error", edit: fs => prependText(fs, "/src/project/tsconfig.tsbuildinfo", "Some random string"), - }] + }], }); verifyTscCompileLike(testTscCompileLike, { @@ -241,7 +241,7 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => { const buildHost = createSolutionBuilderHostForBaseline(sys, "FakeTSCurrentVersion"); const builder = ts.createSolutionBuilder(buildHost, ["/src/tests"], { verbose: true }); sys.exit(builder.build()); - } + }, }); verifyTscCompileLike(testTscCompileLike, { @@ -275,8 +275,8 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => { }, edits: [{ caption: "incremental-declaration-changes", - edit: fs => fs.writeFileSync("/src/tests/tsconfig.base.json", JSON.stringify({ compilerOptions: {} })) - }] + edit: fs => fs.writeFileSync("/src/tests/tsconfig.base.json", JSON.stringify({ compilerOptions: {} })), + }], }); verifyTscCompileLike(testTscCompileLike, { @@ -288,7 +288,7 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => { const buildHost = createSolutionBuilderHostForBaseline(sys); const builder = ts.createSolutionBuilder(buildHost, ["/src/tests"], {}); sys.exit(builder.build("/src/logic/tsconfig.json")); - } + }, }); verifyTscCompileLike(testTscCompileLike, { @@ -300,7 +300,7 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => { const buildHost = createSolutionBuilderHostForBaseline(sys); const builder = ts.createSolutionBuilder(buildHost, ["/src/tests"], {}); sys.exit(builder.build("/src/logic2/tsconfig.json")); - } + }, }); it("building using getNextInvalidatedProject", () => { @@ -320,7 +320,7 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => { coreConfig, coreIndex, coreDecl, coreAnotherModule, logicConfig, logicIndex, testsConfig, testsIndex, - libFile + libFile, ]) ) ); @@ -359,7 +359,7 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => { const buildHost = createSolutionBuilderHostForBaseline(sys); const builder = ts.createSolutionBuilder(buildHost, ["/src/tests"], { verbose: true }); sys.exit(builder.buildReferences("/src/tests")); - } + }, }); }); @@ -370,7 +370,7 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => { fs: () => projFs, commandLineArgs: ["--b", "/src/tests", "--verbose"], modifyFs: fs => replaceText(fs, "/src/logic/index.ts", "c.multiply(10, 15)", `c.muitply()`), - edits: noChangeOnlyRuns + edits: noChangeOnlyRuns, }); }); @@ -392,7 +392,7 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => { coreConfig, coreIndex, coreDecl, coreAnotherModule, logicConfig, logicIndex, testsConfig, testsIndex, - libFile + libFile, ]) ) ); @@ -456,21 +456,21 @@ class someClass2 { }`), subScenario: "listFiles", fs: () => projFs, commandLineArgs: ["--b", "/src/tests", "--listFiles"], - edits: coreChanges + edits: coreChanges, }); verifyTsc({ scenario: "sample1", subScenario: "listEmittedFiles", fs: () => projFs, commandLineArgs: ["--b", "/src/tests", "--listEmittedFiles"], - edits: coreChanges + edits: coreChanges, }); verifyTsc({ scenario: "sample1", subScenario: "explainFiles", fs: () => projFs, commandLineArgs: ["--b", "/src/tests", "--explainFiles", "--v"], - edits: coreChanges + edits: coreChanges, }); }); @@ -501,7 +501,7 @@ class someClass2 { }`), "tsBuildInfoFile": "ownFile.tsbuildinfo",`), commandLineArgs: ["--b", "/src/tests", "--verbose"], baselineSourceMap: true, - baselineReadFileCalls: true + baselineReadFileCalls: true, }); verifyTsc({ @@ -597,10 +597,10 @@ class someClass2 { }`), modifyFs: fs => { fs.writeFileSync("/src/core/tsconfig.json", JSON.stringify({ compilerOptions: { composite: true }, - files: ["anotherModule.ts", "index.ts", "some_decl.d.ts"] + files: ["anotherModule.ts", "index.ts", "some_decl.d.ts"], })); fs.unlinkSync("/src/core/anotherModule.ts"); - } + }, }); verifyTsc({ @@ -611,10 +611,10 @@ class someClass2 { }`), modifyFs: fs => { fs.writeFileSync("/src/core/tsconfig.json", JSON.stringify({ compilerOptions: { composite: true }, - files: ["anotherModule.ts", "index.ts", "some_decl.d.ts"] + files: ["anotherModule.ts", "index.ts", "some_decl.d.ts"], })); fs.unlinkSync("/src/core/anotherModule.ts"); - } + }, }); }); }); diff --git a/src/testRunner/unittests/tsbuild/transitiveReferences.ts b/src/testRunner/unittests/tsbuild/transitiveReferences.ts index 37693c8eb5d5a..aa3a69b626f1d 100644 --- a/src/testRunner/unittests/tsbuild/transitiveReferences.ts +++ b/src/testRunner/unittests/tsbuild/transitiveReferences.ts @@ -19,10 +19,10 @@ export const b = new A();`); fs.writeFileSync("/src/tsconfig.b.json", JSON.stringify({ compilerOptions: { composite: true, - moduleResolution + moduleResolution, }, files: ["b.ts"], - references: [{ path: "tsconfig.a.json" }] + references: [{ path: "tsconfig.a.json" }], })); } diff --git a/src/testRunner/unittests/tsbuildWatch/configFileErrors.ts b/src/testRunner/unittests/tsbuildWatch/configFileErrors.ts index 4059cfce11477..61d6647e560f4 100644 --- a/src/testRunner/unittests/tsbuildWatch/configFileErrors.ts +++ b/src/testRunner/unittests/tsbuildWatch/configFileErrors.ts @@ -24,9 +24,9 @@ describe("unittests:: tsbuildWatch:: watchMode:: configFileErrors:: reports synt "a.ts" "b.ts" ] -}` +}`, }, - libFile + libFile, ], { currentDirectory: "/user/username/projects/myproject" } ), @@ -52,10 +52,10 @@ describe("unittests:: tsbuildWatch:: watchMode:: configFileErrors:: reports synt caption: "builds after fixing config file errors", edit: sys => sys.writeFile(`/user/username/projects/myproject/tsconfig.json`, JSON.stringify({ compilerOptions: { composite: true, declaration: true }, - files: ["a.ts", "b.ts"] + files: ["a.ts", "b.ts"], })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), // build the project - } - ] + }, + ], }); }); \ No newline at end of file diff --git a/src/testRunner/unittests/tsbuildWatch/demo.ts b/src/testRunner/unittests/tsbuildWatch/demo.ts index 03b36bcd39cb4..78e5ed2c6c60a 100644 --- a/src/testRunner/unittests/tsbuildWatch/demo.ts +++ b/src/testRunner/unittests/tsbuildWatch/demo.ts @@ -58,8 +58,8 @@ describe("unittests:: tsbuildWatch:: watchMode:: with demo project", () => { sys.runQueuedTimeoutCallbacks(); // build core sys.runQueuedTimeoutCallbacks(); // build animals, zoo and solution }, - } - ] + }, + ], }); verifyTscWatch({ @@ -80,8 +80,8 @@ import * as A from '../animals'; ${coreFiles[1].content}`), // build core timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); function subProjectFiles(subProject: string, fileNames: readonly string[]): File[] { diff --git a/src/testRunner/unittests/tsbuildWatch/moduleResolution.ts b/src/testRunner/unittests/tsbuildWatch/moduleResolution.ts index 141494295eb71..2d19480af485b 100644 --- a/src/testRunner/unittests/tsbuildWatch/moduleResolution.ts +++ b/src/testRunner/unittests/tsbuildWatch/moduleResolution.ts @@ -17,8 +17,8 @@ describe("unittests:: tsbuildWatch:: watchMode:: moduleResolution", () => { path: `/user/username/projects/myproject/project1/tsconfig.json`, content: JSON.stringify({ compilerOptions: { composite: true, types: ["foo", "bar"] }, - files: ["index.ts"] - }) + files: ["index.ts"], + }), }, { path: `/user/username/projects/myproject/project2/index.ts`, content: `import { foo } from "file";` }, { path: `/user/username/projects/myproject/project2/file.d.ts`, content: "export const foo = 10;" }, @@ -26,8 +26,8 @@ describe("unittests:: tsbuildWatch:: watchMode:: moduleResolution", () => { path: `/user/username/projects/myproject/project2/tsconfig.json`, content: JSON.stringify({ compilerOptions: { composite: true, types: ["foo"], moduleResolution: "classic" }, - files: ["index.ts"] - }) + files: ["index.ts"], + }), }, { path: `/user/username/projects/myproject/node_modules/@types/foo/index.d.ts`, content: "export const foo = 10;" }, { path: `/user/username/projects/myproject/node_modules/@types/bar/index.d.ts`, content: "export const bar = 10;" }, @@ -37,11 +37,11 @@ describe("unittests:: tsbuildWatch:: watchMode:: moduleResolution", () => { files: [], references: [ { path: "./project1" }, - { path: "./project2" } - ] - }) + { path: "./project2" }, + ], + }), }, - libFile + libFile, ], { currentDirectory: "/user/username/projects/myproject" } ), @@ -52,7 +52,7 @@ describe("unittests:: tsbuildWatch:: watchMode:: moduleResolution", () => { edit: sys => sys.appendFile(`/user/username/projects/myproject/project1/index.ts`, "const bar = 10;"), timeouts: sys => sys.runQueuedTimeoutCallbacks(), // build project1 and solution }, - ] + ], }); verifyTscWatch({ @@ -65,14 +65,14 @@ describe("unittests:: tsbuildWatch:: watchMode:: moduleResolution", () => { name: "pkg1", version: "1.0.0", main: "build/index.js", - type: "module" - }) + type: "module", + }), }, { path: `/user/username/projects/myproject/packages/pkg1/index.ts`, content: dedent` import type { TheNum } from 'pkg2' - export const theNum: TheNum = 42;` + export const theNum: TheNum = 42;`, }, { path: `/user/username/projects/myproject/packages/pkg1/tsconfig.json`, @@ -81,16 +81,16 @@ describe("unittests:: tsbuildWatch:: watchMode:: moduleResolution", () => { outDir: "build", module: "node16", }, - references: [{ path: "../pkg2" }] - }) + references: [{ path: "../pkg2" }], + }), }, { path: `/user/username/projects/myproject/packages/pkg2/const.cts`, - content: `export type TheNum = 42;` + content: `export type TheNum = 42;`, }, { path: `/user/username/projects/myproject/packages/pkg2/index.ts`, - content: `export type { TheNum } from './const.cjs';` + content: `export type { TheNum } from './const.cjs';`, }, { path: `/user/username/projects/myproject/packages/pkg2/tsconfig.json`, @@ -99,8 +99,8 @@ describe("unittests:: tsbuildWatch:: watchMode:: moduleResolution", () => { composite: true, outDir: "build", module: "node16", - } - }) + }, + }), }, { path: `/user/username/projects/myproject/packages/pkg2/package.json`, @@ -108,14 +108,14 @@ describe("unittests:: tsbuildWatch:: watchMode:: moduleResolution", () => { name: "pkg2", version: "1.0.0", main: "build/index.js", - type: "module" - }) + type: "module", + }), }, { path: `/user/username/projects/myproject/node_modules/pkg2`, symLink: `/user/username/projects/myproject/packages/pkg2`, }, - { ...libFile, path: `/a/lib/lib.es2022.full.d.ts` } + { ...libFile, path: `/a/lib/lib.es2022.full.d.ts` }, ], { currentDirectory: "/user/username/projects/myproject" }), commandLineArgs: ["-b", "packages/pkg1", "-w", "--verbose", "--traceResolution"], edits: [ @@ -132,7 +132,7 @@ describe("unittests:: tsbuildWatch:: watchMode:: moduleResolution", () => { { caption: "reports import errors after change to package file", edit: sys => sys.replaceFileText(`/user/username/projects/myproject/packages/pkg1/package.json`, `"module"`, `"commonjs"`), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "removes those errors when a package file is changed to cjs extensions", @@ -145,7 +145,7 @@ describe("unittests:: tsbuildWatch:: watchMode:: moduleResolution", () => { sys.runQueuedTimeoutCallbacks(); // building pkg1 }, }, - ] + ], }); verifyTscWatch({ @@ -158,13 +158,13 @@ describe("unittests:: tsbuildWatch:: watchMode:: moduleResolution", () => { name: "pkg1", version: "1.0.0", main: "build/index.js", - }) + }), }, { path: `/user/username/projects/myproject/packages/pkg1/index.ts`, content: dedent` import type { TheNum } from 'pkg2' - export const theNum: TheNum = 42;` + export const theNum: TheNum = 42;`, }, { path: `/user/username/projects/myproject/packages/pkg1/tsconfig.json`, @@ -172,8 +172,8 @@ describe("unittests:: tsbuildWatch:: watchMode:: moduleResolution", () => { compilerOptions: { outDir: "build", }, - references: [{ path: "../pkg2" }] - }) + references: [{ path: "../pkg2" }], + }), }, { path: `/user/username/projects/myproject/packages/pkg2/tsconfig.json`, @@ -182,20 +182,20 @@ describe("unittests:: tsbuildWatch:: watchMode:: moduleResolution", () => { composite: true, outDir: "build", baseUrl: ".", - } - }) + }, + }), }, { path: `/user/username/projects/myproject/packages/pkg2/const.ts`, - content: `export type TheNum = 42;` + content: `export type TheNum = 42;`, }, { path: `/user/username/projects/myproject/packages/pkg2/index.ts`, - content: `export type { TheNum } from './const.js';` + content: `export type { TheNum } from './const.js';`, }, { path: `/user/username/projects/myproject/packages/pkg2/other.ts`, - content: `export type TheStr = string;` + content: `export type TheStr = string;`, }, { path: `/user/username/projects/myproject/packages/pkg2/package.json`, @@ -203,13 +203,13 @@ describe("unittests:: tsbuildWatch:: watchMode:: moduleResolution", () => { name: "pkg2", version: "1.0.0", main: "build/index.js", - }) + }), }, { path: `/user/username/projects/myproject/node_modules/pkg2`, symLink: `/user/username/projects/myproject/packages/pkg2`, }, - libFile + libFile, ], { currentDirectory: "/user/username/projects/myproject" }), commandLineArgs: ["-b", "packages/pkg1", "--verbose", "-w", "--traceResolution"], edits: [ @@ -223,6 +223,6 @@ describe("unittests:: tsbuildWatch:: watchMode:: moduleResolution", () => { edit: sys => sys.replaceFileText(`/user/username/projects/myproject/packages/pkg2/package.json`, `other.js`, `index.js`), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); }); \ No newline at end of file diff --git a/src/testRunner/unittests/tsbuildWatch/noEmit.ts b/src/testRunner/unittests/tsbuildWatch/noEmit.ts index 68ebaa759e024..bbd9097a71f36 100644 --- a/src/testRunner/unittests/tsbuildWatch/noEmit.ts +++ b/src/testRunner/unittests/tsbuildWatch/noEmit.ts @@ -33,6 +33,6 @@ describe("unittests:: tsbuildWatch:: watchMode:: with noEmit", () => { timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, ], - baselineIncremental: true + baselineIncremental: true, }); }); \ No newline at end of file diff --git a/src/testRunner/unittests/tsbuildWatch/noEmitOnError.ts b/src/testRunner/unittests/tsbuildWatch/noEmitOnError.ts index 5a08e0cdbbdc2..8e81a8dfe5ce9 100644 --- a/src/testRunner/unittests/tsbuildWatch/noEmitOnError.ts +++ b/src/testRunner/unittests/tsbuildWatch/noEmitOnError.ts @@ -33,7 +33,7 @@ describe("unittests:: tsbuildWatch:: watchMode:: with noEmitOnError", () => { [ ...["tsconfig.json", "shared/types/db.ts", "src/main.ts", "src/other.ts"] .map(f => getTsBuildProjectFile("noEmitOnError", f)), - { path: libFile.path, content: libContent } + { path: libFile.path, content: libContent }, ], { currentDirectory: `/user/username/projects/noEmitOnError` } ), @@ -50,6 +50,6 @@ const a: string = 10;`), const a: string = "hello";`), noChange, ], - baselineIncremental: true + baselineIncremental: true, }); }); \ No newline at end of file diff --git a/src/testRunner/unittests/tsbuildWatch/programUpdates.ts b/src/testRunner/unittests/tsbuildWatch/programUpdates.ts index 0352a1b571147..376e00d7f9cdf 100644 --- a/src/testRunner/unittests/tsbuildWatch/programUpdates.ts +++ b/src/testRunner/unittests/tsbuildWatch/programUpdates.ts @@ -22,7 +22,7 @@ describe("unittests:: tsbuildWatch:: watchMode:: program updates", () => { core = "core", logic = "logic", tests = "tests", - ui = "ui" + ui = "ui", } type ReadonlyFile = Readonly; /** [tsconfig, index] | [tsconfig, index, anotherModule, someDecl] */ @@ -100,7 +100,7 @@ describe("unittests:: tsbuildWatch:: watchMode:: program updates", () => { baseline, oldSnap, getPrograms, - watchOrSolution: solutionBuilder + watchOrSolution: solutionBuilder, }); }); @@ -108,7 +108,7 @@ describe("unittests:: tsbuildWatch:: watchMode:: program updates", () => { const newFileWithoutExtension = "newFile"; const newFile: File = { path: projectFilePath(SubProject.core, `${newFileWithoutExtension}.ts`), - content: `export const newFileConst = 30;` + content: `export const newFileConst = 30;`, }; function verifyProjectChanges(subScenario: string, allFilesGetter: () => readonly File[]) { @@ -147,7 +147,7 @@ export class someClass2 { }`); timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Builds core }, buildLogicAndTests, - ] + ], }); verifyTscWatch({ @@ -161,7 +161,7 @@ export class someClass2 { }`); edits: [ changeCore(() => `${core[1].content} function foo() { }`, "Make local change to core"), - ] + ], }); function changeNewFile(newFileContent: string) { @@ -181,7 +181,7 @@ function foo() { }`, "Make local change to core"), changeNewFile(`${newFile.content} export class someClass2 { }`), buildLogicAndTests, - ] + ], }); } @@ -201,8 +201,8 @@ export class someClass2 { }`), path: coreTsconfig.path, content: JSON.stringify({ compilerOptions: { composite: true, declaration: true }, - references: [{ path: "../tests", circular: true }] - }) + references: [{ path: "../tests", circular: true }], + }), }; return [libFile, circularCoreConfig, ...otherCoreFiles, ...logic, ...tests]; } @@ -229,8 +229,8 @@ export class someClass2 { }`), edit: ts.noop, // Build tests timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); describe("when referenced using prepend, builds referencing project even for non local change", () => { @@ -238,7 +238,7 @@ export class someClass2 { }`), before(() => { coreIndex = { path: core[1].path, - content: `function foo() { return 10; }` + content: `function foo() { return 10; }`, }; }); after(() => { @@ -258,19 +258,19 @@ export class someClass2 { }`), const coreTsConfig: File = { path: core[0].path, content: JSON.stringify({ - compilerOptions: { composite: true, declaration: true, outFile: "index.js" } - }) + compilerOptions: { composite: true, declaration: true, outFile: "index.js" }, + }), }; const logicTsConfig: File = { path: logic[0].path, content: JSON.stringify({ compilerOptions: { ignoreDeprecations: "5.0", composite: true, declaration: true, outFile: "index.js" }, - references: [{ path: "../core", prepend: true }] - }) + references: [{ path: "../core", prepend: true }], + }), }; const logicIndex: File = { path: logic[1].path, - content: `function bar() { return foo() + 1 };` + content: `function bar() { return foo() + 1 };`, }; return createWatchedSystem([libFile, coreTsConfig, coreIndex, logicTsConfig, logicIndex], { currentDirectory: "/user/username/projects" }); }, @@ -281,7 +281,7 @@ function myFunc() { return 10; }`, "Make non local change and build core"), changeCore(() => `${coreIndex.content} function myFunc() { return 100; }`, "Make local change and build core"), buildLogic, - ] + ], }); }); @@ -300,7 +300,7 @@ export function createSomeObject(): SomeObject return { message: "new Object" }; -}` +}`, }; verifyTscWatch({ scenario: "programUpdates", @@ -309,17 +309,17 @@ export function createSomeObject(): SomeObject sys: () => { const libraryTsconfig: File = { path: `${subProjectLibrary}/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { composite: true } }) + content: JSON.stringify({ compilerOptions: { composite: true } }), }; const subProjectApp = `${"/user/username/projects"}/sample1/App`; const appTs: File = { path: `${subProjectApp}/app.ts`, content: `import { createSomeObject } from "../Library/library"; -createSomeObject().message;` +createSomeObject().message;`, }; const appTsconfig: File = { path: `${subProjectApp}/tsconfig.json`, - content: JSON.stringify({ references: [{ path: "../Library" }] }) + content: JSON.stringify({ references: [{ path: "../Library" }] }), }; const files = [libFile, libraryTs, libraryTsconfig, appTs, appTsconfig]; @@ -344,7 +344,7 @@ createSomeObject().message;` sys.runQueuedTimeoutCallbacks(); // Build App }, }, - ] + ], }); }); @@ -370,8 +370,8 @@ let y: string = 10;`), let x: string = 10;`), // Builds core timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); } verifyIncrementalErrors("when preserveWatchOutput is not used", ts.emptyArray); @@ -386,19 +386,19 @@ let x: string = 10;`), content: `export var myClassWithError = class { tags() { } private p = 12 - };` + };`, }; const fileWithFixedError: File = { path: fileWithError.path, - content: fileWithError.content.replace("private p = 12", "") + content: fileWithError.content.replace("private p = 12", ""), }; const fileWithoutError: File = { path: `${subProjectLocation}/fileWithoutError.ts`, - content: `export class myClass { }` + content: `export class myClass { }`, }; const tsconfig: File = { path: `${subProjectLocation}/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { composite: true } }) + content: JSON.stringify({ compilerOptions: { composite: true } }), }; const fixError: TscWatchCompileChange = { @@ -423,8 +423,8 @@ let x: string = 10;`), { currentDirectory: `${"/user/username/projects"}/${solution}` } ), edits: [ - fixError - ] + fixError, + ], }); verifyTscWatch({ @@ -436,8 +436,8 @@ let x: string = 10;`), { currentDirectory: `${"/user/username/projects"}/${solution}` } ), edits: [ - changeFileWithoutError - ] + changeFileWithoutError, + ], }); describe("when reporting errors on introducing error", () => { @@ -457,8 +457,8 @@ let x: string = 10;`), ), edits: [ introduceError, - fixError - ] + fixError, + ], }); verifyTscWatch({ @@ -471,8 +471,8 @@ let x: string = 10;`), ), edits: [ introduceError, - changeFileWithoutError - ] + changeFileWithoutError, + ], }); }); }); @@ -498,7 +498,7 @@ export function someFn() { }`), sys.runQueuedTimeoutCallbacks(); // build logic sys.runQueuedTimeoutCallbacks(); // build tests }, - } + }, ], }); @@ -509,15 +509,15 @@ export function someFn() { }`), sys: () => { const index: File = { path: `/user/username/projects/myproject/index.ts`, - content: `const fn = (a: string, b: string) => b;` + content: `const fn = (a: string, b: string) => b;`, }; const configFile: File = { path: `/user/username/projects/myproject/tsconfig.json`, content: JSON.stringify({ compilerOptions: { - noUnusedParameters: true - } - }) + noUnusedParameters: true, + }, + }), }; return createWatchedSystem([index, configFile, libFile], { currentDirectory: "/user/username/projects/myproject" }); }, @@ -526,12 +526,12 @@ export function someFn() { }`), caption: "Change tsconfig to set noUnusedParameters to false", edit: sys => sys.writeFile(`/user/username/projects/myproject/tsconfig.json`, JSON.stringify({ compilerOptions: { - noUnusedParameters: false - } + noUnusedParameters: false, + }, })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); verifyTscWatch({ @@ -544,10 +544,10 @@ export function someFn() { }`), { caption: "Add new file", edit: sys => sys.writeFile(`sample1/${SubProject.core}/file3.ts`, `export const y = 10;`), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, noopChange, - ] + ], }); verifyTscWatch({ @@ -564,10 +564,10 @@ export function someFn() { }`), { caption: "Add new file", edit: sys => sys.writeFile(`sample1/${SubProject.core}/file3.ts`, `export const y = 10;`), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - noopChange - ] + noopChange, + ], }); verifyTscWatch({ @@ -577,7 +577,7 @@ export function someFn() { }`), sys: () => { const alphaExtendedConfigFile: File = { path: "/a/b/alpha.tsconfig.json", - content: "{}" + content: "{}", }; const project1Config: File = { path: "/a/b/project1.tsconfig.json", @@ -586,14 +586,14 @@ export function someFn() { }`), compilerOptions: { composite: true, }, - files: [commonFile1.path, commonFile2.path] - }) + files: [commonFile1.path, commonFile2.path], + }), }; const bravoExtendedConfigFile: File = { path: "/a/b/bravo.tsconfig.json", content: JSON.stringify({ - extends: "./alpha.tsconfig.json" - }) + extends: "./alpha.tsconfig.json", + }), }; const otherFile: File = { path: "/a/b/other.ts", @@ -606,8 +606,8 @@ export function someFn() { }`), compilerOptions: { composite: true, }, - files: [otherFile.path] - }) + files: [otherFile.path], + }), }; const otherFile2: File = { path: "/a/b/other2.ts", @@ -618,24 +618,24 @@ export function someFn() { }`), content: JSON.stringify({ compilerOptions: { composite: true, - } - }) + }, + }), }; const extendsConfigFile2: File = { path: "/a/b/extendsConfig2.tsconfig.json", content: JSON.stringify({ compilerOptions: { strictNullChecks: false, - } - }) + }, + }), }; const extendsConfigFile3: File = { path: "/a/b/extendsConfig3.tsconfig.json", content: JSON.stringify({ compilerOptions: { noImplicitAny: true, - } - }) + }, + }), }; const project3Config: File = { path: "/a/b/project3.tsconfig.json", @@ -644,23 +644,23 @@ export function someFn() { }`), compilerOptions: { composite: false, }, - files: [otherFile2.path] - }) + files: [otherFile2.path], + }), }; return createWatchedSystem([ libFile, alphaExtendedConfigFile, project1Config, commonFile1, commonFile2, bravoExtendedConfigFile, project2Config, otherFile, otherFile2, - extendsConfigFile1, extendsConfigFile2, extendsConfigFile3, project3Config + extendsConfigFile1, extendsConfigFile2, extendsConfigFile3, project3Config, ], { currentDirectory: "/a/b" }); }, edits: [ { caption: "Modify alpha config", edit: sys => sys.writeFile("/a/b/alpha.tsconfig.json", JSON.stringify({ - compilerOptions: { strict: true } + compilerOptions: { strict: true }, })), - timeouts: sys => sys.runQueuedTimeoutCallbacks() // Build project1 + timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build project1 }, { caption: "Build project 2", @@ -671,7 +671,7 @@ export function someFn() { }`), caption: "change bravo config", edit: sys => sys.writeFile("/a/b/bravo.tsconfig.json", JSON.stringify({ extends: "./alpha.tsconfig.json", - compilerOptions: { strict: false } + compilerOptions: { strict: false }, })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build project2 }, @@ -695,7 +695,7 @@ export function someFn() { }`), { caption: "Modify extendsConfigFile2", edit: sys => sys.writeFile("/a/b/extendsConfig2.tsconfig.json", JSON.stringify({ - compilerOptions: { strictNullChecks: true } + compilerOptions: { strictNullChecks: true }, })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build project3 }, @@ -704,7 +704,7 @@ export function someFn() { }`), edit: sys => sys.writeFile("/a/b/project3.tsconfig.json", JSON.stringify({ extends: ["./extendsConfig1.tsconfig.json", "./extendsConfig2.tsconfig.json"], compilerOptions: { composite: false }, - files: ["/a/b/other2.ts"] + files: ["/a/b/other2.ts"], })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build project3 }, @@ -712,7 +712,7 @@ export function someFn() { }`), caption: "Delete extendedConfigFile2 and report error", edit: sys => sys.deleteFile("./extendsConfig2.tsconfig.json"), timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build project3 - } + }, ], }); @@ -725,9 +725,9 @@ export function someFn() { }`), path: "/a/b/alpha.tsconfig.json", content: JSON.stringify({ compilerOptions: { - strict: true - } - }) + strict: true, + }, + }), }; const project1Config: File = { path: "/a/b/project1.tsconfig.json", @@ -736,16 +736,16 @@ export function someFn() { }`), compilerOptions: { composite: true, }, - files: [commonFile1.path, commonFile2.path] - }) + files: [commonFile1.path, commonFile2.path], + }), }; const bravoExtendedConfigFile: File = { path: "/a/b/bravo.tsconfig.json", content: JSON.stringify({ compilerOptions: { - strict: true - } - }) + strict: true, + }, + }), }; const otherFile: File = { path: "/a/b/other.ts", @@ -758,8 +758,8 @@ export function someFn() { }`), compilerOptions: { composite: true, }, - files: [otherFile.path] - }) + files: [otherFile.path], + }), }; const configFile: File = { path: "/a/b/tsconfig.json", @@ -773,12 +773,12 @@ export function someFn() { }`), }, ], files: [], - }) + }), }; return createWatchedSystem([ libFile, configFile, alphaExtendedConfigFile, project1Config, commonFile1, commonFile2, - bravoExtendedConfigFile, project2Config, otherFile + bravoExtendedConfigFile, project2Config, otherFile, ], { currentDirectory: "/a/b" }); }, edits: [ @@ -793,8 +793,8 @@ export function someFn() { }`), files: [], })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ diff --git a/src/testRunner/unittests/tsbuildWatch/projectsBuilding.ts b/src/testRunner/unittests/tsbuildWatch/projectsBuilding.ts index 0968b40bdef0e..fa22c3928f3ea 100644 --- a/src/testRunner/unittests/tsbuildWatch/projectsBuilding.ts +++ b/src/testRunner/unittests/tsbuildWatch/projectsBuilding.ts @@ -25,7 +25,7 @@ describe("unittests:: tsbuildWatch:: watchMode:: projectsBuilding", () => { return [ { path: `/user/username/projects/myproject/pkg${index}/index.ts`, - content: `export const pkg${index} = ${index};` + content: `export const pkg${index} = ${index};`, }, { path: `/user/username/projects/myproject/pkg${index}/tsconfig.json`, @@ -33,9 +33,9 @@ describe("unittests:: tsbuildWatch:: watchMode:: projectsBuilding", () => { compilerOptions: { composite: true }, references: index === 0 ? undefined : - [{ path: `../pkg0` }] - }) - } + [{ path: `../pkg0` }], + }), + }, ]; } function solution(maxPkgs: number): File { @@ -44,7 +44,7 @@ describe("unittests:: tsbuildWatch:: watchMode:: projectsBuilding", () => { content: JSON.stringify({ references: pkgs(createPkgReference, maxPkgs), files: [], - }) + }), }; } function checkBuildPkg(startIndex: number, count: number): TscWatchCompileChange { @@ -72,11 +72,11 @@ describe("unittests:: tsbuildWatch:: watchMode:: projectsBuilding", () => { { caption: "dts change", edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `export const someConst = 10;`), - timeouts: sys => sys.runQueuedTimeoutCallbacks() // Build pkg0 + timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build pkg0 }, checkBuildPkg(1, 2), noopChange, - ] + ], }); verifyTscWatch({ scenario: "projectsBuilding", @@ -96,11 +96,11 @@ describe("unittests:: tsbuildWatch:: watchMode:: projectsBuilding", () => { { caption: "dts change", edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `export const someConst = 10;`), - timeouts: sys => sys.runQueuedTimeoutCallbacks() // Build pkg0 + timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build pkg0 }, checkBuildPkg(1, 4), noopChange, - ] + ], }); verifyTscWatch({ scenario: "projectsBuilding", @@ -120,7 +120,7 @@ describe("unittests:: tsbuildWatch:: watchMode:: projectsBuilding", () => { { caption: "dts change", edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `export const someConst = 10;`), - timeouts: sys => sys.runQueuedTimeoutCallbacks() // Build pkg0 + timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build pkg0 }, checkBuildPkg(1, 5), checkBuildPkg(6, 2), @@ -128,17 +128,17 @@ describe("unittests:: tsbuildWatch:: watchMode:: projectsBuilding", () => { { caption: "dts change2", edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `export const someConst3 = 10;`), - timeouts: sys => sys.runQueuedTimeoutCallbacks() // Build pkg0 + timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build pkg0 }, checkBuildPkg(1, 5), { caption: "change while building", edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `const someConst4 = 10;`), - timeouts: sys => sys.runQueuedTimeoutCallbacks() // Build pkg0 + timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build pkg0 }, checkBuildPkg(6, 2), noopChange, - ] + ], }); verifyTscWatch({ scenario: "projectsBuilding", @@ -158,7 +158,7 @@ describe("unittests:: tsbuildWatch:: watchMode:: projectsBuilding", () => { { caption: "dts change", edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `export const someConst = 10;`), - timeouts: sys => sys.runQueuedTimeoutCallbacks() // Build pkg0 + timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build pkg0 }, checkBuildPkg(1, 5), checkBuildPkg(6, 5), @@ -169,20 +169,20 @@ describe("unittests:: tsbuildWatch:: watchMode:: projectsBuilding", () => { { caption: "dts change2", edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `export const someConst3 = 10;`), - timeouts: sys => sys.runQueuedTimeoutCallbacks() // Build pkg0 + timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build pkg0 }, checkBuildPkg(1, 5), checkBuildPkg(6, 5), { caption: "change while building", edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `const someConst4 = 10;`), - timeouts: sys => sys.runQueuedTimeoutCallbacks() // Build pkg0 + timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build pkg0 }, checkBuildPkg(11, 5), { caption: "change while building: dts changes", edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `export const someConst5 = 10;`), - timeouts: sys => sys.runQueuedTimeoutCallbacks() // Build pkg0 + timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build pkg0 }, checkBuildPkg(1, 5), checkBuildPkg(6, 5), @@ -190,6 +190,6 @@ describe("unittests:: tsbuildWatch:: watchMode:: projectsBuilding", () => { checkBuildPkg(16, 5), checkBuildPkg(21, 3), noopChange, - ] + ], }); }); \ No newline at end of file diff --git a/src/testRunner/unittests/tsbuildWatch/publicApi.ts b/src/testRunner/unittests/tsbuildWatch/publicApi.ts index a8b5a21152553..abb46e792abb4 100644 --- a/src/testRunner/unittests/tsbuildWatch/publicApi.ts +++ b/src/testRunner/unittests/tsbuildWatch/publicApi.ts @@ -16,16 +16,16 @@ it("unittests:: tsbuildWatch:: watchMode:: Public API with custom transformers", content: JSON.stringify({ references: [ { path: "./shared/tsconfig.json" }, - { path: "./webpack/tsconfig.json" } + { path: "./webpack/tsconfig.json" }, ], - files: [] - }) + files: [], + }), }; const sharedConfig: File = { path: `/user/username/projects/myproject/shared/tsconfig.json`, content: JSON.stringify({ compilerOptions: { composite: true }, - }) + }), }; const sharedIndex: File = { path: `/user/username/projects/myproject/shared/index.ts`, @@ -33,14 +33,14 @@ it("unittests:: tsbuildWatch:: watchMode:: Public API with custom transformers", export class c { } export enum e { } // leading -export function f2() { } // trailing` +export function f2() { } // trailing`, }; const webpackConfig: File = { path: `/user/username/projects/myproject/webpack/tsconfig.json`, content: JSON.stringify({ - compilerOptions: { composite: true, }, - references: [{ path: "../shared/tsconfig.json" }] - }) + compilerOptions: { composite: true }, + references: [{ path: "../shared/tsconfig.json" }], + }), }; const webpackIndex: File = { path: `/user/username/projects/myproject/webpack/index.ts`, @@ -48,7 +48,7 @@ export function f2() { } // trailing` export class c2 { } export enum e2 { } // leading -export function f22() { } // trailing` +export function f22() { } // trailing`, }; const commandLineArgs = ["--b", "--w"]; const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem([libFile, solution, sharedConfig, sharedIndex, webpackConfig, webpackIndex], { currentDirectory: "/user/username/projects/myproject" })); @@ -71,10 +71,10 @@ export function f22() { } // trailing` timeouts: sys => { sys.runQueuedTimeoutCallbacks(); // Shared sys.runQueuedTimeoutCallbacks(); // webpack and solution - } - } + }, + }, ], - watchOrSolution: builder + watchOrSolution: builder, }); function getCustomTransformers(project: string): ts.CustomTransformers { diff --git a/src/testRunner/unittests/tsbuildWatch/reexport.ts b/src/testRunner/unittests/tsbuildWatch/reexport.ts index ff1f3b1f05bed..f4cb73a95232d 100644 --- a/src/testRunner/unittests/tsbuildWatch/reexport.ts +++ b/src/testRunner/unittests/tsbuildWatch/reexport.ts @@ -16,10 +16,10 @@ describe("unittests:: tsbuildWatch:: watchMode:: with reexport when referenced p ...[ "src/tsconfig.json", "src/main/tsconfig.json", "src/main/index.ts", - "src/pure/tsconfig.json", "src/pure/index.ts", "src/pure/session.ts" + "src/pure/tsconfig.json", "src/pure/index.ts", "src/pure/session.ts", ] .map(f => getTsBuildProjectFile("reexport", f)), - { path: libFile.path, content: libContent } + { path: libFile.path, content: libContent }, ], { currentDirectory: `/user/username/projects/reexport` } ), @@ -39,7 +39,7 @@ describe("unittests:: tsbuildWatch:: watchMode:: with reexport when referenced p sys.runQueuedTimeoutCallbacks(); // build src/pure sys.runQueuedTimeoutCallbacks(); // build src/main and src }, - } - ] + }, + ], }); }); \ No newline at end of file diff --git a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts index ca887c6699db1..cd8b9350cc025 100644 --- a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts @@ -18,7 +18,7 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi const configPath = `${project}/tsconfig.json`; const typing: File = { path: `${project}/typings/xterm.d.ts`, - content: "export const typing = 10;" + content: "export const typing = 10;", }; const allPkgFiles = pkgs(pkgFiles); @@ -43,7 +43,7 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi timeouts: sys => { sys.runQueuedTimeoutCallbacks(); sys.runQueuedTimeoutCallbacks(); - } + }, }, { // Make change @@ -60,7 +60,7 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi timeouts: sys => { sys.runQueuedTimeoutCallbacks(); sys.runQueuedTimeoutCallbacks(); - } + }, }, { // Make change to remove all watches @@ -77,7 +77,7 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi timeouts: sys => sys.logTimeoutQueueLength(), }, ], - watchOrSolution: solutionBuilder + watchOrSolution: solutionBuilder, }); function flatArray(arr: T[][]): readonly T[] { @@ -97,7 +97,7 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi return [ { path: `${project}/pkg${index}/index.ts`, - content: `export const pkg${index} = ${index};` + content: `export const pkg${index} = ${index};`, }, { path: `${project}/pkg${index}/tsconfig.json`, @@ -105,17 +105,17 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi complerOptions: { composite: true }, include: [ "**/*.ts", - "../typings/xterm.d.ts" - ] - }) - } + "../typings/xterm.d.ts", + ], + }), + }, ]; } function writePkgReferences(system: TestServerHost) { system.writeFile(configPath, JSON.stringify({ files: [], include: [], - references: pkgs(createPkgReference) + references: pkgs(createPkgReference), })); } }); diff --git a/src/testRunner/unittests/tsc/cancellationToken.ts b/src/testRunner/unittests/tsc/cancellationToken.ts index dfda4549902b4..e8ac929b29bf9 100644 --- a/src/testRunner/unittests/tsc/cancellationToken.ts +++ b/src/testRunner/unittests/tsc/cancellationToken.ts @@ -27,7 +27,7 @@ describe("unittests:: tsc:: builder cancellationToken", () => { import {B} from './b'; declare var console: any; let b = new B(); - console.log(b.c.d);` + console.log(b.c.d);`, }; const bFile: File = { path: `/user/username/projects/myproject/b.ts`, @@ -35,22 +35,22 @@ describe("unittests:: tsc:: builder cancellationToken", () => { import {C} from './c'; export class B { c = new C(); - }` + }`, }; const cFile: File = { path: `/user/username/projects/myproject/c.ts`, content: Utils.dedent` export class C { d = 1; - }` + }`, }; const dFile: File = { path: `/user/username/projects/myproject/d.ts`, - content: "export class D { }" + content: "export class D { }", }; const config: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { incremental: true, declaration: true } }) + content: JSON.stringify({ compilerOptions: { incremental: true, declaration: true } }), }; const { sys, baseline, oldSnap: originalSnap } = createBaseline(createWatchedSystem( [aFile, bFile, cFile, dFile, config, libFile], diff --git a/src/testRunner/unittests/tsc/composite.ts b/src/testRunner/unittests/tsc/composite.ts index 571ade2ab4235..6379a54bd0bc9 100644 --- a/src/testRunner/unittests/tsc/composite.ts +++ b/src/testRunner/unittests/tsc/composite.ts @@ -4,7 +4,7 @@ import { } from "../helpers/tsc"; import { loadProjectFromFiles, - replaceText + replaceText, } from "../helpers/vfs"; describe("unittests:: tsc:: composite::", () => { @@ -107,7 +107,7 @@ describe("unittests:: tsc:: composite::", () => { { caption: "convert to modules", edit: fs => replaceText(fs, "/src/project/tsconfig.json", "none", "es2015"), - } - ] + }, + ], }); }); diff --git a/src/testRunner/unittests/tsc/declarationEmit.ts b/src/testRunner/unittests/tsc/declarationEmit.ts index 55c5c3d3e8252..4e7b45da87636 100644 --- a/src/testRunner/unittests/tsc/declarationEmit.ts +++ b/src/testRunner/unittests/tsc/declarationEmit.ts @@ -52,7 +52,7 @@ describe("unittests:: tsc:: declarationEmit::", () => { compilerOptions: { target: "es5", declaration: true, - traceResolution: true + traceResolution: true, }, }); } @@ -93,7 +93,7 @@ describe("unittests:: tsc:: declarationEmit::", () => { function fsaPackageJson() { return JSON.stringify({ name: "typescript-fsa", - version: "3.0.0-beta-2" + version: "3.0.0-beta-2", }); } function fsaIndex() { @@ -126,7 +126,7 @@ describe("unittests:: tsc:: declarationEmit::", () => { { path: `/user/username/projects/myproject/plugin-one/node_modules/typescript-fsa/package.json`, content: fsaPackageJson() }, { path: `/user/username/projects/myproject/plugin-one/node_modules/typescript-fsa/index.d.ts`, content: fsaIndex() }, { path: `/user/username/projects/myproject/plugin-one/node_modules/plugin-two`, symLink: `/user/username/projects/myproject/plugin-two` }, - libFile + libFile, ], changeCaseFileTestPath: str => ts.stringContains(str, "/plugin-two"), }); @@ -140,8 +140,8 @@ describe("unittests:: tsc:: declarationEmit::", () => { content: JSON.stringify({ name: "plugin-two", version: "0.1.3", - main: "dist/commonjs/index.js" - }) + main: "dist/commonjs/index.js", + }), }, { path: `/user/username/projects/myproject/plugin-two/dist/commonjs/index.d.ts`, content: pluginTwoDts() }, { path: `/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/package.json`, content: fsaPackageJson() }, @@ -150,13 +150,13 @@ describe("unittests:: tsc:: declarationEmit::", () => { { path: `/user/username/projects/myproject/plugin-one/index.ts`, content: `${pluginOneIndex()} -${pluginOneAction()}` +${pluginOneAction()}`, }, { path: `/user/username/projects/myproject/plugin-one/node_modules/typescript-fsa/package.json`, content: fsaPackageJson() }, { path: `/user/username/projects/myproject/plugin-one/node_modules/typescript-fsa/index.d.ts`, content: fsaIndex() }, { path: `/temp/yarn/data/link/plugin-two`, symLink: `/user/username/projects/myproject/plugin-two` }, { path: `/user/username/projects/myproject/plugin-one/node_modules/plugin-two`, symLink: `/temp/yarn/data/link/plugin-two` }, - libFile + libFile, ], changeCaseFileTestPath: str => ts.stringContains(str, "/plugin-two"), }); @@ -169,7 +169,7 @@ ${pluginOneAction()}` { path: `/user/username/projects/myproject/pkg1/dist/index.d.ts`, content: Utils.dedent` - export * from './types';` + export * from './types';`, }, { path: `/user/username/projects/myproject/pkg1/dist/types.d.ts`, @@ -186,7 +186,7 @@ ${pluginOneAction()}` private constructor(); toString(): string; static create(key: string): MetadataAccessor; - }` + }`, }, { path: `/user/username/projects/myproject/pkg1/package.json`, @@ -194,18 +194,18 @@ ${pluginOneAction()}` name: "@raymondfeng/pkg1", version: "1.0.0", main: "dist/index.js", - typings: "dist/index.d.ts" - }) + typings: "dist/index.d.ts", + }), }, { path: `/user/username/projects/myproject/pkg2/dist/index.d.ts`, content: Utils.dedent` - export * from './types';` + export * from './types';`, }, { path: `/user/username/projects/myproject/pkg2/dist/types.d.ts`, content: Utils.dedent` - export {MetadataAccessor} from '@raymondfeng/pkg1';` + export {MetadataAccessor} from '@raymondfeng/pkg1';`, }, { path: `/user/username/projects/myproject/pkg2/package.json`, @@ -213,19 +213,19 @@ ${pluginOneAction()}` name: "@raymondfeng/pkg2", version: "1.0.0", main: "dist/index.js", - typings: "dist/index.d.ts" - }) + typings: "dist/index.d.ts", + }), }, { path: `/user/username/projects/myproject/pkg3/src/index.ts`, content: Utils.dedent` - export * from './keys';` + export * from './keys';`, }, { path: `/user/username/projects/myproject/pkg3/src/keys.ts`, content: Utils.dedent` import {MetadataAccessor} from "@raymondfeng/pkg2"; - export const ADMIN = MetadataAccessor.create('1');` + export const ADMIN = MetadataAccessor.create('1');`, }, { path: `/user/username/projects/myproject/pkg3/tsconfig.json`, @@ -237,19 +237,19 @@ ${pluginOneAction()}` module: "commonjs", strict: true, esModuleInterop: true, - declaration: true - } - }) + declaration: true, + }, + }), }, { path: `/user/username/projects/myproject/pkg2/node_modules/@raymondfeng/pkg1`, - symLink: `/user/username/projects/myproject/pkg1` + symLink: `/user/username/projects/myproject/pkg1`, }, { path: `/user/username/projects/myproject/pkg3/node_modules/@raymondfeng/pkg2`, - symLink: `/user/username/projects/myproject/pkg2` + symLink: `/user/username/projects/myproject/pkg2`, }, - libFile + libFile, ], changeCaseFileTestPath: str => ts.stringContains(str, "/pkg1"), }); diff --git a/src/testRunner/unittests/tsc/incremental.ts b/src/testRunner/unittests/tsc/incremental.ts index e3d6adefb50a4..8beb61e4754c8 100644 --- a/src/testRunner/unittests/tsc/incremental.ts +++ b/src/testRunner/unittests/tsc/incremental.ts @@ -3,7 +3,7 @@ import * as Utils from "../../_namespaces/Utils"; import * as vfs from "../../_namespaces/vfs"; import { compilerOptionsToConfigJson, - libContent + libContent, } from "../helpers/contents"; import { noChangeOnlyRuns, @@ -15,7 +15,7 @@ import { appendText, loadProjectFromDisk, loadProjectFromFiles, prependText, - replaceText + replaceText, } from "../helpers/vfs"; describe("unittests:: tsc:: incremental::", () => { @@ -36,7 +36,7 @@ describe("unittests:: tsc:: incremental::", () => { }`, }), commandLineArgs: ["--incremental", "--p", "src/project", "--tsBuildInfoFile", "src/project/.tsbuildinfo", "--explainFiles"], - edits: noChangeOnlyRuns + edits: noChangeOnlyRuns, }); verifyTsc({ @@ -53,7 +53,7 @@ describe("unittests:: tsc:: incremental::", () => { }`, }), commandLineArgs: ["--p", "src/project", "--rootDir", "src/project/src"], - edits: noChangeOnlyRuns + edits: noChangeOnlyRuns, }); verifyTsc({ @@ -69,9 +69,9 @@ describe("unittests:: tsc:: incremental::", () => { noChangeRun, { caption: "incremental-declaration-doesnt-change", - edit: fs => appendText(fs, "/src/project/src/main.d.ts", "export const xy = 100;") - } - ] + edit: fs => appendText(fs, "/src/project/src/main.d.ts", "export const xy = 100;"), + }, + ], }); verifyTsc({ @@ -89,7 +89,7 @@ describe("unittests:: tsc:: incremental::", () => { }`, }), commandLineArgs: ["--p", "src/project"], - edits: noChangeOnlyRuns + edits: noChangeOnlyRuns, }); verifyTsc({ @@ -104,7 +104,7 @@ describe("unittests:: tsc:: incremental::", () => { edits: [{ caption: "tsbuildinfo written has error", edit: fs => prependText(fs, "/src/project/tsconfig.tsbuildinfo", "Some random string"), - }] + }], }); describe("with noEmitOnError", () => { @@ -127,11 +127,11 @@ describe("unittests:: tsc:: incremental::", () => { noChangeRun, { caption: "incremental-declaration-doesnt-change", - edit: fixModifyFs + edit: fixModifyFs, }, noChangeRun, ], - baselinePrograms: true + baselinePrograms: true, }); } verifyNoEmitOnError( @@ -296,8 +296,8 @@ const a: string = 10;`, "utf-8"), `, "/src/project/src/filePresent.ts": `function something() { return 10; }`, "/src/project/tsconfig.json": JSON.stringify({ - compilerOptions: { composite: true, }, - include: ["src/**/*.ts"] + compilerOptions: { composite: true }, + include: ["src/**/*.ts"], }), }), commandLineArgs: ["--p", "src/project"], @@ -355,9 +355,9 @@ declare global { "/src/project/node_modules/react/jsx-runtime.js": "export {}", // js needs to be present so there's a resolution result "/src/project/node_modules/@types/react/index.d.ts": getJsxLibraryContent(), // doesn't contain a jsx-runtime definition "/src/project/src/index.tsx": `export const App = () =>
;`, - "/src/project/tsconfig.json": JSON.stringify({ compilerOptions: { module: "commonjs", jsx: "react-jsx", incremental: true, jsxImportSource: "react" } }) + "/src/project/tsconfig.json": JSON.stringify({ compilerOptions: { module: "commonjs", jsx: "react-jsx", incremental: true, jsxImportSource: "react" } }), }), - commandLineArgs: ["--p", "src/project"] + commandLineArgs: ["--p", "src/project"], }); verifyTsc({ @@ -367,9 +367,9 @@ declare global { "/src/project/node_modules/react/jsx-runtime.js": "export {}", // js needs to be present so there's a resolution result "/src/project/node_modules/@types/react/index.d.ts": getJsxLibraryContent(), // doesn't contain a jsx-runtime definition "/src/project/src/index.tsx": `export const App = () =>
;`, - "/src/project/tsconfig.json": JSON.stringify({ compilerOptions: { module: "commonjs", jsx: "react-jsx", incremental: true, jsxImportSource: "react" } }) + "/src/project/tsconfig.json": JSON.stringify({ compilerOptions: { module: "commonjs", jsx: "react-jsx", incremental: true, jsxImportSource: "react" } }), }), - commandLineArgs: ["--p", "src/project", "--strict"] + commandLineArgs: ["--p", "src/project", "--strict"], }); }); @@ -381,20 +381,20 @@ declare global { "/src/projects/project1/tsconfig.json": JSON.stringify({ compilerOptions: { module: "none", - composite: true + composite: true, }, - exclude: ["temp"] + exclude: ["temp"], }), "/src/projects/project1/class1.ts": `class class1 {}`, "/src/projects/project1/class1.d.ts": `declare class class1 {}`, "/src/projects/project2/tsconfig.json": JSON.stringify({ compilerOptions: { module: "none", - composite: true + composite: true, }, references: [ - { path: "../project1" } - ] + { path: "../project1" }, + ], }), "/src/projects/project2/class2.ts": `class class2 {}`, }), @@ -430,7 +430,7 @@ declare global { caption: "Create output for class3", edit: fs => fs.writeFileSync("/src/projects/project1/class3.d.ts", `declare class class3 {}`, "utf-8"), }, - ] + ], }); verifyTsc({ @@ -447,7 +447,7 @@ declare global { "/src/project/class1.ts": `export class class1 {}`, }), edits: noChangeOnlyRuns, - baselinePrograms: true + baselinePrograms: true, }); verifyTsc({ @@ -476,7 +476,7 @@ declare global { (
- )` + )`, }, `\ninterface ReadonlyArray { readonly length: number }`), edits: noChangeOnlyRuns, }); @@ -509,7 +509,7 @@ declare global { commandLineArgs: ["--p", "src/project", "--rootDir", "src/project/src"], modifyFs: (fs) => { fs.writeFileSync("/lib/lib.esnext.d.ts", libContent); - } + }, }); verifyTsc({ @@ -517,7 +517,7 @@ declare global { subScenario: "change to type that gets used as global through export in another file", commandLineArgs: ["-p", `src/project`], fs: () => loadProjectFromFiles({ - "/src/project/tsconfig.json": JSON.stringify({ compilerOptions: { composite: true }, }), + "/src/project/tsconfig.json": JSON.stringify({ compilerOptions: { composite: true } }), "/src/project/class1.ts": `const a: MagicNumber = 1; console.log(a);`, "/src/project/constants.ts": "export default 1;", @@ -534,7 +534,7 @@ console.log(a);`, subScenario: "change to type that gets used as global through export in another file through indirect import", commandLineArgs: ["-p", `src/project`], fs: () => loadProjectFromFiles({ - "/src/project/tsconfig.json": JSON.stringify({ compilerOptions: { composite: true }, }), + "/src/project/tsconfig.json": JSON.stringify({ compilerOptions: { composite: true } }), "/src/project/class1.ts": `const a: MagicNumber = 1; console.log(a);`, "/src/project/constants.ts": "export default 1;", @@ -597,10 +597,10 @@ console.log(a);`, noEmitOnError: true, declaration: true, composite: true, - } + }, }), "/src/project/a.ts": "const x = 10;", - "/src/project/b.ts": "const y = 10;" + "/src/project/b.ts": "const y = 10;", }), commandLineArgs: ["--p", "/src/project"], edits: [ @@ -612,14 +612,14 @@ console.log(a);`, `Clean build does not emit any file so will have emitSignatures with all files since they are not emitted`, `Incremental build has emitSignatures from before, so it will have a.ts with signature since file.version isnt same`, `Incremental build will also have emitSignatureDtsMapDiffers for both files since the emitSignatures were without declarationMap but currentOptions have declrationMap`, - ] + ], }, { caption: "fix error declarationMap", edit: fs => replaceText(fs, "/src/project/a.ts", "x: 20", "x"), commandLineArgs: ["--p", "/src/project", "--declarationMap"], }, - ] + ], }); verifyTsc({ @@ -632,10 +632,10 @@ console.log(a);`, declaration: true, composite: true, outFile: "../outFile.js", - } + }, }), "/src/project/a.ts": "const x = 10;", - "/src/project/b.ts": "const y = 10;" + "/src/project/b.ts": "const y = 10;", }), commandLineArgs: ["--p", "/src/project"], edits: [ @@ -649,7 +649,7 @@ console.log(a);`, edit: fs => replaceText(fs, "/src/project/a.ts", "x: 20", "x"), commandLineArgs: ["--p", "/src/project", "--declarationMap"], }, - ] + ], }); describe("different options::", () => { @@ -669,7 +669,7 @@ console.log(a);`, discrepancyExplanation: () => [ `Clean build tsbuildinfo will have compilerOptions with composite and ${option.replace(/-/g, "")}`, `Incremental build will detect that it doesnt need to rebuild so tsbuild info is from before which has option composite only`, - ] + ], }; } function withEmitDeclarationOnlyChangeAndDiscrepancyExplanation(caption: string): TestTscEdit { @@ -678,7 +678,7 @@ console.log(a);`, edit.discrepancyExplanation = () => [ ...discrepancyExplanation(), `Clean build info does not have js section because its fresh build`, - `Incremental build info has js section from old build` + `Incremental build info has js section from old build`, ]; return edit; } @@ -837,7 +837,7 @@ console.log(a);`, caption: "delete file with imports", edit: fs => fs.unlinkSync("/src/project/file2.ts"), }, - ] + ], }); verifyTsc({ diff --git a/src/testRunner/unittests/tsc/listFilesOnly.ts b/src/testRunner/unittests/tsc/listFilesOnly.ts index 1ff81276d2227..f23d1641b6d09 100644 --- a/src/testRunner/unittests/tsc/listFilesOnly.ts +++ b/src/testRunner/unittests/tsc/listFilesOnly.ts @@ -13,7 +13,7 @@ describe("unittests:: tsc:: listFilesOnly::", () => { "/src/test.ts": Utils.dedent` export const x = 1;`, }), - commandLineArgs: ["/src/test.ts", "--watch", "--listFilesOnly"] + commandLineArgs: ["/src/test.ts", "--watch", "--listFilesOnly"], }); verifyTsc({ @@ -23,7 +23,7 @@ describe("unittests:: tsc:: listFilesOnly::", () => { "/src/test.ts": Utils.dedent` export const x = 1;`, }), - commandLineArgs: ["/src/test.ts", "--listFilesOnly"] + commandLineArgs: ["/src/test.ts", "--listFilesOnly"], }); verifyTsc({ @@ -31,7 +31,7 @@ describe("unittests:: tsc:: listFilesOnly::", () => { subScenario: "combined with incremental", fs: () => loadProjectFromFiles({ "/src/test.ts": `export const x = 1;`, - "/src/tsconfig.json": "{}" + "/src/tsconfig.json": "{}", }), commandLineArgs: ["-p", "/src", "--incremental", "--listFilesOnly"], edits: [ @@ -43,7 +43,7 @@ describe("unittests:: tsc:: listFilesOnly::", () => { { ...noChangeRun, commandLineArgs: ["-p", "/src", "--incremental"], - } - ] + }, + ], }); }); diff --git a/src/testRunner/unittests/tsc/moduleResolution.ts b/src/testRunner/unittests/tsc/moduleResolution.ts index 7be319098fcdc..b5bc2bd3328c1 100644 --- a/src/testRunner/unittests/tsc/moduleResolution.ts +++ b/src/testRunner/unittests/tsc/moduleResolution.ts @@ -58,6 +58,6 @@ describe("unittests:: tsc:: moduleResolution::", () => { caption: "add the ndoe10Result in package/types", edit: fs => fs.writeFileSync("/home/src/projects/project/node_modules/foo2/index.d.ts", getFsContentsForNode10ResultDts("foo2")), }, - ] + ], }); }); \ No newline at end of file diff --git a/src/testRunner/unittests/tsc/projectReferences.ts b/src/testRunner/unittests/tsc/projectReferences.ts index e6bd7ce6caf20..e55e2f34dffff 100644 --- a/src/testRunner/unittests/tsc/projectReferences.ts +++ b/src/testRunner/unittests/tsc/projectReferences.ts @@ -12,11 +12,11 @@ describe("unittests:: tsc:: projectReferences::", () => { "/src/project/tsconfig.json": JSON.stringify({ compilerOptions: { module: "amd", - outFile: "theApp.js" + outFile: "theApp.js", }, references: [ - { path: "../Util/Dates" } - ] + { path: "../Util/Dates" }, + ], }), }), commandLineArgs: ["--p", "src/project"], @@ -31,15 +31,15 @@ describe("unittests:: tsc:: projectReferences::", () => { compilerOptions: { composite: true, noEmit: true, - } + }, }), "/src/project/index.ts": `import { x } from "../utils";`, "/src/project/tsconfig.json": JSON.stringify({ references: [ - { path: "../utils" } - ] + { path: "../utils" }, + ], }), }), - commandLineArgs: ["--p", "src/project"] + commandLineArgs: ["--p", "src/project"], }); }); diff --git a/src/testRunner/unittests/tsc/projectReferencesConfig.ts b/src/testRunner/unittests/tsc/projectReferencesConfig.ts index ae2f4c736cc39..093d1dd18d055 100644 --- a/src/testRunner/unittests/tsc/projectReferencesConfig.ts +++ b/src/testRunner/unittests/tsc/projectReferencesConfig.ts @@ -23,7 +23,7 @@ function getConfig({ references, options, config }: { compilerOptions: { composite: true, outDir: "bin", - ...options + ...options, }, references: references?.map(r => { if (typeof r === "string") { @@ -43,11 +43,11 @@ describe("unittests:: config:: project-references meta check", () => { "/primary/tsconfig.json": getConfig(), "/primary/a.ts": emptyModule(), "/secondary/tsconfig.json": getConfig({ - references: ["../primary"] + references: ["../primary"], }), "/secondary/b.ts": moduleImporting("../primary/a"), }), - commandLineArgs: ["--p", "/primary/tsconfig.json"] + commandLineArgs: ["--p", "/primary/tsconfig.json"], }); }); @@ -61,12 +61,12 @@ describe("unittests:: config:: project-references constraint checking for settin fs: () => loadProjectFromFiles({ "/primary/tsconfig.json": getConfig({ options: { - declaration: false - } + declaration: false, + }, }), "/primary/a.ts": emptyModule(), }), - commandLineArgs: ["--p", "/primary/tsconfig.json"] + commandLineArgs: ["--p", "/primary/tsconfig.json"], }); verifyTsc({ @@ -75,19 +75,19 @@ describe("unittests:: config:: project-references constraint checking for settin fs: () => loadProjectFromFiles({ "/primary/tsconfig.json": getConfig({ options: { - composite: false - } + composite: false, + }, }), "/primary/a.ts": emptyModule(), "/reference/tsconfig.json": getConfig({ references: ["../primary"], config: { - files: ["b.ts"] - } + files: ["b.ts"], + }, }), "/reference/b.ts": moduleImporting("../primary/a"), }), - commandLineArgs: ["--p", "/reference/tsconfig.json"] + commandLineArgs: ["--p", "/reference/tsconfig.json"], }); verifyTsc({ @@ -96,19 +96,19 @@ describe("unittests:: config:: project-references constraint checking for settin fs: () => loadProjectFromFiles({ "/primary/tsconfig.json": getConfig({ options: { - composite: false - } + composite: false, + }, }), "/primary/a.ts": emptyModule(), "/reference/tsconfig.json": getConfig({ references: ["../primary"], config: { - files: [] - } + files: [], + }, }), "/reference/b.ts": moduleImporting("../primary/a"), }), - commandLineArgs: ["--p", "/reference/tsconfig.json"] + commandLineArgs: ["--p", "/reference/tsconfig.json"], }); verifyTsc({ @@ -117,13 +117,13 @@ describe("unittests:: config:: project-references constraint checking for settin fs: () => loadProjectFromFiles({ "/primary/tsconfig.json": getConfig({ config: { - files: ["a.ts"] - } + files: ["a.ts"], + }, }), "/primary/a.ts": "import * as b from './b'", "/primary/b.ts": "export {}", }), - commandLineArgs: ["--p", "/primary/tsconfig.json"] + commandLineArgs: ["--p", "/primary/tsconfig.json"], }); verifyTsc({ @@ -131,11 +131,11 @@ describe("unittests:: config:: project-references constraint checking for settin subScenario: "errors when the referenced project doesnt exist", fs: () => loadProjectFromFiles({ "/primary/tsconfig.json": getConfig({ - references: ["../foo"] + references: ["../foo"], }), "/primary/a.ts": emptyModule(), }), - commandLineArgs: ["--p", "/primary/tsconfig.json"] + commandLineArgs: ["--p", "/primary/tsconfig.json"], }); verifyTsc({ @@ -149,7 +149,7 @@ describe("unittests:: config:: project-references constraint checking for settin "/someProj/tsconfig.json": getConfig(), "/someProj/b.ts": "const x = 100;", }), - commandLineArgs: ["--p", "/primary/tsconfig.json", "--ignoreDeprecations", "5.0"] + commandLineArgs: ["--p", "/primary/tsconfig.json", "--ignoreDeprecations", "5.0"], }); verifyTsc({ @@ -161,11 +161,11 @@ describe("unittests:: config:: project-references constraint checking for settin }), "/primary/a.ts": "const y = x;", "/someProj/tsconfig.json": getConfig({ - options: { outFile: "foo.js" } + options: { outFile: "foo.js" }, }), "/someProj/b.ts": "const x = 100;", }), - commandLineArgs: ["--p", "/primary/tsconfig.json", "--ignoreDeprecations", "5.0"] + commandLineArgs: ["--p", "/primary/tsconfig.json", "--ignoreDeprecations", "5.0"], }); }); @@ -181,11 +181,11 @@ describe("unittests:: config:: project-references path mapping", () => { "/alpha/a.ts": "export const m: number = 3;", "/alpha/bin/a.d.ts": emptyModule(), "/beta/tsconfig.json": getConfig({ - references: ["../alpha"] + references: ["../alpha"], }), "/beta/b.ts": "import { m } from '../alpha/a'", }), - commandLineArgs: ["--p", "/beta/tsconfig.json", "--explainFiles"] + commandLineArgs: ["--p", "/beta/tsconfig.json", "--explainFiles"], }); }); @@ -197,11 +197,11 @@ describe("unittests:: config:: project-references nice-behavior", () => { "/alpha/tsconfig.json": getConfig(), "/alpha/a.ts": "export const m: number = 3;", "/beta/tsconfig.json": getConfig({ - references: ["../alpha"] + references: ["../alpha"], }), "/beta/b.ts": "import { m } from '../alpha/a'", }), - commandLineArgs: ["--p", "/beta/tsconfig.json"] + commandLineArgs: ["--p", "/beta/tsconfig.json"], }); verifyTsc({ @@ -215,13 +215,13 @@ describe("unittests:: config:: project-references nice-behavior", () => { options: { baseUrl: "./", paths: { - "@alpha/*": ["/alpha/*"] - } - } + "@alpha/*": ["/alpha/*"], + }, + }, }), "/beta/b.ts": "import { m } from '@alpha/a'", }), - commandLineArgs: ["--p", "/beta/tsconfig.json"] + commandLineArgs: ["--p", "/beta/tsconfig.json"], }); }); @@ -236,7 +236,7 @@ describe("unittests:: config:: project-references behavior changes under composi "/alpha/tsconfig.json": getConfig(), "/alpha/src/a.ts": "export const m: number = 3;", }), - commandLineArgs: ["--p", "/alpha/tsconfig.json"] + commandLineArgs: ["--p", "/alpha/tsconfig.json"], }); }); @@ -249,6 +249,6 @@ describe("unittests:: config:: project-references errors when a file in a compos "/alpha/src/a.ts": "import * as b from '../../beta/b'", "/beta/b.ts": "export { }", }), - commandLineArgs: ["--p", "/alpha/tsconfig.json"] + commandLineArgs: ["--p", "/alpha/tsconfig.json"], }); }); diff --git a/src/testRunner/unittests/tsc/redirect.ts b/src/testRunner/unittests/tsc/redirect.ts index bd56f7aafdc53..3945ce4da3645 100644 --- a/src/testRunner/unittests/tsc/redirect.ts +++ b/src/testRunner/unittests/tsc/redirect.ts @@ -10,12 +10,12 @@ describe("unittests:: tsc:: redirect::", () => { fs: () => loadProjectFromFiles({ "/src/project/tsconfig.json": JSON.stringify({ compilerOptions: { - outDir: "out" + outDir: "out", }, include: [ "copy1/node_modules/target/*", "copy2/node_modules/target/*", - ] + ], }), "/src/project/copy1/node_modules/target/index.ts": "export const a = 1;", "/src/project/copy1/node_modules/target/import.ts": `import {} from "./";`, diff --git a/src/testRunner/unittests/tsc/runWithoutArgs.ts b/src/testRunner/unittests/tsc/runWithoutArgs.ts index ee4c7a8ae0a41..7c420ddcdfae3 100644 --- a/src/testRunner/unittests/tsc/runWithoutArgs.ts +++ b/src/testRunner/unittests/tsc/runWithoutArgs.ts @@ -9,7 +9,7 @@ describe("unittests:: tsc:: runWithoutArgs::", () => { subScenario: "show help with ExitStatus.DiagnosticsPresent_OutputsSkipped", fs: () => loadProjectFromFiles({}), commandLineArgs: [], - environmentVariables: { TS_TEST_TERMINAL_WIDTH: "120" } + environmentVariables: { TS_TEST_TERMINAL_WIDTH: "120" }, }); verifyTsc({ @@ -24,7 +24,7 @@ describe("unittests:: tsc:: runWithoutArgs::", () => { subScenario: "does not add color when NO_COLOR is set", fs: () => loadProjectFromFiles({}), commandLineArgs: [], - environmentVariables: { NO_COLOR: "true" } + environmentVariables: { NO_COLOR: "true" }, }); }); diff --git a/src/testRunner/unittests/tscWatch/consoleClearing.ts b/src/testRunner/unittests/tscWatch/consoleClearing.ts index f48ea56bd5060..60d1cb0e9690e 100644 --- a/src/testRunner/unittests/tscWatch/consoleClearing.ts +++ b/src/testRunner/unittests/tscWatch/consoleClearing.ts @@ -16,7 +16,7 @@ describe("unittests:: tsc-watch:: console clearing", () => { const scenario = "consoleClearing"; const file: File = { path: "/f.ts", - content: "" + content: "", }; const makeChangeToFile: TscWatchCompileChange[] = [{ @@ -42,11 +42,11 @@ describe("unittests:: tsc-watch:: console clearing", () => { describe("when preserveWatchOutput is true in config file", () => { const compilerOptions: ts.CompilerOptions = { - preserveWatchOutput: true + preserveWatchOutput: true, }; const configFile: File = { path: "/tsconfig.json", - content: JSON.stringify({ compilerOptions }) + content: JSON.stringify({ compilerOptions }), }; const files = [file, configFile, libFile]; it("using createWatchOfConfigFile ", () => { @@ -64,7 +64,7 @@ describe("unittests:: tsc-watch:: console clearing", () => { ...baseline, getPrograms: () => [[watch.getCurrentProgram().getProgram(), watch.getCurrentProgram()]], edits: makeChangeToFile, - watchOrSolution: watch + watchOrSolution: watch, }); }); verifyTscWatch({ diff --git a/src/testRunner/unittests/tscWatch/emit.ts b/src/testRunner/unittests/tscWatch/emit.ts index 4cd7a3b591920..77b53b579b4dc 100644 --- a/src/testRunner/unittests/tscWatch/emit.ts +++ b/src/testRunner/unittests/tscWatch/emit.ts @@ -27,14 +27,14 @@ describe("unittests:: tsc-watch:: emit with outFile or out setting", () => { { caption: "Make change in the file", edit: sys => sys.writeFile("/a/a.ts", "let x = 11"), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "Make change in the file again", edit: sys => sys.writeFile("/a/a.ts", "let xy = 11"), - timeouts: sys => sys.runQueuedTimeoutCallbacks() - } - ] + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ], }); } verifyOutAndOutFileSetting("config does not have out or outFile"); @@ -49,19 +49,19 @@ describe("unittests:: tsc-watch:: emit with outFile or out setting", () => { sys: () => { const file1: File = { path: "/a/b/output/AnotherDependency/file1.d.ts", - content: "declare namespace Common.SomeComponent.DynamicMenu { enum Z { Full = 0, Min = 1, Average = 2, } }" + content: "declare namespace Common.SomeComponent.DynamicMenu { enum Z { Full = 0, Min = 1, Average = 2, } }", }; const file2: File = { path: "/a/b/dependencies/file2.d.ts", - content: "declare namespace Dependencies.SomeComponent { export class SomeClass { version: string; } }" + content: "declare namespace Dependencies.SomeComponent { export class SomeClass { version: string; } }", }; const file3: File = { path: "/a/b/project/src/main.ts", - content: "namespace Main { export function fooBar() {} }" + content: "namespace Main { export function fooBar() {} }", }; const file4: File = { path: "/a/b/project/src/main2.ts", - content: "namespace main.file4 { import DynamicMenu = Common.SomeComponent.DynamicMenu; export function foo(a: DynamicMenu.z) { } }" + content: "namespace main.file4 { import DynamicMenu = Common.SomeComponent.DynamicMenu; export function foo(a: DynamicMenu.z) { } }", }; const configFile: File = { path: "/a/b/project/tsconfig.json", @@ -69,8 +69,8 @@ describe("unittests:: tsc-watch:: emit with outFile or out setting", () => { compilerOptions: useOutFile ? { outFile: "../output/common.js", target: "es5" } : { outDir: "../output", target: "es5" }, - files: [file1.path, file2.path, file3.path, file4.path] - }) + files: [file1.path, file2.path, file3.path, file4.path], + }), }; return createWatchedSystem([file1, file2, file3, file4, libFile, configFile]); }, @@ -102,7 +102,7 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => { configObj, getAdditionalFileOrFolder, firstReloadFileList, - changes + changes, }: VerifyTscWatchEmit) { verifyTscWatch({ scenario, @@ -131,11 +131,11 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => { const globalFile3: File = { path: globalFilePath, - content: `interface GlobalFoo { age: number }` + content: `interface GlobalFoo { age: number }`, }; const configFile: File = { path: configFilePath, - content: JSON.stringify(configObj || {}) + content: JSON.stringify(configObj || {}), }; const additionalFiles = getAdditionalFileOrFolder?.() || ts.emptyArray; const files = [moduleFile1, file1Consumer1, file1Consumer2, globalFile3, moduleFile2, configFile, libFile, ...additionalFiles]; @@ -144,7 +144,7 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => { files ); }, - edits: changes + edits: changes, }); } @@ -165,8 +165,8 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => { caption: "Change the content of moduleFile1 to `export var T: number;export function Foo() { console.log('hi'); };`", edit: sys => sys.writeFile(moduleFile1Path, `export var T: number;export function Foo() { console.log('hi'); };`), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatchEmit({ @@ -197,8 +197,8 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => { modifyModuleFile1Shape(sys); }, timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatchEmit({ @@ -211,8 +211,8 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => { sys.deleteFile(file1Consumer2Path); }, timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatchEmit({ @@ -225,8 +225,8 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => { modifyModuleFile1Shape(sys); }, timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatchEmit({ @@ -238,8 +238,8 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => { caption: "change file1 internal, and verify only file1 is affected", edit: sys => sys.appendFile(moduleFile1Path, "var T1: number;"), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatchEmit({ @@ -249,31 +249,31 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => { caption: "change shape of global file", edit: sys => sys.appendFile(globalFilePath, "var T2: string;"), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatchEmit({ subScenario: "should always return the file itself if '--isolatedModules' is specified", configObj: { compilerOptions: { isolatedModules: true } }, changes: [ - changeModuleFile1Shape - ] + changeModuleFile1Shape, + ], }); verifyTscWatchEmit({ subScenario: "should always return the file itself if '--out' or '--outFile' is specified", configObj: { compilerOptions: { module: "system", outFile: "/a/b/out.js" } }, changes: [ - changeModuleFile1Shape - ] + changeModuleFile1Shape, + ], }); verifyTscWatchEmit({ subScenario: "should return cascaded affected file list", getAdditionalFileOrFolder: () => [{ path: "/a/b/file1Consumer1Consumer1.ts", - content: `import {y} from "./file1Consumer1";` + content: `import {y} from "./file1Consumer1";`, }], changes: [ { @@ -289,8 +289,8 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => { sys.writeFile(moduleFile1Path, `export var T2: number;export function Foo() { };`); }, timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatchEmit({ @@ -299,13 +299,13 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => { { path: "/a/b/file1.ts", content: `/// -export var t1 = 10;` +export var t1 = 10;`, }, { path: "/a/b/file2.ts", content: `/// -export var t2 = 10;` - } +export var t2 = 10;`, + }, ], firstReloadFileList: [libFile.path, "/a/b/file1.ts", "/a/b/file2.ts", configFilePath], changes: [ @@ -313,8 +313,8 @@ export var t2 = 10;` caption: "change file1", edit: sys => sys.appendFile("/a/b/file1.ts", "export var t3 = 10;"), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatchEmit({ @@ -322,7 +322,7 @@ export var t2 = 10;` getAdditionalFileOrFolder: () => [{ path: "/a/b/referenceFile1.ts", content: `/// -export var x = Foo();` +export var x = Foo();`, }], firstReloadFileList: [libFile.path, "/a/b/referenceFile1.ts", moduleFile1Path, configFilePath], changes: [ @@ -330,8 +330,8 @@ export var x = Foo();` caption: "delete moduleFile1", edit: sys => sys.deleteFile(moduleFile1Path), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatchEmit({ @@ -339,7 +339,7 @@ export var x = Foo();` getAdditionalFileOrFolder: () => [{ path: "/a/b/referenceFile1.ts", content: `/// -export var x = Foo();` +export var x = Foo();`, }], firstReloadFileList: [libFile.path, "/a/b/referenceFile1.ts", configFilePath], changes: [ @@ -352,8 +352,8 @@ export var x = Foo();` caption: "create moduleFile2", edit: sys => sys.writeFile(moduleFile2Path, "export var Foo4 = 10;"), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); }); @@ -367,9 +367,9 @@ describe("unittests:: tsc-watch:: emit file content", () => { [ { path: "/a/app.ts", - content: ["var x = 1;", "var y = 2;"].join(newLine) + content: ["var x = 1;", "var y = 2;"].join(newLine), }, - libFile + libFile, ], { newLine } ), @@ -378,7 +378,7 @@ describe("unittests:: tsc-watch:: emit file content", () => { caption: "Append a line", edit: sys => sys.appendFile("/a/app.ts", newLine + "var z = 3;"), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } + }, ], }); } @@ -392,22 +392,22 @@ describe("unittests:: tsc-watch:: emit file content", () => { sys: () => { const file1 = { path: "/a/b/f1.ts", - content: `export function Foo() { return 10; }` + content: `export function Foo() { return 10; }`, }; const file2 = { path: "/a/b/f2.ts", - content: `import {Foo} from "./f1"; export let y = Foo();` + content: `import {Foo} from "./f1"; export let y = Foo();`, }; const file3 = { path: "/a/b/f3.ts", - content: `import {y} from "./f2"; let x = y;` + content: `import {y} from "./f2"; let x = y;`, }; const configFile = { path: "/a/b/tsconfig.json", - content: "{}" + content: "{}", }; return createWatchedSystem([file1, file2, file3, configFile, libFile]); }, @@ -421,7 +421,7 @@ describe("unittests:: tsc-watch:: emit file content", () => { caption: "Again Append content to f1", edit: sys => sys.appendFile("/a/b/f1.ts", "export function fooN() { return 2; }"), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } + }, ], }); @@ -433,15 +433,15 @@ describe("unittests:: tsc-watch:: emit file content", () => { const currentDirectory = "/user/someone/projects/myproject"; const file1: File = { path: `${currentDirectory}/file1.ts`, - content: "export const enum E1 { V = 1 }" + content: "export const enum E1 { V = 1 }", }; const file2: File = { path: `${currentDirectory}/file2.ts`, - content: `import { E1 } from "./file1"; export const enum E2 { V = E1.V }` + content: `import { E1 } from "./file1"; export const enum E2 { V = E1.V }`, }; const file3: File = { path: `${currentDirectory}/file3.ts`, - content: `import { E2 } from "./file2"; const v: E2 = E2.V;` + content: `import { E2 } from "./file2"; const v: E2 = E2.V;`, }; return createWatchedSystem([file1, file2, file3, libFile]); }, @@ -450,7 +450,7 @@ describe("unittests:: tsc-watch:: emit file content", () => { caption: "Append content to file3", edit: sys => sys.appendFile("/user/someone/projects/myproject/file3.ts", "function foo2() { return 2; }"), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } + }, ], }); @@ -462,15 +462,15 @@ describe("unittests:: tsc-watch:: emit file content", () => { const projectLocation = "/home/username/project"; const file: File = { path: `${projectLocation}/app/file.ts`, - content: "var a = 10;" + content: "var a = 10;", }; const configFile: File = { path: `${projectLocation}/tsconfig.json`, content: JSON.stringify({ include: [ - "app/**/*.ts" - ] - }) + "app/**/*.ts", + ], + }), }; const files = [file, configFile, libFile]; return createWatchedSystem(files, { currentDirectory: projectLocation, useCaseSensitiveFileNames: true }); @@ -480,8 +480,8 @@ describe("unittests:: tsc-watch:: emit file content", () => { caption: "file is deleted and then created to modify content", edit: sys => sys.appendFile("/home/username/project/app/file.ts", "\nvar b = 10;", { invokeFileDeleteCreateAsPartInsteadOfChange: true }), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); }); @@ -497,20 +497,20 @@ describe("unittests:: tsc-watch:: emit with when module emit is specified as nod compilerOptions: { module: "none", allowJs: true, - outDir: "Static/scripts/" + outDir: "Static/scripts/", }, include: [ - "Scripts/**/*" + "Scripts/**/*", ], - }) + }), }; const file1: File = { path: "/a/rootFolder/project/Scripts/TypeScript.ts", - content: "var z = 10;" + content: "var z = 10;", }; const file2: File = { path: "/a/rootFolder/project/Scripts/Javascript.js", - content: "var zz = 10;" + content: "var zz = 10;", }; return createWatchedSystem([configFile, file1, file2, libFile]); }, @@ -523,7 +523,7 @@ describe("unittests:: tsc-watch:: emit with when module emit is specified as nod { invokeDirectoryWatcherInsteadOfFileChanged: true }, ), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } + }, ], }); }); diff --git a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts index 926cf99ec5c4f..f5f10091ef7b8 100644 --- a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts +++ b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts @@ -13,7 +13,7 @@ import { describe("unittests:: tsc-watch:: Emit times and Error updates in builder after program changes", () => { const config: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: `{}` + content: `{}`, }; interface VerifyEmitAndErrorUpdates { subScenario: string @@ -36,7 +36,7 @@ describe("unittests:: tsc-watch:: Emit times and Error updates in builder after { currentDirectory: currentDirectory || "/user/username/projects/myproject" } ), edits: changes, - baselineIncremental: true + baselineIncremental: true, }); verifyTscWatch({ @@ -48,7 +48,7 @@ describe("unittests:: tsc-watch:: Emit times and Error updates in builder after { currentDirectory: currentDirectory || "/user/username/projects/myproject" } ), edits: changes, - baselineIncremental: true + baselineIncremental: true, }); verifyTscWatch({ @@ -60,7 +60,7 @@ describe("unittests:: tsc-watch:: Emit times and Error updates in builder after { currentDirectory: currentDirectory || "/user/username/projects/myproject" } ), edits: changes, - baselineIncremental: true + baselineIncremental: true, }); verifyTscWatch({ @@ -72,7 +72,7 @@ describe("unittests:: tsc-watch:: Emit times and Error updates in builder after { currentDirectory: currentDirectory || "/user/username/projects/myproject" } ), edits: changes, - baselineIncremental: true + baselineIncremental: true, }); verifyTscWatch({ @@ -84,7 +84,7 @@ describe("unittests:: tsc-watch:: Emit times and Error updates in builder after { currentDirectory: currentDirectory || "/user/username/projects/myproject" } ), edits: changes, - baselineIncremental: true + baselineIncremental: true, }); verifyTscWatch({ @@ -96,7 +96,7 @@ describe("unittests:: tsc-watch:: Emit times and Error updates in builder after { currentDirectory: currentDirectory || "/user/username/projects/myproject" } ), edits: changes, - baselineIncremental: true + baselineIncremental: true, }); } @@ -106,7 +106,7 @@ describe("unittests:: tsc-watch:: Emit times and Error updates in builder after content: `import {B} from './b'; declare var console: any; let b = new B(); -console.log(b.c.d);` +console.log(b.c.d);`, }; function verifyDeepImportChange(subScenario: string, bFile: File, cFile: File) { @@ -128,7 +128,7 @@ console.log(b.c.d);` caption: "Rename property d to d2 of class C", edit: sys => sys.writeFile(cFile.path, cFile.content.replace("d", "d2")), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } + }, ], }); } @@ -139,14 +139,14 @@ console.log(b.c.d);` export class B { c = new C(); -}` +}`, }; const cFile: File = { path: `/user/username/projects/myproject/c.ts`, content: `export class C { d = 1; -}` +}`, }; verifyDeepImportChange( "errors for .ts change", @@ -161,14 +161,14 @@ export class B export class B { c: C; -}` +}`, }; const cFile: File = { path: `/user/username/projects/myproject/c.d.ts`, content: `export class C { d: number; -}` +}`, }; verifyDeepImportChange( "errors for .d.ts change", @@ -188,13 +188,13 @@ export class B export interface Coords { x2: number; y: number; -}` +}`, }; const bFile: File = { path: `/user/username/projects/myproject/b.ts`, content: `import { Point } from "./a"; export interface PointWrapper extends Point { -}` +}`, }; const cFile: File = { path: `/user/username/projects/myproject/c.ts`, @@ -207,16 +207,16 @@ export function getPoint(): PointWrapper { y: 2 } } -};` +};`, }; const dFile: File = { path: `/user/username/projects/myproject/d.ts`, content: `import { getPoint } from "./c"; -getPoint().c.x;` +getPoint().c.x;`, }; const eFile: File = { path: `/user/username/projects/myproject/e.ts`, - content: `import "./d";` + content: `import "./d";`, }; verifyEmitAndErrorUpdates({ subScenario: "file not exporting a deep multilevel import that changes", @@ -237,7 +237,7 @@ getPoint().c.x;` edit: sys => sys.writeFile(aFile.path, aFile.content.replace("x2", "x")), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); }); describe("updates errors when file transitively exported file changes", () => { @@ -245,8 +245,8 @@ getPoint().c.x;` path: `/user/username/projects/myproject/tsconfig.json`, content: JSON.stringify({ files: ["app.ts"], - compilerOptions: { baseUrl: "." } - }) + compilerOptions: { baseUrl: "." }, + }), }; const app: File = { path: `/user/username/projects/myproject/app.ts`, @@ -255,11 +255,11 @@ export class App { public constructor() { new Data().test(); } -}` +}`, }; const lib2Public: File = { path: `/user/username/projects/myproject/lib2/public.ts`, - content: `export * from "./data";` + content: `export * from "./data";`, }; const lib2Data: File = { path: `/user/username/projects/myproject/lib2/data.ts`, @@ -271,21 +271,21 @@ export class Data { } return result; } -}` +}`, }; const lib1Public: File = { path: `/user/username/projects/myproject/lib1/public.ts`, - content: `export * from "./tools/public";` + content: `export * from "./tools/public";`, }; const lib1ToolsPublic: File = { path: `/user/username/projects/myproject/lib1/tools/public.ts`, - content: `export * from "./toolsinterface";` + content: `export * from "./toolsinterface";`, }; const lib1ToolsInterface: File = { path: `/user/username/projects/myproject/lib1/tools/toolsinterface.ts`, content: `export interface ITest { title: string; -}` +}`, }; function verifyTransitiveExports(subScenario: string, files: readonly File[]) { @@ -307,8 +307,8 @@ export class Data { caption: "Rename property title to title2 of interface ITest", edit: sys => sys.writeFile(lib1ToolsInterface.path, lib1ToolsInterface.content.replace("title", "title2")), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); } describe("when there are no circular import and exports", () => { @@ -328,14 +328,14 @@ export class Data { } return result; } -}` +}`, }; const lib2Data2: File = { path: `/user/username/projects/myproject/lib2/data2.ts`, content: `import { Data } from "./data"; export class Data2 { public dat?: Data; -}` +}`, }; verifyTransitiveExports( "yes circular import/exports", @@ -350,7 +350,7 @@ export class Data2 { caption, edit: sys => sys.writeFile(`/user/username/projects/noEmitOnError/src/main.ts`, content), // build project - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }; } const noChange: TscWatchCompileChange = { diff --git a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts index da9db45871b84..f8c3724578d54 100644 --- a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts +++ b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts @@ -13,17 +13,17 @@ import { describe("unittests:: tsc-watch:: forceConsistentCasingInFileNames", () => { const loggerFile: File = { path: `/user/username/projects/myproject/logger.ts`, - content: `export class logger { }` + content: `export class logger { }`, }; const anotherFile: File = { path: `/user/username/projects/myproject/another.ts`, - content: `import { logger } from "./logger"; new logger();` + content: `import { logger } from "./logger"; new logger();`, }; const tsconfig: File = { path: `/user/username/projects/myproject/tsconfig.json`, content: JSON.stringify({ - compilerOptions: { forceConsistentCasingInFileNames: true } - }) + compilerOptions: { forceConsistentCasingInFileNames: true }, + }), }; function verifyConsistentFileNames({ subScenario, changes }: { subScenario: string; changes: TscWatchCompileChange[]; }) { @@ -32,7 +32,7 @@ describe("unittests:: tsc-watch:: forceConsistentCasingInFileNames", () => { subScenario, commandLineArgs: ["--w", "--p", tsconfig.path], sys: () => createWatchedSystem([loggerFile, anotherFile, tsconfig, libFile]), - edits: changes + edits: changes, }); } @@ -43,8 +43,8 @@ describe("unittests:: tsc-watch:: forceConsistentCasingInFileNames", () => { caption: "Change module name from logger to Logger", edit: sys => sys.writeFile(anotherFile.path, anotherFile.content.replace("./logger", "./Logger")), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyConsistentFileNames({ @@ -54,8 +54,8 @@ describe("unittests:: tsc-watch:: forceConsistentCasingInFileNames", () => { caption: "Change name of file from logger to Logger", edit: sys => sys.renameFile(loggerFile.path, `/user/username/projects/myproject/Logger.ts`), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -65,19 +65,19 @@ describe("unittests:: tsc-watch:: forceConsistentCasingInFileNames", () => { sys: () => { const moduleA: File = { path: `/user/username/projects/myproject/moduleA.ts`, - content: `import a = require("./ModuleC")` + content: `import a = require("./ModuleC")`, }; const moduleB: File = { path: `/user/username/projects/myproject/moduleB.ts`, - content: `import a = require("./moduleC")` + content: `import a = require("./moduleC")`, }; const moduleC: File = { path: `/user/username/projects/myproject/moduleC.ts`, - content: `export const x = 10;` + content: `export const x = 10;`, }; const tsconfig: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { forceConsistentCasingInFileNames: true } }) + content: JSON.stringify({ compilerOptions: { forceConsistentCasingInFileNames: true } }), }; return createWatchedSystem([moduleA, moduleB, moduleC, libFile, tsconfig], { currentDirectory: "/user/username/projects/myproject" }); }, @@ -87,7 +87,7 @@ describe("unittests:: tsc-watch:: forceConsistentCasingInFileNames", () => { edit: sys => sys.prependFile(`/user/username/projects/myproject/moduleA.ts`, `// some comment `), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } + }, ], }); @@ -114,19 +114,19 @@ export const Fragment: unique symbol; }, { path: `/user/username/projects/myproject/node_modules/react/package.json`, - content: JSON.stringify({ name: "react", version: "0.0.1" }) + content: JSON.stringify({ name: "react", version: "0.0.1" }), }, { path: `/user/username/projects/myproject/index.tsx`, - content: `export const App = () =>
;` + content: `export const App = () =>
;`, }, { path: `/user/username/projects/myproject/tsconfig.json`, content: JSON.stringify({ compilerOptions: { jsx: "react-jsx", jsxImportSource: "react", forceConsistentCasingInFileNames: true }, - files: ["node_modules/react/Jsx-Runtime/index.d.ts", "index.tsx"] - }) - } + files: ["node_modules/react/Jsx-Runtime/index.d.ts", "index.tsx"], + }), + }, ], { currentDirectory: "/user/username/projects/myproject" }), }); @@ -141,7 +141,7 @@ export const Fragment: unique symbol; content: ` export const a = 1; export const b = 2; -` +`, }; const moduleB: File = { path: `${windowsStyleRoot}/${projectRootRelative}/b.ts`, @@ -150,11 +150,11 @@ import { a } from "${windowsStyleRoot.toLocaleUpperCase()}/${projectRootRelative import { b } from "${windowsStyleRoot.toLocaleLowerCase()}/${projectRootRelative}/a" a;b; -` +`, }; const tsconfig: File = { path: `${windowsStyleRoot}/${projectRootRelative}/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { forceConsistentCasingInFileNames: true } }) + content: JSON.stringify({ compilerOptions: { forceConsistentCasingInFileNames: true } }), }; return createWatchedSystem([moduleA, moduleB, libFile, tsconfig], { windowsStyleRoot, useCaseSensitiveFileNames: false }); }, @@ -164,7 +164,7 @@ a;b; edit: sys => sys.prependFile(`${windowsStyleRoot}/${projectRootRelative}/a.ts`, `// some comment `), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } + }, ], }); } @@ -184,7 +184,7 @@ a;b; content: ` export const a = 1; export const b = 2; -` +`, }; const symlinkA: SymLink = { path: `/user/username/projects/myproject/link.ts`, @@ -197,11 +197,11 @@ import { a } from "${importedPath}"; import { b } from "./link"; a;b; -` +`, }; const tsconfig: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { forceConsistentCasingInFileNames: true } }) + content: JSON.stringify({ compilerOptions: { forceConsistentCasingInFileNames: true } }), }; return createWatchedSystem([moduleA, symlinkA, moduleB, libFile, tsconfig], { currentDirectory: "/user/username/projects/myproject" }); }, @@ -211,7 +211,7 @@ a;b; edit: sys => sys.prependFile(diskPath, `// some comment `), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } + }, ], }); } @@ -234,7 +234,7 @@ a;b; content: ` export const a = 1; export const b = 2; -` +`, }; const symlinkA: SymLink = { path: `/user/username/projects/myproject/link`, @@ -247,12 +247,12 @@ import { a } from "${importedPath}/a"; import { b } from "./link/a"; a;b; -` +`, }; const tsconfig: File = { path: `/user/username/projects/myproject/tsconfig.json`, // Use outFile because otherwise the real and linked files will have the same output path - content: JSON.stringify({ compilerOptions: { forceConsistentCasingInFileNames: true, outFile: "out.js", module: "system" } }) + content: JSON.stringify({ compilerOptions: { forceConsistentCasingInFileNames: true, outFile: "out.js", module: "system" } }), }; return createWatchedSystem([moduleA, symlinkA, moduleB, libFile, tsconfig], { currentDirectory: "/user/username/projects/myproject" }); }, @@ -262,7 +262,7 @@ a;b; edit: sys => sys.prependFile(`${diskPath}/a.ts`, `// some comment `), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } + }, ], }); } @@ -288,17 +288,17 @@ a;b; ".": { types: { import: "./index.d.mts", - default: "./index.d.ts" - } + default: "./index.d.ts", + }, }, - } + }, }), "/Users/name/projects/web/tsconfig.json": JSON.stringify({ compilerOptions: { moduleResolution: "nodenext", forceConsistentCasingInFileNames: true, traceResolution: true, - } + }, }), [libFile.path]: libFile.content, }, { currentDirectory: "/Users/name/projects/web" }), @@ -313,8 +313,8 @@ a;b; name: "@this/package", type: "module", exports: { - ".": "./dist/index.js" - } + ".": "./dist/index.js", + }, }), "/Users/name/projects/web/index.ts": Utils.dedent` import * as me from "@this/package"; @@ -329,7 +329,7 @@ a;b; composite: true, forceConsistentCasingInFileNames: true, traceResolution: true, - } + }, }), "/a/lib/lib.esnext.full.d.ts": libFile.content, }, { currentDirectory: "/Users/name/projects/web" }), @@ -359,7 +359,7 @@ a;b; target: "es2021", forceConsistentCasingInFileNames: true, traceResolution: true, - } + }, }), "/a/lib/lib.es2021.full.d.ts": libFile.content, }, { currentDirectory: "/Users/name/projects/lib-boilerplate" }), diff --git a/src/testRunner/unittests/tscWatch/incremental.ts b/src/testRunner/unittests/tscWatch/incremental.ts index 4bef1da5b5d87..3989165459c67 100644 --- a/src/testRunner/unittests/tscWatch/incremental.ts +++ b/src/testRunner/unittests/tscWatch/incremental.ts @@ -21,7 +21,7 @@ describe("unittests:: tsc-watch:: emit file --incremental", () => { const configFile: File = { path: `${project}/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { incremental: true } }) + content: JSON.stringify({ compilerOptions: { incremental: true } }), }; interface VerifyIncrementalWatchEmitInput { @@ -70,7 +70,7 @@ describe("unittests:: tsc-watch:: emit file --incremental", () => { getPrograms, oldPrograms, sys, - oldSnap + oldSnap, }); if (closer) closer.close(); } @@ -79,11 +79,11 @@ describe("unittests:: tsc-watch:: emit file --incremental", () => { describe("non module compilation", () => { const file1: File = { path: `${project}/file1.ts`, - content: "const x = 10;" + content: "const x = 10;", }; const file2: File = { path: `${project}/file2.ts`, - content: "const y = 20;" + content: "const y = 20;", }; describe("own file emit without errors", () => { function verify(subScenario: string, optionsToExtend?: readonly string[]) { @@ -102,7 +102,7 @@ describe("unittests:: tsc-watch:: emit file --incremental", () => { verifyIncrementalWatchEmit({ files: () => [libFile, file1, configFile, { path: file2.path, - content: `const y: string = 20;` + content: `const y: string = 20;`, }], subScenario: "own file emit with errors", modifyFs: host => host.writeFile(file1.path, file1.content.replace("x", "z")), @@ -111,7 +111,7 @@ describe("unittests:: tsc-watch:: emit file --incremental", () => { verifyIncrementalWatchEmit({ files: () => [libFile, file1, file2, { path: configFile.path, - content: JSON.stringify({ compilerOptions: { incremental: true, outFile: "out.js" } }) + content: JSON.stringify({ compilerOptions: { incremental: true, outFile: "out.js" } }), }], subScenario: "with --out", }); @@ -120,15 +120,15 @@ describe("unittests:: tsc-watch:: emit file --incremental", () => { describe("module compilation", () => { const file1: File = { path: `${project}/file1.ts`, - content: "export const x = 10;" + content: "export const x = 10;", }; const file2: File = { path: `${project}/file2.ts`, - content: "export const y = 20;" + content: "export const y = 20;", }; const config: File = { path: configFile.path, - content: JSON.stringify({ compilerOptions: { incremental: true, module: "amd" } }) + content: JSON.stringify({ compilerOptions: { incremental: true, module: "amd" } }), }; verifyIncrementalWatchEmit({ @@ -140,7 +140,7 @@ describe("unittests:: tsc-watch:: emit file --incremental", () => { describe("own file emit with errors", () => { const fileModified: File = { path: file2.path, - content: `export const y: string = 20;` + content: `export const y: string = 20;`, }; verifyIncrementalWatchEmit({ @@ -159,7 +159,7 @@ describe("unittests:: tsc-watch:: emit file --incremental", () => { projectReferences: parsedConfig.projectReferences, configFileParsingDiagnostics: ts.getConfigFileParsingDiagnostics(parsedConfig), reportDiagnostic, - system + system, }); const command = ts.parseConfigFileWithSystem("tsconfig.json", {}, /*extendedConfigCache*/ undefined, /*watchOptionsToExtend*/ undefined, system, ts.noop)!; @@ -168,7 +168,7 @@ describe("unittests:: tsc-watch:: emit file --incremental", () => { options: command.options, projectReferences: command.projectReferences, configFileParsingDiagnostics: ts.getConfigFileParsingDiagnostics(command), - host: ts.createIncrementalCompilerHost(command.options, system) + host: ts.createIncrementalCompilerHost(command.options, system), }); const state = builderProgram.getState(); @@ -197,7 +197,7 @@ describe("unittests:: tsc-watch:: emit file --incremental", () => { assert.deepEqual(state.compilerOptions, { incremental: true, module: ts.ModuleKind.AMD, - configFilePath: config.path + configFilePath: config.path, }); assert.equal(ts.arrayFrom(state.referencedMap!.keys()).length, 0); @@ -225,7 +225,7 @@ describe("unittests:: tsc-watch:: emit file --incremental", () => { verifyIncrementalWatchEmit({ files: () => [libFile, file1, file2, { path: configFile.path, - content: JSON.stringify({ compilerOptions: { incremental: true, module: "amd", outFile: "out.js" } }) + content: JSON.stringify({ compilerOptions: { incremental: true, module: "amd", outFile: "out.js" } }), }], subScenario: "module compilation/with --out", }); @@ -241,9 +241,9 @@ describe("unittests:: tsc-watch:: emit file --incremental", () => { target: "es5", module: "commonjs", declaration: true, - emitDeclarationOnly: true - } - }) + emitDeclarationOnly: true, + }, + }), }; const aTs: File = { path: `${project}/a.ts`, @@ -251,7 +251,7 @@ describe("unittests:: tsc-watch:: emit file --incremental", () => { export interface A { b: B; } -` +`, }; const bTs: File = { path: `${project}/b.ts`, @@ -259,7 +259,7 @@ export interface A { export interface B { b: C; } -` +`, }; const cTs: File = { path: `${project}/c.ts`, @@ -267,14 +267,14 @@ export interface B { export interface C { a: A; } -` +`, }; const indexTs: File = { path: `${project}/index.ts`, content: `export { A } from "./a"; export { B } from "./b"; export { C } from "./c"; -` +`, }; return [libFile, aTs, bTs, cTs, indexTs, config]; }, @@ -284,7 +284,7 @@ export interface A { b: B; foo: any; } -`) +`), }); verifyIncrementalWatchEmit({ @@ -293,9 +293,9 @@ export interface A { { path: libFile.path, content: libContent }, { path: `${project}/globals.d.ts`, content: `declare namespace Config { const value: string;} ` }, { path: `${project}/index.ts`, content: `console.log(Config.value);` }, - { path: configFile.path, content: JSON.stringify({ compilerOptions: { incremental: true, } }) } + { path: configFile.path, content: JSON.stringify({ compilerOptions: { incremental: true } }) }, ], - modifyFs: host => host.deleteFile(`${project}/globals.d.ts`) + modifyFs: host => host.deleteFile(`${project}/globals.d.ts`), }); describe("with option jsxImportSource", () => { @@ -322,10 +322,10 @@ export const Fragment: unique symbol; { path: `${project}/node_modules/preact/jsx-runtime/index.d.ts`, content: jsxLibraryContent.replace("propA", "propB") }, { path: `${project}/node_modules/preact/package.json`, content: JSON.stringify({ name: "preact", version: "0.0.1" }) }, { path: `${project}/index.tsx`, content: `export const App = () =>
;` }, - { path: configFile.path, content: JSON.stringify({ compilerOptions: jsxImportSourceOptions }) } + { path: configFile.path, content: JSON.stringify({ compilerOptions: jsxImportSourceOptions }) }, ], modifyFs: host => host.writeFile(configFile.path, JSON.stringify({ compilerOptions: { ...jsxImportSourceOptions, jsxImportSource: "preact" } })), - optionsToExtend: ["--explainFiles"] + optionsToExtend: ["--explainFiles"], }); verifyIncrementalWatchEmit({ @@ -333,7 +333,7 @@ export const Fragment: unique symbol; files: () => [ { path: libFile.path, content: libContent }, { path: `${project}/index.tsx`, content: `export const App = () =>
;` }, - { path: configFile.path, content: JSON.stringify({ compilerOptions: jsxImportSourceOptions }) } + { path: configFile.path, content: JSON.stringify({ compilerOptions: jsxImportSourceOptions }) }, ], modifyFs: host => { host.createDirectory(`${project}/node_modules`); @@ -341,7 +341,7 @@ export const Fragment: unique symbol; host.createDirectory(`${project}/node_modules/react/jsx-runtime`); host.writeFile(`${project}/node_modules/react/jsx-runtime/index.d.ts`, jsxLibraryContent); host.writeFile(`${project}/node_modules/react/package.json`, JSON.stringify({ name: "react", version: "0.0.1" })); - } + }, }); verifyIncrementalWatchEmit({ @@ -351,12 +351,12 @@ export const Fragment: unique symbol; { path: `${project}/node_modules/react/jsx-runtime/index.d.ts`, content: jsxLibraryContent }, { path: `${project}/node_modules/react/package.json`, content: JSON.stringify({ name: "react", version: "0.0.1" }) }, { path: `${project}/index.tsx`, content: `export const App = () =>
;` }, - { path: configFile.path, content: JSON.stringify({ compilerOptions: jsxImportSourceOptions }) } + { path: configFile.path, content: JSON.stringify({ compilerOptions: jsxImportSourceOptions }) }, ], modifyFs: host => { host.deleteFile(`${project}/node_modules/react/jsx-runtime/index.d.ts`); host.deleteFile(`${project}/node_modules/react/package.json`); - } + }, }); verifyIncrementalWatchEmit({ @@ -366,12 +366,12 @@ export const Fragment: unique symbol; { path: `${project}/node_modules/tslib/index.d.ts`, content: "export function __assign(...args: any[]): any;" }, { path: `${project}/node_modules/tslib/package.json`, content: JSON.stringify({ name: "tslib", version: "0.0.1" }) }, { path: `${project}/index.tsx`, content: `export const x = {...{}};` }, - { path: configFile.path, content: JSON.stringify({ compilerOptions: { importHelpers: true } }) } + { path: configFile.path, content: JSON.stringify({ compilerOptions: { importHelpers: true } }) }, ], modifyFs: host => { host.deleteFile(`${project}/node_modules/tslib/index.d.ts`); host.deleteFile(`${project}/node_modules/tslib/package.json`); - } + }, }); }); diff --git a/src/testRunner/unittests/tscWatch/libraryResolution.ts b/src/testRunner/unittests/tscWatch/libraryResolution.ts index 9605491eca0f6..1d95068360d42 100644 --- a/src/testRunner/unittests/tscWatch/libraryResolution.ts +++ b/src/testRunner/unittests/tscWatch/libraryResolution.ts @@ -2,7 +2,7 @@ import { getCommandLineArgsForLibResolution, getSysForLibResolution } from "../h import { TscWatchCompileChange, TscWatchSystem, - verifyTscWatch + verifyTscWatch, } from "../helpers/tscWatch"; describe("unittests:: tsc-watch:: libraryResolution", () => { @@ -38,7 +38,7 @@ describe("unittests:: tsc-watch:: libraryResolution", () => { changeLib(sys); }, timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } + }, ]; } function verify(withoutConfig?: true) { @@ -54,7 +54,7 @@ describe("unittests:: tsc-watch:: libraryResolution", () => { timeouts: sys => { sys.runQueuedTimeoutCallbacks(); sys.runQueuedTimeoutCallbacks(); - } + }, }, { caption: "edit index", @@ -78,14 +78,14 @@ describe("unittests:: tsc-watch:: libraryResolution", () => { timeouts: sys => { sys.runQueuedTimeoutCallbacks(); sys.runQueuedTimeoutCallbacks(); - } + }, }, { caption: "delete redirect file webworker", edit: sys => sys.deleteFile("/home/src/projects/node_modules/@typescript/lib-webworker/index.d.ts"), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); verifyTscWatch({ @@ -115,7 +115,7 @@ describe("unittests:: tsc-watch:: libraryResolution", () => { timeouts: sys => { sys.runQueuedTimeoutCallbacks(); sys.runQueuedTimeoutCallbacks(); - } + }, }, ...editOptions(withoutConfig, sys => sys.deleteFile("/home/src/projects/node_modules/@typescript/lib-dom/index.d.ts")), { @@ -129,9 +129,9 @@ describe("unittests:: tsc-watch:: libraryResolution", () => { timeouts: sys => { sys.runQueuedTimeoutCallbacks(); sys.runQueuedTimeoutCallbacks(); - } + }, }, - ] + ], }); } verify(); diff --git a/src/testRunner/unittests/tscWatch/moduleResolution.ts b/src/testRunner/unittests/tscWatch/moduleResolution.ts index 2512116a46ab1..db86443691f68 100644 --- a/src/testRunner/unittests/tscWatch/moduleResolution.ts +++ b/src/testRunner/unittests/tscWatch/moduleResolution.ts @@ -18,13 +18,13 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { name: "pkg1", version: "1.0.0", main: "build/index.js", - }) + }), }, { path: `/user/username/projects/myproject/packages/pkg1/index.ts`, content: Utils.dedent` import type { TheNum } from 'pkg2' - export const theNum: TheNum = 42;` + export const theNum: TheNum = 42;`, }, { path: `/user/username/projects/myproject/packages/pkg1/tsconfig.json`, @@ -32,19 +32,19 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { compilerOptions: { outDir: "build", }, - }) + }), }, { path: `/user/username/projects/myproject/packages/pkg2/build/const.d.ts`, - content: `export type TheNum = 42;` + content: `export type TheNum = 42;`, }, { path: `/user/username/projects/myproject/packages/pkg2/build/index.d.ts`, - content: `export type { TheNum } from './const.js';` + content: `export type { TheNum } from './const.js';`, }, { path: `/user/username/projects/myproject/packages/pkg2/build/other.d.ts`, - content: `export type TheStr = string;` + content: `export type TheStr = string;`, }, { path: `/user/username/projects/myproject/packages/pkg2/package.json`, @@ -52,13 +52,13 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { name: "pkg2", version: "1.0.0", main: "build/index.js", - }) + }), }, { path: `/user/username/projects/myproject/node_modules/pkg2`, symLink: `/user/username/projects/myproject/packages/pkg2`, }, - libFile + libFile, ], { currentDirectory: "/user/username/projects/myproject" }), commandLineArgs: ["--project", "./packages/pkg1/tsconfig.json", "-w", "--traceResolution"], edits: [ @@ -78,7 +78,7 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { sys.runQueuedTimeoutCallbacks(); // actual update }, }, - ] + ], }); verifyTscWatch({ @@ -92,9 +92,9 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { moduleResolution: "nodenext", outDir: "./dist", declaration: true, - declarationDir: "./types" + declarationDir: "./types", }, - }) + }), }, { path: `/user/username/projects/myproject/package.json`, @@ -104,10 +104,10 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { exports: { ".": { default: "./dist/index.js", - types: "./types/index.d.ts" - } - } - }) + types: "./types/index.d.ts", + }, + }, + }), }, { path: `/user/username/projects/myproject/index.ts`, @@ -115,22 +115,22 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { import * as me from "@this/package"; me.thing() export function thing(): void {} - ` + `, }, { path: `/user/username/projects/myproject/index2.ts`, content: Utils.dedent` export function thing(): void {} - ` + `, }, - libFile + libFile, ], { currentDirectory: "/user/username/projects/myproject" }), commandLineArgs: ["-w", "--traceResolution"], edits: [{ caption: "Add import to index2", edit: sys => sys.prependFile(`/user/username/projects/myproject/index2.ts`, `import * as me from "./index.js";`), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - }] + }], }); describe("package json file is edited", () => { @@ -141,27 +141,27 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { compilerOptions: { target: "es2016", module: "Node16", - outDir: "../out" - } - }) + outDir: "../out", + }, + }), }; const packageFile: File = { path: `/user/username/projects/myproject/package.json`, - content: packageFileContents + content: packageFileContents, }; const fileA: File = { path: `/user/username/projects/myproject/src/fileA.ts`, content: Utils.dedent` import { foo } from "./fileB.mjs"; foo(); - ` + `, }; const fileB: File = { path: `/user/username/projects/myproject/project/src/fileB.mts`, content: Utils.dedent` export function foo() { } - ` + `, }; return createWatchedSystem( [configFile, fileA, fileB, packageFile, { ...libFile, path: "/a/lib/lib.es2016.full.d.ts" }], @@ -283,7 +283,7 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { path: `/user/username/projects/myproject/tsconfig.json`, content: JSON.stringify({ compilerOptions: { moduleResolution: "node16" }, - }) + }), }, { path: `/user/username/projects/myproject/index.ts`, @@ -291,13 +291,13 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; import type { RequireInterface } from "pkg1" assert { "resolution-mode": "require" }; import {x} from "./a"; - ` + `, }, { path: `/user/username/projects/myproject/a.ts`, content: Utils.dedent` export const x = 10; - ` + `, }, { path: `/user/username/projects/myproject/node_modules/pkg/package.json`, @@ -306,17 +306,17 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { version: "0.0.1", exports: { import: "./import.js", - require: "./require.js" - } - }) + require: "./require.js", + }, + }), }, { path: `/user/username/projects/myproject/node_modules/pkg/import.d.ts`, - content: `export interface ImportInterface {}` + content: `export interface ImportInterface {}`, }, { path: `/user/username/projects/myproject/node_modules/pkg/require.d.ts`, - content: `export interface RequireInterface {}` + content: `export interface RequireInterface {}`, }, { path: `/user/username/projects/myproject/node_modules/pkg1/package.json`, @@ -325,15 +325,15 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { version: "0.0.1", exports: { import: "./import.js", - require: "./require.js" - } - }) + require: "./require.js", + }, + }), }, { path: `/user/username/projects/myproject/node_modules/pkg1/import.d.ts`, - content: `export interface ImportInterface {}` + content: `export interface ImportInterface {}`, }, - libFile + libFile, ], { currentDirectory: "/user/username/projects/myproject" }), commandLineArgs: ["-w", "--traceResolution"], edits: [ @@ -341,8 +341,8 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { caption: "modify aFile by adding import", edit: sys => sys.appendFile(`/user/username/projects/myproject/a.ts`, `import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }`), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -353,7 +353,7 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { path: `/user/username/projects/myproject/tsconfig.json`, content: JSON.stringify({ compilerOptions: { moduleResolution: "node16" }, - }) + }), }, { path: `/user/username/projects/myproject/index.ts`, @@ -361,13 +361,13 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { /// /// export interface LocalInterface extends RequireInterface {} - ` + `, }, { path: `/user/username/projects/myproject/a.ts`, content: Utils.dedent` export const x = 10; - ` + `, }, { path: `/user/username/projects/myproject/node_modules/pkg/package.json`, @@ -376,9 +376,9 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { version: "0.0.1", exports: { import: "./import.js", - require: "./require.js" - } - }) + require: "./require.js", + }, + }), }, { path: `/user/username/projects/myproject/node_modules/pkg/import.d.ts`, @@ -387,7 +387,7 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { declare global { interface ImportInterface {} } - ` + `, }, { path: `/user/username/projects/myproject/node_modules/pkg/require.d.ts`, @@ -396,7 +396,7 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { declare global { interface RequireInterface {} } - ` + `, }, { path: `/user/username/projects/myproject/node_modules/pkg1/package.json`, @@ -405,9 +405,9 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { version: "0.0.1", exports: { import: "./import.js", - require: "./require.js" - } - }) + require: "./require.js", + }, + }), }, { path: `/user/username/projects/myproject/node_modules/pkg1/import.d.ts`, @@ -416,13 +416,13 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { declare global { interface ImportInterface {} } - ` + `, }, { path: `/user/username/projects/myproject/node_modules/@types/pkg2/index.d.ts`, - content: `export const x = 10;` + content: `export const x = 10;`, }, - libFile + libFile, ], { currentDirectory: "/user/username/projects/myproject" }), commandLineArgs: ["-w", "--traceResolution"], edits: [ @@ -430,8 +430,8 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { caption: "modify aFile by adding import", edit: sys => sys.prependFile(`/user/username/projects/myproject/a.ts`, `/// \n`), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -536,6 +536,6 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { sys.runQueuedTimeoutCallbacks(); }, }, - ] + ], }); }); \ No newline at end of file diff --git a/src/testRunner/unittests/tscWatch/nodeNextWatch.ts b/src/testRunner/unittests/tscWatch/nodeNextWatch.ts index 38f5b340a8643..451c555e58a67 100644 --- a/src/testRunner/unittests/tscWatch/nodeNextWatch.ts +++ b/src/testRunner/unittests/tscWatch/nodeNextWatch.ts @@ -20,9 +20,9 @@ describe("unittests:: tsc-watch:: nodeNextWatch:: emit when module emit is speci target: "es2020", module: "nodenext", moduleResolution: "nodenext", - outDir: "../dist" - } - }) + outDir: "../dist", + }, + }), }; const packageFile: File = { path: "/project/package.json", @@ -32,18 +32,18 @@ describe("unittests:: tsc-watch:: nodeNextWatch:: emit when module emit is speci description: "", type: "module", main: "index.js", - }) + }), }; const file1: File = { path: "/project/src/index.ts", content: Utils.dedent` import * as Thing from "thing"; - Thing.fn();` + Thing.fn();`, }; const declFile: File = { path: "/project/src/deps.d.ts", - content: `declare module "thing";` + content: `declare module "thing";`, }; return createWatchedSystem([configFile, file1, declFile, packageFile, { ...libFile, path: "/a/lib/lib.es2020.full.d.ts" }]); }, @@ -58,7 +58,7 @@ describe("unittests:: tsc-watch:: nodeNextWatch:: emit when module emit is speci {}, ), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } + }, ], }); }); \ No newline at end of file diff --git a/src/testRunner/unittests/tscWatch/programUpdates.ts b/src/testRunner/unittests/tscWatch/programUpdates.ts index 196056480048f..12561b257848e 100644 --- a/src/testRunner/unittests/tscWatch/programUpdates.ts +++ b/src/testRunner/unittests/tscWatch/programUpdates.ts @@ -26,7 +26,7 @@ describe("unittests:: tsc-watch:: program updates", () => { const configFilePath = "/a/b/tsconfig.json"; const configFile: File = { path: configFilePath, - content: `{}` + content: `{}`, }; verifyTscWatch({ scenario, @@ -38,12 +38,12 @@ describe("unittests:: tsc-watch:: program updates", () => { content: ` import {f} from "./module" console.log(f) - ` + `, }; const moduleFile: File = { path: "/a/b/c/module.d.ts", - content: `export let x: number` + content: `export let x: number`, }; return createWatchedSystem([appFile, moduleFile, libFile]); }, @@ -56,13 +56,13 @@ describe("unittests:: tsc-watch:: program updates", () => { sys: () => { const f1 = { path: "/a/b/app.ts", - content: "let x = 1" + content: "let x = 1", }; const config = { path: configFilePath, content: JSON.stringify({ - include: ["app.ts"] - }) + include: ["app.ts"], + }), }; return createWatchedSystem([f1, libFile, config], { useCaseSensitiveFileNames: false }); }, @@ -81,19 +81,19 @@ describe("unittests:: tsc-watch:: program updates", () => { "exclude": [ "e" ] - }` + }`, }; const file1: File = { path: "/a/b/c/f1.ts", - content: "let x = 1" + content: "let x = 1", }; const file2: File = { path: "/a/b/d/f2.ts", - content: "let y = 1" + content: "let y = 1", }; const file3: File = { path: "/a/b/e/f3.ts", - content: "let z = 1" + content: "let z = 1", }; return createWatchedSystem([configFile, libFile, file1, file2, file3]); }, @@ -109,8 +109,8 @@ describe("unittests:: tsc-watch:: program updates", () => { caption: "Create commonFile2", edit: sys => sys.writeFile(commonFile2.path, commonFile2.content), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -126,7 +126,7 @@ describe("unittests:: tsc-watch:: program updates", () => { "commonFile1.ts", "commonFile3.ts" ] - }` + }`, }; return createWatchedSystem([commonFile1, commonFile2, libFile, configFile]); }, @@ -154,8 +154,8 @@ describe("unittests:: tsc-watch:: program updates", () => { caption: "recreate file2", edit: sys => sys.writeFile(commonFile2.path, commonFile2.content), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -166,7 +166,7 @@ describe("unittests:: tsc-watch:: program updates", () => { const file1: File = { path: commonFile1.path, content: `/// - let x = y` + let x = y`, }; return createWatchedSystem([file1, libFile]); }, @@ -175,8 +175,8 @@ describe("unittests:: tsc-watch:: program updates", () => { caption: "create file2", edit: sys => sys.writeFile(commonFile2.path, commonFile2.content), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -189,7 +189,7 @@ describe("unittests:: tsc-watch:: program updates", () => { content: `{ "compilerOptions": {}, "files": ["${commonFile1.path}", "${commonFile2.path}"] - }` + }`, }; return createWatchedSystem([libFile, commonFile1, commonFile2, configFile]); }, @@ -206,8 +206,8 @@ describe("unittests:: tsc-watch:: program updates", () => { "files": ["${commonFile1.path}"] }`), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -220,7 +220,7 @@ describe("unittests:: tsc-watch:: program updates", () => { content: `{ "compilerOptions": {}, "files": ["${commonFile1.path}", "${commonFile2.path}"] - }` + }`, }; return createWatchedSystem([libFile, commonFile1, commonFile2, configFile]); }, @@ -232,8 +232,8 @@ describe("unittests:: tsc-watch:: program updates", () => { "files": ["${commonFile1.path}", "${commonFile2.path}"] }`), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -243,13 +243,13 @@ describe("unittests:: tsc-watch:: program updates", () => { sys: () => { const aTs: File = { path: "/a.ts", - content: "label: while (1) {}" + content: "label: while (1) {}", }; const tsconfig: File = { path: "/tsconfig.json", content: JSON.stringify({ - compilerOptions: { allowUnusedLabels: true } - }) + compilerOptions: { allowUnusedLabels: true }, + }), }; return createWatchedSystem([libFile, aTs, tsconfig]); }, @@ -257,18 +257,18 @@ describe("unittests:: tsc-watch:: program updates", () => { { caption: "Disable allowUnsusedLabels", edit: sys => sys.modifyFile("/tsconfig.json", JSON.stringify({ - compilerOptions: { allowUnusedLabels: false } + compilerOptions: { allowUnusedLabels: false }, })), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "Enable allowUnsusedLabels", edit: sys => sys.modifyFile("/tsconfig.json", JSON.stringify({ - compilerOptions: { allowUnusedLabels: true } + compilerOptions: { allowUnusedLabels: true }, })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -278,18 +278,18 @@ describe("unittests:: tsc-watch:: program updates", () => { sys: () => { const aTs: File = { path: "/a.ts", - content: "import {} from './b.css'" + content: "import {} from './b.css'", }; const bCssTs: File = { path: "/b.d.css.ts", - content: "declare const style: string;" + content: "declare const style: string;", }; const tsconfig: File = { path: "/tsconfig.json", content: JSON.stringify({ compilerOptions: { allowArbitraryExtensions: true }, files: ["/a.ts"], - }) + }), }; return createWatchedSystem([libFile, aTs, bCssTs, tsconfig]); }, @@ -300,7 +300,7 @@ describe("unittests:: tsc-watch:: program updates", () => { compilerOptions: { allowArbitraryExtensions: false }, files: ["/a.ts"], })), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "Enable allowArbitraryExtensions", @@ -309,8 +309,8 @@ describe("unittests:: tsc-watch:: program updates", () => { files: ["/a.ts"], })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -333,8 +333,8 @@ export class A { const tsconfig: File = { path: "/tsconfig.json", content: JSON.stringify({ - compilerOptions: { target: "es6", importsNotUsedAsValues: "error" } - }) + compilerOptions: { target: "es6", importsNotUsedAsValues: "error" }, + }), }; return createWatchedSystem([libFile, aTs, bTs, tsconfig]); }, @@ -342,7 +342,7 @@ export class A { { caption: "Enable experimentalDecorators", edit: sys => sys.modifyFile("/tsconfig.json", JSON.stringify({ - compilerOptions: { target: "es6", importsNotUsedAsValues: "error", experimentalDecorators: true } + compilerOptions: { target: "es6", importsNotUsedAsValues: "error", experimentalDecorators: true }, })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), @@ -350,11 +350,11 @@ export class A { { caption: "Enable emitDecoratorMetadata", edit: sys => sys.modifyFile("/tsconfig.json", JSON.stringify({ - compilerOptions: { target: "es6", importsNotUsedAsValues: "error", experimentalDecorators: true, emitDecoratorMetadata: true } + compilerOptions: { target: "es6", importsNotUsedAsValues: "error", experimentalDecorators: true, emitDecoratorMetadata: true }, })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -367,11 +367,11 @@ export class A { content: `{ "compilerOptions": {}, "exclude": ["/a/c"] - }` + }`, }; const excludedFile1: File = { path: "/a/c/excluedFile1.ts", - content: `let t = 1;` + content: `let t = 1;`, }; return createWatchedSystem([libFile, commonFile1, commonFile2, excludedFile1, configFile]); }, @@ -384,15 +384,15 @@ export class A { sys: () => { const file1: File = { path: "/a/b/file1.ts", - content: `import { T } from "module1";` + content: `import { T } from "module1";`, }; const nodeModuleFile: File = { path: "/a/b/node_modules/module1.ts", - content: `export interface T {}` + content: `export interface T {}`, }; const classicModuleFile: File = { path: "/a/module1.ts", - content: `export interface T {}` + content: `export interface T {}`, }; const configFile: File = { path: configFilePath, @@ -401,7 +401,7 @@ export class A { "moduleResolution": "node" }, "files": ["${file1.path}"] - }` + }`, }; return createWatchedSystem([libFile, file1, nodeModuleFile, classicModuleFile, configFile]); }, @@ -415,8 +415,8 @@ export class A { "files": ["/a/b/file1.ts"] }`), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -432,7 +432,7 @@ export class A { "allowAnything": true }, "someOtherProperty": {} - }` + }`, }; return createWatchedSystem([commonFile1, commonFile2, libFile, configFile]); }, @@ -445,15 +445,15 @@ export class A { sys: () => { const file1 = { path: "/a/b/f1.ts", - content: `export * from "./f2"` + content: `export * from "./f2"`, }; const file2 = { path: "/a/b/f2.ts", - content: `export let x = 1` + content: `export let x = 1`, }; const file3 = { path: "/a/c/f3.ts", - content: `export let y = 1;` + content: `export let y = 1;`, }; return createWatchedSystem([file1, file2, file3, libFile]); }, @@ -463,8 +463,8 @@ export class A { // now inferred project should inclule file3 edit: sys => sys.modifyFile("/a/b/f2.ts", `export * from "../c/f3"`), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -474,15 +474,15 @@ export class A { sys: () => { const file1 = { path: "/a/b/f1.ts", - content: `export * from "./f2"` + content: `export * from "./f2"`, }; const file2 = { path: "/a/b/f2.ts", - content: `export * from "../c/f3"` + content: `export * from "../c/f3"`, }; const file3 = { path: "/a/c/f3.ts", - content: `export let y = 1;` + content: `export let y = 1;`, }; return createWatchedSystem([file1, file2, file3, libFile]); }, @@ -491,8 +491,8 @@ export class A { caption: "Delete f2", edit: sys => sys.deleteFile("/a/b/f2.ts"), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -502,15 +502,15 @@ export class A { sys: () => { const file1 = { path: "/a/b/f1.ts", - content: `export * from "./f2"` + content: `export * from "./f2"`, }; const file2 = { path: "/a/b/f2.ts", - content: `export * from "../c/f3"` + content: `export * from "../c/f3"`, }; const file3 = { path: "/a/c/f3.ts", - content: `export let y = 1;` + content: `export let y = 1;`, }; return createWatchedSystem([file1, file2, file3, libFile]); }, @@ -519,8 +519,8 @@ export class A { caption: "Delete f2", edit: sys => sys.deleteFile("/a/b/f2.ts"), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -530,19 +530,19 @@ export class A { sys: () => { const file1 = { path: "/a/b/f1.ts", - content: "export let x = 5" + content: "export let x = 5", }; const file2 = { path: "/a/c/f2.ts", - content: `import {x} from "../b/f1"` + content: `import {x} from "../b/f1"`, }; const file3 = { path: "/a/c/f3.ts", - content: "export let y = 1" + content: "export let y = 1", }; const configFile = { path: "/a/c/tsconfig.json", - content: JSON.stringify({ compilerOptions: {}, files: ["f2.ts", "f3.ts"] }) + content: JSON.stringify({ compilerOptions: {}, files: ["f2.ts", "f3.ts"] }), }; return createWatchedSystem([file1, file2, file3, libFile, configFile]); }, @@ -555,7 +555,7 @@ export class A { sys: () => { const file1 = { path: "/a/b/f1.ts", - content: "export {}\ndeclare global {}" + content: "export {}\ndeclare global {}", }; return createWatchedSystem([file1, libFile, configFile]); }, @@ -564,8 +564,8 @@ export class A { timeouts: sys => sys.runQueuedTimeoutCallbacks(), edit: sys => { sys.writeFile(configFilePath, JSON.stringify({ compilerOptions: { module: "none" } })); - } - }] + }, + }], }); it("two watch programs are not affected by each other", () => { @@ -573,15 +573,15 @@ export class A { path: "/a/b/f1.ts", content: ` export * from "../c/f2"; - export * from "../d/f3";` + export * from "../d/f3";`, }; const file2 = { path: "/a/c/f2.ts", - content: "export let x = 1;" + content: "export let x = 1;", }; const file3 = { path: "/a/d/f3.ts", - content: "export let y = 1;" + content: "export let y = 1;", }; const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem([libFile, file1, file2, file3])); const host = createWatchCompilerHostOfFilesAndCompilerOptionsForBaseline({ @@ -589,7 +589,7 @@ export class A { system: sys, options: { allowNonTsExtensions: true }, cb, - watchOptions: undefined + watchOptions: undefined, }); ts.createWatchProgram(host); baseline.push(`${sys.getExecutingFilePath()} --w ${file2.path} ${file3.path}`); @@ -609,7 +609,7 @@ export class A { system: sys, options: { allowNonTsExtensions: true }, cb: cb2, - watchOptions: undefined + watchOptions: undefined, })); watchBaseline({ baseline, @@ -632,7 +632,7 @@ export class A { sys: () => { const file1 = { path: "/a/b/f1.ts", - content: "let x = 1" + content: "let x = 1", }; return createWatchedSystem([file1, libFile, configFile]); }, @@ -641,8 +641,8 @@ export class A { caption: "Write f2", edit: sys => sys.writeFile("/a/b/f2.ts", "let y = 1"), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -652,15 +652,15 @@ export class A { sys: () => { const file1 = { path: "/a/b/f1.ts", - content: "let x = 1" + content: "let x = 1", }; const file2 = { path: "/a/b/f2.ts", - content: "let y = 1" + content: "let y = 1", }; const configFile = { path: configFilePath, - content: JSON.stringify({ compilerOptions: {}, files: ["f1.ts"] }) + content: JSON.stringify({ compilerOptions: {}, files: ["f1.ts"] }), }; return createWatchedSystem([file1, file2, libFile, configFile]); }, @@ -669,8 +669,8 @@ export class A { caption: "Modify config to make f2 as root too", edit: sys => sys.writeFile(configFilePath, JSON.stringify({ compilerOptions: {}, files: ["f1.ts", "f2.ts"] })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -680,15 +680,15 @@ export class A { sys: () => { const file1 = { path: `/user/username/projects/myproject/f1.ts`, - content: "export const x = 1" + content: "export const x = 1", }; const file2 = { path: `/user/username/projects/myproject/f2.ts`, - content: "export const y = 1" + content: "export const y = 1", }; const configFile = { path: `/user/username/projects/myproject/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { composite: true }, include: ["./", "./**/*.json"] }) + content: JSON.stringify({ compilerOptions: { composite: true }, include: ["./", "./**/*.json"] }), }; return createWatchedSystem([file1, file2, libFile, configFile], { currentDirectory: "/user/username/projects/myproject" }); }, @@ -702,8 +702,8 @@ export class A { caption: "Import new file", edit: sys => sys.prependFile(`/user/username/projects/myproject/f1.ts`, `import { z } from "./new-file";`), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -713,11 +713,11 @@ export class A { sys: () => { const file1 = { path: `/user/username/projects/myproject/Project/file1.ts`, - content: "export const x = 10;" + content: "export const x = 10;", }; const configFile = { path: `/user/username/projects/myproject/Project/tsconfig.json`, - content: JSON.stringify({ include: [".", "./**/*.json"] }) + content: JSON.stringify({ include: [".", "./**/*.json"] }), }; return createWatchedSystem([file1, libFile, configFile], { currentDirectory: `/user/username/projects/myproject/Project` }); }, @@ -725,9 +725,9 @@ export class A { { caption: "Write file2", edit: sys => sys.writeFile(`/user/username/projects/myproject/Project/file2.ts`, "export const y = 10;"), - timeouts: sys => sys.runQueuedTimeoutCallbacks() - } - ] + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ], }); verifyTscWatch({ @@ -737,15 +737,15 @@ export class A { sys: () => { const file1 = { path: "/a/b/f1.ts", - content: "let x = 1" + content: "let x = 1", }; const file2 = { path: "/a/b/f2.ts", - content: "let y = 1" + content: "let y = 1", }; const configFile = { path: configFilePath, - content: JSON.stringify({ compilerOptions: {}, files: ["f1.ts", "f2.ts"] }) + content: JSON.stringify({ compilerOptions: {}, files: ["f1.ts", "f2.ts"] }), }; return createWatchedSystem([file1, file2, libFile, configFile]); }, @@ -754,8 +754,8 @@ export class A { caption: "Modify config to set outFile option", edit: sys => sys.writeFile(configFilePath, JSON.stringify({ compilerOptions: { outFile: "out.js" }, files: ["f1.ts", "f2.ts"] })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -765,15 +765,15 @@ export class A { sys: () => { const file1 = { path: "/a/b/f1.ts", - content: "let x = 1" + content: "let x = 1", }; const file2 = { path: "/a/b/f2.ts", - content: "let y = 1" + content: "let y = 1", }; const configFile = { path: configFilePath, - content: JSON.stringify({ compilerOptions: {}, files: ["f1.ts", "f2.ts"] }) + content: JSON.stringify({ compilerOptions: {}, files: ["f1.ts", "f2.ts"] }), }; return createWatchedSystem([file1, file2, libFile, configFile]); }, @@ -782,8 +782,8 @@ export class A { caption: "Delete f2", edit: sys => sys.deleteFile("/a/b/f2.ts"), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -793,11 +793,11 @@ export class A { sys: () => { const file1 = { path: "/a/b/f1.ts", - content: "let x = 1;" + content: "let x = 1;", }; const file2 = { path: "/a/b/f2.ts", - content: "let y = 2;" + content: "let y = 2;", }; return createWatchedSystem([file1, file2, libFile, configFile]); }, @@ -806,8 +806,8 @@ export class A { caption: "Delete config file", edit: sys => sys.deleteFile(configFilePath), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -817,11 +817,11 @@ export class A { sys: () => { const file1 = { path: "/a/b/app.ts", - content: "" + content: "", }; const corruptedConfig = { path: configFilePath, - content: "{" + content: "{", }; return createWatchedSystem([file1, libFile, corruptedConfig]); }, @@ -835,15 +835,15 @@ export class A { const libES5 = { path: "/compiler/lib.es5.d.ts", content: `${libFile.content} -declare const eval: any` +declare const eval: any`, }; const libES2015Promise = { path: "/compiler/lib.es2015.promise.d.ts", - content: `declare class Promise {}` + content: `declare class Promise {}`, }; const app = { path: "/src/app.ts", - content: "var x: Promise;" + content: "var x: Promise;", }; const config1 = { path: "/src/tsconfig.json", @@ -855,10 +855,10 @@ declare const eval: any` noImplicitAny: true, sourceMap: false, lib: [ - "es5" - ] - } - }) + "es5", + ], + }, + }), }; return createWatchedSystem([libES5, libES2015Promise, app, config1], { executingFilePath: "/compiler/tsc.js" }); }, @@ -874,14 +874,14 @@ declare const eval: any` sourceMap: false, lib: [ "es5", - "es2015.promise" - ] - } + "es2015.promise", + ], + }, }) ), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -891,7 +891,7 @@ declare const eval: any` sys: () => { const f = { path: "/a/src/app.ts", - content: "let x = 1;" + content: "let x = 1;", }; const config = { path: "/a/tsconfig.json", @@ -899,9 +899,9 @@ declare const eval: any` compilerOptions: {}, include: [ "src/**/*", - "notexistingfolder/*" - ] - }) + "notexistingfolder/*", + ], + }), }; return createWatchedSystem([f, config, libFile]); }, @@ -918,7 +918,7 @@ declare const eval: any` sys.renameFile("/users/username/projects/project/moduleFile.ts", "/users/username/projects/project/moduleFile1.ts"); sys.deleteFile("/users/username/projects/project/moduleFile.js"); }, - timeouts: runQueuedTimeoutCallbacksTwice + timeouts: runQueuedTimeoutCallbacksTwice, }; const changeModuleFile1ToModuleFile: TscWatchCompileChange = { caption: "Rename moduleFile1 back to moduleFile", @@ -933,18 +933,18 @@ declare const eval: any` sys: () => { const moduleFile = { path: "/users/username/projects/project/moduleFile.ts", - content: "export function bar() { };" + content: "export function bar() { };", }; const file1 = { path: "/users/username/projects/project/file1.ts", - content: 'import * as T from "./moduleFile"; T.bar();' + content: 'import * as T from "./moduleFile"; T.bar();', }; return createWatchedSystem([moduleFile, file1, libFile]); }, edits: [ changeModuleFileToModuleFile1, - changeModuleFile1ToModuleFile - ] + changeModuleFile1ToModuleFile, + ], }); verifyTscWatch({ @@ -954,22 +954,22 @@ declare const eval: any` sys: () => { const moduleFile = { path: "/users/username/projects/project/moduleFile.ts", - content: "export function bar() { };" + content: "export function bar() { };", }; const file1 = { path: "/users/username/projects/project/file1.ts", - content: 'import * as T from "./moduleFile"; T.bar();' + content: 'import * as T from "./moduleFile"; T.bar();', }; const configFile = { path: "/users/username/projects/project/tsconfig.json", - content: `{}` + content: `{}`, }; return createWatchedSystem([moduleFile, file1, configFile, libFile]); }, edits: [ changeModuleFileToModuleFile1, - changeModuleFile1ToModuleFile - ] + changeModuleFile1ToModuleFile, + ], }); describe("types from config file", () => { @@ -983,18 +983,18 @@ declare const eval: any` sys: () => { const f1 = { path: "/a/b/app.ts", - content: "let x = 1" + content: "let x = 1", }; const config = { path: configFilePath, - content: JSON.stringify({ compilerOptions: { types: ["node"], typeRoots: includeTypeRoots ? [] : undefined } }) + content: JSON.stringify({ compilerOptions: { types: ["node"], typeRoots: includeTypeRoots ? [] : undefined } }), }; const node = { path: "/a/b/node_modules/@types/node/index.d.ts", - content: "declare var process: any" + content: "declare var process: any", }; const cwd = { - path: "/a/c" + path: "/a/c", }; return createWatchedSystem([f1, config, node, cwd, libFile], { currentDirectory: cwd.path }); }, @@ -1011,7 +1011,7 @@ declare const eval: any` sys: () => { const file1 = { path: "/users/username/projects/project/file1.ts", - content: 'import * as T from "./moduleFile"; T.bar();' + content: 'import * as T from "./moduleFile"; T.bar();', }; return createWatchedSystem([file1, libFile]); }, @@ -1020,8 +1020,8 @@ declare const eval: any` caption: "Create module file", edit: sys => sys.writeFile("/users/username/projects/project/moduleFile.ts", "export function bar() { }"), timeouts: runQueuedTimeoutCallbacksTwice, - } - ] + }, + ], }); verifyTscWatch({ @@ -1031,7 +1031,7 @@ declare const eval: any` sys: () => { const file = { path: "/a/b/app.ts", - content: "let x = 10" + content: "let x = 10", }; const configFile = { path: configFilePath, @@ -1040,7 +1040,7 @@ declare const eval: any` "foo": "bar", "allowJS": true } - }` + }`, }; return createWatchedSystem([file, configFile, libFile]); }, @@ -1053,13 +1053,13 @@ declare const eval: any` sys: () => { const file = { path: "/a/b/app.ts", - content: "let x = 10" + content: "let x = 10", }; const configFile = { path: configFilePath, content: `{ "compilerOptions": {} - }` + }`, }; return createWatchedSystem([file, configFile, libFile]); }, @@ -1072,7 +1072,7 @@ declare const eval: any` sys: () => { const file = { path: "/a/b/app.ts", - content: "let x = 10" + content: "let x = 10", }; return createWatchedSystem([file, configFile, libFile]); }, @@ -1093,8 +1093,8 @@ declare const eval: any` } }`), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -1107,11 +1107,11 @@ declare const eval: any` content: `{ "compilerOptions": {}, "include": ["app/*", "test/**/*", "something"] - }` + }`, }; const file1 = { path: "/a/b/file1.ts", - content: "let t = 10;" + content: "let t = 10;", }; return createWatchedSystem([file1, configFile, libFile]); }, @@ -1124,22 +1124,22 @@ declare const eval: any` sys: () => { const f = { path: "/a/app.ts", - content: "let x = 1" + content: "let x = 1", }; const config = { path: "/a/tsconfig.json", content: JSON.stringify({ compiler: {}, - files: [] - }) + files: [], + }), }; const t1 = { path: "/a/node_modules/@types/typings/index.d.ts", - content: `export * from "./lib"` + content: `export * from "./lib"`, }; const t2 = { path: "/a/node_modules/@types/typings/lib.d.ts", - content: `export const x: number` + content: `export const x: number`, }; return createWatchedSystem([f, config, t1, t2, libFile], { currentDirectory: ts.getDirectoryPath(f.path) }); }, @@ -1148,7 +1148,7 @@ declare const eval: any` it("should support files without extensions", () => { const f = { path: "/a/compile", - content: "let x = 1" + content: "let x = 1", }; const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem([f, libFile])); const watch = ts.createWatchProgram(createWatchCompilerHostOfFilesAndCompilerOptionsForBaseline({ @@ -1156,7 +1156,7 @@ declare const eval: any` system: sys, options: { allowNonTsExtensions: true }, cb, - watchOptions: undefined + watchOptions: undefined, })); runWatchBaseline({ scenario, @@ -1166,7 +1166,7 @@ declare const eval: any` baseline, oldSnap, getPrograms, - watchOrSolution: watch + watchOrSolution: watch, }); }); @@ -1177,7 +1177,7 @@ declare const eval: any` sys: () => { const file = { path: "/a/b/app.ts", - content: "let x = 10" + content: "let x = 10", }; const configFile = { path: configFilePath, @@ -1189,7 +1189,7 @@ declare const eval: any` "inlineSourceMap": true, "mapRoot": "./" } -}` +}`, }; return createWatchedSystem([file, libFile, configFile]); }, @@ -1204,8 +1204,8 @@ declare const eval: any` } }`), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); describe("should not trigger recompilation because of program emit", () => { @@ -1217,17 +1217,17 @@ declare const eval: any` sys: () => { const file1: File = { path: `/user/username/projects/myproject/file1.ts`, - content: "export const c = 30;" + content: "export const c = 30;", }; const file2: File = { path: `/user/username/projects/myproject/src/file2.ts`, - content: `import {c} from "file1"; export const d = 30;` + content: `import {c} from "file1"; export const d = 30;`, }; const tsconfig: File = { path: `/user/username/projects/myproject/tsconfig.json`, content: JSON.stringify({ - compilerOptions: compilerOptionsToConfigJson(options) - }) + compilerOptions: compilerOptionsToConfigJson(options), + }), }; return createWatchedSystem([file1, file2, libFile, tsconfig], { currentDirectory: "/user/username/projects/myproject" }); }, @@ -1239,7 +1239,7 @@ declare const eval: any` timeouts: sys => sys.runQueuedTimeoutCallbacks(), // To update program and failed lookups }, noopChange, - ] + ], }); } @@ -1286,7 +1286,7 @@ function two() { return function three() { one(); } -}` +}`, }; return createWatchedSystem([file, libFile]); }, @@ -1301,8 +1301,8 @@ export function two() { }`), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -1313,11 +1313,11 @@ export function two() { const projectLocation = "/home/username/project"; const file: File = { path: `${projectLocation}/src/file1.ts`, - content: "var a = 10;" + content: "var a = 10;", }; const configFile: File = { path: `${projectLocation}/tsconfig.json`, - content: "{}" + content: "{}", }; return createWatchedSystem([file, libFile, configFile]); }, @@ -1326,8 +1326,8 @@ export function two() { caption: "Rename file1 to file2", edit: sys => sys.renameFile("/home/username/project/src/file1.ts", "/home/username/project/src/file2.ts"), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); function changeParameterTypeOfBFile(parameterName: string, toType: string): TscWatchCompileChange { @@ -1346,14 +1346,14 @@ export function two() { const aFile: File = { path: `/user/username/projects/myproject/a.ts`, content: `import test from './b'; -test(4, 5);` +test(4, 5);`, }; const bFile: File = { path: `/user/username/projects/myproject/b.ts`, content: `function test(x: number, y: number) { return x + y / 5; } -export default test;` +export default test;`, }; const tsconfigFile: File = { path: `/user/username/projects/myproject/tsconfig.json`, @@ -1362,8 +1362,8 @@ export default test;` module: "commonjs", noEmit: true, strict: true, - } - }) + }, + }), }; return createWatchedSystem([aFile, bFile, libFile, tsconfigFile], { currentDirectory: "/user/username/projects/myproject" }); }, @@ -1372,7 +1372,7 @@ export default test;` changeParameterTypeOfBFile("x", "number"), changeParameterTypeOfBFile("y", "string"), changeParameterTypeOfBFile("y", "number"), - ] + ], }); verifyTscWatch({ @@ -1383,11 +1383,11 @@ export default test;` const aFile: File = { path: `/user/username/projects/myproject/a.ts`, content: `declare function foo(): null | { hello: any }; -foo().hello` +foo().hello`, }; const config: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: JSON.stringify({ compilerOptions: {} }) + content: JSON.stringify({ compilerOptions: {} }), }; return createWatchedSystem([aFile, config, libFile], { currentDirectory: "/user/username/projects/myproject" }); }, @@ -1407,7 +1407,7 @@ foo().hello` edit: sys => sys.writeFile(`/user/username/projects/myproject/tsconfig.json`, JSON.stringify({ compilerOptions: {} })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); verifyTscWatch({ @@ -1426,11 +1426,11 @@ foo().hello` reallyLongPropertyName6: string | number | boolean | object | symbol | bigint; reallyLongPropertyName7: string | number | boolean | object | symbol | bigint; }; -v === 'foo';` +v === 'foo';`, }; const config: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: JSON.stringify({ compilerOptions: {} }) + content: JSON.stringify({ compilerOptions: {} }), }; return createWatchedSystem([aFile, config, libFile], { currentDirectory: "/user/username/projects/myproject" }); }, @@ -1440,7 +1440,7 @@ v === 'foo';` edit: sys => sys.writeFile(`/user/username/projects/myproject/tsconfig.json`, JSON.stringify({ compilerOptions: { noErrorTruncation: true } })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); verifyTscWatch({ @@ -1451,11 +1451,11 @@ v === 'foo';` const aFile: File = { path: `/a.ts`, content: `class C { get prop() { return 1; } } -class D extends C { prop = 1; }` +class D extends C { prop = 1; }`, }; const config: File = { path: `/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { target: "es6" } }) + content: JSON.stringify({ compilerOptions: { target: "es6" } }), }; return createWatchedSystem([aFile, config, libFile]); }, @@ -1465,7 +1465,7 @@ class D extends C { prop = 1; }` edit: sys => sys.writeFile(`/tsconfig.json`, JSON.stringify({ compilerOptions: { target: "es6", useDefineForClassFields: true } })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); verifyTscWatch({ @@ -1475,16 +1475,16 @@ class D extends C { prop = 1; }` sys: () => { const aFile: File = { path: `/user/username/projects/myproject/a.ts`, - content: `export class C {}` + content: `export class C {}`, }; const bFile: File = { path: `/user/username/projects/myproject/b.ts`, content: `import {C} from './a'; -export function f(p: C) { return p; }` +export function f(p: C) { return p; }`, }; const config: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: JSON.stringify({ compilerOptions: {} }) + content: JSON.stringify({ compilerOptions: {} }), }; return createWatchedSystem([aFile, bFile, config, libFile], { currentDirectory: "/user/username/projects/myproject" }); }, @@ -1504,7 +1504,7 @@ export function f(p: C) { return p; }` edit: sys => sys.writeFile(`/user/username/projects/myproject/tsconfig.json`, JSON.stringify({ compilerOptions: { importsNotUsedAsValues: "preserve" } })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); @@ -1515,15 +1515,15 @@ export function f(p: C) { return p; }` sys: () => { const aFile: File = { path: `/a.ts`, - content: `export class C {}` + content: `export class C {}`, }; const bFile: File = { path: `/b.ts`, - content: `import {C} from './a'; import * as A from './A';` + content: `import {C} from './a'; import * as A from './A';`, }; const config: File = { path: `/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { forceConsistentCasingInFileNames: false } }) + content: JSON.stringify({ compilerOptions: { forceConsistentCasingInFileNames: false } }), }; return createWatchedSystem([aFile, bFile, config, libFile], { useCaseSensitiveFileNames: false }); }, @@ -1533,7 +1533,7 @@ export function f(p: C) { return p; }` edit: sys => sys.writeFile(`/tsconfig.json`, JSON.stringify({ compilerOptions: { forceConsistentCasingInFileNames: true } })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); verifyTscWatch({ @@ -1543,15 +1543,15 @@ export function f(p: C) { return p; }` sys: () => { const aFile: File = { path: `/user/username/projects/myproject/a.ts`, - content: `import * as data from './data.json'` + content: `import * as data from './data.json'`, }; const jsonFile: File = { path: `/user/username/projects/myproject/data.json`, - content: `{ "foo": 1 }` + content: `{ "foo": 1 }`, }; const config: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { moduleResolution: "node" } }) + content: JSON.stringify({ compilerOptions: { moduleResolution: "node" } }), }; return createWatchedSystem([aFile, jsonFile, config, libFile], { currentDirectory: "/user/username/projects/myproject" }); }, @@ -1561,7 +1561,7 @@ export function f(p: C) { return p; }` edit: sys => sys.writeFile(`/user/username/projects/myproject/tsconfig.json`, JSON.stringify({ compilerOptions: { moduleResolution: "node", resolveJsonModule: true } })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); verifyTscWatch({ @@ -1573,11 +1573,11 @@ export function f(p: C) { return p; }` path: `/user/username/projects/myproject/a.ts`, content: `declare module 'a' { type foo = number; -}` +}`, }; const config: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: "{}" + content: "{}", }; return createWatchedSystem([aFile, config, libFile], { currentDirectory: "/user/username/projects/myproject" }); }, @@ -1595,7 +1595,7 @@ export function f(p: C) { return p; }` edit: sys => sys.deleteFile(`/user/username/projects/myproject/b.ts`), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); describe("updates errors in lib file", () => { @@ -1609,7 +1609,7 @@ export function f(p: C) { return p; }` content: `${libFile.content} interface Document { readonly ${field}: boolean; -}` +}`, }; function verifyLibFileErrorsWith(subScenario: string, aFile: File) { @@ -1630,7 +1630,7 @@ interface Document { edit: sys => sys.writeFile(aFile.path, aFile.content), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); } @@ -1643,7 +1643,7 @@ interface Document { const aFile: File = { path: `/user/username/projects/myproject/a.ts`, content: `${fieldWithoutReadonly} -var y: number;` +var y: number;`, }; verifyLibFileErrorsWith("when non module file changes", aFile); }); @@ -1655,7 +1655,7 @@ var y: number;` declare global { ${fieldWithoutReadonly} var y: number; -}` +}`, }; verifyLibFileErrorsWith("when module file with global definitions changes", aFile); }); @@ -1680,24 +1680,24 @@ var y: number; path: `/user/username/projects/myproject/a.ts`, content: `interface Document { ${field}: boolean; -}` +}`, }; const bFile: File = { path: `/user/username/projects/myproject/b.d.ts`, content: `interface Document { ${field}: boolean; -}` +}`, }; const libFileWithDocument: File = { path: libFile.path, content: `${libFile.content} interface Document { readonly ${field}: boolean; -}` +}`, }; const configFile: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: "{}" + content: "{}", }; return createWatchedSystem([aFile, bFile, configFile, libFileWithDocument], { currentDirectory: "/user/username/projects/myproject" }); }, @@ -1708,7 +1708,7 @@ interface Document { changeWhenLibCheckChanges({ skipDefaultLibCheck: true }), changeWhenLibCheckChanges({ skipLibCheck: true }), changeWhenLibCheckChanges({}), - ] + ], }); verifyTscWatch({ @@ -1718,20 +1718,20 @@ interface Document { sys: () => { const aFile: File = { path: `/user/username/projects/myproject/a.ts`, - content: `export const a: string = "";` + content: `export const a: string = "";`, }; const bFile: File = { path: `/user/username/projects/myproject/b.ts`, content: `import { a } from "./a"; -const b: string = a;` +const b: string = a;`, }; const configFile: File = { path: `/user/username/projects/myproject/tsconfig.json`, content: JSON.stringify({ compilerOptions: { - isolatedModules: true - } - }) + isolatedModules: true, + }, + }), }; return createWatchedSystem([aFile, bFile, configFile, libFile], { currentDirectory: "/user/username/projects/myproject" }); }, @@ -1741,7 +1741,7 @@ const b: string = a;` edit: sys => sys.writeFile(`/user/username/projects/myproject/a.ts`, `export const a: number = 1`), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); verifyTscWatch({ @@ -1751,20 +1751,20 @@ const b: string = a;` sys: () => { const aFile: File = { path: `/user/username/projects/myproject/a.ts`, - content: `import { x } from "../b";` + content: `import { x } from "../b";`, }; const bFile: File = { path: `/user/username/projects/b.ts`, - content: `export const x = 10;` + content: `export const x = 10;`, }; const configFile: File = { path: `/user/username/projects/myproject/tsconfig.json`, content: JSON.stringify({ compilerOptions: { rootDir: ".", - outDir: "lib" - } - }) + outDir: "lib", + }, + }), }; return createWatchedSystem([aFile, bFile, configFile, libFile], { currentDirectory: "/user/username/projects/myproject" }); }, @@ -1776,7 +1776,7 @@ const b: string = a;` import { x } from "../b";`), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); verifyTscWatch({ @@ -1786,15 +1786,15 @@ import { x } from "../b";`), sys: () => { const index: File = { path: `/user/username/projects/myproject/index.tsx`, - content: `declare var React: any;\nconst d =
;` + content: `declare var React: any;\nconst d =
;`, }; const configFile: File = { path: `/user/username/projects/myproject/tsconfig.json`, content: JSON.stringify({ compilerOptions: { - jsx: "preserve" - } - }) + jsx: "preserve", + }, + }), }; return createWatchedSystem([index, configFile, libFile], { currentDirectory: "/user/username/projects/myproject" }); }, @@ -1804,7 +1804,7 @@ import { x } from "../b";`), edit: sys => sys.writeFile(`/user/username/projects/myproject/tsconfig.json`, '{ "compilerOptions": { "jsx": "react" } }'), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); verifyTscWatch({ @@ -1816,25 +1816,25 @@ import { x } from "../b";`), path: "/a/b/first.tsconfig.json", content: JSON.stringify({ compilerOptions: { - strict: true - } - }) + strict: true, + }, + }), }; const secondExtendedConfigFile: File = { path: "/a/b/second.tsconfig.json", content: JSON.stringify({ - extends: "./first.tsconfig.json" - }) + extends: "./first.tsconfig.json", + }), }; const configFile: File = { path: configFilePath, content: JSON.stringify({ compilerOptions: {}, - files: [commonFile1.path, commonFile2.path] - }) + files: [commonFile1.path, commonFile2.path], + }), }; return createWatchedSystem([ - libFile, commonFile1, commonFile2, configFile, firstExtendedConfigFile, secondExtendedConfigFile + libFile, commonFile1, commonFile2, configFile, firstExtendedConfigFile, secondExtendedConfigFile, ]); }, edits: [ @@ -1843,7 +1843,7 @@ import { x } from "../b";`), edit: sys => sys.modifyFile(configFilePath, JSON.stringify({ extends: "./second.tsconfig.json", compilerOptions: {}, - files: [commonFile1.path, commonFile2.path] + files: [commonFile1.path, commonFile2.path], })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, @@ -1852,7 +1852,7 @@ import { x } from "../b";`), edit: sys => sys.modifyFile("/a/b/first.tsconfig.json", JSON.stringify({ compilerOptions: { strict: false, - } + }, })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, @@ -1862,7 +1862,7 @@ import { x } from "../b";`), extends: "./first.tsconfig.json", compilerOptions: { strictNullChecks: true, - } + }, })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, @@ -1870,11 +1870,11 @@ import { x } from "../b";`), caption: "Change config to stop extending another config", edit: sys => sys.modifyFile(configFilePath, JSON.stringify({ compilerOptions: {}, - files: [commonFile1.path, commonFile2.path] + files: [commonFile1.path, commonFile2.path], })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); verifyTscWatch({ @@ -1884,11 +1884,11 @@ import { x } from "../b";`), sys: () => { const module1: File = { path: `/user/username/projects/myproject/client/folder1/module1.ts`, - content: `export class Module1Class { }` + content: `export class Module1Class { }`, }; const module2: File = { path: `/user/username/projects/myproject/folder2/module2.ts`, - content: `import * as M from "folder1/module1";` + content: `import * as M from "folder1/module1";`, }; const symlink: SymLink = { path: `/user/username/projects/myproject/client/linktofolder2`, @@ -1901,8 +1901,8 @@ import { x } from "../b";`), baseUrl: "client", paths: { "*": ["*"] }, }, - include: ["client/**/*", "folder2"] - }) + include: ["client/**/*", "folder2"], + }), }; return createWatchedSystem([module1, module2, symlink, config, libFile], { currentDirectory: "/user/username/projects/myproject" }); }, @@ -1912,7 +1912,7 @@ import { x } from "../b";`), edit: sys => sys.writeFile(`/user/username/projects/myproject/client/linktofolder2/module3.ts`, `import * as M from "folder1/module1";`), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); verifyTscWatch({ @@ -1925,35 +1925,35 @@ import { x } from "../b";`), content: JSON.stringify({ compilerOptions: { module: "none", - composite: true + composite: true, }, - exclude: ["temp"] - }) + exclude: ["temp"], + }), }; const class1: File = { path: `/user/username/projects/myproject/projects/project1/class1.ts`, - content: `class class1 {}` + content: `class class1 {}`, }; // Built file const class1Dt: File = { path: `/user/username/projects/myproject/projects/project1/class1.d.ts`, - content: `declare class class1 {}` + content: `declare class class1 {}`, }; const config2: File = { path: `/user/username/projects/myproject/projects/project2/tsconfig.json`, content: JSON.stringify({ compilerOptions: { module: "none", - composite: true + composite: true, }, references: [ - { path: "../project1" } - ] - }) + { path: "../project1" }, + ], + }), }; const class2: File = { path: `/user/username/projects/myproject/projects/project2/class2.ts`, - content: `class class2 {}` + content: `class class2 {}`, }; return createWatchedSystem([config1, class1, config2, class2, libFile, class1Dt]); }, @@ -1983,7 +1983,7 @@ import { x } from "../b";`), edit: sys => sys.writeFile(`/user/username/projects/myproject/projects/project1/class3.d.ts`, `declare class class3 {}`), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); verifyTscWatch({ @@ -1993,11 +1993,11 @@ import { x } from "../b";`), sys: () => { const module1: File = { path: `/user/username/projects/myproject/index.ts`, - content: `` + content: ``, }; const config: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: `{}` + content: `{}`, }; return createWatchedSystem([module1, config, libFile], { currentDirectory: "/user/username/projects/myproject" }); }, @@ -2007,7 +2007,7 @@ import { x } from "../b";`), edit: sys => sys.writeFile(`/user/username/projects/myproject/foo`, ``), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); verifyTscWatch({ @@ -2017,19 +2017,19 @@ import { x } from "../b";`), sys: () => { const module1: File = { path: `/user/username/projects/myproject/a.ts`, - content: `` + content: ``, }; const module2: File = { path: `/user/username/projects/myproject/b.ts`, - content: `import "./a.ts";` + content: `import "./a.ts";`, }; const config: File = { path: `/user/username/projects/myproject/tsconfig.json`, content: JSON.stringify({ compilerOptions: { noEmit: true, - allowImportingTsExtensions: false - } + allowImportingTsExtensions: false, + }, }), }; return createWatchedSystem([module1, module2, config, libFile], { currentDirectory: "/user/username/projects/myproject" }); @@ -2040,11 +2040,11 @@ import { x } from "../b";`), edit: sys => sys.writeFile(`/user/username/projects/myproject/tsconfig.json`, JSON.stringify({ compilerOptions: { noEmit: true, - allowImportingTsExtensions: true - } + allowImportingTsExtensions: true, + }, })), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); }); diff --git a/src/testRunner/unittests/tscWatch/projectsWithReferences.ts b/src/testRunner/unittests/tscWatch/projectsWithReferences.ts index 8c091768df202..9a8363b866a5a 100644 --- a/src/testRunner/unittests/tscWatch/projectsWithReferences.ts +++ b/src/testRunner/unittests/tscWatch/projectsWithReferences.ts @@ -49,22 +49,22 @@ describe("unittests:: tsc-watch:: projects with references: invoking when refere const solutionBuilder = createSolutionBuilder(sys, ["logic"]); solutionBuilder.build(); }, - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "change in project reference config file builds correctly", edit: sys => { sys.writeFile(getTsBuildProjectFilePath("sample1", "logic/tsconfig.json"), JSON.stringify({ compilerOptions: { composite: true, declaration: true, declarationDir: "decls" }, - references: [{ path: "../core" }] + references: [{ path: "../core" }], })); const solutionBuilder = createSolutionBuilder(sys, ["logic"]); solutionBuilder.build(); }, - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, ], - baselineDependencies: true + baselineDependencies: true, }); function changeCompilerOpitonsPaths(sys: TestServerHost, config: string, newPaths: object) { @@ -99,53 +99,53 @@ describe("unittests:: tsc-watch:: projects with references: invoking when refere const solutionBuilder = createSolutionBuilder(sys, ["tsconfig.b.json"]); solutionBuilder.build(); }, - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "edit on config file", edit: sys => { sys.ensureFileOrFolder({ path: getTsBuildProjectFilePath("transitiveReferences", "nrefs/a.d.ts"), - content: sys.readFile(getTsBuildProjectFilePath("transitiveReferences", "refs/a.d.ts"))! + content: sys.readFile(getTsBuildProjectFilePath("transitiveReferences", "refs/a.d.ts"))!, }); changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "tsconfig.c.json"), { "@ref/*": ["./nrefs/*"] }); }, - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "Revert config file edit", edit: sys => changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "tsconfig.c.json"), { "@ref/*": ["./refs/*"] }), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "edit in referenced config file", edit: sys => changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json"), { "@ref/*": ["./nrefs/*"] }), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "Revert referenced config file edit", edit: sys => changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json"), { "@ref/*": ["./refs/*"] }), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "deleting referenced config file", edit: sys => sys.deleteFile(getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json")), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "Revert deleting referenced config file", edit: sys => sys.ensureFileOrFolder(getTsBuildProjectFile("transitiveReferences", "tsconfig.b.json")), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "deleting transitively referenced config file", edit: sys => sys.deleteFile(getTsBuildProjectFilePath("transitiveReferences", "tsconfig.a.json")), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "Revert deleting transitively referenced config file", edit: sys => sys.ensureFileOrFolder(getTsBuildProjectFile("transitiveReferences", "tsconfig.a.json")), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, ], baselineDependencies: true, @@ -164,14 +164,14 @@ describe("unittests:: tsc-watch:: projects with references: invoking when refere content: JSON.stringify({ compilerOptions: { composite: true, moduleResolution: "classic" }, files: ["b.ts"], - references: [{ path: "tsconfig.a.json" }] - }) + references: [{ path: "tsconfig.a.json" }], + }), }, getTsBuildProjectFile("transitiveReferences", "tsconfig.c.json"), getTsBuildProjectFile("transitiveReferences", "a.ts"), { path: getTsBuildProjectFilePath("transitiveReferences", "b.ts"), - content: `import {A} from "a";export const b = new A();` + content: `import {A} from "a";export const b = new A();`, }, getTsBuildProjectFile("transitiveReferences", "c.ts"), getTsBuildProjectFile("transitiveReferences", "refs/a.d.ts"), @@ -193,7 +193,7 @@ describe("unittests:: tsc-watch:: projects with references: invoking when refere path: getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json"), content: JSON.stringify({ compilerOptions: { composite: true }, - files: ["index.ts"] + files: ["index.ts"], }), }, { @@ -201,7 +201,7 @@ describe("unittests:: tsc-watch:: projects with references: invoking when refere content: JSON.stringify({ compilerOptions: { composite: true, baseUrl: "./", paths: { "@ref/*": ["../*"] } }, files: ["index.ts"], - references: [{ path: `../a` }] + references: [{ path: `../a` }], }), }, { @@ -209,7 +209,7 @@ describe("unittests:: tsc-watch:: projects with references: invoking when refere content: JSON.stringify({ compilerOptions: { baseUrl: "./", paths: { "@ref/*": ["../refs/*"] } }, files: ["index.ts"], - references: [{ path: `../b` }] + references: [{ path: `../b` }], }), }, { @@ -241,38 +241,38 @@ X;`, const solutionBuilder = createSolutionBuilder(sys, ["b"]); solutionBuilder.build(); }, - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "edit on config file", edit: sys => { sys.ensureFileOrFolder({ path: getTsBuildProjectFilePath("transitiveReferences", "nrefs/a.d.ts"), - content: sys.readFile(getTsBuildProjectFilePath("transitiveReferences", "refs/a.d.ts"))! + content: sys.readFile(getTsBuildProjectFilePath("transitiveReferences", "refs/a.d.ts"))!, }); changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }); }, - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "Revert config file edit", edit: sys => changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../refs/*"] }), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "edit in referenced config file", edit: sys => changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "Revert referenced config file edit", edit: sys => changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../refs/*"] }), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "deleting referenced config file", edit: sys => sys.deleteFile(getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json")), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "Revert deleting referenced config file", @@ -281,15 +281,15 @@ X;`, JSON.stringify({ compilerOptions: { composite: true, baseUrl: "./", paths: { "@ref/*": ["../*"] } }, files: ["index.ts"], - references: [{ path: `../a` }] + references: [{ path: `../a` }], }) ), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "deleting transitively referenced config file", edit: sys => sys.deleteFile(getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json")), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "Revert deleting transitively referenced config file", @@ -297,10 +297,10 @@ X;`, getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json"), JSON.stringify({ compilerOptions: { composite: true }, - files: ["index.ts"] + files: ["index.ts"], }), ), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, ], baselineDependencies: true, @@ -321,14 +321,14 @@ X;`, path: getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), content: JSON.stringify({ compilerOptions: { composite: true, baseUrl: "./", paths: { "@ref/*": ["../*"] } }, - references: [{ path: `../a` }] + references: [{ path: `../a` }], }), }, { path: getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), content: JSON.stringify({ compilerOptions: { baseUrl: "./", paths: { "@ref/*": ["../refs/*"] } }, - references: [{ path: `../b` }] + references: [{ path: `../b` }], }), }, { @@ -360,38 +360,38 @@ X;`, const solutionBuilder = createSolutionBuilder(sys, ["b"]); solutionBuilder.build(); }, - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "edit on config file", edit: sys => { sys.ensureFileOrFolder({ path: getTsBuildProjectFilePath("transitiveReferences", "nrefs/a.d.ts"), - content: sys.readFile(getTsBuildProjectFilePath("transitiveReferences", "refs/a.d.ts"))! + content: sys.readFile(getTsBuildProjectFilePath("transitiveReferences", "refs/a.d.ts"))!, }); changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }); }, - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "Revert config file edit", edit: sys => changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../refs/*"] }), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "edit in referenced config file", edit: sys => changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "Revert referenced config file edit", edit: sys => changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../refs/*"] }), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "deleting referenced config file", edit: sys => sys.deleteFile(getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json")), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "Revert deleting referenced config file", @@ -399,15 +399,15 @@ X;`, getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), JSON.stringify({ compilerOptions: { composite: true, baseUrl: "./", paths: { "@ref/*": ["../*"] } }, - references: [{ path: `../a` }] + references: [{ path: `../a` }], }) ), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "deleting transitively referenced config file", edit: sys => sys.deleteFile(getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json")), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "Revert deleting transitively referenced config file", @@ -415,7 +415,7 @@ X;`, getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json"), JSON.stringify({ compilerOptions: { composite: true } }), ), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, ], baselineDependencies: true, @@ -449,6 +449,6 @@ X;`, timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, ], - baselineDependencies: true + baselineDependencies: true, }); }); \ No newline at end of file diff --git a/src/testRunner/unittests/tscWatch/resolutionCache.ts b/src/testRunner/unittests/tscWatch/resolutionCache.ts index e40425630e63a..98b27b9e2a157 100644 --- a/src/testRunner/unittests/tscWatch/resolutionCache.ts +++ b/src/testRunner/unittests/tscWatch/resolutionCache.ts @@ -19,11 +19,11 @@ describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch module resolution it("caching works", () => { const root = { path: "/users/username/projects/project/d/f0.ts", - content: `import {x} from "f1"` + content: `import {x} from "f1"`, }; const imported = { path: "/users/username/projects/project/f1.ts", - content: `foo()` + content: `foo()`, }; const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem([root, imported, libFile])); @@ -32,7 +32,7 @@ describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch module resolution system: sys, options: { module: ts.ModuleKind.AMD }, cb, - watchOptions: undefined + watchOptions: undefined, }); const originalFileExists = host.fileExists; const watch = ts.createWatchProgram(host); @@ -54,7 +54,7 @@ describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch module resolution sys.writeFile(root.path, `import {x} from "f1" var x: string = 1;`); }, - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "Resolves f2", @@ -91,22 +91,22 @@ describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch module resolution timeouts: sys => { sys.runQueuedTimeoutCallbacks(); assert.isTrue(fileExistsIsCalled); - } + }, }, ], - watchOrSolution: watch + watchOrSolution: watch, }); }); it("loads missing files from disk", () => { const root = { path: `/users/username/projects/project/foo.ts`, - content: `import {x} from "bar"` + content: `import {x} from "bar"`, }; const imported = { path: `/users/username/projects/project/bar.d.ts`, - content: `export const y = 1;` + content: `export const y = 1;`, }; const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem([root, libFile])); @@ -115,7 +115,7 @@ describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch module resolution system: sys, options: { module: ts.ModuleKind.AMD }, cb, - watchOptions: undefined + watchOptions: undefined, }); const originalFileExists = host.fileExists; let fileExistsCalledForBar = false; @@ -150,21 +150,21 @@ describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch module resolution timeouts: sys => { sys.runQueuedTimeoutCallbacks(); assert.isTrue(fileExistsCalledForBar, "'fileExists' should be called."); - } + }, }], - watchOrSolution: watch + watchOrSolution: watch, }); }); it("should compile correctly when resolved module goes missing and then comes back (module is not part of the root)", () => { const root = { path: `/users/username/projects/project/foo.ts`, - content: `import {x} from "bar"` + content: `import {x} from "bar"`, }; const imported = { path: `/users/username/projects/project/bar.d.ts`, - content: `export const y = 1;export const x = 10;` + content: `export const y = 1;export const x = 10;`, }; const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem([root, imported, libFile])); @@ -173,7 +173,7 @@ describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch module resolution system: sys, options: { module: ts.ModuleKind.AMD }, cb, - watchOptions: undefined + watchOptions: undefined, }); const originalFileExists = host.fileExists; let fileExistsCalledForBar = false; @@ -221,7 +221,7 @@ describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch module resolution }, }, ], - watchOrSolution: watch + watchOrSolution: watch, }); }); @@ -231,7 +231,7 @@ describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch module resolution commandLineArgs: ["-w", "/users/username/projects/project/foo.ts"], sys: () => createWatchedSystem([{ path: "/users/username/projects/project/foo.ts", - content: `import * as fs from "fs";` + content: `import * as fs from "fs";`, }, libFile], { currentDirectory: "/users/username/projects/project" }), edits: [ { @@ -243,7 +243,7 @@ describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch module resolution { "main": "" } -` +`, }); sys.ensureFileOrFolder({ path: "/users/username/projects/project/node_modules/@types/node/index.d.ts", @@ -252,12 +252,12 @@ declare module "fs" { export interface Stats { isFile(): boolean; } -}` +}`, }); }, timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -270,7 +270,7 @@ declare module "fs" { content: ` import * as fs from "fs"; import * as u from "url"; -` +`, }; const file = { @@ -281,7 +281,7 @@ declare module "url" { href?: string; } } -` +`, }; return createWatchedSystem([root, file, libFile], { currentDirectory: "/users/username/projects/project" }); }, @@ -296,8 +296,8 @@ declare module "fs" { } `), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -308,15 +308,15 @@ declare module "fs" { const configDir = "/a/b/projects/myProject/src/"; const file1: File = { path: configDir + "file1.ts", - content: 'import module1 = require("module1");\nmodule1("hello");' + content: 'import module1 = require("module1");\nmodule1("hello");', }; const file2: File = { path: configDir + "file2.ts", - content: 'import module11 = require("module1");\nmodule11("hello");' + content: 'import module11 = require("module1");\nmodule11("hello");', }; const module1: File = { path: "/a/b/projects/myProject/node_modules/module1/index.js", - content: "module.exports = options => { return options.toString(); }" + content: "module.exports = options => { return options.toString(); }", }; const configFile: File = { path: configDir + "tsconfig.json", @@ -326,9 +326,9 @@ declare module "fs" { rootDir: ".", outDir: "../dist", moduleResolution: "node", - maxNodeModuleJsDepth: 1 - } - }) + maxNodeModuleJsDepth: 1, + }, + }), }; return createWatchedSystem([file1, file2, module1, libFile, configFile], { currentDirectory: "/a/b/projects/myProject/" }); }, @@ -337,8 +337,8 @@ declare module "fs" { caption: "Add new line to file1", edit: sys => sys.appendFile("/a/b/projects/myProject/src/file1.ts", "\n;"), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); verifyTscWatch({ @@ -348,11 +348,11 @@ declare module "fs" { sys: () => { const file: File = { path: `/user/username/projects/myproject/a.ts`, - content: `import * as q from "qqq";` + content: `import * as q from "qqq";`, }; const module: File = { path: `/user/username/projects/myproject/node_modules2/@types/qqq/index.d.ts`, - content: "export {}" + content: "export {}", }; return createWatchedSystem([file, libFile, module], { currentDirectory: "/user/username/projects/myproject" }); }, @@ -361,8 +361,8 @@ declare module "fs" { caption: "npm install", edit: sys => sys.renameFolder(`/user/username/projects/myproject/node_modules2`, `/user/username/projects/myproject/node_modules`), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); describe("ignores files/folder changes in node_modules that start with '.'", () => { @@ -374,15 +374,15 @@ declare module "fs" { sys: () => { const file1: File = { path: `/user/username/projects/myproject/test.ts`, - content: `import { x } from "somemodule";` + content: `import { x } from "somemodule";`, }; const file2: File = { path: `/user/username/projects/myproject/node_modules/somemodule/index.d.ts`, - content: `export const x = 10;` + content: `export const x = 10;`, }; const config: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: "{}" + content: "{}", }; return createWatchedSystem([libFile, file1, file2, config]); }, @@ -391,11 +391,11 @@ declare module "fs" { caption: "npm install file and folder that start with '.'", edit: sys => sys.ensureFileOrFolder({ path: `/user/username/projects/myproject/node_modules/.cache/babel-loader/89c02171edab901b9926470ba6d5677e.ts`, - content: JSON.stringify({ something: 10 }) + content: JSON.stringify({ something: 10 }), }), timeouts: sys => sys.logTimeoutQueueLength(), - } - ] + }, + ], }); } verifyIgnore("watch without configFile", ["--w", `/user/username/projects/myproject/test.ts`]); @@ -409,16 +409,16 @@ declare module "fs" { sys: () => { const app: File = { path: `/user/username/projects/myproject/lib/app.ts`, - content: `myapp.component("hello");` + content: `myapp.component("hello");`, }; const tsconfig: File = { path: `/user/username/projects/myproject/tsconfig.json`, content: JSON.stringify({ compilerOptions: { module: "none", - types: ["@myapp/ts-types"] - } - }) + types: ["@myapp/ts-types"], + }, + }), }; return createWatchedSystem([app, tsconfig, libFile]); }, @@ -430,15 +430,15 @@ declare module "fs" { path: `/user/username/projects/myproject/node_modules/@myapp/ts-types/package.json`, content: JSON.stringify({ version: "1.65.1", - types: "types/somefile.define.d.ts" - }) + types: "types/somefile.define.d.ts", + }), }); sys.ensureFileOrFolder({ path: `/user/username/projects/myproject/node_modules/@myapp/ts-types/types/somefile.define.d.ts`, content: ` declare namespace myapp { function component(str: string): number; -}` +}`, }); }, timeouts: sys => { @@ -454,9 +454,9 @@ declare namespace myapp { const newProgram = (watchorSolution as ts.WatchOfConfigFile).getProgram(); assert.strictEqual(newProgram, oldBuilderProgram, "No change so builder program should be same"); assert.strictEqual(newProgram.getProgram(), oldProgram, "No change so program should be same"); - } - } - ] + }, + }, + ], }); verifyTscWatch({ @@ -468,30 +468,30 @@ declare namespace myapp { const linkedPackageRoot = `/user/username/projects/myproject/linked-package`; const mainFile: File = { path: `${mainPackageRoot}/index.ts`, - content: "import { Foo } from '@scoped/linked-package'" + content: "import { Foo } from '@scoped/linked-package'", }; const config: File = { path: `${mainPackageRoot}/tsconfig.json`, content: JSON.stringify({ compilerOptions: { module: "commonjs", moduleResolution: "node", baseUrl: ".", rootDir: "." }, - files: ["index.ts"] - }) + files: ["index.ts"], + }), }; const linkedPackageInMain: SymLink = { path: `${mainPackageRoot}/node_modules/@scoped/linked-package`, - symLink: `${linkedPackageRoot}` + symLink: `${linkedPackageRoot}`, }; const linkedPackageJson: File = { path: `${linkedPackageRoot}/package.json`, - content: JSON.stringify({ name: "@scoped/linked-package", version: "0.0.1", types: "dist/index.d.ts", main: "dist/index.js" }) + content: JSON.stringify({ name: "@scoped/linked-package", version: "0.0.1", types: "dist/index.d.ts", main: "dist/index.js" }), }; const linkedPackageIndex: File = { path: `${linkedPackageRoot}/dist/index.d.ts`, - content: "export * from './other';" + content: "export * from './other';", }; const linkedPackageOther: File = { path: `${linkedPackageRoot}/dist/other.d.ts`, - content: 'export declare const Foo = "BAR";' + content: 'export declare const Foo = "BAR";', }; const files = [libFile, mainFile, config, linkedPackageInMain, linkedPackageJson, linkedPackageIndex, linkedPackageOther]; return createWatchedSystem(files, { currentDirectory: mainPackageRoot }); @@ -502,16 +502,16 @@ declare namespace myapp { function getNodeAtTypes() { const nodeAtTypesIndex: File = { path: `/user/username/projects/myproject/node_modules/@types/node/index.d.ts`, - content: `/// ` + content: `/// `, }; const nodeAtTypesBase: File = { path: `/user/username/projects/myproject/node_modules/@types/node/base.d.ts`, content: `// Base definitions for all NodeJS modules that are not specific to any version of TypeScript: -/// ` +/// `, }; const nodeAtTypes36Base: File = { path: `/user/username/projects/myproject/node_modules/@types/node/ts3.6/base.d.ts`, - content: `/// ` + content: `/// `, }; const nodeAtTypesGlobals: File = { path: `/user/username/projects/myproject/node_modules/@types/node/globals.d.ts`, @@ -520,7 +520,7 @@ declare namespace NodeJS { interface Process { on(msg: string): void; } -}` +}`, }; return { nodeAtTypesIndex, nodeAtTypesBase, nodeAtTypes36Base, nodeAtTypesGlobals }; } @@ -531,11 +531,11 @@ declare namespace NodeJS { sys: () => { const file: File = { path: `/user/username/projects/myproject/worker.ts`, - content: `process.on("uncaughtException");` + content: `process.on("uncaughtException");`, }; const tsconfig: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: "{}" + content: "{}", }; const { nodeAtTypesIndex, nodeAtTypesBase, nodeAtTypes36Base, nodeAtTypesGlobals } = getNodeAtTypes(); return createWatchedSystem([file, libFile, tsconfig, nodeAtTypesIndex, nodeAtTypesBase, nodeAtTypes36Base, nodeAtTypesGlobals], { currentDirectory: "/user/username/projects/myproject" }); @@ -550,14 +550,14 @@ declare namespace NodeJS { caption: `npm ci step two: create atTypes but something else in the @types folder`, edit: sys => sys.ensureFileOrFolder({ path: `/user/username/projects/myproject/node_modules/@types/mocha/index.d.ts`, - content: `export const foo = 10;` + content: `export const foo = 10;`, }), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: `npm ci step three: create atTypes node folder`, edit: sys => sys.ensureFileOrFolder({ path: `/user/username/projects/myproject/node_modules/@types/node` }), - timeouts: sys => sys.runQueuedTimeoutCallbacks() + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: `npm ci step four: create atTypes write all the files but dont invoke watcher for index.d.ts`, @@ -573,7 +573,7 @@ declare namespace NodeJS { sys.runQueuedTimeoutCallbacks(); // actual program update }, }, - ] + ], }); }); @@ -610,7 +610,7 @@ declare namespace NodeJS { timeouts: sys => { sys.runQueuedTimeoutCallbacks(); // failed lookup sys.runQueuedTimeoutCallbacks(); // actual update - } + }, }, { caption: "write file not resolved by typeRef", @@ -618,9 +618,9 @@ declare namespace NodeJS { timeouts: sys => { sys.runQueuedTimeoutCallbacks(); // failed lookup sys.runQueuedTimeoutCallbacks(); // actual update - } + }, }, - ] + ], }); verifyTscWatch({ @@ -640,7 +640,7 @@ declare namespace NodeJS { caption: "npm install unrelated non scoped", edit: sys => sys.ensureFileOrFolder({ path: `/user/username/projects/myproject/node_modules/unrelated/index.d.ts`, - content: `export const unrelated = 10;` + content: `export const unrelated = 10;`, }), timeouts: sys => { sys.runQueuedTimeoutCallbacks(); @@ -651,7 +651,7 @@ declare namespace NodeJS { caption: "npm install unrelated scoped in myapp", edit: sys => sys.ensureFileOrFolder({ path: `/user/username/projects/myproject/node_modules/@myapp/unrelated/index.d.ts`, - content: `export const myappUnrelated = 10;` + content: `export const myappUnrelated = 10;`, }), timeouts: sys => { sys.runQueuedTimeoutCallbacks(); @@ -662,7 +662,7 @@ declare namespace NodeJS { caption: "npm install unrelated2 scoped in myapp", edit: sys => sys.ensureFileOrFolder({ path: `/user/username/projects/myproject/node_modules/@myapp/unrelated2/index.d.ts`, - content: `export const myappUnrelated2 = 10;` + content: `export const myappUnrelated2 = 10;`, }), timeouts: sys => { sys.runQueuedTimeoutCallbacks(); @@ -673,13 +673,13 @@ declare namespace NodeJS { caption: "npm install ts-types", edit: sys => sys.ensureFileOrFolder({ path: `/user/username/projects/myproject/node_modules/@myapp/ts-types/index.d.ts`, - content: `export const myapp = 10;` + content: `export const myapp = 10;`, }), timeouts: sys => { sys.runQueuedTimeoutCallbacks(); sys.runQueuedTimeoutCallbacks(); }, }, - ] + ], }); }); diff --git a/src/testRunner/unittests/tscWatch/resolveJsonModuleWithIncremental.ts b/src/testRunner/unittests/tscWatch/resolveJsonModuleWithIncremental.ts index e4a1d09ac2019..43c1e18a94d15 100644 --- a/src/testRunner/unittests/tscWatch/resolveJsonModuleWithIncremental.ts +++ b/src/testRunner/unittests/tscWatch/resolveJsonModuleWithIncremental.ts @@ -22,6 +22,6 @@ describe("unittests:: tsc-watch:: resolveJsonModuleWithIncremental:: emit file - caption: "Change json setting", edit: sys => sys.writeFile("/src/project/tsconfig.json", JSON.stringify({ compilerOptions: { resolveJsonModule: false } }, null, 4)), // eslint-disable-line no-null/no-null timeouts: sys => sys.runQueuedTimeoutCallbacks(), - }] + }], }); }); \ No newline at end of file diff --git a/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts b/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts index e8f6810564ca4..682f64955d10b 100644 --- a/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts +++ b/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts @@ -45,7 +45,7 @@ describe("unittests:: tsc-watch:: watchAPI:: with sourceOfProjectReferenceRedire baseline, oldSnap, getPrograms, - watchOrSolution: watch + watchOrSolution: watch, }); } @@ -71,7 +71,7 @@ describe("unittests:: tsc-watch:: watchAPI:: with sourceOfProjectReferenceRedire return { files: [{ path: libFile.path, content: libContent }, baseConfig, coreTs, coreConfig, animalTs, dogTs, indexTs, animalsConfig], config: animalsConfig.path, - subScenario: "with simple project" + subScenario: "with simple project", }; }); }); @@ -102,7 +102,7 @@ describe("unittests:: tsc-watch:: watchAPI:: with sourceOfProjectReferenceRedire return { files: [libFile, bPackageJson, aConfig, bConfig, aTest, bFoo, bBar, bSymlink], config: aConfig.path, - subScenario: `${subScenario}${extraOptions.preserveSymlinks ? " with preserveSymlinks" : ""}` + subScenario: `${subScenario}${extraOptions.preserveSymlinks ? " with preserveSymlinks" : ""}`, }; }); } @@ -115,18 +115,18 @@ describe("unittests:: tsc-watch:: watchAPI:: with sourceOfProjectReferenceRedire outDir: "lib", rootDir: "src", composite: true, - ...extraOptions + ...extraOptions, }, include: ["src"], - ...(references ? { references: references.map(path => ({ path })) } : {}) - }) + ...(references ? { references: references.map(path => ({ path })) } : {}), + }), }; } function file(packageName: string, fileName: string, content: string): File { return { path: `/user/username/projects/myproject/packages/${packageName}/src/${fileName}`, - content + content, }; } @@ -137,8 +137,8 @@ describe("unittests:: tsc-watch:: watchAPI:: with sourceOfProjectReferenceRedire path: `/user/username/projects/myproject/packages/B/package.json`, content: JSON.stringify({ main: "lib/index.js", - types: "lib/index.d.ts" - }) + types: "lib/index.d.ts", + }), }, aTest: file("A", "index.ts", `import { foo } from '${scope}b'; import { bar } from '${scope}b/lib/bar'; @@ -149,9 +149,9 @@ bar(); bBar: file("B", "bar.ts", `export function bar() { }`), bSymlink: { path: `/user/username/projects/myproject/node_modules/${scope}b`, - symLink: `/user/username/projects/myproject/packages/B` + symLink: `/user/username/projects/myproject/packages/B`, }, - subScenario: `when packageJson has types field${scope ? " with scoped package" : ""}` + subScenario: `when packageJson has types field${scope ? " with scoped package" : ""}`, })); }); @@ -159,7 +159,7 @@ bar(); verifySymlinkScenario(() => ({ bPackageJson: { path: `/user/username/projects/myproject/packages/B/package.json`, - content: "{}" + content: "{}", }, aTest: file("A", "test.ts", `import { foo } from '${scope}b/lib/foo'; import { bar } from '${scope}b/lib/bar/foo'; @@ -170,9 +170,9 @@ bar(); bBar: file("B", "bar/foo.ts", `export function bar() { }`), bSymlink: { path: `/user/username/projects/myproject/node_modules/${scope}b`, - symLink: `/user/username/projects/myproject/packages/B` + symLink: `/user/username/projects/myproject/packages/B`, }, - subScenario: `when referencing file from subFolder${scope ? " with scoped package" : ""}` + subScenario: `when referencing file from subFolder${scope ? " with scoped package" : ""}`, })); }); } diff --git a/src/testRunner/unittests/tscWatch/watchApi.ts b/src/testRunner/unittests/tscWatch/watchApi.ts index 81274cbbf1932..8366a3c01d170 100644 --- a/src/testRunner/unittests/tscWatch/watchApi.ts +++ b/src/testRunner/unittests/tscWatch/watchApi.ts @@ -22,19 +22,19 @@ describe("unittests:: tsc-watch:: watchAPI:: tsc-watch with custom module resolu it("verify that module resolution with json extension works when returned without extension", () => { const configFileJson: any = { compilerOptions: { module: "commonjs", resolveJsonModule: true }, - files: ["index.ts"] + files: ["index.ts"], }; const mainFile: File = { path: `/user/username/projects/myproject/index.ts`, - content: "import settings from './settings.json';" + content: "import settings from './settings.json';", }; const config: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: JSON.stringify(configFileJson) + content: JSON.stringify(configFileJson), }; const settingsJson: File = { path: `/user/username/projects/myproject/settings.json`, - content: JSON.stringify({ content: "Print this" }) + content: JSON.stringify({ content: "Print this" }), }; const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem( [libFile, mainFile, config, settingsJson], @@ -64,7 +64,7 @@ describe("unittests:: tsc-watch:: watchAPI:: tsc-watch with custom module resolu baseline, oldSnap, getPrograms, - watchOrSolution: watch + watchOrSolution: watch, }); }); @@ -74,7 +74,7 @@ describe("unittests:: tsc-watch:: watchAPI:: tsc-watch with custom module resolu const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem({ [`/user/username/projects/myproject/tsconfig.json`]: JSON.stringify({ compilerOptions: { traceResolution: true, extendedDiagnostics: true }, - files: ["main.ts"] + files: ["main.ts"], }), [`/user/username/projects/myproject/main.ts`]: `import { foo } from "./other";`, [`/user/username/projects/myproject/other.d.ts`]: "export function foo(): void;", @@ -118,7 +118,7 @@ describe("unittests:: tsc-watch:: watchAPI:: tsc-watch with custom module resolu timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, ], - watchOrSolution: watch + watchOrSolution: watch, }); }); } @@ -133,12 +133,12 @@ describe("unittests:: tsc-watch:: watchAPI:: tsc-watch expose error count to wat path: `/user/username/projects/myproject/tsconfig.json`, content: JSON.stringify({ compilerOptions: { module: "commonjs" }, - files: ["index.ts"] - }) + files: ["index.ts"], + }), }; const mainFile: File = { path: `/user/username/projects/myproject/index.ts`, - content: "let compiler = new Compiler(); for (let i = 0; j < 5; i++) {}" + content: "let compiler = new Compiler(); for (let i = 0; j < 5; i++) {}", }; const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem( [libFile, mainFile, config], @@ -165,7 +165,7 @@ describe("unittests:: tsc-watch:: watchAPI:: tsc-watch expose error count to wat baseline, oldSnap, getPrograms, - watchOrSolution: watch + watchOrSolution: watch, }); }); }); @@ -174,11 +174,11 @@ describe("unittests:: tsc-watch:: watchAPI:: when watchHost does not implement s it("verifies that getProgram gets updated program if new file is added to the program", () => { const config: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: "{}" + content: "{}", }; const mainFile: File = { path: `/user/username/projects/myproject/main.ts`, - content: "const x = 10;" + content: "const x = 10;", }; const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem([config, mainFile, libFile])); const host = createWatchCompilerHostOfConfigFileForBaseline({ @@ -203,9 +203,9 @@ describe("unittests:: tsc-watch:: watchAPI:: when watchHost does not implement s timeouts: sys => { sys.logTimeoutQueueLength(); watch.getProgram(); - } + }, }], - watchOrSolution: watch + watchOrSolution: watch, }); }); }); @@ -214,15 +214,15 @@ describe("unittests:: tsc-watch:: watchAPI:: when watchHost can add extraFileExt it("verifies that extraFileExtensions are supported to get the program with other extensions", () => { const config: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: "{}" + content: "{}", }; const mainFile: File = { path: `/user/username/projects/myproject/main.ts`, - content: "const x = 10;" + content: "const x = 10;", }; const otherFile: File = { path: `/user/username/projects/myproject/other.vue`, - content: "" + content: "", }; const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline( createWatchedSystem([config, mainFile, otherFile, libFile]) @@ -248,7 +248,7 @@ describe("unittests:: tsc-watch:: watchAPI:: when watchHost can add extraFileExt edit: sys => sys.writeFile(`/user/username/projects/myproject/other2.vue`, otherFile.content), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }], - watchOrSolution: watch + watchOrSolution: watch, }); }); }); @@ -257,15 +257,15 @@ describe("unittests:: tsc-watch:: watchAPI:: when watchHost uses createSemanticD function createSystem(configText: string, mainText: string) { const config: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: configText + content: configText, }; const mainFile: File = { path: `/user/username/projects/myproject/main.ts`, - content: mainText + content: mainText, }; const otherFile: File = { path: `/user/username/projects/myproject/other.ts`, - content: "export const y = 10;" + content: "export const y = 10;", }; return { ...createBaseline(createWatchedSystem([config, mainFile, otherFile, libFile])), @@ -366,7 +366,7 @@ describe("unittests:: tsc-watch:: watchAPI:: when watchHost uses createSemanticD edit: sys => sys.appendFile(mainFile.path, "\n// SomeComment"), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }], - watchOrSolution: watch + watchOrSolution: watch, }); }); @@ -501,34 +501,34 @@ describe("unittests:: tsc-watch:: watchAPI:: when getParsedCommandLine is implem content: JSON.stringify({ compilerOptions: { module: "none", - composite: true + composite: true, }, - exclude: ["temp"] - }) + exclude: ["temp"], + }), }; const class1: File = { path: `/user/username/projects/myproject/projects/project1/class1.ts`, - content: `class class1 {}` + content: `class class1 {}`, }; const class1Dts: File = { path: `/user/username/projects/myproject/projects/project1/class1.d.ts`, - content: `declare class class1 {}` + content: `declare class class1 {}`, }; const config2: File = { path: `/user/username/projects/myproject/projects/project2/tsconfig.json`, content: JSON.stringify({ compilerOptions: { module: "none", - composite: true + composite: true, }, references: [ - { path: "../project1" } - ] - }) + { path: "../project1" }, + ], + }), }; const class2: File = { path: `/user/username/projects/myproject/projects/project2/class2.ts`, - content: `class class2 {}` + content: `class class2 {}`, }; const system = createWatchedSystem([config1, class1, class1Dts, config2, class2, libFile]); const baseline = createBaseline(system); @@ -536,7 +536,7 @@ describe("unittests:: tsc-watch:: watchAPI:: when getParsedCommandLine is implem cb: baseline.cb, system, configFileName: config2.path, - optionsToExtend: { extendedDiagnostics: true } + optionsToExtend: { extendedDiagnostics: true }, }); compilerHost.useSourceOfProjectReferenceRedirect = useSourceOfProjectReferenceRedirect; const calledGetParsedCommandLine = new Set(); @@ -583,7 +583,7 @@ describe("unittests:: tsc-watch:: watchAPI:: when getParsedCommandLine is implem timeouts: sys => sys.logTimeoutQueueLength(), }, ], - watchOrSolution: watch + watchOrSolution: watch, }); }); @@ -624,7 +624,7 @@ describe("unittests:: tsc-watch:: watchAPI:: when getParsedCommandLine is implem timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, ], - watchOrSolution: watch + watchOrSolution: watch, }); }); }); @@ -646,7 +646,7 @@ describe("unittests:: tsc-watch:: watchAPI:: when builder emit occurs with emitO cb: baseline.cb, system, configFileName: `/user/username/projects/myproject/tsconfig.json`, - optionsToExtend: { extendedDiagnostics: true } + optionsToExtend: { extendedDiagnostics: true }, }); const originalEmitProgram = compilerHost.afterProgramCreate; compilerHost.afterProgramCreate = myAfterProgramCreate; @@ -703,7 +703,7 @@ describe("unittests:: tsc-watch:: watchAPI:: when builder emit occurs with emitO timeouts: sys => sys.logTimeoutQueueLength(), }, ], - watchOrSolution: watch + watchOrSolution: watch, }); function myAfterProgramCreate(program: ts.EmitAndSemanticDiagnosticsBuilderProgram) { @@ -728,7 +728,7 @@ describe("unittests:: tsc-watch:: watchAPI:: when creating program with project "/user/username/projects/project/tsconfig.json": JSON.stringify({ compilerOptions: { types: [] }, files: ["app.ts"], - references: [{ path: "./lib" }] + references: [{ path: "./lib" }], }), "/user/username/projects/project/app.ts": dedent` import { one } from './lib'; @@ -788,7 +788,7 @@ describe("unittests:: tsc-watch:: watchAPI:: when creating program with project timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, ], - watchOrSolution: watch + watchOrSolution: watch, }); }); @@ -817,7 +817,7 @@ describe("unittests:: tsc-watch:: watchAPI:: when creating program with project timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, ], - watchOrSolution: watch + watchOrSolution: watch, }); }); }); diff --git a/src/testRunner/unittests/tscWatch/watchEnvironment.ts b/src/testRunner/unittests/tscWatch/watchEnvironment.ts index 79afff507cf16..0207f3d7ab503 100644 --- a/src/testRunner/unittests/tscWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tscWatch/watchEnvironment.ts @@ -25,7 +25,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po const projectFolder = "/a/username/project"; const file1: File = { path: `${projectFolder}/typescript.ts`, - content: "var z = 10;" + content: "var z = 10;", }; const environmentVariables = new Map(); environmentVariables.set("TSC_WATCHFILE", Tsc_WatchFile.DynamicPolling); @@ -77,8 +77,8 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po sys.runQueuedTimeoutCallbacks(); return; }, - } - ] + }, + ], }); verifyTscWatch({ @@ -90,9 +90,9 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po path: "/a/b/tsconfig.json", content: JSON.stringify({ watchOptions: { - watchFile: "FixedChunkSizePolling" - } - }) + watchFile: "FixedChunkSizePolling", + }, + }), }; const files = [libFile, commonFile1, commonFile2, configFile]; return createWatchedSystem(files); @@ -132,7 +132,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po assert.deepEqual(programs[0][0], initialProgram); }, }, - ] + ], }); describe("tsc-watch when watchDirectories implementation", () => { @@ -143,13 +143,13 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po path: `${projectFolder}/tsconfig.json`, content: JSON.stringify({ watchOptions: { - synchronousWatchDirectory: true - } - }) + synchronousWatchDirectory: true, + }, + }), }; const file: File = { path: `${projectSrcFolder}/file1.ts`, - content: "" + content: "", }; verifyTscWatch({ scenario, @@ -194,35 +194,35 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po const cwd = "/home/user/projects/myproject"; const file1: File = { path: `${cwd}/src/file.ts`, - content: `import * as a from "a"` + content: `import * as a from "a"`, }; const tsconfig: File = { path: `${cwd}/tsconfig.json`, - content: `{ "compilerOptions": { "extendedDiagnostics": true, "traceResolution": true }}` + content: `{ "compilerOptions": { "extendedDiagnostics": true, "traceResolution": true }}`, }; const realA: File = { path: `${cwd}/node_modules/reala/index.d.ts`, - content: `export {}` + content: `export {}`, }; const realB: File = { path: `${cwd}/node_modules/realb/index.d.ts`, - content: `export {}` + content: `export {}`, }; const symLinkA: SymLink = { path: `${cwd}/node_modules/a`, - symLink: `${cwd}/node_modules/reala` + symLink: `${cwd}/node_modules/reala`, }; const symLinkB: SymLink = { path: `${cwd}/node_modules/b`, - symLink: `${cwd}/node_modules/realb` + symLink: `${cwd}/node_modules/realb`, }; const symLinkBInA: SymLink = { path: `${cwd}/node_modules/reala/node_modules/b`, - symLink: `${cwd}/node_modules/b` + symLink: `${cwd}/node_modules/b`, }; const symLinkAInB: SymLink = { path: `${cwd}/node_modules/realb/node_modules/a`, - symLink: `${cwd}/node_modules/a` + symLink: `${cwd}/node_modules/a`, }; const files = [libFile, file1, tsconfig, realA, realB, symLinkA, symLinkB, symLinkBInA, symLinkAInB]; const environmentVariables = new Map(); @@ -238,15 +238,15 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po sys: () => { const configFile: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: "{}" + content: "{}", }; const file1: File = { path: `/user/username/projects/myproject/src/file1.ts`, - content: `import { x } from "file2";` + content: `import { x } from "file2";`, }; const file2: File = { path: `/user/username/projects/myproject/node_modules/file2/index.d.ts`, - content: `export const x = 10;` + content: `export const x = 10;`, }; const files = [libFile, file1, file2, configFile]; return createWatchedSystem(files, { runWithoutRecursiveWatches: true }); @@ -316,15 +316,15 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po sys: () => { const configFile: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { outDir: "dist", declaration: true } }) + content: JSON.stringify({ compilerOptions: { outDir: "dist", declaration: true } }), }; const file1: File = { path: `/user/username/projects/myproject/src/file1.ts`, - content: `import { x } from "file2";` + content: `import { x } from "file2";`, }; const file2: File = { path: `/user/username/projects/myproject/node_modules/file2/index.d.ts`, - content: `export const x = 10;` + content: `export const x = 10;`, }; const files = [libFile, file1, file2, configFile]; return createWatchedSystem(files, { runWithoutRecursiveWatches: true }); @@ -357,15 +357,15 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po sys: () => { const configFile: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { outDir: "dist" } }) + content: JSON.stringify({ compilerOptions: { outDir: "dist" } }), }; const file1: File = { path: `/user/username/projects/myproject/src/file1.ts`, - content: `import { x } from "./file2";` + content: `import { x } from "./file2";`, }; const file2: File = { path: `/user/username/projects/myproject/src/file2.ts`, - content: `export const x = 10;` + content: `export const x = 10;`, }; const files = [libFile, file1, file2, configFile]; return createWatchedSystem(files, { runWithoutRecursiveWatches: true }); @@ -401,9 +401,9 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po path: "/a/b/tsconfig.json", content: JSON.stringify({ watchOptions: { - watchFile: "UseFsEvents" - } - }) + watchFile: "UseFsEvents", + }, + }), }; const files = [libFile, commonFile1, commonFile2, configFile]; return createWatchedSystem(files); @@ -419,9 +419,9 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po path: "/a/b/tsconfig.json", content: JSON.stringify({ watchOptions: { - watchDirectory: "UseFsEvents" - } - }) + watchDirectory: "UseFsEvents", + }, + }), }; const files = [libFile, commonFile1, commonFile2, configFile]; return createWatchedSystem(files, { runWithoutRecursiveWatches: true }); @@ -437,9 +437,9 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po path: "/a/b/tsconfig.json", content: JSON.stringify({ watchOptions: { - fallbackPolling: "PriorityInterval" - } - }) + fallbackPolling: "PriorityInterval", + }, + }), }; const files = [libFile, commonFile1, commonFile2, configFile]; return createWatchedSystem(files, { runWithoutRecursiveWatches: true, runWithFallbackPolling: true }); @@ -453,7 +453,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po sys: () => { const configFile: File = { path: "/a/b/tsconfig.json", - content: "{}" + content: "{}", }; const files = [libFile, commonFile1, commonFile2, configFile]; return createWatchedSystem(files); @@ -464,27 +464,27 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po function sys(watchOptions: ts.WatchOptions, runWithoutRecursiveWatches?: boolean): TestServerHost { const configFile: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: JSON.stringify({ exclude: ["node_modules"], watchOptions }) + content: JSON.stringify({ exclude: ["node_modules"], watchOptions }), }; const main: File = { path: `/user/username/projects/myproject/src/main.ts`, - content: `import { foo } from "bar"; foo();` + content: `import { foo } from "bar"; foo();`, }; const bar: File = { path: `/user/username/projects/myproject/node_modules/bar/index.d.ts`, - content: `export { foo } from "./foo";` + content: `export { foo } from "./foo";`, }; const foo: File = { path: `/user/username/projects/myproject/node_modules/bar/foo.d.ts`, - content: `export function foo(): string;` + content: `export function foo(): string;`, }; const fooBar: File = { path: `/user/username/projects/myproject/node_modules/bar/fooBar.d.ts`, - content: `export function fooBar(): string;` + content: `export function fooBar(): string;`, }; const temp: File = { path: `/user/username/projects/myproject/node_modules/bar/temp/index.d.ts`, - content: "export function temp(): string;" + content: "export function temp(): string;", }; const files = [libFile, main, bar, foo, fooBar, temp, configFile]; return createWatchedSystem(files, { currentDirectory: "/user/username/projects/myproject", runWithoutRecursiveWatches }); @@ -501,8 +501,8 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po caption: "Change foo", edit: sys => sys.replaceFileText(`/user/username/projects/myproject/node_modules/bar/foo.d.ts`, "foo", "fooBar"), timeouts: sys => sys.logTimeoutQueueLength(), - } - ] + }, + ], }); verifyTscWatch({ @@ -514,8 +514,8 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po { caption: "delete fooBar", edit: sys => sys.deleteFile(`/user/username/projects/myproject/node_modules/bar/fooBar.d.ts`), - timeouts: sys => sys.logTimeoutQueueLength(), } - ] + timeouts: sys => sys.logTimeoutQueueLength() }, + ], }); verifyTscWatch({ @@ -533,8 +533,8 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po caption: "add new folder to temp", edit: sys => sys.ensureFileOrFolder({ path: `/user/username/projects/myproject/node_modules/bar/temp/fooBar/index.d.ts`, content: "export function temp(): string;" }), timeouts: sys => sys.logTimeoutQueueLength(), - } - ] + }, + ], }); } @@ -554,10 +554,10 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po [`/user/username/projects/myproject/foo.ts`]: `export declare function foo(): string;`, [`/user/username/projects/myproject/tsconfig.json`]: JSON.stringify({ watchOptions: { watchFile: "useFsEvents" }, - files: ["foo.ts", "main.ts"] + files: ["foo.ts", "main.ts"], }), }, - { currentDirectory: "/user/username/projects/myproject", } + { currentDirectory: "/user/username/projects/myproject" } ), edits: [ { @@ -572,10 +572,10 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po }, { caption: "Replace file with rename event that fixes error", - edit: sys => sys.modifyFile(`/user/username/projects/myproject/foo.ts`, `export declare function foo(): string;`, { invokeFileDeleteCreateAsPartInsteadOfChange: true, }), + edit: sys => sys.modifyFile(`/user/username/projects/myproject/foo.ts`, `export declare function foo(): string;`, { invokeFileDeleteCreateAsPartInsteadOfChange: true }), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); describe("with fsWatch on inodes", () => { @@ -592,7 +592,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po }, { currentDirectory: "/user/username/projects/myproject", - inodeWatching: true + inodeWatching: true, } ), edits: [ @@ -606,7 +606,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po edit: sys => sys.modifyFile(`/user/username/projects/myproject/foo.d.ts`, `export function foo(): string;`, { invokeFileDeleteCreateAsPartInsteadOfChange: true }), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); verifyTscWatch({ @@ -622,7 +622,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po }, { currentDirectory: "/user/username/projects/myproject", - inodeWatching: true + inodeWatching: true, } ), edits: [ @@ -636,7 +636,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po edit: sys => sys.modifyFile(`/user/username/projects/myproject/foo.d.ts`, `export function foo(): string;`, { invokeFileDeleteCreateAsPartInsteadOfChange: true, useTildeAsSuffixInRenameEventFileName: true }), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); verifyTscWatch({ @@ -650,7 +650,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po [`/user/username/projects/myproject/foo.ts`]: `export declare function foo(): string;`, [`/user/username/projects/myproject/tsconfig.json`]: JSON.stringify({ watchOptions: { watchFile: "useFsEvents" }, - files: ["foo.ts", "main.ts"] + files: ["foo.ts", "main.ts"], }), }, { @@ -666,16 +666,16 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po edit: sys => sys.modifyFile(`/user/username/projects/myproject/foo.ts`, `export declare function foo2(): string;`, { invokeFileDeleteCreateAsPartInsteadOfChange: true, ignoreDelete: true, - skipInodeCheckOnCreate: true + skipInodeCheckOnCreate: true, }), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, { caption: "Replace file with rename event that fixes error", - edit: sys => sys.modifyFile(`/user/username/projects/myproject/foo.ts`, `export declare function foo(): string;`, { invokeFileDeleteCreateAsPartInsteadOfChange: true, }), + edit: sys => sys.modifyFile(`/user/username/projects/myproject/foo.ts`, `export declare function foo(): string;`, { invokeFileDeleteCreateAsPartInsteadOfChange: true }), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - ] + ], }); }); @@ -707,7 +707,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po caption: "receive another change event without modifying the file", edit: sys => sys.invokeFsWatches("/user/username/projects/project/main.ts", "change", /*modifiedTime*/ undefined, /*useTildeSuffix*/ undefined), timeouts: sys => sys.runQueuedTimeoutCallbacks(), - } - ] + }, + ], }); }); diff --git a/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts b/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts index d78e6168b0470..03cbe2c5cebee 100644 --- a/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts +++ b/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts @@ -23,28 +23,28 @@ ${file.content}`; function setup() { const configFile: File = { path: "/a/b/tsconfig.json", - content: "{}" + content: "{}", }; const file3: File = { path: "/a/b/file3.ts", - content: "let xyz = 1;" + content: "let xyz = 1;", }; const app: File = { path: "/a/b/app.ts", - content: "let z = 1;" + content: "let z = 1;", }; const host = createServerHost([app, file3, commonFile1, commonFile2, libFile, configFile]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Open, - arguments: { file: app.path } + arguments: { file: app.path }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Open, arguments: { file: file3.path, - fileContent: fileContentWithComment(file3) - } + fileContent: fileContentWithComment(file3), + }, }); return { session, file3, app }; } @@ -58,12 +58,12 @@ ${file.content}`; openFiles: [ { fileName: commonFile1.path, - content: fileContentWithComment(commonFile1) + content: fileContentWithComment(commonFile1), }, { fileName: commonFile2.path, - content: fileContentWithComment(commonFile2) - } + content: fileContentWithComment(commonFile2), + }, ], changedFiles: [ { @@ -71,19 +71,19 @@ ${file.content}`; changes: [ { span: { start: 0, length: 0 }, - newText: "let zzz = 10;" + newText: "let zzz = 10;", }, { span: { start: 0, length: 0 }, - newText: "let zz = 10;" - } - ] - } + newText: "let zz = 10;", + }, + ], + }, ], closedFiles: [ - file3.path - ] - } + file3.path, + ], + }, }); // Open file1 again session.executeCommandSeq({ @@ -91,9 +91,9 @@ ${file.content}`; arguments: { openFiles: [{ fileName: commonFile1.path, - content: commonFile1.content - }] - } + content: commonFile1.content, + }], + }, }); baselineTsserverLogs("applyChangesToOpenFiles", "with applyChangedToOpenFiles request", session); }); @@ -107,12 +107,12 @@ ${file.content}`; openFiles: [ { file: commonFile1.path, - fileContent: fileContentWithComment(commonFile1) + fileContent: fileContentWithComment(commonFile1), }, { file: commonFile2.path, - fileContent: fileContentWithComment(commonFile2) - } + fileContent: fileContentWithComment(commonFile2), + }, ], changedFiles: [ { @@ -127,14 +127,14 @@ ${file.content}`; start: { line: 1, offset: 1 }, end: { line: 1, offset: 1 }, newText: "let zz = 10;", - } - ] - } + }, + ], + }, ], closedFiles: [ - file3.path - ] - } + file3.path, + ], + }, }); // Open file1 again session.executeCommandSeq({ @@ -142,9 +142,9 @@ ${file.content}`; arguments: { openFiles: [{ file: commonFile1.path, - fileContent: commonFile1.content - }] - } + fileContent: commonFile1.content, + }], + }, }); baselineTsserverLogs("applyChangesToOpenFiles", "with updateOpen request", session); }); diff --git a/src/testRunner/unittests/tsserver/autoImportProvider.ts b/src/testRunner/unittests/tsserver/autoImportProvider.ts index f07a52f9112eb..80a64081476d5 100644 --- a/src/testRunner/unittests/tsserver/autoImportProvider.ts +++ b/src/testRunner/unittests/tsserver/autoImportProvider.ts @@ -32,11 +32,11 @@ const tsconfig: File = { }; const packageJson: File = { path: "/package.json", - content: `{ "dependencies": { "@angular/forms": "*", "@angular/core": "*" } }` + content: `{ "dependencies": { "@angular/forms": "*", "@angular/core": "*" } }`, }; const indexTs: File = { path: "/index.ts", - content: "" + content: "", }; describe("unittests:: tsserver:: autoImportProvider", () => { @@ -46,7 +46,7 @@ describe("unittests:: tsserver:: autoImportProvider", () => { angularFormsPackageJson, tsconfig, { path: packageJson.path, content: `{ "dependencies": {} }` }, - indexTs + indexTs, ]); openFilesForSession([indexTs], session); assert.isUndefined(projectService.configuredProjects.get(tsconfig.path)!.getLanguageService().getAutoImportProvider()); @@ -59,7 +59,7 @@ describe("unittests:: tsserver:: autoImportProvider", () => { angularFormsPackageJson, tsconfig, packageJson, - { path: indexTs.path, content: "import '@angular/forms';" } + { path: indexTs.path, content: "import '@angular/forms';" }, ]); openFilesForSession([indexTs], session); assert.isUndefined(projectService.configuredProjects.get(tsconfig.path)!.getLanguageService().getAutoImportProvider()); @@ -102,7 +102,7 @@ describe("unittests:: tsserver:: autoImportProvider", () => { angularFormsPackageJson, tsconfig, { path: "/package.json", content: "{}" }, - indexTs + indexTs, ]); openFilesForSession([indexTs], session); @@ -119,7 +119,7 @@ describe("unittests:: tsserver:: autoImportProvider", () => { angularFormsPackageJson, tsconfig, packageJson, - indexTs + indexTs, ]); openFilesForSession([indexTs], session); @@ -139,7 +139,7 @@ describe("unittests:: tsserver:: autoImportProvider", () => { angularFormsPackageJson, tsconfig, packageJson, - indexTs + indexTs, ]); openFilesForSession([indexTs], session); @@ -159,7 +159,7 @@ describe("unittests:: tsserver:: autoImportProvider", () => { angularFormsDts, angularFormsPackageJson, tsconfig, - indexTs + indexTs, ]); // Create configured project only, ensure !projectService.pendingEnsureProjectForOpenFiles @@ -184,7 +184,7 @@ describe("unittests:: tsserver:: autoImportProvider", () => { angularCorePackageJson, tsconfig, packageJson, - indexTs + indexTs, ]); openFilesForSession([indexTs], session); @@ -212,7 +212,7 @@ describe("unittests:: tsserver:: autoImportProvider", () => { angularCorePackageJson, tsconfig, packageJson, - indexTs + indexTs, ]); openFilesForSession([indexTs, angularFormsDts], session); @@ -233,7 +233,7 @@ describe("unittests:: tsserver:: autoImportProvider", () => { angularFormsPackageJson, tsconfig, { path: packageJson.path, content: "{" }, - indexTs + indexTs, ]); openFilesForSession([indexTs], session); @@ -247,7 +247,7 @@ describe("unittests:: tsserver:: autoImportProvider", () => { it("Does not create an auto import provider if there are too many dependencies", () => { const createPackage = (i: number): File[] => ([ { path: `/node_modules/package${i}/package.json`, content: `{ "name": "package${i}" }` }, - { path: `/node_modules/package${i}/index.d.ts`, content: `` } + { path: `/node_modules/package${i}/index.d.ts`, content: `` }, ]); const packages = []; @@ -321,7 +321,7 @@ describe("unittests:: tsserver:: autoImportProvider - monorepo", () => { // packages/b { path: "/packages/b/package.json", content: packageJson.content }, { path: "/packages/b/tsconfig.json", content: `{ "compilerOptions": { "composite": true } }` }, - { path: "/packages/b/index.ts", content: `export class B {}` } + { path: "/packages/b/index.ts", content: `export class B {}` }, ]; const { projectService, session, findAllReferences } = setup(files); @@ -344,7 +344,7 @@ describe("unittests:: tsserver:: autoImportProvider - monorepo", () => { // packages/b { path: "/packages/a/node_modules/b/package.json", content: `{ "types": "dist/index.d.ts" }` }, { path: "/packages/a/node_modules/b/tsconfig.json", content: `{ "compilerOptions": { "composite": true, "outDir": "dist" } }` }, - { path: "/packages/a/node_modules/b/index.ts", content: `export class B {}` } + { path: "/packages/a/node_modules/b/index.ts", content: `export class B {}` }, ]; const { projectService, session } = setup(files); @@ -384,9 +384,9 @@ function setup(files: File[]) { arguments: { openFiles: [{ fileName: path, - content: newText - }] - } + content: newText, + }], + }, }); } @@ -397,8 +397,8 @@ function setup(files: File[]) { arguments: { file, line, - offset - } + offset, + }, }); } @@ -413,7 +413,7 @@ function setup(files: File[]) { arguments: { ...requestLocation, includeExternalModuleExports: true, - } + }, }); } } diff --git a/src/testRunner/unittests/tsserver/auxiliaryProject.ts b/src/testRunner/unittests/tsserver/auxiliaryProject.ts index 36f0e6cb45a69..65f99d06f0a29 100644 --- a/src/testRunner/unittests/tsserver/auxiliaryProject.ts +++ b/src/testRunner/unittests/tsserver/auxiliaryProject.ts @@ -12,15 +12,15 @@ import { const aTs: File = { path: "/a.ts", - content: `import { B } from "./b";` + content: `import { B } from "./b";`, }; const bDts: File = { path: "/b.d.ts", - content: `export declare class B {}` + content: `export declare class B {}`, }; const bJs: File = { path: "/b.js", - content: `export class B {}` + content: `export class B {}`, }; describe("unittests:: tsserver:: auxiliaryProject", () => { it("AuxiliaryProject does not remove scrips from InferredProject", () => { diff --git a/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts b/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts index 250a9ffc94a8f..6c68a29c70296 100644 --- a/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts +++ b/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts @@ -23,10 +23,10 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS fileExists = "fileExists", directoryExists = "directoryExists", getDirectories = "getDirectories", - readFile = "readFile" + readFile = "readFile", } enum CalledMapsWithFiveArgs { - readDirectory = "readDirectory" + readDirectory = "readDirectory", } type CalledMaps = CalledMapsWithSingleArg | CalledMapsWithFiveArgs; type CalledWithFiveArgs = [readonly string[], readonly string[], readonly string[], number]; @@ -36,7 +36,7 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS directoryExists: setCallsTrackingWithSingleArgFn(CalledMapsWithSingleArg.directoryExists), getDirectories: setCallsTrackingWithSingleArgFn(CalledMapsWithSingleArg.getDirectories), readFile: setCallsTrackingWithSingleArgFn(CalledMapsWithSingleArg.readFile), - readDirectory: setCallsTrackingWithFiveArgFn(CalledMapsWithFiveArgs.readDirectory) + readDirectory: setCallsTrackingWithFiveArgFn(CalledMapsWithFiveArgs.readDirectory), }; return logCacheAndClear; @@ -89,12 +89,12 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS let rootContent = `import {x} from "f1"`; const root: File = { path: "/c/d/f0.ts", - content: rootContent + content: rootContent, }; const imported: File = { path: "/c/f1.ts", - content: `foo()` + content: `foo()`, }; const host = createServerHost([root, imported]); @@ -147,12 +147,12 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS it("loads missing files from disk", () => { const root: File = { path: "/users/username/projects/project/foo.ts", - content: `import {y} from "bar"` + content: `import {y} from "bar"`, }; const imported: File = { path: "/users/username/projects/project/bar.d.ts", - content: `export var y = 1` + content: `export var y = 1`, }; const host = createServerHost([root]); @@ -180,18 +180,18 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS content: ` import { Vessel } from '~/models/vessel'; const v = new Vessel(); - ` + `, }; const anotherModuleFile: File = { path: "/a/b/utils/db.ts", - content: "export class Bookshelf { }" + content: "export class Bookshelf { }", }; const moduleFile: File = { path: "/a/b/models/vessel.ts", content: ` import { Bookshelf } from '~/utils/db'; export class Vessel extends Bookshelf {} - ` + `, }; const tsconfigFile: File = { path: "/a/b/tsconfig.json", @@ -201,8 +201,8 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS module: "es6", baseUrl: "./", // all paths are relative to the baseUrl paths: { - "~/*": ["*"] // resolve any `~/foo/bar` to `/foo/bar` - } + "~/*": ["*"], // resolve any `~/foo/bar` to `/foo/bar` + }, }, exclude: [ "api", @@ -211,9 +211,9 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS "public", "seeds", "sql_updates", - "tests.build" - ] - }) + "tests.build", + ], + }), }; const projectFiles = [clientFile, anotherModuleFile, moduleFile, tsconfigFile]; const host = createServerHost(projectFiles); @@ -228,8 +228,8 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS file: clientFile.path, position: clientFile.content.indexOf("/vessel") + 1, line: undefined!, // TODO: GH#18217 - offset: undefined! // TODO: GH#18217 - } + offset: undefined!, // TODO: GH#18217 + }, }); logCacheAndClear(session.logger); @@ -246,19 +246,19 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS const frontendDir = "/Users/someuser/work/applications/frontend"; const file1: File = { path: `${frontendDir}/src/app/utils/Analytic.ts`, - content: "export class SomeClass { };" + content: "export class SomeClass { };", }; const file2: File = { path: `${frontendDir}/src/app/redux/configureStore.ts`, - content: "export class configureStore { }" + content: "export class configureStore { }", }; const file3: File = { path: `${frontendDir}/src/app/utils/Cookie.ts`, - content: "export class Cookie { }" + content: "export class Cookie { }", }; const es2016LibFile: File = { path: "/a/lib/lib.es2016.full.d.ts", - content: libFile.content + content: libFile.content, }; const typeRoots = ["types", "node_modules/@types"]; const types = ["node", "jest"]; @@ -282,18 +282,18 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS baseUrl: ".", paths: { "*": [ - "types/*" - ] - } + "types/*", + ], + }, }, include: [ - "src/**/*" + "src/**/*", ], exclude: [ "node_modules", - "compiled" - ] - }) + "compiled", + ], + }), }; const projectFiles = [file1, file2, es2016LibFile, tsconfigFile]; const host = createServerHost(projectFiles, { useCaseSensitiveFileNames }); @@ -321,18 +321,18 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS const projectLocation = "/users/username/projects/proj"; const file1: File = { path: `${projectLocation}/foo/boo/app.ts`, - content: `import * as debug from "debug"` + content: `import * as debug from "debug"`, }; const file2: File = { path: `${projectLocation}/foo/boo/moo/app.ts`, - content: `import * as debug from "debug"` + content: `import * as debug from "debug"`, }; const tsconfig: File = { path: `${projectLocation}/tsconfig.json`, content: JSON.stringify({ files: ["foo/boo/app.ts", "foo/boo/moo/app.ts"], - moduleResolution: resolution - }) + moduleResolution: resolution, + }), }; const files = [file1, file2, tsconfig, libFile]; @@ -346,7 +346,7 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS const debugTypesFile: File = { path: `${projectLocation}/node_modules/debug/index.d.ts`, - content: "export {}" + content: "export {}", }; host.writeFile(debugTypesFile.path, debugTypesFile.content); host.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions @@ -374,11 +374,11 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS }; const app: File = getRootedFileOrFolder({ path: "/a/b/app.ts", - content: "import _ from 'lodash';" + content: "import _ from 'lodash';", }); const tsconfigJson: File = getRootedFileOrFolder({ path: "/a/b/tsconfig.json", - content: '{ "compilerOptions": { } }' + content: '{ "compilerOptions": { } }', }); const packageJson: File = getRootedFileOrFolder({ path: "/a/b/package.json", @@ -403,7 +403,7 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS "author": "", "license": "ISC" } -` +`, }); const host = createServerHost([app, libFile, tsconfigJson, packageJson]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -437,7 +437,7 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS { path: "/a/b/node_modules/.staging/rxjs-22375c61/add/operator" }, { path: "/a/b/node_modules/.staging/@types/lodash-e56c4fe7/package.json", content: "{\n \"name\": \"@types/lodash\",\n \"version\": \"4.14.74\",\n \"description\": \"TypeScript definitions for Lo-Dash\",\n \"license\": \"MIT\",\n \"contributors\": [\n {\n \"name\": \"Brian Zengel\",\n \"url\": \"https://github.com/bczengel\"\n },\n {\n \"name\": \"Ilya Mochalov\",\n \"url\": \"https://github.com/chrootsu\"\n },\n {\n \"name\": \"Stepan Mikhaylyuk\",\n \"url\": \"https://github.com/stepancar\"\n },\n {\n \"name\": \"Eric L Anderson\",\n \"url\": \"https://github.com/ericanderson\"\n },\n {\n \"name\": \"AJ Richardson\",\n \"url\": \"https://github.com/aj-r\"\n },\n {\n \"name\": \"Junyoung Clare Jang\",\n \"url\": \"https://github.com/ailrun\"\n }\n ],\n \"main\": \"\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://www.github.com/DefinitelyTyped/DefinitelyTyped.git\"\n },\n \"scripts\": {},\n \"dependencies\": {},\n \"typesPublisherContentHash\": \"12af578ffaf8d86d2df37e591857906a86b983fa9258414326544a0fe6af0de8\",\n \"typeScriptVersion\": \"2.2\"\n}" }, { path: "/a/b/node_modules/.staging/lodash-b0733faa/index.js", content: "module.exports = require('./lodash');" }, - { path: "/a/b/node_modules/.staging/typescript-8493ea5d/package.json.3017591594", content: "" } + { path: "/a/b/node_modules/.staging/typescript-8493ea5d/package.json.3017591594", content: "" }, ].map(getRootedFileOrFolder)); // Since we added/removed in .staging no timeout verifyAfterPartialOrCompleteNpmInstall(); @@ -451,7 +451,7 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS { path: "/a/b/node_modules/.staging/rxjs-22375c61/bundles" }, { path: "/a/b/node_modules/.staging/rxjs-22375c61/operator" }, { path: "/a/b/node_modules/.staging/rxjs-22375c61/src/add/observable/dom" }, - { path: "/a/b/node_modules/.staging/@types/lodash-e56c4fe7/index.d.ts", content: "\n// Stub for lodash\nexport = _;\nexport as namespace _;\ndeclare var _: _.LoDashStatic;\ndeclare namespace _ {\n interface LoDashStatic {\n someProp: string;\n }\n class SomeClass {\n someMethod(): void;\n }\n}" } + { path: "/a/b/node_modules/.staging/@types/lodash-e56c4fe7/index.d.ts", content: "\n// Stub for lodash\nexport = _;\nexport as namespace _;\ndeclare var _: _.LoDashStatic;\ndeclare namespace _ {\n interface LoDashStatic {\n someProp: string;\n }\n class SomeClass {\n someMethod(): void;\n }\n}" }, ].map(getRootedFileOrFolder)); verifyAfterPartialOrCompleteNpmInstall(); @@ -460,7 +460,7 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS { path: "/a/b/node_modules/.staging/rxjs-22375c61/src/util" }, { path: "/a/b/node_modules/.staging/rxjs-22375c61/symbol" }, { path: "/a/b/node_modules/.staging/rxjs-22375c61/testing" }, - { path: "/a/b/node_modules/.staging/rxjs-22375c61/package.json.2252192041", content: "{\n \"_args\": [\n [\n {\n \"raw\": \"rxjs@^5.4.2\",\n \"scope\": null,\n \"escapedName\": \"rxjs\",\n \"name\": \"rxjs\",\n \"rawSpec\": \"^5.4.2\",\n \"spec\": \">=5.4.2 <6.0.0\",\n \"type\": \"range\"\n },\n \"C:\\\\Users\\\\shkamat\\\\Desktop\\\\app\"\n ]\n ],\n \"_from\": \"rxjs@>=5.4.2 <6.0.0\",\n \"_id\": \"rxjs@5.4.3\",\n \"_inCache\": true,\n \"_location\": \"/rxjs\",\n \"_nodeVersion\": \"7.7.2\",\n \"_npmOperationalInternal\": {\n \"host\": \"s3://npm-registry-packages\",\n \"tmp\": \"tmp/rxjs-5.4.3.tgz_1502407898166_0.6800217325799167\"\n },\n \"_npmUser\": {\n \"name\": \"blesh\",\n \"email\": \"ben@benlesh.com\"\n },\n \"_npmVersion\": \"5.3.0\",\n \"_phantomChildren\": {},\n \"_requested\": {\n \"raw\": \"rxjs@^5.4.2\",\n \"scope\": null,\n \"escapedName\": \"rxjs\",\n \"name\": \"rxjs\",\n \"rawSpec\": \"^5.4.2\",\n \"spec\": \">=5.4.2 <6.0.0\",\n \"type\": \"range\"\n },\n \"_requiredBy\": [\n \"/\"\n ],\n \"_resolved\": \"https://registry.npmjs.org/rxjs/-/rxjs-5.4.3.tgz\",\n \"_shasum\": \"0758cddee6033d68e0fd53676f0f3596ce3d483f\",\n \"_shrinkwrap\": null,\n \"_spec\": \"rxjs@^5.4.2\",\n \"_where\": \"C:\\\\Users\\\\shkamat\\\\Desktop\\\\app\",\n \"author\": {\n \"name\": \"Ben Lesh\",\n \"email\": \"ben@benlesh.com\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/ReactiveX/RxJS/issues\"\n },\n \"config\": {\n \"commitizen\": {\n \"path\": \"cz-conventional-changelog\"\n }\n },\n \"contributors\": [\n {\n \"name\": \"Ben Lesh\",\n \"email\": \"ben@benlesh.com\"\n },\n {\n \"name\": \"Paul Taylor\",\n \"email\": \"paul.e.taylor@me.com\"\n },\n {\n \"name\": \"Jeff Cross\",\n \"email\": \"crossj@google.com\"\n },\n {\n \"name\": \"Matthew Podwysocki\",\n \"email\": \"matthewp@microsoft.com\"\n },\n {\n \"name\": \"OJ Kwon\",\n \"email\": \"kwon.ohjoong@gmail.com\"\n },\n {\n \"name\": \"Andre Staltz\",\n \"email\": \"andre@staltz.com\"\n }\n ],\n \"dependencies\": {\n \"symbol-observable\": \"^1.0.1\"\n },\n \"description\": \"Reactive Extensions for modern JavaScript\",\n \"devDependencies\": {\n \"babel-polyfill\": \"^6.23.0\",\n \"benchmark\": \"^2.1.0\",\n \"benchpress\": \"2.0.0-beta.1\",\n \"chai\": \"^3.5.0\",\n \"color\": \"^0.11.1\",\n \"colors\": \"1.1.2\",\n \"commitizen\": \"^2.8.6\",\n \"coveralls\": \"^2.11.13\",\n \"cz-conventional-changelog\": \"^1.2.0\",\n \"danger\": \"^1.1.0\",\n \"doctoc\": \"^1.0.0\",\n \"escape-string-regexp\": \"^1.0.5 \",\n \"esdoc\": \"^0.4.7\",\n \"eslint\": \"^3.8.0\",\n \"fs-extra\": \"^2.1.2\",\n \"get-folder-size\": \"^1.0.0\",\n \"glob\": \"^7.0.3\",\n \"gm\": \"^1.22.0\",\n \"google-closure-compiler-js\": \"^20170218.0.0\",\n \"gzip-size\": \"^3.0.0\",\n \"http-server\": \"^0.9.0\",\n \"husky\": \"^0.13.3\",\n \"lint-staged\": \"3.2.5\",\n \"lodash\": \"^4.15.0\",\n \"madge\": \"^1.4.3\",\n \"markdown-doctest\": \"^0.9.1\",\n \"minimist\": \"^1.2.0\",\n \"mkdirp\": \"^0.5.1\",\n \"mocha\": \"^3.0.2\",\n \"mocha-in-sauce\": \"0.0.1\",\n \"npm-run-all\": \"^4.0.2\",\n \"npm-scripts-info\": \"^0.3.4\",\n \"nyc\": \"^10.2.0\",\n \"opn-cli\": \"^3.1.0\",\n \"platform\": \"^1.3.1\",\n \"promise\": \"^7.1.1\",\n \"protractor\": \"^3.1.1\",\n \"rollup\": \"0.36.3\",\n \"rollup-plugin-inject\": \"^2.0.0\",\n \"rollup-plugin-node-resolve\": \"^2.0.0\",\n \"rx\": \"latest\",\n \"rxjs\": \"latest\",\n \"shx\": \"^0.2.2\",\n \"sinon\": \"^2.1.0\",\n \"sinon-chai\": \"^2.9.0\",\n \"source-map-support\": \"^0.4.0\",\n \"tslib\": \"^1.5.0\",\n \"eslint\": \"^5.16.0\",\n \"typescript\": \"~2.0.6\",\n \"typings\": \"^2.0.0\",\n \"validate-commit-msg\": \"^2.14.0\",\n \"watch\": \"^1.0.1\",\n \"webpack\": \"^1.13.1\",\n \"xmlhttprequest\": \"1.8.0\"\n },\n \"directories\": {},\n \"dist\": {\n \"integrity\": \"sha512-fSNi+y+P9ss+EZuV0GcIIqPUK07DEaMRUtLJvdcvMyFjc9dizuDjere+A4V7JrLGnm9iCc+nagV/4QdMTkqC4A==\",\n \"shasum\": \"0758cddee6033d68e0fd53676f0f3596ce3d483f\",\n \"tarball\": \"https://registry.npmjs.org/rxjs/-/rxjs-5.4.3.tgz\"\n },\n \"engines\": {\n \"npm\": \">=2.0.0\"\n },\n \"homepage\": \"https://github.com/ReactiveX/RxJS\",\n \"keywords\": [\n \"Rx\",\n \"RxJS\",\n \"ReactiveX\",\n \"ReactiveExtensions\",\n \"Streams\",\n \"Observables\",\n \"Observable\",\n \"Stream\",\n \"ES6\",\n \"ES2015\"\n ],\n \"license\": \"Apache-2.0\",\n \"lint-staged\": {\n \"*.@(js)\": [\n \"eslint --fix\",\n \"git add\"\n ],\n \"*.@(ts)\": [\n \"eslint -c .eslintrc --ext .ts . --fix\",\n \"git add\"\n ]\n },\n \"main\": \"Rx.js\",\n \"maintainers\": [\n {\n \"name\": \"blesh\",\n \"email\": \"ben@benlesh.com\"\n }\n ],\n \"name\": \"rxjs\",\n \"optionalDependencies\": {},\n \"readme\": \"ERROR: No README data found!\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+ssh://git@github.com/ReactiveX/RxJS.git\"\n },\n \"scripts-info\": {\n \"info\": \"List available script\",\n \"build_all\": \"Build all packages (ES6, CJS, UMD) and generate packages\",\n \"build_cjs\": \"Build CJS package with clean up existing build, copy source into dist\",\n \"build_es6\": \"Build ES6 package with clean up existing build, copy source into dist\",\n \"build_closure_core\": \"Minify Global core build using closure compiler\",\n \"build_global\": \"Build Global package, then minify build\",\n \"build_perf\": \"Build CJS & Global build, run macro performance test\",\n \"build_test\": \"Build CJS package & test spec, execute mocha test runner\",\n \"build_cover\": \"Run lint to current code, build CJS & test spec, execute test coverage\",\n \"build_docs\": \"Build ES6 & global package, create documentation using it\",\n \"build_spec\": \"Build test specs\",\n \"check_circular_dependencies\": \"Check codebase has circular dependencies\",\n \"clean_spec\": \"Clean up existing test spec build output\",\n \"clean_dist_cjs\": \"Clean up existing CJS package output\",\n \"clean_dist_es6\": \"Clean up existing ES6 package output\",\n \"clean_dist_global\": \"Clean up existing Global package output\",\n \"commit\": \"Run git commit wizard\",\n \"compile_dist_cjs\": \"Compile codebase into CJS module\",\n \"compile_module_es6\": \"Compile codebase into ES6\",\n \"cover\": \"Execute test coverage\",\n \"lint_perf\": \"Run lint against performance test suite\",\n \"lint_spec\": \"Run lint against test spec\",\n \"lint_src\": \"Run lint against source\",\n \"lint\": \"Run lint against everything\",\n \"perf\": \"Run macro performance benchmark\",\n \"perf_micro\": \"Run micro performance benchmark\",\n \"test_mocha\": \"Execute mocha test runner against existing test spec build\",\n \"test_browser\": \"Execute mocha test runner on browser against existing test spec build\",\n \"test\": \"Clean up existing test spec build, build test spec and execute mocha test runner\",\n \"tests2png\": \"Generate marble diagram image from test spec\",\n \"watch\": \"Watch codebase, trigger compile when source code changes\"\n },\n \"typings\": \"Rx.d.ts\",\n \"version\": \"5.4.3\"\n}\n" } + { path: "/a/b/node_modules/.staging/rxjs-22375c61/package.json.2252192041", content: "{\n \"_args\": [\n [\n {\n \"raw\": \"rxjs@^5.4.2\",\n \"scope\": null,\n \"escapedName\": \"rxjs\",\n \"name\": \"rxjs\",\n \"rawSpec\": \"^5.4.2\",\n \"spec\": \">=5.4.2 <6.0.0\",\n \"type\": \"range\"\n },\n \"C:\\\\Users\\\\shkamat\\\\Desktop\\\\app\"\n ]\n ],\n \"_from\": \"rxjs@>=5.4.2 <6.0.0\",\n \"_id\": \"rxjs@5.4.3\",\n \"_inCache\": true,\n \"_location\": \"/rxjs\",\n \"_nodeVersion\": \"7.7.2\",\n \"_npmOperationalInternal\": {\n \"host\": \"s3://npm-registry-packages\",\n \"tmp\": \"tmp/rxjs-5.4.3.tgz_1502407898166_0.6800217325799167\"\n },\n \"_npmUser\": {\n \"name\": \"blesh\",\n \"email\": \"ben@benlesh.com\"\n },\n \"_npmVersion\": \"5.3.0\",\n \"_phantomChildren\": {},\n \"_requested\": {\n \"raw\": \"rxjs@^5.4.2\",\n \"scope\": null,\n \"escapedName\": \"rxjs\",\n \"name\": \"rxjs\",\n \"rawSpec\": \"^5.4.2\",\n \"spec\": \">=5.4.2 <6.0.0\",\n \"type\": \"range\"\n },\n \"_requiredBy\": [\n \"/\"\n ],\n \"_resolved\": \"https://registry.npmjs.org/rxjs/-/rxjs-5.4.3.tgz\",\n \"_shasum\": \"0758cddee6033d68e0fd53676f0f3596ce3d483f\",\n \"_shrinkwrap\": null,\n \"_spec\": \"rxjs@^5.4.2\",\n \"_where\": \"C:\\\\Users\\\\shkamat\\\\Desktop\\\\app\",\n \"author\": {\n \"name\": \"Ben Lesh\",\n \"email\": \"ben@benlesh.com\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/ReactiveX/RxJS/issues\"\n },\n \"config\": {\n \"commitizen\": {\n \"path\": \"cz-conventional-changelog\"\n }\n },\n \"contributors\": [\n {\n \"name\": \"Ben Lesh\",\n \"email\": \"ben@benlesh.com\"\n },\n {\n \"name\": \"Paul Taylor\",\n \"email\": \"paul.e.taylor@me.com\"\n },\n {\n \"name\": \"Jeff Cross\",\n \"email\": \"crossj@google.com\"\n },\n {\n \"name\": \"Matthew Podwysocki\",\n \"email\": \"matthewp@microsoft.com\"\n },\n {\n \"name\": \"OJ Kwon\",\n \"email\": \"kwon.ohjoong@gmail.com\"\n },\n {\n \"name\": \"Andre Staltz\",\n \"email\": \"andre@staltz.com\"\n }\n ],\n \"dependencies\": {\n \"symbol-observable\": \"^1.0.1\"\n },\n \"description\": \"Reactive Extensions for modern JavaScript\",\n \"devDependencies\": {\n \"babel-polyfill\": \"^6.23.0\",\n \"benchmark\": \"^2.1.0\",\n \"benchpress\": \"2.0.0-beta.1\",\n \"chai\": \"^3.5.0\",\n \"color\": \"^0.11.1\",\n \"colors\": \"1.1.2\",\n \"commitizen\": \"^2.8.6\",\n \"coveralls\": \"^2.11.13\",\n \"cz-conventional-changelog\": \"^1.2.0\",\n \"danger\": \"^1.1.0\",\n \"doctoc\": \"^1.0.0\",\n \"escape-string-regexp\": \"^1.0.5 \",\n \"esdoc\": \"^0.4.7\",\n \"eslint\": \"^3.8.0\",\n \"fs-extra\": \"^2.1.2\",\n \"get-folder-size\": \"^1.0.0\",\n \"glob\": \"^7.0.3\",\n \"gm\": \"^1.22.0\",\n \"google-closure-compiler-js\": \"^20170218.0.0\",\n \"gzip-size\": \"^3.0.0\",\n \"http-server\": \"^0.9.0\",\n \"husky\": \"^0.13.3\",\n \"lint-staged\": \"3.2.5\",\n \"lodash\": \"^4.15.0\",\n \"madge\": \"^1.4.3\",\n \"markdown-doctest\": \"^0.9.1\",\n \"minimist\": \"^1.2.0\",\n \"mkdirp\": \"^0.5.1\",\n \"mocha\": \"^3.0.2\",\n \"mocha-in-sauce\": \"0.0.1\",\n \"npm-run-all\": \"^4.0.2\",\n \"npm-scripts-info\": \"^0.3.4\",\n \"nyc\": \"^10.2.0\",\n \"opn-cli\": \"^3.1.0\",\n \"platform\": \"^1.3.1\",\n \"promise\": \"^7.1.1\",\n \"protractor\": \"^3.1.1\",\n \"rollup\": \"0.36.3\",\n \"rollup-plugin-inject\": \"^2.0.0\",\n \"rollup-plugin-node-resolve\": \"^2.0.0\",\n \"rx\": \"latest\",\n \"rxjs\": \"latest\",\n \"shx\": \"^0.2.2\",\n \"sinon\": \"^2.1.0\",\n \"sinon-chai\": \"^2.9.0\",\n \"source-map-support\": \"^0.4.0\",\n \"tslib\": \"^1.5.0\",\n \"eslint\": \"^5.16.0\",\n \"typescript\": \"~2.0.6\",\n \"typings\": \"^2.0.0\",\n \"validate-commit-msg\": \"^2.14.0\",\n \"watch\": \"^1.0.1\",\n \"webpack\": \"^1.13.1\",\n \"xmlhttprequest\": \"1.8.0\"\n },\n \"directories\": {},\n \"dist\": {\n \"integrity\": \"sha512-fSNi+y+P9ss+EZuV0GcIIqPUK07DEaMRUtLJvdcvMyFjc9dizuDjere+A4V7JrLGnm9iCc+nagV/4QdMTkqC4A==\",\n \"shasum\": \"0758cddee6033d68e0fd53676f0f3596ce3d483f\",\n \"tarball\": \"https://registry.npmjs.org/rxjs/-/rxjs-5.4.3.tgz\"\n },\n \"engines\": {\n \"npm\": \">=2.0.0\"\n },\n \"homepage\": \"https://github.com/ReactiveX/RxJS\",\n \"keywords\": [\n \"Rx\",\n \"RxJS\",\n \"ReactiveX\",\n \"ReactiveExtensions\",\n \"Streams\",\n \"Observables\",\n \"Observable\",\n \"Stream\",\n \"ES6\",\n \"ES2015\"\n ],\n \"license\": \"Apache-2.0\",\n \"lint-staged\": {\n \"*.@(js)\": [\n \"eslint --fix\",\n \"git add\"\n ],\n \"*.@(ts)\": [\n \"eslint -c .eslintrc --ext .ts . --fix\",\n \"git add\"\n ]\n },\n \"main\": \"Rx.js\",\n \"maintainers\": [\n {\n \"name\": \"blesh\",\n \"email\": \"ben@benlesh.com\"\n }\n ],\n \"name\": \"rxjs\",\n \"optionalDependencies\": {},\n \"readme\": \"ERROR: No README data found!\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+ssh://git@github.com/ReactiveX/RxJS.git\"\n },\n \"scripts-info\": {\n \"info\": \"List available script\",\n \"build_all\": \"Build all packages (ES6, CJS, UMD) and generate packages\",\n \"build_cjs\": \"Build CJS package with clean up existing build, copy source into dist\",\n \"build_es6\": \"Build ES6 package with clean up existing build, copy source into dist\",\n \"build_closure_core\": \"Minify Global core build using closure compiler\",\n \"build_global\": \"Build Global package, then minify build\",\n \"build_perf\": \"Build CJS & Global build, run macro performance test\",\n \"build_test\": \"Build CJS package & test spec, execute mocha test runner\",\n \"build_cover\": \"Run lint to current code, build CJS & test spec, execute test coverage\",\n \"build_docs\": \"Build ES6 & global package, create documentation using it\",\n \"build_spec\": \"Build test specs\",\n \"check_circular_dependencies\": \"Check codebase has circular dependencies\",\n \"clean_spec\": \"Clean up existing test spec build output\",\n \"clean_dist_cjs\": \"Clean up existing CJS package output\",\n \"clean_dist_es6\": \"Clean up existing ES6 package output\",\n \"clean_dist_global\": \"Clean up existing Global package output\",\n \"commit\": \"Run git commit wizard\",\n \"compile_dist_cjs\": \"Compile codebase into CJS module\",\n \"compile_module_es6\": \"Compile codebase into ES6\",\n \"cover\": \"Execute test coverage\",\n \"lint_perf\": \"Run lint against performance test suite\",\n \"lint_spec\": \"Run lint against test spec\",\n \"lint_src\": \"Run lint against source\",\n \"lint\": \"Run lint against everything\",\n \"perf\": \"Run macro performance benchmark\",\n \"perf_micro\": \"Run micro performance benchmark\",\n \"test_mocha\": \"Execute mocha test runner against existing test spec build\",\n \"test_browser\": \"Execute mocha test runner on browser against existing test spec build\",\n \"test\": \"Clean up existing test spec build, build test spec and execute mocha test runner\",\n \"tests2png\": \"Generate marble diagram image from test spec\",\n \"watch\": \"Watch codebase, trigger compile when source code changes\"\n },\n \"typings\": \"Rx.d.ts\",\n \"version\": \"5.4.3\"\n}\n" }, ].map(getRootedFileOrFolder)); verifyAfterPartialOrCompleteNpmInstall(); @@ -475,7 +475,7 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS { path: "/a/b/node_modules/lodash" }, { path: "/a/b/node_modules/rxjs" }, { path: "/a/b/node_modules/typescript" }, - { path: "/a/b/node_modules/.bin" } + { path: "/a/b/node_modules/.bin" }, ].map(getRootedFileOrFolder)); // From the type root update verifyAfterPartialOrCompleteNpmInstall(); @@ -521,11 +521,11 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS const projectLocation = "/user/username/folder/myproject"; const app: File = { path: `${projectLocation}/app.ts`, - content: `import * as debug from "debug"` + content: `import * as debug from "debug"`, }; const tsconfig: File = { path: `${projectLocation}/tsconfig.json`, - content: "" + content: "", }; const files = [app, tsconfig, libFile]; @@ -538,7 +538,7 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS const debugTypesFile: File = { path: `${projectLocation}/node_modules/@types/debug/index.d.ts`, - content: "export {}" + content: "export {}", }; // Do not invoke recursive directory watcher for anything other than node_module/@types const invoker = host.invokeFsWatchesRecursiveCallbacks; @@ -556,11 +556,11 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS it("when creating new file in symlinked folder", () => { const module1: File = { path: `/user/username/projects/myproject/client/folder1/module1.ts`, - content: `export class Module1Class { }` + content: `export class Module1Class { }`, }; const module2: File = { path: `/user/username/projects/myproject/folder2/module2.ts`, - content: `import * as M from "folder1/module1";` + content: `import * as M from "folder1/module1";`, }; const symlink: SymLink = { path: `/user/username/projects/myproject/client/linktofolder2`, @@ -573,8 +573,8 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS baseUrl: "client", paths: { "*": ["*"] }, }, - include: ["client/**/*", "folder2"] - }) + include: ["client/**/*", "folder2"], + }), }; const host = createServerHost([module1, module2, symlink, config, libFile]); const service = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); diff --git a/src/testRunner/unittests/tsserver/cancellationToken.ts b/src/testRunner/unittests/tsserver/cancellationToken.ts index b095bd690de59..ce14ecf60d1af 100644 --- a/src/testRunner/unittests/tsserver/cancellationToken.ts +++ b/src/testRunner/unittests/tsserver/cancellationToken.ts @@ -23,30 +23,30 @@ describe("unittests:: tsserver:: cancellationToken", () => { it("is attached to request", () => { const f1 = { path: "/a/b/app.ts", - content: "let xyz = 1;" + content: "let xyz = 1;", }; const host = createServerHost([f1]); const cancellationToken: ts.server.ServerCancellationToken = { isCancellationRequested: () => false, setRequest: requestId => session.logger.log(`ServerCancellationToken:: Cancellation Request id:: ${requestId}`), - resetRequest: ts.noop + resetRequest: ts.noop, }; const session = createSession(host, { cancellationToken, logger: createLoggerWithInMemoryLogs(host) }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Open, - arguments: { file: f1.path } + arguments: { file: f1.path }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Geterr, - arguments: { files: [f1.path], delay: 0 } + arguments: { files: [f1.path], delay: 0 }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.DocumentHighlights, - arguments: { file: f1.path, line: 1, offset: 6, filesToSearch: [f1.path] } + arguments: { file: f1.path, line: 1, offset: 6, filesToSearch: [f1.path] }, }); host.runQueuedTimeoutCallbacks(); @@ -58,13 +58,13 @@ describe("unittests:: tsserver:: cancellationToken", () => { it("Geterr is cancellable", () => { const f1 = { path: "/a/app.ts", - content: "let x = 1" + content: "let x = 1", }; const config = { path: "/a/tsconfig.json", content: JSON.stringify({ - compilerOptions: {} - }) + compilerOptions: {}, + }), }; const host = createServerHost([f1, config]); @@ -79,12 +79,12 @@ describe("unittests:: tsserver:: cancellationToken", () => { { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Open, - arguments: { file: f1.path } + arguments: { file: f1.path }, }); // send geterr for missing file session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Geterr, - arguments: { files: ["/a/missing"], delay: 0 } + arguments: { files: ["/a/missing"], delay: 0 }, }); // Queued files host.runQueuedTimeoutCallbacks(); @@ -95,13 +95,13 @@ describe("unittests:: tsserver:: cancellationToken", () => { // send geterr for a valid file session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Geterr, - arguments: { files: [f1.path], delay: 0 } + arguments: { files: [f1.path], delay: 0 }, }); // run new request session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.ProjectInfo, - arguments: { file: f1.path, needFileNameList: false } + arguments: { file: f1.path, needFileNameList: false }, }); // cancel previously issued Geterr @@ -113,7 +113,7 @@ describe("unittests:: tsserver:: cancellationToken", () => { const getErrId = session.getNextSeq(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Geterr, - arguments: { files: [f1.path], delay: 0 } + arguments: { files: [f1.path], delay: 0 }, }); // run first step @@ -127,7 +127,7 @@ describe("unittests:: tsserver:: cancellationToken", () => { { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Geterr, - arguments: { files: [f1.path], delay: 0 } + arguments: { files: [f1.path], delay: 0 }, }); // run first step host.runQueuedTimeoutCallbacks(); @@ -139,13 +139,13 @@ describe("unittests:: tsserver:: cancellationToken", () => { { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Geterr, - arguments: { files: [f1.path], delay: 0 } + arguments: { files: [f1.path], delay: 0 }, }); // run first step host.runQueuedTimeoutCallbacks(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Geterr, - arguments: { files: [f1.path], delay: 0 } + arguments: { files: [f1.path], delay: 0 }, }); // make sure that getErr1 is completed } @@ -155,13 +155,13 @@ describe("unittests:: tsserver:: cancellationToken", () => { it("Lower priority tasks are cancellable", () => { const f1 = { path: "/a/app.ts", - content: `{ let x = 1; } var foo = "foo"; var bar = "bar"; var fooBar = "fooBar";` + content: `{ let x = 1; } var foo = "foo"; var bar = "bar"; var fooBar = "fooBar";`, }; const config = { path: "/a/tsconfig.json", content: JSON.stringify({ - compilerOptions: {} - }) + compilerOptions: {}, + }), }; const host = createServerHost([f1, config]); const logger = createLoggerWithInMemoryLogs(host); @@ -176,31 +176,31 @@ describe("unittests:: tsserver:: cancellationToken", () => { { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Open, - arguments: { file: f1.path } + arguments: { file: f1.path }, }); // send navbar request (normal priority) session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.NavBar, - arguments: { file: f1.path } + arguments: { file: f1.path }, }); // ensure the nav bar request can be canceled verifyExecuteCommandSeqIsCancellable({ command: ts.server.protocol.CommandTypes.NavBar, - arguments: { file: f1.path } + arguments: { file: f1.path }, }); // send outlining spans request (normal priority) session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.GetOutliningSpansFull, - arguments: { file: f1.path } + arguments: { file: f1.path }, }); // ensure the outlining spans request can be canceled verifyExecuteCommandSeqIsCancellable({ command: ts.server.protocol.CommandTypes.GetOutliningSpansFull, - arguments: { file: f1.path } + arguments: { file: f1.path }, }); } baselineTsserverLogs("cancellationT", "Lower priority tasks are cancellable", session); diff --git a/src/testRunner/unittests/tsserver/compileOnSave.ts b/src/testRunner/unittests/tsserver/compileOnSave.ts index 9e8f783d65186..0ee81c4ef7171 100644 --- a/src/testRunner/unittests/tsserver/compileOnSave.ts +++ b/src/testRunner/unittests/tsserver/compileOnSave.ts @@ -21,34 +21,34 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { function files() { const moduleFile1: File = { path: "/a/b/moduleFile1.ts", - content: "export function Foo() { };" + content: "export function Foo() { };", }; const file1Consumer1: File = { path: "/a/b/file1Consumer1.ts", - content: `import {Foo} from "./moduleFile1"; export var y = 10;` + content: `import {Foo} from "./moduleFile1"; export var y = 10;`, }; const file1Consumer2: File = { path: "/a/b/file1Consumer2.ts", - content: `import {Foo} from "./moduleFile1"; let z = 10;` + content: `import {Foo} from "./moduleFile1"; let z = 10;`, }; const moduleFile2: File = { path: "/a/b/moduleFile2.ts", - content: `export var Foo4 = 10;` + content: `export var Foo4 = 10;`, }; const globalFile3: File = { path: "/a/b/globalFile3.ts", - content: `interface GlobalFoo { age: number }` + content: `interface GlobalFoo { age: number }`, }; const configFile: File = { path: "/a/b/tsconfig.json", content: `{ "compileOnSave": true - }` + }`, }; return { moduleFile1, file1Consumer1, file1Consumer2, moduleFile2, globalFile3, configFile }; } @@ -63,7 +63,7 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { // Send an initial compileOnSave request session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Change, @@ -73,12 +73,12 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { offset: 1, endLine: 1, endOffset: 1, - insertString: `export var T: number;` - } + insertString: `export var T: number;`, + }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); // Change the content of file1 to `export var T: number;export function Foo() { console.log('hi'); };` @@ -90,12 +90,12 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { offset: 46, endLine: 1, endOffset: 46, - insertString: `console.log('hi');` - } + insertString: `console.log('hi');`, + }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); baselineTsserverLogs("compileOnSave", "configProjects module shape changed", session); }); @@ -110,7 +110,7 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { // Send an initial compileOnSave request session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); // Change file2 content to `let y = Foo();` @@ -122,8 +122,8 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { offset: 1, endLine: 1, endOffset: 28, - insertString: "" - } + insertString: "", + }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Change, @@ -133,12 +133,12 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { offset: 1, endLine: 1, endOffset: 1, - insertString: `export var T: number;` - } + insertString: `export var T: number;`, + }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); // Add the import statements back to file2 @@ -150,8 +150,8 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { offset: 1, endLine: 1, endOffset: 1, - insertString: `import {Foo} from "./moduleFile1";` - } + insertString: `import {Foo} from "./moduleFile1";`, + }, }); // Change the content of file1 to `export var T2: string;export var T: number;export function Foo() { };` @@ -163,12 +163,12 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { offset: 1, endLine: 1, endOffset: 1, - insertString: `export var T2: string;` - } + insertString: `export var T2: string;`, + }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); baselineTsserverLogs("compileOnSave", "configProjects uptodate with reference map changes", session); }); @@ -183,7 +183,7 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { // Send an initial compileOnSave request session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); host.writeFile(file1Consumer1.path, `let y = 10;`); @@ -196,12 +196,12 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { offset: 1, endLine: 1, endOffset: 1, - insertString: `export var T: number;` - } + insertString: `export var T: number;`, + }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); baselineTsserverLogs("compileOnSave", "configProjects uptodate with changes in non open files", session); }); @@ -214,7 +214,7 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { openFilesForSession([moduleFile1], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); session.executeCommandSeq({ @@ -225,14 +225,14 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { offset: 1, endLine: 1, endOffset: 1, - insertString: `export var T: number;` - } + insertString: `export var T: number;`, + }, }); // Delete file1Consumer2 host.deleteFile(file1Consumer2.path); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); baselineTsserverLogs("compileOnSave", "configProjects uptodate with deleted files", session); }); @@ -245,12 +245,12 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { openFilesForSession([moduleFile1], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); const file1Consumer3: File = { path: "/a/b/file1Consumer3.ts", - content: `import {Foo} from "./moduleFile1"; let y = Foo();` + content: `import {Foo} from "./moduleFile1"; let y = Foo();`, }; host.writeFile(file1Consumer3.path, file1Consumer3.content); host.runQueuedTimeoutCallbacks(); @@ -262,12 +262,12 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { offset: 1, endLine: 1, endOffset: 1, - insertString: `export var T: number;` - } + insertString: `export var T: number;`, + }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); baselineTsserverLogs("compileOnSave", "configProjects uptodate with new files", session); }); @@ -275,12 +275,12 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { it("should detect changes in non-root files", () => { const moduleFile1: File = { path: "/a/b/moduleFile1.ts", - content: "export function Foo() { };" + content: "export function Foo() { };", }; const file1Consumer1: File = { path: "/a/b/file1Consumer1.ts", - content: `import {Foo} from "./moduleFile1"; let y = Foo();` + content: `import {Foo} from "./moduleFile1"; let y = Foo();`, }; const configFile: File = { @@ -288,7 +288,7 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { content: `{ "compileOnSave": true, "files": ["${file1Consumer1.path}"] - }` + }`, }; const host = createServerHost([moduleFile1, file1Consumer1, configFile, libFile]); @@ -297,7 +297,7 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { openFilesForSession([moduleFile1, file1Consumer1], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); // change file1 shape now, and verify both files are affected @@ -309,12 +309,12 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { offset: 1, endLine: 1, endOffset: 1, - insertString: `export var T: number;` - } + insertString: `export var T: number;`, + }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); // change file1 internal, and verify only file1 is affected @@ -326,12 +326,12 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { offset: 1, endLine: 1, endOffset: 1, - insertString: `var T1: number;` - } + insertString: `var T1: number;`, + }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); baselineTsserverLogs("compileOnSave", "configProjects detect changes in non-root files", session); }); @@ -352,12 +352,12 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { offset: 1, endLine: 1, endOffset: 1, - insertString: `var T2: string;` - } + insertString: `var T2: string;`, + }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: globalFile3.path } + arguments: { file: globalFile3.path }, }); baselineTsserverLogs("compileOnSave", "configProjects global file shape changed", session); }); @@ -366,7 +366,7 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { const { moduleFile1, file1Consumer1, file1Consumer2 } = files(); const configFile: File = { path: "/a/b/tsconfig.json", - content: `{}` + content: `{}`, }; const host = createServerHost([moduleFile1, file1Consumer1, file1Consumer2, configFile, libFile]); @@ -374,7 +374,7 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { openFilesForSession([moduleFile1], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); baselineTsserverLogs("compileOnSave", "configProjects compileOnSave disabled", session); }); @@ -388,7 +388,7 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { "compilerOptions": { "noEmit": true } - }` + }`, }; const host = createServerHost([moduleFile1, file1Consumer1, file1Consumer2, configFile, libFile]); @@ -396,7 +396,7 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { openFilesForSession([moduleFile1], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); baselineTsserverLogs("compileOnSave", "configProjects noEmit", session); }); @@ -407,14 +407,14 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { path: "/a/b/tsconfig.json", content: `{ "extends": "/a/tsconfig.json" - }` + }`, }; const configFile2: File = { path: "/a/tsconfig.json", content: `{ "compileOnSave": true - }` + }`, }; const host = createServerHost([moduleFile1, file1Consumer1, file1Consumer2, configFile2, configFile, libFile]); @@ -423,7 +423,7 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { openFilesForSession([moduleFile1, file1Consumer1], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); baselineTsserverLogs("compileOnSave", "configProjects compileOnSave in base tsconfig", session); }); @@ -437,7 +437,7 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { "compilerOptions": { "isolatedModules": true } - }` + }`, }; const host = createServerHost([moduleFile1, file1Consumer1, configFile, libFile]); @@ -452,12 +452,12 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { offset: 27, endLine: 1, endOffset: 27, - insertString: `Point,` - } + insertString: `Point,`, + }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); baselineTsserverLogs("compileOnSave", "configProjects isolatedModules", session); }); @@ -472,7 +472,7 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { "module": "system", "outFile": "/a/b/out.js" } - }` + }`, }; const host = createServerHost([moduleFile1, file1Consumer1, configFile, libFile]); @@ -487,12 +487,12 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { offset: 27, endLine: 1, endOffset: 27, - insertString: `Point,` - } + insertString: `Point,`, + }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); baselineTsserverLogs("compileOnSave", "configProjects outFile", session); }); @@ -501,7 +501,7 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { const { moduleFile1, file1Consumer1, globalFile3, configFile } = files(); const file1Consumer1Consumer1: File = { path: "/a/b/file1Consumer1Consumer1.ts", - content: `import {y} from "./file1Consumer1";` + content: `import {y} from "./file1Consumer1";`, }; const host = createServerHost([moduleFile1, file1Consumer1, file1Consumer1Consumer1, globalFile3, configFile, libFile]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -509,7 +509,7 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { openFilesForSession([moduleFile1, file1Consumer1], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); session.executeCommandSeq({ @@ -520,8 +520,8 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { offset: 1, endLine: 1, endOffset: 1, - insertString: `export var T: number;` - } + insertString: `export var T: number;`, + }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Change, @@ -531,12 +531,12 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { offset: 1, endLine: 2, endOffset: 1, - insertString: `export var T: number;` - } + insertString: `export var T: number;`, + }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path, projectFileName: configFile.path } + arguments: { file: moduleFile1.path, projectFileName: configFile.path }, }); baselineTsserverLogs("compileOnSave", "configProjects cascaded affected file list", session); }); @@ -547,13 +547,13 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { path: "/a/b/file1.ts", content: ` /// - export var t1 = 10;` + export var t1 = 10;`, }; const file2: File = { path: "/a/b/file2.ts", content: ` /// - export var t2 = 10;` + export var t2 = 10;`, }; const host = createServerHost([file1, file2, configFile]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -561,7 +561,7 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { openFilesForSession([file1, file2], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: file1.path } + arguments: { file: file1.path }, }); baselineTsserverLogs("compileOnSave", "configProjects circular references", session); }); @@ -579,7 +579,7 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { openFilesForSession([file1, file2, file3], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: file1.path } + arguments: { file: file1.path }, }); baselineTsserverLogs("compileOnSave", "configProjects all projects without projectPath", session); }); @@ -590,7 +590,7 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { path: "/a/b/referenceFile1.ts", content: ` /// - export var x = Foo();` + export var x = Foo();`, }; const host = createServerHost([moduleFile1, referenceFile1, configFile]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -600,11 +600,11 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: referenceFile1.path } + arguments: { file: referenceFile1.path }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: moduleFile1.path } + arguments: { file: moduleFile1.path }, }); baselineTsserverLogs("compileOnSave", "configProjects removed code", session); }); @@ -615,7 +615,7 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { path: "/a/b/referenceFile1.ts", content: ` /// - export var x = Foo();` + export var x = Foo();`, }; const host = createServerHost([referenceFile1, configFile]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -623,7 +623,7 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { openFilesForSession([referenceFile1], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: referenceFile1.path } + arguments: { file: referenceFile1.path }, }); baselineTsserverLogs("compileOnSave", "configProjects non existing code", session); }); @@ -634,18 +634,18 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { it(subScenario, () => { const dtsFile = { path: "/a/runtime/a.d.ts", - content: dtsFileContents + content: dtsFileContents, }; const f2 = { path: "/a/b.ts", - content: tsFileContents + content: tsFileContents, }; const config = { path: "/a/tsconfig.json", content: JSON.stringify({ compilerOptions: opts, - compileOnSave: true - }) + compileOnSave: true, + }), }; const host = createServerHost([dtsFile, f2, config]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -653,11 +653,11 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { openFilesForSession([f2], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dtsFile.path } + arguments: { file: dtsFile.path }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: f2.path } + arguments: { file: f2.path }, }); baselineTsserverLogs("compileOnSave", subScenario, session); }); @@ -704,25 +704,25 @@ describe("unittests:: tsserver:: compileOnSave:: affected list", () => { it(subScenario, () => { const f1 = { path: "/a/a.ts", - content: "let x = 1" + content: "let x = 1", }; const f2 = { path: "/a/b.ts", - content: "let y = 1" + content: "let y = 1", }; const config = { path: "/a/tsconfig.json", content: JSON.stringify({ compilerOptions: opts, - compileOnSave: true - }) + compileOnSave: true, + }), }; const host = createServerHost([f1, f2, config]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); openFilesForSession([f1], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: f1.path } + arguments: { file: f1.path }, }); baselineTsserverLogs("compileOnSave", subScenario, session); }); @@ -745,7 +745,7 @@ describe("unittests:: tsserver:: compileOnSave:: EmitFile test", () => { const path = "/a/app"; const f = { path: path + ts.Extension.Ts, - content: lines.join(newLine) + content: lines.join(newLine), }; const host = createServerHost([f], { newLine }); logger.host = host; @@ -754,7 +754,7 @@ describe("unittests:: tsserver:: compileOnSave:: EmitFile test", () => { openFilesForSession([f], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: f.path } + arguments: { file: f.path }, }); return logger; } @@ -763,15 +763,15 @@ describe("unittests:: tsserver:: compileOnSave:: EmitFile test", () => { it("should emit specified file", () => { const file1 = { path: "/a/b/f1.ts", - content: `export function Foo() { return 10; }` + content: `export function Foo() { return 10; }`, }; const file2 = { path: "/a/b/f2.ts", - content: `import {Foo} from "./f1"; let y = Foo();` + content: `import {Foo} from "./f1"; let y = Foo();`, }; const configFile = { path: "/a/b/tsconfig.json", - content: `{}` + content: `{}`, }; const host = createServerHost([file1, file2, configFile, libFile], { newLine: "\r\n" }); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -779,7 +779,7 @@ describe("unittests:: tsserver:: compileOnSave:: EmitFile test", () => { openFilesForSession([file1, file2], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: file1.path, projectFileName: configFile.path } + arguments: { file: file1.path, projectFileName: configFile.path }, }); baselineTsserverLogs("compileOnSave", "emit specified file", session); @@ -788,16 +788,16 @@ describe("unittests:: tsserver:: compileOnSave:: EmitFile test", () => { it("shoud not emit js files in external projects", () => { const file1 = { path: "/a/b/file1.ts", - content: "consonle.log('file1');" + content: "consonle.log('file1');", }; // file2 has errors. The emitting should not be blocked. const file2 = { path: "/a/b/file2.js", - content: "console.log'file2');" + content: "console.log'file2');", }; const file3 = { path: "/a/b/file3.js", - content: "console.log('file3');" + content: "console.log('file3');", }; const externalProjectName = "/a/b/externalproject"; const host = createServerHost([file1, file2, file3, libFile]); @@ -807,14 +807,14 @@ describe("unittests:: tsserver:: compileOnSave:: EmitFile test", () => { options: { allowJs: true, outFile: "dist.js", - compileOnSave: true + compileOnSave: true, }, - projectFileName: externalProjectName + projectFileName: externalProjectName, }, session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: file1.path } + arguments: { file: file1.path }, }); baselineTsserverLogs("compileOnSave", "should not emit js files in external projects", session); @@ -824,7 +824,7 @@ describe("unittests:: tsserver:: compileOnSave:: EmitFile test", () => { const inputFileName = "Foo.ts"; const file1 = { path: `/root/TypeScriptProject3/TypeScriptProject3/${inputFileName}`, - content: "consonle.log('file1');" + content: "consonle.log('file1');", }; const externalProjectName = "/root/TypeScriptProject3/TypeScriptProject3/TypeScriptProject3.csproj"; const host = createServerHost([file1, libFile]); @@ -834,13 +834,13 @@ describe("unittests:: tsserver:: compileOnSave:: EmitFile test", () => { options: { outFile: "bar.js", sourceMap: true, - compileOnSave: true + compileOnSave: true, }, - projectFileName: externalProjectName + projectFileName: externalProjectName, }, session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: file1.path } + arguments: { file: file1.path }, }); baselineTsserverLogs("compileOnSave", "use projectRoot as current directory", session); }); @@ -866,16 +866,16 @@ describe("unittests:: tsserver:: compileOnSave:: EmitFile test", () => { noEmitOnError: true, declaration: true, }, - exclude: ["node_modules"] - }) + exclude: ["node_modules"], + }), }; const file1: File = { path: `/user/username/projects/myproject/file1.ts`, - content: "const x = 1;" + content: "const x = 1;", }; const file2: File = { path: `/user/username/projects/myproject/file2.ts`, - content: "const y = 2;" + content: "const y = 2;", }; const host = createServerHost([file1, file2, config, libFile]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -883,15 +883,15 @@ describe("unittests:: tsserver:: compileOnSave:: EmitFile test", () => { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: file1.path } + arguments: { file: file1.path }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: file1.path, richResponse } + arguments: { file: file1.path, richResponse }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: file2.path, richResponse } + arguments: { file: file2.path, richResponse }, }); baselineTsserverLogs("compileOnSave", `emit with richRepsonse as ${richResponse}`, session); } @@ -921,31 +921,31 @@ describe("unittests:: tsserver:: compileOnSave:: EmitFile test", () => { compileOnSave: true, compilerOptions: { declaration, - module: hasModule ? undefined : "none" + module: hasModule ? undefined : "none", }, - }) + }), }; const file1: File = { path: `/user/username/projects/myproject/file1.ts`, content: `const x = 1; function foo() { return "hello"; -}` +}`, }; const file2: File = { path: `/user/username/projects/myproject/file2.ts`, content: `const y = 2; function bar() { return "world"; -}` +}`, }; const file3: File = { path: `/user/username/projects/myproject/file3.ts`, - content: "const xy = 3;" + content: "const xy = 3;", }; const module: File = { path: `/user/username/projects/myproject/module.ts`, - content: "export const xyz = 4;" + content: "export const xyz = 4;", }; const files = [file1, file2, file3, ...(hasModule ? [module] : ts.emptyArray)]; const host = createServerHost([...files, config, libFile]); @@ -954,7 +954,7 @@ function bar() { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: file1.path } + arguments: { file: file1.path }, }); verifyFileSave(file1); @@ -974,7 +974,7 @@ function bar() { function verifyFileSave(file: File) { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: file.path } + arguments: { file: file.path }, }); } @@ -987,14 +987,14 @@ function bar() { fileName: file.path, textChanges: [{ newText, - ...protocolTextSpanFromSubstring(file.content, oldText) - }] - }] - } + ...protocolTextSpanFromSubstring(file.content, oldText), + }], + }], + }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: file.path } + arguments: { file: file.path }, }); file.content = file.content.replace(oldText, newText); verifyFileSave(file); @@ -1013,8 +1013,8 @@ describe("unittests:: tsserver:: compileOnSave:: CompileOnSaveAffectedFileListRe offset: 1, endLine: 1, endOffset: 1, - insertString: "let k = 1" - } + insertString: "let k = 1", + }, }); } @@ -1027,31 +1027,31 @@ describe("unittests:: tsserver:: compileOnSave:: CompileOnSaveAffectedFileListRe it(subScenario, () => { const core: File = { path: `/user/username/projects/myproject/core/core.ts`, - content: "let z = 10;" + content: "let z = 10;", }; const app1: File = { path: `/user/username/projects/myproject/app1/app.ts`, - content: "let x = 10;" + content: "let x = 10;", }; const app2: File = { path: `/user/username/projects/myproject/app2/app.ts`, - content: "let y = 10;" + content: "let y = 10;", }; const app1Config: File = { path: `/user/username/projects/myproject/app1/tsconfig.json`, content: JSON.stringify({ files: ["app.ts", "../core/core.ts"], compilerOptions: { outFile: "build/output.js" }, - compileOnSave: true - }) + compileOnSave: true, + }), }; const app2Config: File = { path: `/user/username/projects/myproject/app2/tsconfig.json`, content: JSON.stringify({ files: ["app.ts", "../core/core.ts"], compilerOptions: { outFile: "build/output.js" }, - compileOnSave: true - }) + compileOnSave: true, + }), }; const files = [libFile, core, app1, app2, app1Config, app2Config]; const host = createServerHost(files); @@ -1062,7 +1062,7 @@ describe("unittests:: tsserver:: compileOnSave:: CompileOnSaveAffectedFileListRe logDirtyOfProjects(session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: commandArgs + arguments: commandArgs, }); logDirtyOfProjects(session); baselineTsserverLogs("compileOnSave", subScenario, session); @@ -1070,7 +1070,7 @@ describe("unittests:: tsserver:: compileOnSave:: CompileOnSaveAffectedFileListRe } verify("CompileOnSaveAffectedFileListRequest when projectFile is specified", { file: `/user/username/projects/myproject/core/core.ts`, - projectFileName: `/user/username/projects/myproject/app1/tsconfig.json` + projectFileName: `/user/username/projects/myproject/app1/tsconfig.json`, }); verify("CompileOnSaveAffectedFileListRequest when projectFile is not specified", { file: `/user/username/projects/myproject/core/core.ts`, diff --git a/src/testRunner/unittests/tsserver/completions.ts b/src/testRunner/unittests/tsserver/completions.ts index e385dad6c06e6..5ce5248a47a59 100644 --- a/src/testRunner/unittests/tsserver/completions.ts +++ b/src/testRunner/unittests/tsserver/completions.ts @@ -43,7 +43,7 @@ describe("unittests:: tsserver:: completions", () => { ...requestLocation, includeExternalModuleExports: true, prefix: "foo", - } + }, }).response as ts.server.protocol.CompletionInfo; const exportMapKey = (response?.entries[0].data as any)?.exportMapKey; session.executeCommandSeq({ @@ -51,7 +51,7 @@ describe("unittests:: tsserver:: completions", () => { arguments: { ...requestLocation, entryNames: [{ name: "foo", source: "/a", data: { exportName: "foo", fileName: "/a.ts", exportMapKey } }], - } + }, }); interface CompletionDetailsFullRequest extends ts.server.protocol.FileLocationRequest { @@ -63,7 +63,7 @@ describe("unittests:: tsserver:: completions", () => { arguments: { ...requestLocation, entryNames: [{ name: "foo", source: "/a", data: { exportName: "foo", fileName: "/a.ts", exportMapKey } }], - } + }, }); baselineTsserverLogs("completions", "works", session); }); @@ -78,8 +78,8 @@ describe("unittests:: tsserver:: completions", () => { dependencies: { "react": "^16.12.0", "react-router-dom": "^5.1.2", - } - }) + }, + }), }; const appFile: File = { path: `${projectRoot}/src/app.js`, @@ -87,7 +87,7 @@ describe("unittests:: tsserver:: completions", () => { import { BrowserRouter as Router, } from "react-router-dom"; -` +`, }; const localNodeModules = `${projectRoot}/node_modules`; const localAtTypes = `${localNodeModules}/@types`; @@ -96,30 +96,30 @@ import { content: JSON.stringify({ name: "@types/react", version: "16.9.14", - }) + }), }; const localReact: File = { path: `${localAtTypes}/react/index.d.ts`, content: `import * as PropTypes from 'prop-types'; -` +`, }; const localReactRouterDomPackage: File = { path: `${localNodeModules}/react-router-dom/package.json`, content: JSON.stringify({ name: "react-router-dom", version: "5.1.2", - }) + }), }; const localReactRouterDom: File = { path: `${localNodeModules}/react-router-dom/index.js`, - content: `export function foo() {}` + content: `export function foo() {}`, }; const localPropTypesPackage: File = { path: `${localAtTypes}/prop-types/package.json`, content: JSON.stringify({ name: "@types/prop-types", version: "15.7.3", - }) + }), }; const localPropTypes: File = { path: `${localAtTypes}/prop-types/index.d.ts`, @@ -127,7 +127,7 @@ import { | string | ((props: any, context?: any) => any) | (new (props: any, context?: any) => any); -` +`, }; const globalCacheLocation = `c:/typescript`; @@ -137,7 +137,7 @@ import { content: JSON.stringify({ name: "@types/react-router-dom", version: "5.1.2", - }) + }), }; const globalReactRouterDom: File = { path: `${globalAtTypes}/react-router-dom/index.d.ts`, @@ -147,15 +147,15 @@ export interface BrowserRouterProps { getUserConfirmation?: ((message: string, callback: (ok: boolean) => void) => void); forceRefresh?: boolean; keyLength?: number; -}` +}`, }; const globalReactPackage: File = { path: `${globalAtTypes}/react/package.json`, - content: localReactPackage.content + content: localReactPackage.content, }; const globalReact: File = { path: `${globalAtTypes}/react/index.d.ts`, - content: localReact.content + content: localReact.content, }; const filesInProject = [ @@ -189,8 +189,8 @@ export interface BrowserRouterProps { line: 5, offset: 1, includeExternalModuleExports: true, - includeInsertTextCompletions: true - } + includeInsertTextCompletions: true, + }, }); baselineTsserverLogs("completions", "works when files are included from two different drives of windows", session); }); diff --git a/src/testRunner/unittests/tsserver/completionsIncomplete.ts b/src/testRunner/unittests/tsserver/completionsIncomplete.ts index ad52b6ebe3c16..e1bf66b8fca09 100644 --- a/src/testRunner/unittests/tsserver/completionsIncomplete.ts +++ b/src/testRunner/unittests/tsserver/completionsIncomplete.ts @@ -43,12 +43,12 @@ function createNodeModulesPackage(packageName: string, fileCount: number, export const indexFile: File = { path: "/index.ts", - content: "" + content: "", }; const tsconfigFile: File = { path: "/tsconfig.json", - content: `{ "compilerOptions": { "module": "commonjs" } }` + content: `{ "compilerOptions": { "module": "commonjs" } }`, }; const packageJsonFile: File = { @@ -176,8 +176,8 @@ function setup(files: File[]) { includeCompletionsWithInsertText: true, includeCompletionsForImportStatements: true, includePackageJsonAutoImports: "auto", - } - } + }, + }, }); return { host, session, projectService, typeToTriggerCompletions, assertCompletionDetailsOk }; @@ -213,7 +213,7 @@ function setup(files: File[]) { triggerKind: isIncompleteContinuation ? ts.server.protocol.CompletionTriggerKind.TriggerForIncompleteCompletions : undefined, - } + }, }).response as ts.server.protocol.CompletionInfo; cb?.(ts.Debug.checkDefined(response)); @@ -268,8 +268,8 @@ function setup(files: File[]) { name: entry.name, source: entry.source, data: entry.data, - }] - } + }], + }, }).response as ts.server.protocol.CompletionEntryDetails[]; assert(details[0]); diff --git a/src/testRunner/unittests/tsserver/configFileSearch.ts b/src/testRunner/unittests/tsserver/configFileSearch.ts index 17682e3042056..e250ae54fa965 100644 --- a/src/testRunner/unittests/tsserver/configFileSearch.ts +++ b/src/testRunner/unittests/tsserver/configFileSearch.ts @@ -13,11 +13,11 @@ describe("unittests:: tsserver:: configFileSearch:: searching for config file", it("should stop at projectRootPath if given", () => { const f1 = { path: "/a/file1.ts", - content: "" + content: "", }; const configFile = { path: "/tsconfig.json", - content: "{}" + content: "{}", }; const host = createServerHost([f1, configFile]); const service = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -33,15 +33,15 @@ describe("unittests:: tsserver:: configFileSearch:: searching for config file", const configFileLocation = `${projectDir}/src`; const f1 = { path: `${configFileLocation}/file1.ts`, - content: "" + content: "", }; const configFile = { path: `${configFileLocation}/tsconfig.json`, - content: "{}" + content: "{}", }; const configFile2 = { path: "/a/b/projects/tsconfig.json", - content: "{}" + content: "{}", }; const host = createServerHost([f1, libFile, configFile, configFile2]); const service = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -58,15 +58,15 @@ describe("unittests:: tsserver:: configFileSearch:: searching for config file", const configFileLocation = `${projectDir}/src`; const f1 = { path: `${configFileLocation}/file1.ts`, - content: "" + content: "", }; const configFile = { path: `${configFileLocation}/tsconfig.json`, - content: "{}" + content: "{}", }; const configFile2 = { path: "/a/b/projects/tsconfig.json", - content: "{}" + content: "{}", }; const host = createServerHost([f1, libFile, configFile, configFile2]); const service = createProjectService(host, { @@ -86,11 +86,11 @@ describe("unittests:: tsserver:: configFileSearch:: searching for config file", const projectRoot = "/a/b/projects/project"; const file: File = { path: `${projectRoot}/src/index.ts`, - content: "let y = 10" + content: "let y = 10", }; const tsconfig: File = { path: `${projectRoot}/tsconfig.json`, - content: "{}" + content: "{}", }; function openClientFile(files: File[]) { const host = createServerHost(files); diff --git a/src/testRunner/unittests/tsserver/configuredProjects.ts b/src/testRunner/unittests/tsserver/configuredProjects.ts index a496d5612849c..7ea14280773ca 100644 --- a/src/testRunner/unittests/tsserver/configuredProjects.ts +++ b/src/testRunner/unittests/tsserver/configuredProjects.ts @@ -31,19 +31,19 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { "exclude": [ "e" ] - }` + }`, }; const file1: File = { path: "/a/b/c/f1.ts", - content: "let x = 1" + content: "let x = 1", }; const file2: File = { path: "/a/b/d/f2.ts", - content: "let y = 1" + content: "let y = 1", }; const file3: File = { path: "/a/b/e/f3.ts", - content: "let z = 1" + content: "let z = 1", }; const host = createServerHost([configFile, libFile, file1, file2, file3]); @@ -63,19 +63,19 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { { "compilerOptions": {}, "include": ["*.ts"] - }` + }`, }; const file1: File = { path: "/a/b/f1.ts", - content: "let x = 1" + content: "let x = 1", }; const file2: File = { path: "/a/b/f2.ts", - content: "let y = 1" + content: "let y = 1", }; const file3: File = { path: "/a/b/c/f3.ts", - content: "let z = 1" + content: "let z = 1", }; const host = createServerHost([configFile, libFile, file1, file2, file3]); @@ -93,15 +93,15 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { path: `/user/username/projects/myproject/tsconfig.json`, content: `{ "files": ["commonFile1.ts"] - }` + }`, }; const commonFile1: File = { path: `/user/username/projects/myproject/commonFile1.ts`, - content: "let x = 1" + content: "let x = 1", }; const commonFile2: File = { path: `/user/username/projects/myproject/commonFile2.ts`, - content: "let y = 1" + content: "let y = 1", }; const host = createServerHost([libFile, commonFile1, commonFile2]); @@ -124,7 +124,7 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { it("add new files to a configured project without file list", () => { const configFile: File = { path: "/a/b/tsconfig.json", - content: `{}` + content: `{}`, }; const host = createServerHost([commonFile1, libFile, configFile]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -145,7 +145,7 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { "commonFile1.ts", "commonFile3.ts" ] - }` + }`, }; const host = createServerHost([commonFile1, commonFile2, configFile]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -157,7 +157,7 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { it("handle recreated files correctly", () => { const configFile: File = { path: "/a/b/tsconfig.json", - content: `{}` + content: `{}`, }; const host = createServerHost([commonFile1, commonFile2, configFile]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -179,11 +179,11 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { content: `{ "compilerOptions": {}, "exclude": ["/a/c"] - }` + }`, }; const excludedFile1: File = { path: "/a/c/excluedFile1.ts", - content: `let t = 1;` + content: `let t = 1;`, }; const host = createServerHost([commonFile1, commonFile2, excludedFile1, configFile]); @@ -197,19 +197,19 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { it("should properly handle module resolution changes in config file", () => { const file1: File = { path: "/a/b/file1.ts", - content: `import { T } from "module1";` + content: `import { T } from "module1";`, }; const nodeModuleFile: File = { path: "/a/b/node_modules/module1.ts", - content: `export interface T {}` + content: `export interface T {}`, }; const classicModuleFile: File = { path: "/a/module1.ts", - content: `export interface T {}` + content: `export interface T {}`, }; const randomFile: File = { path: "/a/file1.ts", - content: `export interface T {}` + content: `export interface T {}`, }; const configFile: File = { path: "/a/b/tsconfig.json", @@ -218,7 +218,7 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { "moduleResolution": "node" }, "files": ["${file1.path}"] - }` + }`, }; const files = [file1, nodeModuleFile, classicModuleFile, configFile, randomFile]; const host = createServerHost(files); @@ -247,11 +247,11 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { it("should keep the configured project when the opened file is referenced by the project but not its root", () => { const file1: File = { path: "/a/b/main.ts", - content: "import { objA } from './obj-a';" + content: "import { objA } from './obj-a';", }; const file2: File = { path: "/a/b/obj-a.ts", - content: `export const objA = Object.assign({foo: "bar"}, {bar: "baz"});` + content: `export const objA = Object.assign({foo: "bar"}, {bar: "baz"});`, }; const configFile: File = { path: "/a/b/tsconfig.json", @@ -260,7 +260,7 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { "target": "es6" }, "files": [ "main.ts" ] - }` + }`, }; const host = createServerHost([file1, file2, configFile]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -279,7 +279,7 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { "allowAnything": true }, "someOtherProperty": {} - }` + }`, }; const host = createServerHost([commonFile1, commonFile2, libFile, configFile]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -290,11 +290,11 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { it("should reuse same project if file is opened from the configured project that has no open files", () => { const file1 = { path: "/a/b/main.ts", - content: "let x =1;" + content: "let x =1;", }; const file2 = { path: "/a/b/main2.ts", - content: "let y =1;" + content: "let y =1;", }; const configFile: File = { path: "/a/b/tsconfig.json", @@ -303,7 +303,7 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { "target": "es6" }, "files": [ "main.ts", "main2.ts" ] - }` + }`, }; const host = createServerHost([file1, file2, configFile, libFile]); const projectService = createProjectService(host, { useSingleInferredProject: true, logger: createLoggerWithInMemoryLogs(host) }); @@ -321,7 +321,7 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { it("should not close configured project after closing last open file, but should be closed on next file open if its not the file from same project", () => { const file1 = { path: "/a/b/main.ts", - content: "let x =1;" + content: "let x =1;", }; const configFile: File = { path: "/a/b/tsconfig.json", @@ -330,7 +330,7 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { "target": "es6" }, "files": [ "main.ts" ] - }` + }`, }; const host = createServerHost([file1, configFile, libFile]); const projectService = createProjectService(host, { useSingleInferredProject: true, logger: createLoggerWithInMemoryLogs(host) }); @@ -348,19 +348,19 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { it("open file become a part of configured project if it is referenced from root file", () => { const file1 = { path: `/user/username/projects/myproject/a/b/f1.ts`, - content: "export let x = 5" + content: "export let x = 5", }; const file2 = { path: `/user/username/projects/myproject/a/c/f2.ts`, - content: `import {x} from "../b/f1"` + content: `import {x} from "../b/f1"`, }; const file3 = { path: `/user/username/projects/myproject/a/c/f3.ts`, - content: "export let y = 1" + content: "export let y = 1", }; const configFile = { path: `/user/username/projects/myproject/a/c/tsconfig.json`, - content: JSON.stringify({ compilerOptions: {}, files: ["f2.ts", "f3.ts"] }) + content: JSON.stringify({ compilerOptions: {}, files: ["f2.ts", "f3.ts"] }), }; const host = createServerHost([file1, file2, file3]); @@ -379,15 +379,15 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { it("can correctly update configured project when set of root files has changed (new file on disk)", () => { const file1 = { path: "/a/b/f1.ts", - content: "let x = 1" + content: "let x = 1", }; const file2 = { path: "/a/b/f2.ts", - content: "let y = 1" + content: "let y = 1", }; const configFile = { path: "/a/b/tsconfig.json", - content: JSON.stringify({ compilerOptions: {} }) + content: JSON.stringify({ compilerOptions: {} }), }; const host = createServerHost([file1, configFile]); @@ -405,15 +405,15 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { it("can correctly update configured project when set of root files has changed (new file in list of files)", () => { const file1 = { path: "/a/b/f1.ts", - content: "let x = 1" + content: "let x = 1", }; const file2 = { path: "/a/b/f2.ts", - content: "let y = 1" + content: "let y = 1", }; const configFile = { path: "/a/b/tsconfig.json", - content: JSON.stringify({ compilerOptions: {}, files: ["f1.ts"] }) + content: JSON.stringify({ compilerOptions: {}, files: ["f1.ts"] }), }; const host = createServerHost([file1, file2, configFile]); @@ -430,15 +430,15 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { it("can update configured project when set of root files was not changed", () => { const file1 = { path: "/a/b/f1.ts", - content: "let x = 1" + content: "let x = 1", }; const file2 = { path: "/a/b/f2.ts", - content: "let y = 1" + content: "let y = 1", }; const configFile = { path: "/a/b/tsconfig.json", - content: JSON.stringify({ compilerOptions: {}, files: ["f1.ts", "f2.ts"] }) + content: JSON.stringify({ compilerOptions: {}, files: ["f1.ts", "f2.ts"] }), }; const host = createServerHost([file1, file2, configFile]); @@ -455,23 +455,23 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { it("Open ref of configured project when open file gets added to the project as part of configured file update", () => { const file1: File = { path: "/a/b/src/file1.ts", - content: "let x = 1;" + content: "let x = 1;", }; const file2: File = { path: "/a/b/src/file2.ts", - content: "let y = 1;" + content: "let y = 1;", }; const file3: File = { path: "/a/b/file3.ts", - content: "let z = 1;" + content: "let z = 1;", }; const file4: File = { path: "/a/file4.ts", - content: "let z = 1;" + content: "let z = 1;", }; const configFile = { path: "/a/b/tsconfig.json", - content: JSON.stringify({ files: ["src/file1.ts", "file3.ts"] }) + content: JSON.stringify({ files: ["src/file1.ts", "file3.ts"] }), }; const files = [file1, file2, file3, file4]; @@ -506,7 +506,7 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { const file5: File = { path: "/file5.ts", - content: "let zz = 1;" + content: "let zz = 1;", }; host.writeFile(file5.path, file5.content); projectService.testhost.baselineHost("File5 written"); @@ -518,23 +518,23 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { it("Open ref of configured project when open file gets added to the project as part of configured file update buts its open file references are all closed when the update happens", () => { const file1: File = { path: "/a/b/src/file1.ts", - content: "let x = 1;" + content: "let x = 1;", }; const file2: File = { path: "/a/b/src/file2.ts", - content: "let y = 1;" + content: "let y = 1;", }; const file3: File = { path: "/a/b/file3.ts", - content: "let z = 1;" + content: "let z = 1;", }; const file4: File = { path: "/a/file4.ts", - content: "let z = 1;" + content: "let z = 1;", }; const configFile = { path: "/a/b/tsconfig.json", - content: JSON.stringify({ files: ["src/file1.ts", "file3.ts"] }) + content: JSON.stringify({ files: ["src/file1.ts", "file3.ts"] }), }; const files = [file1, file2, file3]; @@ -569,19 +569,19 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { it("files are properly detached when language service is disabled", () => { const f1 = { path: "/a/app.js", - content: "var x = 1" + content: "var x = 1", }; const f2 = { path: "/a/largefile.js", - content: "" + content: "", }; const f3 = { path: "/a/lib.js", - content: "var x = 1" + content: "var x = 1", }; const config = { path: "/a/tsconfig.json", - content: JSON.stringify({ compilerOptions: { allowJs: true } }) + content: JSON.stringify({ compilerOptions: { allowJs: true } }), }; const host = createServerHost([f1, f2, f3, config]); const originalGetFileSize = host.getFileSize; @@ -603,7 +603,7 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { const f4 = { path: "/aa.js", - content: "var x = 1" + content: "var x = 1", }; host.writeFile(f4.path, f4.content); projectService.openClientFile(f4.path); @@ -619,15 +619,15 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { it("syntactic features work even if language service is disabled", () => { const f1 = { path: "/a/app.js", - content: "let x = 1;" + content: "let x = 1;", }; const f2 = { path: "/a/largefile.js", - content: "" + content: "", }; const config = { path: "/a/jsconfig.json", - content: "{}" + content: "{}", }; const host = createServerHost([f1, f2, config]); const originalGetFileSize = host.getFileSize; @@ -641,7 +641,7 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { command: ts.server.protocol.CommandTypes.FormatFull, arguments: { file: f1.path, - } + }, }); baselineTsserverLogs("configuredProjects", "syntactic features work even if language service is disabled", session); }); @@ -652,47 +652,47 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => { content: JSON.stringify({ include: ["index.ts"], compilerOptions: { - lib: ["dom", "es2017"] - } - }) + lib: ["dom", "es2017"], + }, + }), }; const barIndex: File = { path: `/user/username/projects/myproject/bar/index.ts`, content: ` export function bar() { console.log("hello world"); -}` +}`, }; const fooConfig: File = { path: `/user/username/projects/myproject/foo/tsconfig.json`, content: JSON.stringify({ include: ["index.ts"], compilerOptions: { - lib: ["es2017"] - } - }) + lib: ["es2017"], + }, + }), }; const fooIndex: File = { path: `/user/username/projects/myproject/foo/index.ts`, content: ` import { bar } from "bar"; -bar();` +bar();`, }; const barSymLink: SymLink = { path: `/user/username/projects/myproject/foo/node_modules/bar`, - symLink: `/user/username/projects/myproject/bar` + symLink: `/user/username/projects/myproject/bar`, }; const lib2017: File = { path: `${ts.getDirectoryPath(libFile.path)}/lib.es2017.d.ts`, - content: libFile.content + content: libFile.content, }; const libDom: File = { path: `${ts.getDirectoryPath(libFile.path)}/lib.dom.d.ts`, content: ` declare var console: { log(...args: any[]): void; -};` +};`, }; const host = createServerHost([barConfig, barIndex, fooConfig, fooIndex, barSymLink, lib2017, libDom]); const session = createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host) }); @@ -704,15 +704,15 @@ declare var console: { it("when file name starts with ^", () => { const file: File = { path: `/user/username/projects/myproject/file.ts`, - content: "const x = 10;" + content: "const x = 10;", }; const app: File = { path: `/user/username/projects/myproject/^app.ts`, - content: "const y = 10;" + content: "const y = 10;", }; const tsconfig: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: "{}" + content: "{}", }; const host = createServerHost([file, app, tsconfig, libFile]); const service = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -723,21 +723,21 @@ declare var console: { describe("when creating new file", () => { const foo: File = { path: `/user/username/projects/myproject/src/foo.ts`, - content: "export function foo() { }" + content: "export function foo() { }", }; const bar: File = { path: `/user/username/projects/myproject/src/bar.ts`, - content: "export function bar() { }" + content: "export function bar() { }", }; const config: File = { path: `/user/username/projects/myproject/tsconfig.json`, content: JSON.stringify({ - include: ["./src"] - }) + include: ["./src"], + }), }; const fooBar: File = { path: `/user/username/projects/myproject/src/sub/fooBar.ts`, - content: "export function fooBar() { }" + content: "export function fooBar() { }", }; function verifySessionWorker({ withExclude, openFileBeforeCreating }: VerifySession, errorOnNewFileBeforeOldFile: boolean) { const host = createServerHost([ @@ -747,10 +747,10 @@ declare var console: { path: config.path, content: JSON.stringify({ include: ["./src"], - exclude: ["./src/sub"] - }) + exclude: ["./src/sub"], + }), } : - config + config, ]); const session = createSession(host, { canUseEvents: true, @@ -761,8 +761,8 @@ declare var console: { arguments: { file: foo.path, fileContent: foo.content, - projectRootPath: "/user/username/projects/myproject" - } + projectRootPath: "/user/username/projects/myproject", + }, }); if (!openFileBeforeCreating) { host.writeFile(fooBar.path, fooBar.content); @@ -772,8 +772,8 @@ declare var console: { arguments: { file: fooBar.path, fileContent: fooBar.content, - projectRootPath: "/user/username/projects/myproject" - } + projectRootPath: "/user/username/projects/myproject", + }, }); if (openFileBeforeCreating) { host.writeFile(fooBar.path, fooBar.content); @@ -783,7 +783,7 @@ declare var console: { files: errorOnNewFileBeforeOldFile ? [fooBar, foo] : [foo, fooBar], - existingTimeouts: !withExclude + existingTimeouts: !withExclude, }); baselineTsserverLogs("configuredProjects", `creating new file and then open it ${openFileBeforeCreating ? "before" : "after"} watcher is invoked, ask errors on it ${errorOnNewFileBeforeOldFile ? "before" : "after"} old one${withExclude ? " without file being in config" : ""}`, session); } @@ -828,20 +828,20 @@ declare var console: { it("when default configured project does not contain the file", () => { const barConfig: File = { path: `/user/username/projects/myproject/bar/tsconfig.json`, - content: "{}" + content: "{}", }; const barIndex: File = { path: `/user/username/projects/myproject/bar/index.ts`, content: `import {foo} from "../foo/lib"; -foo();` +foo();`, }; const fooBarConfig: File = { path: `/user/username/projects/myproject/foobar/tsconfig.json`, - content: barConfig.path + content: barConfig.path, }; const fooBarIndex: File = { path: `/user/username/projects/myproject/foobar/index.ts`, - content: barIndex.content + content: barIndex.content, }; const fooConfig: File = { path: `/user/username/projects/myproject/foo/tsconfig.json`, @@ -849,13 +849,13 @@ foo();` include: ["index.ts"], compilerOptions: { declaration: true, - outDir: "lib" - } - }) + outDir: "lib", + }, + }), }; const fooIndex: File = { path: `/user/username/projects/myproject/foo/index.ts`, - content: `export function foo() {}` + content: `export function foo() {}`, }; const host = createServerHost([barConfig, barIndex, fooBarConfig, fooBarIndex, fooConfig, fooIndex, libFile]); ensureErrorFreeBuild(host, [fooConfig.path]); @@ -870,8 +870,8 @@ foo();` startLine: 1, startOffset: 1, endLine: 1, - endOffset: 1 - } + endOffset: 1, + }, }); session.logger.log(`Default project for file: ${fooDts}: ${service.tryGetDefaultProjectForFile(ts.server.toNormalizedPath(fooDts))?.projectName}`); baselineTsserverLogs("configuredProjects", "when default configured project does not contain the file", session); @@ -881,35 +881,35 @@ foo();` function getService(additionalFiles?: File[]) { const alphaExtendedConfig: File = { path: `/user/username/projects/myproject/extended/alpha.tsconfig.json`, - content: "{}" + content: "{}", }; const bravoExtendedConfig: File = { path: `/user/username/projects/myproject/extended/bravo.tsconfig.json`, content: JSON.stringify({ - extends: "./alpha.tsconfig.json" - }) + extends: "./alpha.tsconfig.json", + }), }; const aConfig: File = { path: `/user/username/projects/myproject/a/tsconfig.json`, content: JSON.stringify({ extends: "../extended/alpha.tsconfig.json", - files: ["a.ts"] - }) + files: ["a.ts"], + }), }; const aFile: File = { path: `/user/username/projects/myproject/a/a.ts`, - content: `let a = 1;` + content: `let a = 1;`, }; const bConfig: File = { path: `/user/username/projects/myproject/b/tsconfig.json`, content: JSON.stringify({ extends: "../extended/bravo.tsconfig.json", - files: ["b.ts"] - }) + files: ["b.ts"], + }), }; const bFile: File = { path: `/user/username/projects/myproject/b/b.ts`, - content: `let b = 1;` + content: `let b = 1;`, }; const host = createServerHost([alphaExtendedConfig, aConfig, aFile, bravoExtendedConfig, bConfig, bFile, ...(additionalFiles || ts.emptyArray)]); @@ -925,16 +925,16 @@ foo();` host.writeFile(alphaExtendedConfig.path, JSON.stringify({ compilerOptions: { - strict: true - } + strict: true, + }, })); host.runQueuedTimeoutCallbacks(); host.writeFile(bravoExtendedConfig.path, JSON.stringify({ extends: "./alpha.tsconfig.json", compilerOptions: { - strict: false - } + strict: false, + }, })); host.runQueuedTimeoutCallbacks(); @@ -951,11 +951,11 @@ foo();` it("should stop watching the extended configs of closed projects", () => { const dummy: File = { path: `/user/username/projects/myproject/dummy/dummy.ts`, - content: `let dummy = 1;` + content: `let dummy = 1;`, }; const dummyConfig: File = { path: `/user/username/projects/myproject/dummy/tsconfig.json`, - content: "{}" + content: "{}", }; const { projectService, aFile, bFile } = getService([dummy, dummyConfig]); @@ -983,11 +983,11 @@ describe("unittests:: tsserver:: ConfiguredProjects:: non-existing directories l content: `{ "compilerOptions": {}, "include": ["app/*", "test/**/*", "something"] - }` + }`, }; const file1 = { path: "/a/b/file1.ts", - content: "let t = 10;" + content: "let t = 10;", }; const host = createServerHost([file1, configFile]); @@ -1002,22 +1002,22 @@ describe("unittests:: tsserver:: ConfiguredProjects:: non-existing directories l it("should be able to handle @types if input file list is empty", () => { const f = { path: "/a/app.ts", - content: "let x = 1" + content: "let x = 1", }; const config = { path: "/a/tsconfig.json", content: JSON.stringify({ compiler: {}, - files: [] - }) + files: [], + }), }; const t1 = { path: "/a/node_modules/@types/typings/index.d.ts", - content: `export * from "./lib"` + content: `export * from "./lib"`, }; const t2 = { path: "/a/node_modules/@types/typings/lib.d.ts", - content: `export const x: number` + content: `export const x: number`, }; const host = createServerHost([f, config, t1, t2], { currentDirectory: ts.getDirectoryPath(f.path) }); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -1030,19 +1030,19 @@ describe("unittests:: tsserver:: ConfiguredProjects:: non-existing directories l it("should tolerate invalid include files that start in subDirectory", () => { const f = { path: `/user/username/projects/myproject/src/server/index.ts`, - content: "let x = 1" + content: "let x = 1", }; const config = { path: `/user/username/projects/myproject/src/server/tsconfig.json`, content: JSON.stringify({ compiler: { module: "commonjs", - outDir: "../../build" + outDir: "../../build", }, include: [ - "../src/**/*.ts" - ] - }) + "../src/**/*.ts", + ], + }), }; const host = createServerHost([f, config, libFile], { useCaseSensitiveFileNames: true }); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -1055,19 +1055,19 @@ describe("unittests:: tsserver:: ConfiguredProjects:: non-existing directories l it("Changed module resolution reflected when specifying files list", () => { const file1: File = { path: "/users/username/projects/project/file1.ts", - content: 'import classc from "file2"' + content: 'import classc from "file2"', }; const file2a: File = { path: "/users/username/projects/file2.ts", - content: "export classc { method2a() { return 10; } }" + content: "export classc { method2a() { return 10; } }", }; const file2: File = { path: "/users/username/projects/project/file2.ts", - content: "export classc { method2() { return 10; } }" + content: "export classc { method2() { return 10; } }", }; const configFile: File = { path: "/users/username/projects/project/tsconfig.json", - content: JSON.stringify({ files: [file1.path], compilerOptions: { module: "amd" } }) + content: JSON.stringify({ files: [file1.path], compilerOptions: { module: "amd" } }), }; const files = [file1, file2a, configFile, libFile]; const host = createServerHost(files); @@ -1087,24 +1087,24 @@ describe("unittests:: tsserver:: ConfiguredProjects:: non-existing directories l const root = "/user/username/rootfolder"; const file1: File = { path: "/a/b/src/file1.ts", - content: 'import { classc } from "module1"' + content: 'import { classc } from "module1"', }; const module1: File = { path: "/a/b/node_modules/module1/index.d.ts", content: `import { class2 } from "module2"; - export classc { method2a(): class2; }` + export classc { method2a(): class2; }`, }; const module2: File = { path: "/a/b/node_modules/module2/index.d.ts", - content: "export class2 { method2() { return 10; } }" + content: "export class2 { method2() { return 10; } }", }; const module3: File = { path: "/a/b/node_modules/module/node_modules/module3/index.d.ts", - content: "export class3 { method2() { return 10; } }" + content: "export class3 { method2() { return 10; } }", }; const configFile: File = { path: "/a/b/src/tsconfig.json", - content: JSON.stringify({ files: ["file1.ts"] }) + content: JSON.stringify({ files: ["file1.ts"] }), }; const nonLibFiles = [file1, module1, module2, module3, configFile]; nonLibFiles.forEach(f => f.path = root + f.path); @@ -1120,11 +1120,11 @@ describe("unittests:: tsserver:: ConfiguredProjects:: when reading tsconfig file it("should be tolerated without crashing the server", () => { const configFile = { path: `/user/username/projects/myproject/tsconfig.json`, - content: "" + content: "", }; const file1 = { path: `/user/username/projects/myproject/file1.ts`, - content: "let t = 10;" + content: "let t = 10;", }; const host = createServerHost([file1, libFile, configFile]); diff --git a/src/testRunner/unittests/tsserver/declarationFileMaps.ts b/src/testRunner/unittests/tsserver/declarationFileMaps.ts index 1539380be3728..1f159ff356e18 100644 --- a/src/testRunner/unittests/tsserver/declarationFileMaps.ts +++ b/src/testRunner/unittests/tsserver/declarationFileMaps.ts @@ -42,7 +42,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references sourceRoot: "", sources: ["../a.ts"], names: [], - mappings: "AAAA,wBAAgB,GAAG,SAAK;AACxB,MAAM,WAAW,MAAM;CAAG;AAC1B,eAAO,MAAM,SAAS,EAAE,MAAW,CAAC" + mappings: "AAAA,wBAAgB,GAAG,SAAK;AACxB,MAAM,WAAW,MAAM;CAAG;AAC1B,eAAO,MAAM,SAAS,EAAE,MAAW,CAAC", }; const aDtsMap: File = { path: "/a/bin/a.d.ts.map", @@ -80,7 +80,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references const dummyFile: File = { path: "/dummy/dummy.ts", - content: "let a = 10;" + content: "let a = 10;", }; const userTs: File = { @@ -97,8 +97,8 @@ describe("unittests:: tsserver:: with declaration file maps:: project references path: "/user/tsconfig.json", content: JSON.stringify({ file: ["user.ts"], - references: [{ path: "../a" }, { path: "../b" }] - }) + references: [{ path: "../a" }, { path: "../b" }], + }), }; function makeSampleProjects(addUserTsConfig?: boolean, keepAllFiles?: boolean) { @@ -138,7 +138,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references const session = makeSampleProjects(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Definition, - arguments: protocolFileLocationFromSubstring(userTs, "fnA()") + arguments: protocolFileLocationFromSubstring(userTs, "fnA()"), }); verifySingleInferredProject(session); baselineTsserverLogs("declarationFileMaps", "goToDefinition", session); @@ -148,7 +148,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references const session = makeSampleProjects(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.DefinitionAndBoundSpan, - arguments: protocolFileLocationFromSubstring(userTs, "fnA()") + arguments: protocolFileLocationFromSubstring(userTs, "fnA()"), }); verifySingleInferredProject(session); baselineTsserverLogs("declarationFileMaps", "getDefinitionAndBoundSpan", session); @@ -158,7 +158,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references const session = makeSampleProjects(/*addUserTsConfig*/ true); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.DefinitionAndBoundSpan, - arguments: protocolFileLocationFromSubstring(userTs, "fnA()") + arguments: protocolFileLocationFromSubstring(userTs, "fnA()"), }); // Navigate to the definition @@ -175,7 +175,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references const session = makeSampleProjects(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.TypeDefinition, - arguments: protocolFileLocationFromSubstring(userTs, "instanceA") + arguments: protocolFileLocationFromSubstring(userTs, "instanceA"), }); verifySingleInferredProject(session); baselineTsserverLogs("declarationFileMaps", "goToType", session); @@ -185,7 +185,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references const session = makeSampleProjects(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Implementation, - arguments: protocolFileLocationFromSubstring(userTs, "fnA()") + arguments: protocolFileLocationFromSubstring(userTs, "fnA()"), }); verifySingleInferredProject(session); baselineTsserverLogs("declarationFileMaps", "goToImplementation", session); @@ -195,7 +195,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references const session = makeSampleProjects(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Definition, - arguments: protocolFileLocationFromSubstring(userTs, "fnB()") + arguments: protocolFileLocationFromSubstring(userTs, "fnB()"), }); verifySingleInferredProject(session); baselineTsserverLogs("declarationFileMaps", "goToDefinition target does not exist", session); @@ -205,7 +205,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references const session = makeSampleProjects(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Navto, - arguments: { file: userTs.path, searchValue: "fn" } + arguments: { file: userTs.path, searchValue: "fn" }, }); verifySingleInferredProject(session); baselineTsserverLogs("declarationFileMaps", "navigateTo", session); @@ -215,7 +215,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references const session = makeSampleProjects(/*addUserTsConfig*/ true, /*keepAllFiles*/ true); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Navto, - arguments: { file: undefined, searchValue: "fn" } + arguments: { file: undefined, searchValue: "fn" }, }); baselineTsserverLogs("declarationFileMaps", "navigateToAll neither file not project is specified", session); }); @@ -224,7 +224,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references const session = makeSampleProjects(/*addUserTsConfig*/ true, /*keepAllFiles*/ true); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Navto, - arguments: { projectFileName: bTsconfig.path, file: undefined, searchValue: "fn" } + arguments: { projectFileName: bTsconfig.path, file: undefined, searchValue: "fn" }, }); baselineTsserverLogs("declarationFileMaps", "navigateToAll file is not specified but project is", session); }); @@ -233,7 +233,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references const session = makeSampleProjects(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.References, - arguments: protocolFileLocationFromSubstring(userTs, "fnA()") + arguments: protocolFileLocationFromSubstring(userTs, "fnA()"), }); verifyATsConfigOriginalProject(session); @@ -245,7 +245,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references openFilesForSession([aTs], session); // If it's not opened, the reference isn't found. session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.References, - arguments: protocolFileLocationFromSubstring(aTs, "fnA") + arguments: protocolFileLocationFromSubstring(aTs, "fnA"), }); verifyATsConfigWhenOpened(session); baselineTsserverLogs("declarationFileMaps", "findAllReferences starting at definition", session); @@ -257,7 +257,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.ReferencesFull, - arguments: protocolFileLocationFromSubstring(userTs, "fnA()") + arguments: protocolFileLocationFromSubstring(userTs, "fnA()"), }); verifyATsConfigOriginalProject(session); baselineTsserverLogs("declarationFileMaps", "findAllReferencesFull", session); @@ -284,7 +284,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.ReferencesFull, - arguments: protocolFileLocationFromSubstring(bTs, "f()") + arguments: protocolFileLocationFromSubstring(bTs, "f()"), }); baselineTsserverLogs("declarationFileMaps", "findAllReferencesFull definition is in mapped file", session); }); @@ -293,7 +293,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references const session = makeSampleProjects(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.References, - arguments: protocolFileLocationFromSubstring(userTs, "fnB()") + arguments: protocolFileLocationFromSubstring(userTs, "fnB()"), }); verifySingleInferredProject(session); baselineTsserverLogs("declarationFileMaps", "findAllReferences target does not exist", session); @@ -303,7 +303,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references const session = makeSampleProjects(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Rename, - arguments: protocolFileLocationFromSubstring(userTs, "fnA()") + arguments: protocolFileLocationFromSubstring(userTs, "fnA()"), }); verifyATsConfigOriginalProject(session); baselineTsserverLogs("declarationFileMaps", "renameLocations", session); @@ -314,7 +314,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references openFilesForSession([aTs], session); // If it's not opened, the reference isn't found. session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Rename, - arguments: protocolFileLocationFromSubstring(aTs, "fnA") + arguments: protocolFileLocationFromSubstring(aTs, "fnA"), }); verifyATsConfigWhenOpened(session); baselineTsserverLogs("declarationFileMaps", "renameLocations starting at definition", session); @@ -324,7 +324,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references const session = makeSampleProjects(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.RenameLocationsFull, - arguments: protocolFileLocationFromSubstring(userTs, "fnA()") + arguments: protocolFileLocationFromSubstring(userTs, "fnA()"), }); verifyATsConfigOriginalProject(session); baselineTsserverLogs("declarationFileMaps", "renameLocationsFull", session); @@ -334,7 +334,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references const session = makeSampleProjects(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Rename, - arguments: protocolFileLocationFromSubstring(userTs, "fnB()") + arguments: protocolFileLocationFromSubstring(userTs, "fnB()"), }); verifySingleInferredProject(session); baselineTsserverLogs("declarationFileMaps", "renameLocations target does not exist", session); @@ -347,7 +347,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references arguments: { oldFilePath: aTs.path, newFilePath: "/a/aNew.ts", - } + }, }); verifySingleInferredProject(session); baselineTsserverLogs("declarationFileMaps", "getEditsForFileRename", session); @@ -363,7 +363,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references declaration: true, declarationMap: true, outDir: "./build", - } + }, }), }; const bTs: File = { path: "/b/src/b.ts", content: "" }; @@ -387,7 +387,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references arguments: { oldFilePath: aTs.path, newFilePath: "/a/src/a1.ts", - } + }, }); baselineTsserverLogs("declarationFileMaps", "getEditsForFileRename when referencing project doesnt include file and its renamed", session); }); @@ -395,11 +395,11 @@ describe("unittests:: tsserver:: with declaration file maps:: project references it("does not jump to source if inlined sources", () => { const aDtsInlinedSources: ts.RawSourceMap = { ...aDtsMapContent, - sourcesContent: [aTs.content] + sourcesContent: [aTs.content], }; const aDtsMapInlinedSources: File = { path: aDtsMap.path, - content: JSON.stringify(aDtsInlinedSources) + content: JSON.stringify(aDtsInlinedSources), }; const host = createServerHost([aTs, aDtsMapInlinedSources, aDts, bTs, bDtsMap, bDts, userTs, dummyFile]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -410,13 +410,13 @@ describe("unittests:: tsserver:: with declaration file maps:: project references // Inlined so does not jump to aTs session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.DefinitionAndBoundSpan, - arguments: protocolFileLocationFromSubstring(userTs, "fnA()") + arguments: protocolFileLocationFromSubstring(userTs, "fnA()"), }); // Not inlined, jumps to bTs session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.DefinitionAndBoundSpan, - arguments: protocolFileLocationFromSubstring(userTs, "fnB()") + arguments: protocolFileLocationFromSubstring(userTs, "fnB()"), }); verifySingleInferredProject(session); baselineTsserverLogs("declarationFileMaps", "does not jump to source if inlined sources", session); diff --git a/src/testRunner/unittests/tsserver/documentRegistry.ts b/src/testRunner/unittests/tsserver/documentRegistry.ts index 3b3a5b63150dd..28deb27770223 100644 --- a/src/testRunner/unittests/tsserver/documentRegistry.ts +++ b/src/testRunner/unittests/tsserver/documentRegistry.ts @@ -19,15 +19,15 @@ describe("unittests:: tsserver:: documentRegistry:: document registry in project const importModuleContent = `import {a} from "./module1"`; const file: File = { path: `/user/username/projects/myproject/index.ts`, - content: importModuleContent + content: importModuleContent, }; const moduleFile: File = { path: `/user/username/projects/myproject/module1.d.ts`, - content: "export const a: number;" + content: "export const a: number;", }; const configFile: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: JSON.stringify({ files: ["index.ts"] }) + content: JSON.stringify({ files: ["index.ts"] }), }; function getProject(service: TestProjectService) { @@ -127,18 +127,18 @@ describe("unittests:: tsserver:: documentRegistry:: works when reusing orphan sc textChanges: [{ newText, start: { line: 1, offset: 1 }, - end: { line: 2, offset: newText.length + 1 } // Remove the import so that structure is not reused - }] + end: { line: 2, offset: newText.length + 1 }, // Remove the import so that structure is not reused + }], }], openFiles: [ { file: "^/inmemory/model/4", fileContent: newText, projectRootPath: "/users/user/projects/san", // Add same document with different script kind - scriptKindName: "TS" + scriptKindName: "TS", }, - ] - } + ], + }, }); baselineTsserverLogs("documentRegistry", "works when reusing orphan script info with different scriptKind", session); }); diff --git a/src/testRunner/unittests/tsserver/duplicatePackages.ts b/src/testRunner/unittests/tsserver/duplicatePackages.ts index 3d4f31cba11e1..4a957d481ae01 100644 --- a/src/testRunner/unittests/tsserver/duplicatePackages.ts +++ b/src/testRunner/unittests/tsserver/duplicatePackages.ts @@ -43,7 +43,7 @@ describe("unittests:: tsserver:: duplicate packages", () => { endLine: 2, endOffset: 4, errorCodes: [ts.Diagnostics.Cannot_find_name_0.code], - } + }, }); } baselineTsserverLogs("duplicatePackages", "works with import fixes", session); diff --git a/src/testRunner/unittests/tsserver/dynamicFiles.ts b/src/testRunner/unittests/tsserver/dynamicFiles.ts index 4d1c79c582891..77181f9f8d565 100644 --- a/src/testRunner/unittests/tsserver/dynamicFiles.ts +++ b/src/testRunner/unittests/tsserver/dynamicFiles.ts @@ -21,7 +21,7 @@ function verifyPathRecognizedAsDynamic(subscenario: string, path: string) { path, content: `/// /// -var x = 10;` +var x = 10;`, }; const host = createServerHost([libFile]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -61,7 +61,7 @@ describe("unittests:: tsserver:: dynamicFiles:: Untitled files", () => { endLine: 3, endOffset: 5, errorCodes: [ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1.code], - } + }, }); baselineTsserverLogs("dynamicFiles", "untitled can convert positions to locations", session); }); @@ -69,7 +69,7 @@ describe("unittests:: tsserver:: dynamicFiles:: Untitled files", () => { it("opening untitled files", () => { const config: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: "{}" + content: "{}", }; const host = createServerHost([config, libFile], { useCaseSensitiveFileNames: true, currentDirectory: "/user/username/projects/myproject" }); const service = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -78,7 +78,7 @@ describe("unittests:: tsserver:: dynamicFiles:: Untitled files", () => { const untitled: File = { path: `/user/username/projects/myproject/Untitled-1.ts`, - content: "const x = 10;" + content: "const x = 10;", }; host.writeFile(untitled.path, untitled.content); service.testhost.logTimeoutQueueLength(); @@ -94,11 +94,11 @@ describe("unittests:: tsserver:: dynamicFiles:: Untitled files", () => { it("opening and closing untitled files when projectRootPath is different from currentDirectory", () => { const config: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: "{}" + content: "{}", }; const file: File = { path: `/user/username/projects/myproject/file.ts`, - content: "const y = 10" + content: "const y = 10", }; const host = createServerHost([config, file, libFile], { useCaseSensitiveFileNames: true }); const service = createProjectService(host, { useInferredProjectPerProjectRoot: true, logger: createLoggerWithInMemoryLogs(host) }); @@ -137,7 +137,7 @@ describe("unittests:: tsserver:: dynamicFiles:: ", () => { it("dynamic file without external project", () => { const file: File = { path: "^walkThroughSnippet:/Users/UserName/projects/someProject/out/someFile#1.js", - content: "var x = 10;" + content: "var x = 10;", }; const host = createServerHost([libFile], { useCaseSensitiveFileNames: true }); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -145,7 +145,7 @@ describe("unittests:: tsserver:: dynamicFiles:: ", () => { module: ts.ModuleKind.CommonJS, allowJs: true, allowSyntheticDefaultImports: true, - allowNonTsExtensions: true + allowNonTsExtensions: true, }, session); openFilesForSession([{ file: file.path, content: "var x = 10;" }], session); @@ -153,7 +153,7 @@ describe("unittests:: tsserver:: dynamicFiles:: ", () => { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Quickinfo, - arguments: protocolFileLocationFromSubstring(file, "x") + arguments: protocolFileLocationFromSubstring(file, "x"), }); baselineTsserverLogs("dynamicFiles", "dynamic file without external project", session); }); @@ -163,15 +163,15 @@ describe("unittests:: tsserver:: dynamicFiles:: ", () => { describe("dynamic file with projectRootPath", () => { const file: File = { path: "^walkThroughSnippet:/Users/UserName/projects/someProject/out/someFile#1.js", - content: "var x = 10;" + content: "var x = 10;", }; const configFile: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: "{}" + content: "{}", }; const configProjectFile: File = { path: `/user/username/projects/myproject/a.ts`, - content: "let y = 10;" + content: "let y = 10;", }; it("with useInferredProjectPerProjectRoot", () => { const host = createServerHost([libFile, configFile, configProjectFile], { useCaseSensitiveFileNames: true }); @@ -184,8 +184,8 @@ describe("unittests:: tsserver:: dynamicFiles:: ", () => { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.GetOutliningSpans, arguments: { - file: file.path - } + file: file.path, + }, }); // Without project root diff --git a/src/testRunner/unittests/tsserver/events/largeFileReferenced.ts b/src/testRunner/unittests/tsserver/events/largeFileReferenced.ts index c62579832b33e..7406af24c15ad 100644 --- a/src/testRunner/unittests/tsserver/events/largeFileReferenced.ts +++ b/src/testRunner/unittests/tsserver/events/largeFileReferenced.ts @@ -23,7 +23,7 @@ describe("unittests:: tsserver:: events:: LargeFileReferencedEvent with large fi const largeFile: File = { path: `/user/username/projects/myproject/${getLargeFile(useLargeTsFile)}`, content: "export var x = 10;", - fileSize: ts.server.maxFileSize + 1 + fileSize: ts.server.maxFileSize + 1, }; files.push(largeFile); const host = createServerHost(files); @@ -36,11 +36,11 @@ describe("unittests:: tsserver:: events:: LargeFileReferencedEvent with large fi it("when large file is included by tsconfig", () => { const file: File = { path: `/user/username/projects/myproject/src/file.ts`, - content: "export var y = 10;" + content: "export var y = 10;", }; const tsconfig: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: JSON.stringify({ files: ["src/file.ts", getLargeFile(useLargeTsFile)], compilerOptions: { target: 1, allowJs: true } }) + content: JSON.stringify({ files: ["src/file.ts", getLargeFile(useLargeTsFile)], compilerOptions: { target: 1, allowJs: true } }), }; const files = [file, libFile, tsconfig]; const session = createSessionWithEventHandler(files, useLargeTsFile); @@ -51,7 +51,7 @@ describe("unittests:: tsserver:: events:: LargeFileReferencedEvent with large fi it("when large file is included by module resolution", () => { const file: File = { path: `/user/username/projects/myproject/src/file.ts`, - content: `export var y = 10;import {x} from "./large"` + content: `export var y = 10;import {x} from "./large"`, }; const files = [file, libFile]; const session = createSessionWithEventHandler(files, useLargeTsFile); diff --git a/src/testRunner/unittests/tsserver/events/projectLanguageServiceState.ts b/src/testRunner/unittests/tsserver/events/projectLanguageServiceState.ts index 6ce697771b67a..856df36ba51dc 100644 --- a/src/testRunner/unittests/tsserver/events/projectLanguageServiceState.ts +++ b/src/testRunner/unittests/tsserver/events/projectLanguageServiceState.ts @@ -16,7 +16,7 @@ describe("unittests:: tsserver:: events:: ProjectLanguageServiceStateEvent", () it("language service disabled events are triggered", () => { const f1 = { path: "/a/app.js", - content: "let x = 1;" + content: "let x = 1;", }; const f2 = { path: "/a/largefile.js", @@ -24,11 +24,11 @@ describe("unittests:: tsserver:: events:: ProjectLanguageServiceStateEvent", () }; const config = { path: "/a/jsconfig.json", - content: "{}" + content: "{}", }; const configWithExclude = { path: config.path, - content: JSON.stringify({ exclude: ["largefile.js"] }) + content: JSON.stringify({ exclude: ["largefile.js"] }), }; const host = createServerHost([f1, f2, config]); const originalGetFileSize = host.getFileSize; @@ -48,21 +48,21 @@ describe("unittests:: tsserver:: events:: ProjectLanguageServiceStateEvent", () it("Large file size is determined correctly", () => { const f1: File = { path: "/a/app.js", - content: "let x = 1;" + content: "let x = 1;", }; const f2: File = { path: "/a/largefile.js", content: "", - fileSize: ts.server.maxProgramSizeForNonTsFiles + 1 + fileSize: ts.server.maxProgramSizeForNonTsFiles + 1, }; const f3: File = { path: "/a/extremlylarge.d.ts", content: "", - fileSize: ts.server.maxProgramSizeForNonTsFiles + 100 + fileSize: ts.server.maxProgramSizeForNonTsFiles + 100, }; const config = { path: "/a/jsconfig.json", - content: "{}" + content: "{}", }; const host = createServerHost([f1, f2, f3, libFile, config]); const service = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); diff --git a/src/testRunner/unittests/tsserver/events/projectLoading.ts b/src/testRunner/unittests/tsserver/events/projectLoading.ts index 90781f75c8bba..8374c4580047f 100644 --- a/src/testRunner/unittests/tsserver/events/projectLoading.ts +++ b/src/testRunner/unittests/tsserver/events/projectLoading.ts @@ -20,11 +20,11 @@ import { describe("unittests:: tsserver:: events:: ProjectLoadingStart and ProjectLoadingFinish events", () => { const aTs: File = { path: `/user/username/projects/a/a.ts`, - content: "export class A { }" + content: "export class A { }", }; const configA: File = { path: `/user/username/projects/a/tsconfig.json`, - content: "{}" + content: "{}", }; const bTsPath = `/user/username/projects/b/b.ts`; const configBPath = `/user/username/projects/b/tsconfig.json`; @@ -35,11 +35,11 @@ describe("unittests:: tsserver:: events:: ProjectLoadingStart and ProjectLoading it("when project is created by open file", () => { const bTs: File = { path: bTsPath, - content: "export class B {}" + content: "export class B {}", }; const configB: File = { path: configBPath, - content: "{}" + content: "{}", }; const host = createServerHost(files.concat(bTs, configB)); const session = createSession(host); @@ -61,13 +61,13 @@ describe("unittests:: tsserver:: events:: ProjectLoadingStart and ProjectLoading it("when change is detected in an extended config file", () => { const bTs: File = { path: bTsPath, - content: "export class B {}" + content: "export class B {}", }; const configB: File = { path: configBPath, content: JSON.stringify({ extends: "../a/tsconfig.json", - }) + }), }; const host = createServerHost(files.concat(bTs, configB)); const session = createSession(host); @@ -93,26 +93,26 @@ describe("unittests:: tsserver:: events:: ProjectLoadingStart and ProjectLoading content: `export declare class A { } //# sourceMappingURL=a.d.ts.map -` +`, }; const aDTsMap: File = { path: `/user/username/projects/a/a.d.ts.map`, - content: `{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["./a.ts"],"names":[],"mappings":"AAAA,qBAAa,CAAC;CAAI"}` + content: `{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["./a.ts"],"names":[],"mappings":"AAAA,qBAAa,CAAC;CAAI"}`, }; const bTs: File = { path: bTsPath, - content: `import {A} from "../a/a"; new A();` + content: `import {A} from "../a/a"; new A();`, }; const configB: File = { path: configBPath, content: JSON.stringify({ ...(disableSourceOfProjectReferenceRedirect && { compilerOptions: { - disableSourceOfProjectReferenceRedirect - } + disableSourceOfProjectReferenceRedirect, + }, }), - references: [{ path: "../a" }] - }) + references: [{ path: "../a" }], + }), }; const host = createServerHost(files.concat(aDTs, aDTsMap, bTs, configB)); @@ -123,8 +123,8 @@ describe("unittests:: tsserver:: events:: ProjectLoadingStart and ProjectLoading command: ts.server.protocol.CommandTypes.References, arguments: { file: bTs.path, - ...protocolLocationFromSubstring(bTs.content, "A()") - } + ...protocolLocationFromSubstring(bTs.content, "A()"), + }, }); baselineTsserverLogs("events/projectLoading", `opening original location project${disableSourceOfProjectReferenceRedirect ? " disableSourceOfProjectReferenceRedirect" : ""} ${sessionType}`, session); } @@ -139,13 +139,13 @@ describe("unittests:: tsserver:: events:: ProjectLoadingStart and ProjectLoading session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Configure, arguments: { - preferences: { lazyConfiguredProjectsFromExternalProject } - } + preferences: { lazyConfiguredProjectsFromExternalProject }, + }, }); openExternalProjectForSession({ projectFileName, rootFiles: toExternalFiles([aTs.path, configA.path]), - options: {} + options: {}, }, session); return session; } @@ -166,8 +166,8 @@ describe("unittests:: tsserver:: events:: ProjectLoadingStart and ProjectLoading session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Configure, arguments: { - preferences: { lazyConfiguredProjectsFromExternalProject: false } - } + preferences: { lazyConfiguredProjectsFromExternalProject: false }, + }, }); baselineTsserverLogs("events/projectLoading", `lazyConfiguredProjectsFromExternalProject is disabled ${sessionType}`, session); }); diff --git a/src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts b/src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts index 19be7628c980b..c24ab7ef0a9e0 100644 --- a/src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts +++ b/src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts @@ -19,19 +19,19 @@ describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => { it("when adding new file", () => { const commonFile1: File = { path: "/users/username/projects/project/file1.ts", - content: "export var x = 10;" + content: "export var x = 10;", }; const commonFile2: File = { path: "/users/username/projects/project/file2.ts", - content: "export var y = 10;" + content: "export var y = 10;", }; const commonFile3: File = { path: "/users/username/projects/project/file3.ts", - content: "export var z = 10;" + content: "export var z = 10;", }; const configFile: File = { path: "/users/username/projects/project/tsconfig.json", - content: `{}` + content: `{}`, }; const host = createServerHost([commonFile1, libFile, configFile]); const session = createSession(host); @@ -51,17 +51,17 @@ describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => { const config: File = { path: "/users/username/projects/project/tsconfig.json", content: JSON.stringify({ - compilerOptions - }) + compilerOptions, + }), }; const f1: File = { path: "/users/username/projects/project/a.ts", - content: "export let x = 1" + content: "export let x = 1", }; const f2: File = { path: "/users/username/projects/project/b.ts", - content: "export let y = 1" + content: "export let y = 1", }; const files = [f1, config, libFile]; @@ -117,13 +117,13 @@ describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => { const globalFile3: File = { path: "/users/username/projects/project/globalFile3.ts", - content: `interface GlobalFoo { age: number }` + content: `interface GlobalFoo { age: number }`, }; const additionalFiles = getAdditionalFileOrFolder ? getAdditionalFileOrFolder() : []; const configFile = { path: configFilePath, - content: JSON.stringify(configObj || { compilerOptions: {} }) + content: JSON.stringify(configObj || { compilerOptions: {} }), }; const files: File[] = [file1Consumer1, moduleFile1, file1Consumer2, moduleFile2, ...additionalFiles, globalFile3, libFile, configFile]; @@ -154,8 +154,8 @@ describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => { endLine: 1, endOffset: file.content.length, line: 1, - offset: 1 - } + offset: 1, + }, }); file.content = newContent; } @@ -216,7 +216,7 @@ describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => { }); it("should be up-to-date with newly created files", () => { - const { host, moduleFile1, session, } = getInitialState(); + const { host, moduleFile1, session } = getInitialState(); host.writeFile(moduleFile1.path, `export var T: number;export function Foo() { };`); host.writeFile("/users/username/projects/project/file1Consumer3.ts", `import {Foo} from "./moduleFile1"; let y = Foo();`); @@ -248,7 +248,7 @@ describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => { it("should always return the file itself if '--isolatedModules' is specified", () => { const { host, moduleFile1, session } = getInitialState({ - configObj: { compilerOptions: { isolatedModules: true } } + configObj: { compilerOptions: { isolatedModules: true } }, }); host.writeFile(moduleFile1.path, `export var T: number;export function Foo() { };`); @@ -259,7 +259,7 @@ describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => { it("should always return the file itself if '--out' or '--outFile' is specified", () => { const outFilePath = "/users/username/projects/project/out.js"; const { host, moduleFile1, session } = getInitialState({ - configObj: { compilerOptions: { module: "system", outFile: outFilePath } } + configObj: { compilerOptions: { module: "system", outFile: outFilePath } }, }); host.writeFile(moduleFile1.path, `export var T: number;export function Foo() { };`); @@ -270,10 +270,10 @@ describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => { it("should return cascaded affected file list", () => { const file1Consumer1Consumer1: File = { path: "/users/username/projects/project/file1Consumer1Consumer1.ts", - content: `import {y} from "./file1Consumer1";` + content: `import {y} from "./file1Consumer1";`, }; const { host, moduleFile1, file1Consumer1, updateContentOfOpenFile, session } = getInitialState({ - getAdditionalFileOrFolder: () => [file1Consumer1Consumer1] + getAdditionalFileOrFolder: () => [file1Consumer1Consumer1], }); updateContentOfOpenFile(file1Consumer1, file1Consumer1.content + "export var T: number;"); @@ -295,17 +295,17 @@ describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => { path: "/users/username/projects/project/file1.ts", content: ` /// - export var t1 = 10;` + export var t1 = 10;`, }; const file2: File = { path: "/users/username/projects/project/file2.ts", content: ` /// - export var t2 = 10;` + export var t2 = 10;`, }; const { host, session } = getInitialState({ getAdditionalFileOrFolder: () => [file1, file2], - firstReloadFileList: [file1.path, libFile.path, file2.path, configFilePath] + firstReloadFileList: [file1.path, libFile.path, file2.path, configFilePath], }); host.writeFile(file2.path, file2.content + "export var t3 = 10;"); @@ -318,11 +318,11 @@ describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => { path: "/users/username/projects/project/referenceFile1.ts", content: ` /// - export var x = Foo();` + export var x = Foo();`, }; const { host, session } = getInitialState({ getAdditionalFileOrFolder: () => [referenceFile1], - firstReloadFileList: [referenceFile1.path, libFile.path, moduleFile1Path, configFilePath] + firstReloadFileList: [referenceFile1.path, libFile.path, moduleFile1Path, configFilePath], }); host.deleteFile(moduleFile1Path); @@ -335,11 +335,11 @@ describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => { path: "/users/username/projects/project/referenceFile1.ts", content: ` /// - export var x = Foo();` + export var x = Foo();`, }; const { host, moduleFile2, updateContentOfOpenFile, session } = getInitialState({ getAdditionalFileOrFolder: () => [referenceFile1], - firstReloadFileList: [referenceFile1.path, libFile.path, configFilePath] + firstReloadFileList: [referenceFile1.path, libFile.path, configFilePath], }); updateContentOfOpenFile(referenceFile1, referenceFile1.content + "export var yy = Foo();"); @@ -358,19 +358,19 @@ describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => { const rootFolder = useSlashRootAsSomeNotRootFolderInUserDirectory ? "/user/username/rootfolder/otherfolder/" : "/"; const file1: File = { path: rootFolder + "a/b/project/file1.ts", - content: 'import a from "file2"' + content: 'import a from "file2"', }; const file2: File = { path: rootFolder + "a/b/node_modules/file2.d.ts", - content: "export class a { }" + content: "export class a { }", }; const file3: File = { path: rootFolder + "a/b/project/file3.ts", - content: "export class c { }" + content: "export class c { }", }; const configFile: File = { path: rootFolder + "a/b/project/tsconfig.json", - content: JSON.stringify({ compilerOptions: { typeRoots: [] } }) + content: JSON.stringify({ compilerOptions: { typeRoots: [] } }), }; const host = createServerHost([file1, file3, libFile, configFile]); @@ -401,7 +401,7 @@ describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => { describe("without noGetErrOnBackgroundUpdate, diagnostics for open files are queued", () => { verifyProjectsUpdatedInBackgroundEvent("without noGetErrOnBackgroundUpdate", host => createSession(host, { canUseEvents: true, - logger: createLoggerWithInMemoryLogs(host) + logger: createLoggerWithInMemoryLogs(host), })); }); @@ -409,7 +409,7 @@ describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => { verifyProjectsUpdatedInBackgroundEvent("with noGetErrOnBackgroundUpdate", host => createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host), - noGetErrOnBackgroundUpdate: true + noGetErrOnBackgroundUpdate: true, })); }); }); diff --git a/src/testRunner/unittests/tsserver/exportMapCache.ts b/src/testRunner/unittests/tsserver/exportMapCache.ts index 601be84a76f4a..bcf6b3b38fd71 100644 --- a/src/testRunner/unittests/tsserver/exportMapCache.ts +++ b/src/testRunner/unittests/tsserver/exportMapCache.ts @@ -12,7 +12,7 @@ import { const packageJson: File = { path: "/package.json", - content: `{ "dependencies": { "mobx": "*" } }` + content: `{ "dependencies": { "mobx": "*" } }`, }; const aTs: File = { path: "/a.ts", @@ -28,15 +28,15 @@ const tsconfig: File = { }; const ambientDeclaration: File = { path: "/ambient.d.ts", - content: "declare module 'ambient' {}" + content: "declare module 'ambient' {}", }; const mobxPackageJson: File = { path: "/node_modules/mobx/package.json", - content: `{ "name": "mobx", "version": "1.0.0" }` + content: `{ "name": "mobx", "version": "1.0.0" }`, }; const mobxDts: File = { path: "/node_modules/mobx/index.d.ts", - content: "export declare function observable(): unknown;" + content: "export declare function observable(): unknown;", }; const exportEqualsMappedType: File = { path: "/lib/foo/constants.d.ts", @@ -120,9 +120,9 @@ describe("unittests:: tsserver:: exportMapCache", () => { newText: " ", start: { line: 1, offset: 1 }, end: { line: 1, offset: 1 }, - }] - }] - } + }], + }], + }, }); project.getLanguageService(/*ensureSynchronized*/ true); assert.notEqual(programBefore, project.getCurrentProgram()!); @@ -146,7 +146,7 @@ describe("unittests:: tsserver:: exportMapCache", () => { export abstract class Component { abstract render(): Element; - }` + }`, }; const classesTs: File = { path: "/classes.ts", @@ -154,7 +154,7 @@ describe("unittests:: tsserver:: exportMapCache", () => { export class MyComponent extends Component { render/**/ - }` + }`, }; const host = createServerHost([utilsTs, classesTs, tsconfig]); const session = createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host) }); @@ -168,7 +168,7 @@ describe("unittests:: tsserver:: exportMapCache", () => { includeCompletionsWithClassMemberSnippets: true, includeCompletionsWithInsertText: true, }, - } + }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompletionInfo, @@ -179,7 +179,7 @@ describe("unittests:: tsserver:: exportMapCache", () => { prefix: "render", includeExternalModuleExports: true, includeInsertTextCompletions: true, - } + }, }); const project = projectService.configuredProjects.get(tsconfig.path)!; @@ -197,9 +197,9 @@ describe("unittests:: tsserver:: exportMapCache", () => { newText: "", start: { line: 4, offset: 22 }, end: { line: 4, offset: 23 }, - }] - }] - } + }], + }], + }, }); host.runQueuedTimeoutCallbacks(); @@ -219,7 +219,7 @@ describe("unittests:: tsserver:: exportMapCache", () => { prefix: "rende", includeExternalModuleExports: true, includeInsertTextCompletions: true, - } + }, }); baselineTsserverLogs("exportMapCache", "invalidates the cache when a file is opened with different contents", session); @@ -248,7 +248,7 @@ function setup() { ...requestLocation, includeExternalModuleExports: true, prefix: "foo", - } + }, }); } } diff --git a/src/testRunner/unittests/tsserver/externalProjects.ts b/src/testRunner/unittests/tsserver/externalProjects.ts index ff20e0c081fb1..01ea7f347dd25 100644 --- a/src/testRunner/unittests/tsserver/externalProjects.ts +++ b/src/testRunner/unittests/tsserver/externalProjects.ts @@ -25,13 +25,13 @@ describe("unittests:: tsserver:: externalProjects", () => { function verifyConfigFileCasing(lazyConfiguredProjectsFromExternalProject: boolean) { const f1 = { path: "/a/b/app.ts", - content: "let x = 1" + content: "let x = 1", }; const config = { path: "/a/b/tsconfig.json", content: JSON.stringify({ - include: [] - }) + include: [], + }), }; const host = createServerHost([f1, config], { useCaseSensitiveFileNames: false }); @@ -39,14 +39,14 @@ describe("unittests:: tsserver:: externalProjects", () => { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Configure, arguments: { - preferences: { lazyConfiguredProjectsFromExternalProject } - } + preferences: { lazyConfiguredProjectsFromExternalProject }, + }, }); const upperCaseConfigFilePath = ts.combinePaths(ts.getDirectoryPath(config.path).toUpperCase(), ts.getBaseFileName(config.path)); openExternalProjectForSession({ projectFileName: "/a/b/project.csproj", rootFiles: toExternalFiles([f1.path, upperCaseConfigFilePath]), - options: {} + options: {}, }, session); openFilesForSession([f1], session); @@ -65,7 +65,7 @@ describe("unittests:: tsserver:: externalProjects", () => { it("load global plugins", () => { const f1 = { path: "/a/file1.ts", - content: "let x = [1, 2];" + content: "let x = [1, 2];", }; const p1 = { projectFileName: "/a/proj1.csproj", rootFiles: [toExternalFile(f1.path)], options: {} }; @@ -85,14 +85,14 @@ describe("unittests:: tsserver:: externalProjects", () => { code: 9999, length: 3, messageText: `Plugin diagnostic`, - start: 0 + start: 0, }); return prev; }; return proxy; - } + }, }), - error: undefined + error: undefined, }; }; const session = createSession(host, { globalPlugins: ["myplugin"], logger: createLoggerWithInMemoryLogs(host) }); @@ -102,8 +102,8 @@ describe("unittests:: tsserver:: externalProjects", () => { command: ts.server.protocol.CommandTypes.SemanticDiagnosticsSync, arguments: { file: f1.path, - projectFileName: p1.projectFileName - } + projectFileName: p1.projectFileName, + }, }); baselineTsserverLogs("externalProjects", "load global plugins", session); }); @@ -111,15 +111,15 @@ describe("unittests:: tsserver:: externalProjects", () => { it("remove not-listed external projects", () => { const f1 = { path: "/a/app.ts", - content: "let x = 1" + content: "let x = 1", }; const f2 = { path: "/b/app.ts", - content: "let x = 1" + content: "let x = 1", }; const f3 = { path: "/c/app.ts", - content: "let x = 1" + content: "let x = 1", }; const makeProject = (f: File) => ({ projectFileName: f.path + ".csproj", rootFiles: [toExternalFile(f.path)], options: {} }); const p1 = makeProject(f1); @@ -138,11 +138,11 @@ describe("unittests:: tsserver:: externalProjects", () => { it("should not close external project with no open files", () => { const file1 = { path: "/a/b/f1.ts", - content: "let x =1;" + content: "let x =1;", }; const file2 = { path: "/a/b/f2.ts", - content: "let y =1;" + content: "let y =1;", }; const externalProjectName = "externalproject"; const host = createServerHost([file1, file2]); @@ -150,7 +150,7 @@ describe("unittests:: tsserver:: externalProjects", () => { projectService.openExternalProject({ rootFiles: toExternalFiles([file1.path, file2.path]), options: {}, - projectFileName: externalProjectName + projectFileName: externalProjectName, }); // open client file - should not lead to creation of inferred project projectService.openClientFile(file1.path, file1.content); @@ -168,7 +168,7 @@ describe("unittests:: tsserver:: externalProjects", () => { projectService.openExternalProject({ rootFiles: externalFiles, options: {}, - projectFileName: externalProjectName + projectFileName: externalProjectName, }); verifyDynamic(projectService, "/^scriptdocument1 file1.ts"); @@ -181,11 +181,11 @@ describe("unittests:: tsserver:: externalProjects", () => { it("when file name starts with ^", () => { const file: File = { path: `/user/username/projects/myproject/file.ts`, - content: "const x = 10;" + content: "const x = 10;", }; const app: File = { path: `/user/username/projects/myproject/^app.ts`, - content: "const y = 10;" + content: "const y = 10;", }; const host = createServerHost([file, app, libFile]); const service = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -193,7 +193,7 @@ describe("unittests:: tsserver:: externalProjects", () => { projectFileName: `/user/username/projects/myproject/myproject.njsproj`, rootFiles: [ toExternalFile(file.path), - toExternalFile(app.path) + toExternalFile(app.path), ], options: {}, }]); @@ -203,33 +203,33 @@ describe("unittests:: tsserver:: externalProjects", () => { it("external project that included config files", () => { const file1 = { path: "/a/b/f1.ts", - content: "let x =1;" + content: "let x =1;", }; const config1 = { path: "/a/b/tsconfig.json", content: JSON.stringify( { compilerOptions: {}, - files: ["f1.ts"] + files: ["f1.ts"], } - ) + ), }; const file2 = { path: "/a/c/f2.ts", - content: "let y =1;" + content: "let y =1;", }; const config2 = { path: "/a/c/tsconfig.json", content: JSON.stringify( { compilerOptions: {}, - files: ["f2.ts"] + files: ["f2.ts"], } - ) + ), }; const file3 = { path: "/a/d/f3.ts", - content: "let z =1;" + content: "let z =1;", }; const externalProjectName = "externalproject"; const host = createServerHost([file1, file2, file3, config1, config2]); @@ -237,7 +237,7 @@ describe("unittests:: tsserver:: externalProjects", () => { projectService.openExternalProject({ rootFiles: toExternalFiles([config1.path, config2.path, file3.path]), options: {}, - projectFileName: externalProjectName + projectFileName: externalProjectName, }); // open client file - should not lead to creation of inferred project @@ -264,11 +264,11 @@ describe("unittests:: tsserver:: externalProjects", () => { it("external project with included config file opened after configured project", () => { const file1 = { path: "/a/b/f1.ts", - content: "let x = 1" + content: "let x = 1", }; const configFile = { path: "/a/b/tsconfig.json", - content: JSON.stringify({ compilerOptions: {} }) + content: JSON.stringify({ compilerOptions: {} }), }; const externalProjectName = "externalproject"; const host = createServerHost([file1, configFile]); @@ -279,7 +279,7 @@ describe("unittests:: tsserver:: externalProjects", () => { projectService.openExternalProject({ rootFiles: toExternalFiles([configFile.path]), options: {}, - projectFileName: externalProjectName + projectFileName: externalProjectName, }); @@ -293,15 +293,15 @@ describe("unittests:: tsserver:: externalProjects", () => { it("external project with included config file opened after configured project and then closed", () => { const file1 = { path: "/a/b/f1.ts", - content: "let x = 1" + content: "let x = 1", }; const file2 = { path: "/a/f2.ts", - content: "let x = 1" + content: "let x = 1", }; const configFile = { path: "/a/b/tsconfig.json", - content: JSON.stringify({ compilerOptions: {} }) + content: JSON.stringify({ compilerOptions: {} }), }; const externalProjectName = "externalproject"; const host = createServerHost([file1, file2, libFile, configFile]); @@ -312,7 +312,7 @@ describe("unittests:: tsserver:: externalProjects", () => { projectService.openExternalProject({ rootFiles: toExternalFiles([configFile.path]), options: {}, - projectFileName: externalProjectName + projectFileName: externalProjectName, }); projectService.closeExternalProject(externalProjectName); @@ -327,11 +327,11 @@ describe("unittests:: tsserver:: externalProjects", () => { it("can correctly update external project when set of root files has changed", () => { const file1 = { path: "/a/b/f1.ts", - content: "let x = 1" + content: "let x = 1", }; const file2 = { path: "/a/b/f2.ts", - content: "let y = 1" + content: "let y = 1", }; const host = createServerHost([file1, file2]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -345,15 +345,15 @@ describe("unittests:: tsserver:: externalProjects", () => { it("can update external project when set of root files was not changed", () => { const file1 = { path: "/a/b/f1.ts", - content: `export * from "m"` + content: `export * from "m"`, }; const file2 = { path: "/a/b/f2.ts", - content: "export let y = 1" + content: "export let y = 1", }; const file3 = { path: "/a/m.ts", - content: "export let y = 1" + content: "export let y = 1", }; const host = createServerHost([file1, file2, file3]); @@ -368,11 +368,11 @@ describe("unittests:: tsserver:: externalProjects", () => { it("language service disabled state is updated in external projects", () => { const f1 = { path: "/a/app.js", - content: "var x = 1" + content: "var x = 1", }; const f2 = { path: "/a/largefile.js", - content: "" + content: "", }; const host = createServerHost([f1, f2]); const originalGetFileSize = host.getFileSize; @@ -385,21 +385,21 @@ describe("unittests:: tsserver:: externalProjects", () => { service.openExternalProject({ projectFileName, rootFiles: toExternalFiles([f1.path, f2.path]), - options: {} + options: {}, }); assert.isFalse(service.externalProjects[0].languageServiceEnabled, "language service should be disabled - 1"); service.openExternalProject({ projectFileName, rootFiles: toExternalFiles([f1.path]), - options: {} + options: {}, }); assert.isTrue(service.externalProjects[0].languageServiceEnabled, "language service should be enabled"); service.openExternalProject({ projectFileName, rootFiles: toExternalFiles([f1.path, f2.path]), - options: {} + options: {}, }); assert.isFalse(service.externalProjects[0].languageServiceEnabled, "language service should be disabled - 2"); baselineTsserverLogs("externalProjects", "language service disabled state is updated in external projects", service); @@ -409,11 +409,11 @@ describe("unittests:: tsserver:: externalProjects", () => { function verifyDeletingConfigFile(lazyConfiguredProjectsFromExternalProject: boolean) { const site = { path: "/user/someuser/project/js/site.js", - content: "" + content: "", }; const configFile = { path: "/user/someuser/project/tsconfig.json", - content: "{}" + content: "{}", }; const projectFileName = "/user/someuser/project/WebApplication6.csproj"; const host = createServerHost([libFile, site, configFile]); @@ -424,7 +424,7 @@ describe("unittests:: tsserver:: externalProjects", () => { projectFileName, rootFiles: [toExternalFile(site.path), toExternalFile(configFile.path)], options: { allowJs: false }, - typeAcquisition: { include: [] } + typeAcquisition: { include: [] }, }; projectService.openExternalProjects([externalProject]); @@ -452,15 +452,15 @@ describe("unittests:: tsserver:: externalProjects", () => { function verifyAddRemoveConfig(lazyConfiguredProjectsFromExternalProject: boolean) { const f1 = { path: "/a/b/app.ts", - content: "let x = 1;" + content: "let x = 1;", }; const f2 = { path: "/a/b/lib.ts", - content: "" + content: "", }; const tsconfig = { path: "/a/b/tsconfig.json", - content: "" + content: "", }; const host = createServerHost([f1, f2]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -471,7 +471,7 @@ describe("unittests:: tsserver:: externalProjects", () => { projectService.openExternalProject({ projectFileName: projectName, rootFiles: toExternalFiles([f1.path, f2.path]), - options: {} + options: {}, }); projectService.openClientFile(f1.path); @@ -480,7 +480,7 @@ describe("unittests:: tsserver:: externalProjects", () => { projectService.openExternalProject({ projectFileName: projectName, rootFiles: toExternalFiles([f1.path, tsconfig.path]), - options: {} + options: {}, }); if (lazyConfiguredProjectsFromExternalProject) { projectService.ensureInferredProjectsUpToDate_TestOnly(); @@ -491,7 +491,7 @@ describe("unittests:: tsserver:: externalProjects", () => { projectService.openExternalProject({ projectFileName: projectName, rootFiles: toExternalFiles([f1.path, f2.path]), - options: {} + options: {}, }); baselineTsserverLogs("externalProjects", `correctly handling add or remove tsconfig - 1${lazyConfiguredProjectsFromExternalProject ? " with lazyConfiguredProjectsFromExternalProject" : ""}`, projectService); } @@ -507,23 +507,23 @@ describe("unittests:: tsserver:: externalProjects", () => { function verifyAddRemoveConfig(lazyConfiguredProjectsFromExternalProject: boolean) { const f1 = { path: "/a/b/app.ts", - content: "let x = 1;" + content: "let x = 1;", }; const cLib = { path: "/a/b/c/lib.ts", - content: "" + content: "", }; const cTsconfig = { path: "/a/b/c/tsconfig.json", - content: "{}" + content: "{}", }; const dLib = { path: "/a/b/d/lib.ts", - content: "" + content: "", }; const dTsconfig = { path: "/a/b/d/tsconfig.json", - content: "{}" + content: "{}", }; const host = createServerHost([f1, cLib, cTsconfig, dLib, dTsconfig]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -534,14 +534,14 @@ describe("unittests:: tsserver:: externalProjects", () => { projectService.openExternalProject({ projectFileName: projectName, rootFiles: toExternalFiles([f1.path]), - options: {} + options: {}, }); // add two config file as root files projectService.openExternalProject({ projectFileName: projectName, rootFiles: toExternalFiles([f1.path, cTsconfig.path, dTsconfig.path]), - options: {} + options: {}, }); if (lazyConfiguredProjectsFromExternalProject) { projectService.ensureInferredProjectsUpToDate_TestOnly(); @@ -551,14 +551,14 @@ describe("unittests:: tsserver:: externalProjects", () => { projectService.openExternalProject({ projectFileName: projectName, rootFiles: toExternalFiles([f1.path, dTsconfig.path]), - options: {} + options: {}, }); // remove second config file projectService.openExternalProject({ projectFileName: projectName, rootFiles: toExternalFiles([f1.path]), - options: {} + options: {}, }); // open two config files @@ -566,7 +566,7 @@ describe("unittests:: tsserver:: externalProjects", () => { projectService.openExternalProject({ projectFileName: projectName, rootFiles: toExternalFiles([f1.path, cTsconfig.path, dTsconfig.path]), - options: {} + options: {}, }); if (lazyConfiguredProjectsFromExternalProject) { projectService.ensureInferredProjectsUpToDate_TestOnly(); @@ -588,15 +588,15 @@ describe("unittests:: tsserver:: externalProjects", () => { it("correctly handles changes in lib section of config file", () => { const libES5 = { path: "/compiler/lib.es5.d.ts", - content: "declare const eval: any" + content: "declare const eval: any", }; const libES2015Promise = { path: "/compiler/lib.es2015.promise.d.ts", - content: "declare class Promise {}" + content: "declare class Promise {}", }; const app = { path: "/src/app.ts", - content: "var x: Promise;" + content: "var x: Promise;", }; const config1 = { path: "/src/tsconfig.json", @@ -608,10 +608,10 @@ describe("unittests:: tsserver:: externalProjects", () => { noImplicitAny: true, sourceMap: false, lib: [ - "es5" - ] - } - }) + "es5", + ], + }, + }), }; const config2 = { path: config1.path, @@ -624,10 +624,10 @@ describe("unittests:: tsserver:: externalProjects", () => { sourceMap: false, lib: [ "es5", - "es2015.promise" - ] - } - }) + "es2015.promise", + ], + }, + }), }; const host = createServerHost([libES5, libES2015Promise, app, config1], { executingFilePath: "/compiler/tsc.js" }); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -642,7 +642,7 @@ describe("unittests:: tsserver:: externalProjects", () => { it("should handle non-existing directories in config file", () => { const f = { path: "/a/src/app.ts", - content: "let x = 1;" + content: "let x = 1;", }; const config = { path: "/a/tsconfig.json", @@ -650,9 +650,9 @@ describe("unittests:: tsserver:: externalProjects", () => { compilerOptions: {}, include: [ "src/**/*", - "notexistingfolder/*" - ] - }) + "notexistingfolder/*", + ], + }), }; const host = createServerHost([f, config]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -669,11 +669,11 @@ describe("unittests:: tsserver:: externalProjects", () => { it("handles loads existing configured projects of external projects when lazyConfiguredProjectsFromExternalProject is disabled", () => { const f1 = { path: "/a/b/app.ts", - content: "let x = 1" + content: "let x = 1", }; const config = { path: "/a/b/tsconfig.json", - content: JSON.stringify({}) + content: JSON.stringify({}), }; const projectFileName = "/a/b/project.csproj"; const host = createServerHost([f1, config]); @@ -682,7 +682,7 @@ describe("unittests:: tsserver:: externalProjects", () => { service.openExternalProject({ projectFileName, rootFiles: toExternalFiles([f1.path, config.path]), - options: {} + options: {}, } as ts.server.protocol.ExternalProject); const project = service.configuredProjects.get(config.path)!; assert.equal(project.pendingReload, ts.ConfigFileProgramReloadLevel.Full); // External project referenced configured project pending to be reloaded @@ -695,7 +695,7 @@ describe("unittests:: tsserver:: externalProjects", () => { service.openExternalProject({ projectFileName, rootFiles: toExternalFiles([f1.path, config.path]), - options: {} + options: {}, } as ts.server.protocol.ExternalProject); const project2 = service.configuredProjects.get(config.path)!; assert.equal(project2.pendingReload, ts.ConfigFileProgramReloadLevel.None); // External project referenced configured project loaded @@ -706,7 +706,7 @@ describe("unittests:: tsserver:: externalProjects", () => { const projectFileName = `/user/username/projects/myproject/WebApplication36.csproj`; const tsconfig: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: "{}" + content: "{}", }; const files = [libFile, tsconfig]; const host = createServerHost(files); @@ -716,7 +716,7 @@ describe("unittests:: tsserver:: externalProjects", () => { service.openExternalProjects([{ projectFileName, rootFiles: [{ fileName: tsconfig.path }], - options: { allowJs: false } + options: { allowJs: false }, }]); // write js file, open external project and open it for edit @@ -725,14 +725,14 @@ describe("unittests:: tsserver:: externalProjects", () => { service.openExternalProjects([{ projectFileName, rootFiles: [{ fileName: tsconfig.path }, { fileName: jsFilePath }], - options: { allowJs: false } + options: { allowJs: false }, }]); service.applyChangesInOpenFiles(ts.singleIterator({ fileName: jsFilePath, scriptKind: ts.ScriptKind.JS, content: "" })); // write jsconfig file const jsConfig: File = { path: `/user/username/projects/myproject/jsconfig.json`, - content: "{}" + content: "{}", }; // Dont invoke file creation watchers as the repro suggests host.ensureFileOrFolder(jsConfig, /*ignoreWatchInvokedWithTriggerAsFileCreate*/ true); @@ -741,7 +741,7 @@ describe("unittests:: tsserver:: externalProjects", () => { service.openExternalProjects([{ projectFileName, rootFiles: [{ fileName: jsConfig.path }, { fileName: tsconfig.path }, { fileName: jsFilePath }], - options: { allowJs: false } + options: { allowJs: false }, }]); logInferredProjectsOrphanStatus(service); baselineTsserverLogs("externalProjects", "handles creation of external project with jsconfig before jsconfig creation watcher is invoked", service); diff --git a/src/testRunner/unittests/tsserver/findAllReferences.ts b/src/testRunner/unittests/tsserver/findAllReferences.ts index 85b1b4b05fcaa..d68ecb47b7bc3 100644 --- a/src/testRunner/unittests/tsserver/findAllReferences.ts +++ b/src/testRunner/unittests/tsserver/findAllReferences.ts @@ -22,14 +22,14 @@ describe("unittests:: services:: findAllReferences", () => { "include": ["src"], "references": [{"path": "../core"}] } -` +`, }, { path: "/packages/babel-loader/src/index.ts", content: ` import type { Foo } from "../../core/src/index.js"; -` +`, }, { path: "/packages/core/tsconfig.json", @@ -47,7 +47,7 @@ import type { Foo } from "../../core/src/index.js"; }, "include": ["./src"] } -` +`, }, { path: "/packages/core/src/index.ts", @@ -58,7 +58,7 @@ export type Foo = {}; const bar: Bar = { prop: 0 } -` +`, }, { path: "/packages/core/src/loading-indicator.ts", @@ -70,7 +70,7 @@ export interface Bar { const bar: Bar = { prop: 1 } -` +`, }, ]; const host = createServerHost(files); @@ -83,9 +83,9 @@ const bar: Bar = { { file: files[1].path, // babel-loader/src/index.ts fileContent: files[1].content, - } - ] - } + }, + ], + }, }); session.executeCommandSeq({ command: protocol.CommandTypes.UpdateOpen, @@ -94,9 +94,9 @@ const bar: Bar = { { file: files[3].path, // core/src/index.ts fileContent: files[3].content, - } - ] - } + }, + ], + }, }); // Now change `babel-loader` project to no longer import `core` project session.executeCommandSeq({ @@ -109,18 +109,18 @@ const bar: Bar = { { start: { line: 1, - offset: 26 + offset: 26, }, end: { line: 1, - offset: 26 + offset: 26, }, newText: "// comment", - } - ] - } - ] - } + }, + ], + }, + ], + }, }); const loadingIndicatorScriptInfo = session.getProjectService().getScriptInfo(files[3].path)!; // At this point, we haven't updated `babel-loader` project yet, @@ -134,7 +134,7 @@ const bar: Bar = { file: files[3].path, // core/src/index.ts line: 5, // `prop` offset: 5, - } + }, }); baselineTsserverLogs("findAllReferences", "does not try to open a file in a project that was updated and no longer has the file", session); }); diff --git a/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts b/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts index 6dbfe687f421e..e726f0aad630b 100644 --- a/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts +++ b/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts @@ -52,8 +52,8 @@ describe("unittests:: tsserver:: forceConsistentCasingInFileNames", () => { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompilerOptionsDiagnosticsFull, arguments: { - projectFileName: tsconfig.path - } + projectFileName: tsconfig.path, + }, }); baselineTsserverLogs("forceConsistentCasingInFileNames", "works when extends is specified with a case insensitive file system", session); }); @@ -61,17 +61,17 @@ describe("unittests:: tsserver:: forceConsistentCasingInFileNames", () => { it("works when renaming file with different casing", () => { const loggerFile: File = { path: `/user/username/projects/myproject/Logger.ts`, - content: `export class logger { }` + content: `export class logger { }`, }; const anotherFile: File = { path: `/user/username/projects/myproject/another.ts`, - content: `import { logger } from "./Logger"; new logger();` + content: `import { logger } from "./Logger"; new logger();`, }; const tsconfig: File = { path: `/user/username/projects/myproject/tsconfig.json`, content: JSON.stringify({ - compilerOptions: { forceConsistentCasingInFileNames: true } - }) + compilerOptions: { forceConsistentCasingInFileNames: true }, + }), }; const host = createServerHost([loggerFile, anotherFile, tsconfig, libFile, tsconfig]); @@ -96,10 +96,10 @@ describe("unittests:: tsserver:: forceConsistentCasingInFileNames", () => { ...protocolTextSpanFromSubstring( anotherFile.content, "./Logger" - ) - }] - }] - } + ), + }], + }], + }, }); // Check errors in both files @@ -110,17 +110,17 @@ describe("unittests:: tsserver:: forceConsistentCasingInFileNames", () => { it("when changing module name with different casing", () => { const loggerFile: File = { path: `/user/username/projects/myproject/Logger.ts`, - content: `export class logger { }` + content: `export class logger { }`, }; const anotherFile: File = { path: `/user/username/projects/myproject/another.ts`, - content: `import { logger } from "./Logger"; new logger();` + content: `import { logger } from "./Logger"; new logger();`, }; const tsconfig: File = { path: `/user/username/projects/myproject/tsconfig.json`, content: JSON.stringify({ - compilerOptions: { forceConsistentCasingInFileNames: true } - }) + compilerOptions: { forceConsistentCasingInFileNames: true }, + }), }; const host = createServerHost([loggerFile, anotherFile, tsconfig, libFile, tsconfig]); @@ -138,10 +138,10 @@ describe("unittests:: tsserver:: forceConsistentCasingInFileNames", () => { ...protocolTextSpanFromSubstring( anotherFile.content, "./Logger" - ) - }] - }] - } + ), + }], + }], + }, }); // Check errors in both files diff --git a/src/testRunner/unittests/tsserver/formatSettings.ts b/src/testRunner/unittests/tsserver/formatSettings.ts index 2978804b91d8a..5ac809f0d2791 100644 --- a/src/testRunner/unittests/tsserver/formatSettings.ts +++ b/src/testRunner/unittests/tsserver/formatSettings.ts @@ -6,7 +6,7 @@ describe("unittests:: tsserver:: formatSettings", () => { it("can be set globally", () => { const f1 = { path: "/a/b/app.ts", - content: "let x;" + content: "let x;", }; const host = createServerHost([f1]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -18,7 +18,7 @@ describe("unittests:: tsserver:: formatSettings", () => { const newGlobalSettings1 = { ...defaultSettings, placeOpenBraceOnNewLineForControlBlocks: !defaultSettings.placeOpenBraceOnNewLineForControlBlocks }; session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Configure, - arguments: { formatOptions: newGlobalSettings1 } + arguments: { formatOptions: newGlobalSettings1 }, }); // get format options for file - should be equal to new global settings @@ -28,7 +28,7 @@ describe("unittests:: tsserver:: formatSettings", () => { const newPerFileSettings = { ...defaultSettings, insertSpaceAfterCommaDelimiter: !defaultSettings.insertSpaceAfterCommaDelimiter }; session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Configure, - arguments: { formatOptions: newPerFileSettings, file: f1.path } + arguments: { formatOptions: newPerFileSettings, file: f1.path }, }); // get format options for file - should be equal to new per-file settings @@ -38,7 +38,7 @@ describe("unittests:: tsserver:: formatSettings", () => { const newGlobalSettings2 = { ...defaultSettings, insertSpaceAfterSemicolonInForStatements: !defaultSettings.insertSpaceAfterSemicolonInForStatements }; session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Configure, - arguments: { formatOptions: newGlobalSettings2 } + arguments: { formatOptions: newGlobalSettings2 }, }); // get format options for file - should be equal to new per-file settings diff --git a/src/testRunner/unittests/tsserver/getApplicableRefactors.ts b/src/testRunner/unittests/tsserver/getApplicableRefactors.ts index 793ee5cfd0979..03ed1542cfb8f 100644 --- a/src/testRunner/unittests/tsserver/getApplicableRefactors.ts +++ b/src/testRunner/unittests/tsserver/getApplicableRefactors.ts @@ -18,7 +18,7 @@ describe("unittests:: tsserver:: getApplicableRefactors", () => { openFilesForSession([aTs], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.GetApplicableRefactors, - arguments: { file: aTs.path, line: 1, offset: 1 } + arguments: { file: aTs.path, line: 1, offset: 1 }, }); baselineTsserverLogs("getApplicableRefactors", "works when taking position", session); }); diff --git a/src/testRunner/unittests/tsserver/getEditsForFileRename.ts b/src/testRunner/unittests/tsserver/getEditsForFileRename.ts index e9e717cce003b..d7ebe9570845b 100644 --- a/src/testRunner/unittests/tsserver/getEditsForFileRename.ts +++ b/src/testRunner/unittests/tsserver/getEditsForFileRename.ts @@ -86,7 +86,7 @@ describe("unittests:: tsserver:: getEditsForFileRename", () => { arguments: { oldFilePath: aOldTs.path, newFilePath: "/a/new.ts", - } + }, }); baselineTsserverLogs("getEditsForFileRename", "works with multiple projects", session); }); @@ -105,7 +105,7 @@ describe("unittests:: tsserver:: getEditsForFileRename", () => { arguments: { oldFilePath: "/b.ts", newFilePath: cTs.path, - } + }, }); baselineTsserverLogs("getEditsForFileRename", "works with file moved to inferred project", session); }); diff --git a/src/testRunner/unittests/tsserver/getFileReferences.ts b/src/testRunner/unittests/tsserver/getFileReferences.ts index 147f9091c3f1d..057ab0dcb2240 100644 --- a/src/testRunner/unittests/tsserver/getFileReferences.ts +++ b/src/testRunner/unittests/tsserver/getFileReferences.ts @@ -26,11 +26,11 @@ describe("unittests:: tsserver:: getFileReferences", () => { }; const cTs: File = { path: "/project/c.ts", - content: importCurlyFromA + content: importCurlyFromA, }; const dTs: File = { path: "/project/d.ts", - content: [importAFromA, typeofImportA].join("\n") + content: [importAFromA, typeofImportA].join("\n"), }; const tsconfig: File = { path: "/project/tsconfig.json", @@ -59,8 +59,8 @@ describe("unittests:: tsserver:: getFileReferences", () => { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Configure, arguments: { - preferences: { disableLineTextInReferences: true } - } + preferences: { disableLineTextInReferences: true }, + }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.FileReferences, diff --git a/src/testRunner/unittests/tsserver/getMoveToRefactoringFileSuggestions.ts b/src/testRunner/unittests/tsserver/getMoveToRefactoringFileSuggestions.ts index e70ab769cb052..f4d8976e6b53b 100644 --- a/src/testRunner/unittests/tsserver/getMoveToRefactoringFileSuggestions.ts +++ b/src/testRunner/unittests/tsserver/getMoveToRefactoringFileSuggestions.ts @@ -3,11 +3,11 @@ import { baselineTsserverLogs, createLoggerWithInMemoryLogs, createSession, - openFilesForSession + openFilesForSession, } from "../helpers/tsserver"; import { createServerHost, - File + File, } from "../helpers/virtualFileSystemWithWatch"; describe("unittests:: tsserver:: getMoveToRefactoringFileSuggestions", () => { @@ -17,22 +17,22 @@ describe("unittests:: tsserver:: getMoveToRefactoringFileSuggestions", () => { content: `interface ka { name: string; } - ` + `, }; const file2: File = { path: "/project/b/file2.ts", content: "" }; const file3: File = { path: "/project/d/e/file3.ts", content: "" }; const file4: File = { path: "/project/a/file4.ts", content: `import { value } from "../node_modules/@types/node/someFile.d.ts"; -import { value1 } from "../node_modules/.cache/someFile.d.ts";` +import { value1 } from "../node_modules/.cache/someFile.d.ts";`, }; const nodeModulesFile1: File = { path: "project/node_modules/@types/node/someFile.d.ts", - content: `export const value = 0;` + content: `export const value = 0;`, }; const nodeModulesFile2: File = { path: "project/node_modules/.cache/someFile.d.ts", - content: `export const value1 = 0;` + content: `export const value1 = 0;`, }; const tsconfig: File = { path: "/project/tsconfig.json", @@ -43,7 +43,7 @@ import { value1 } from "../node_modules/.cache/someFile.d.ts";` openFilesForSession([file1], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.GetMoveToRefactoringFileSuggestions, - arguments: { file: file1.path, line: 1, offset: 11 } + arguments: { file: file1.path, line: 1, offset: 11 }, }); baselineTsserverLogs("getMoveToRefactoringFileSuggestions", "works for suggesting a list of files, excluding node_modules within a project", session); }); @@ -53,7 +53,7 @@ import { value1 } from "../node_modules/.cache/someFile.d.ts";` content: `interface ka { name: string; } - ` + `, }; const file2: File = { path: "/file2.tsx", content: "" }; const file3: File = { path: "/file3.mts", content: "" }; @@ -69,14 +69,14 @@ import { value1 } from "../node_modules/.cache/someFile.d.ts";` session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.GetMoveToRefactoringFileSuggestions, - arguments: { file: file1.path, line: 1, offset: 11 } + arguments: { file: file1.path, line: 1, offset: 11 }, }); baselineTsserverLogs("getMoveToRefactoringFileSuggestions", "suggests only .ts file for a .ts filepath", session); }); it("suggests only .js file for a .js filepath", () => { const file1: File = { path: "/file1.js", - content: `class C {}` + content: `class C {}`, }; const file2: File = { path: "/file2.js", content: "" }; const file3: File = { path: "/file3.mts", content: "" }; @@ -90,14 +90,14 @@ import { value1 } from "../node_modules/.cache/someFile.d.ts";` session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.GetMoveToRefactoringFileSuggestions, - arguments: { file: file1.path, line: 1, offset: 7 } + arguments: { file: file1.path, line: 1, offset: 7 }, }); baselineTsserverLogs("getMoveToRefactoringFileSuggestions", "suggests only .js file for a .js filepath", session); }); it("skips lib.d.ts files", () => { const file1: File = { path: "/file1.d.ts", - content: `class C {}` + content: `class C {}`, }; const file2: File = { path: "/a/lib.d.ts", content: "" }; const file3: File = { path: "/a/file3.d.ts", content: "" }; @@ -110,7 +110,7 @@ import { value1 } from "../node_modules/.cache/someFile.d.ts";` session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.GetMoveToRefactoringFileSuggestions, - arguments: { file: file1.path, line: 1, offset: 7 } + arguments: { file: file1.path, line: 1, offset: 7 }, }); baselineTsserverLogs("getMoveToRefactoringFileSuggestions", "skips lib.d.ts files", session); }); diff --git a/src/testRunner/unittests/tsserver/goToDefinition.ts b/src/testRunner/unittests/tsserver/goToDefinition.ts index 852fc7d5588b3..61e7b5694185d 100644 --- a/src/testRunner/unittests/tsserver/goToDefinition.ts +++ b/src/testRunner/unittests/tsserver/goToDefinition.ts @@ -20,7 +20,7 @@ describe("unittests:: services:: goToDefinition", () => { }, "include": ["src"], } -` +`, }, { path: "/packages/babel-loader/src/index.ts", @@ -32,7 +32,7 @@ declare class Stuff { checkFooIs(value: object): void; } -` +`, }, ]; const host = createServerHost(files); @@ -45,9 +45,9 @@ declare class Stuff { { file: files[1].path, // babel-loader/src/index.ts fileContent: files[1].content, - } - ] - } + }, + ], + }, }); session.executeCommandSeq({ command: protocol.CommandTypes.Definition, @@ -62,7 +62,7 @@ declare class Stuff { command: protocol.CommandTypes.SemanticDiagnosticsSync, arguments: { file: "/packages/babel-loader/src/index.ts", - } + }, }); baselineTsserverLogs("goToDefinition", "does not issue errors on jsdoc in TS", session); @@ -84,7 +84,7 @@ declare class Stuff { }, "include": ["src"], } -` +`, }, { path: "/packages/babel-loader/src/index.ts", @@ -102,7 +102,7 @@ declare class Stuff { */ on_init(f: (() => void) | undefined): void } -` +`, }, ]; const host = createServerHost(files); @@ -115,9 +115,9 @@ declare class Stuff { { file: files[1].path, // babel-loader/src/index.ts fileContent: files[1].content, - } - ] - } + }, + ], + }, }); session.executeCommandSeq({ command: protocol.CommandTypes.Definition, @@ -132,7 +132,7 @@ declare class Stuff { command: protocol.CommandTypes.SemanticDiagnosticsSync, arguments: { file: "/packages/babel-loader/src/index.ts", - } + }, }); baselineTsserverLogs("goToDefinition", "does not issue errors on jsdoc in TS2", session); diff --git a/src/testRunner/unittests/tsserver/importHelpers.ts b/src/testRunner/unittests/tsserver/importHelpers.ts index cad9e1c491552..7bc807fd57a24 100644 --- a/src/testRunner/unittests/tsserver/importHelpers.ts +++ b/src/testRunner/unittests/tsserver/importHelpers.ts @@ -11,11 +11,11 @@ describe("unittests:: tsserver:: importHelpers", () => { it("should not crash in tsserver", () => { const f1 = { path: "/a/app.ts", - content: "export async function foo() { return 100; }" + content: "export async function foo() { return 100; }", }; const tslib = { path: "/a/node_modules/tslib/index.d.ts", - content: "" + content: "", }; const host = createServerHost([f1, tslib]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); diff --git a/src/testRunner/unittests/tsserver/inconsistentErrorInEditor.ts b/src/testRunner/unittests/tsserver/inconsistentErrorInEditor.ts index fdee92a017186..3a80c1437731d 100644 --- a/src/testRunner/unittests/tsserver/inconsistentErrorInEditor.ts +++ b/src/testRunner/unittests/tsserver/inconsistentErrorInEditor.ts @@ -21,10 +21,10 @@ describe("unittests:: tsserver:: inconsistentErrorInEditor", () => { { file: "^/untitled/ts-nul-authority/Untitled-1", fileContent: "export function foo() {\r\n /*$*/return bar;\r\n}\r\n\r\nexport function bar(x: T) {\r\n return x;\r\n}\r\n\r\nlet x = foo()(42);", - scriptKindName: "TS" - } - ] - } + scriptKindName: "TS", + }, + ], + }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EncodedSemanticClassificationsFull, @@ -32,8 +32,8 @@ describe("unittests:: tsserver:: inconsistentErrorInEditor", () => { file: "^/untitled/ts-nul-authority/Untitled-1", start: 0, length: 128, - format: "2020" - } + format: "2020", + }, }); verifyGetErrRequest({ session, files: ["^/untitled/ts-nul-authority/Untitled-1"] }); baselineTsserverLogs("inconsistentErrorInEditor", "should not error", session); @@ -53,10 +53,10 @@ describe("unittests:: tsserver:: inconsistentErrorInEditor2", () => { { file: "^/untitled/ts-nul-authority/Untitled-1", fileContent: "function fn(Foo: number) {\r\n type Foo = typeof Foo;\r\n return 0 as any as {x: Foo};\r\n}", - scriptKindName: "TS" - } - ] - } + scriptKindName: "TS", + }, + ], + }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EncodedSemanticClassificationsFull, @@ -64,8 +64,8 @@ describe("unittests:: tsserver:: inconsistentErrorInEditor2", () => { file: "^/untitled/ts-nul-authority/Untitled-1", start: 0, length: 128, - format: "2020" - } + format: "2020", + }, }); verifyGetErrRequest({ session, files: ["^/untitled/ts-nul-authority/Untitled-1"] }); baselineTsserverLogs("inconsistentErrorInEditor2", "should not error", session); diff --git a/src/testRunner/unittests/tsserver/inferredProjects.ts b/src/testRunner/unittests/tsserver/inferredProjects.ts index abe55289e5222..74ca4f080cca8 100644 --- a/src/testRunner/unittests/tsserver/inferredProjects.ts +++ b/src/testRunner/unittests/tsserver/inferredProjects.ts @@ -23,12 +23,12 @@ describe("unittests:: tsserver:: inferredProjects", () => { content: ` import {f} from "./module" console.log(f) - ` + `, }; const moduleFile: File = { path: `/user/username/projects/myproject/module.d.ts`, - content: `export let x: number` + content: `export let x: number`, }; const host = createServerHost([appFile, moduleFile, libFile]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -39,7 +39,7 @@ describe("unittests:: tsserver:: inferredProjects", () => { it("should use only one inferred project if 'useOneInferredProject' is set", () => { const file1 = { path: `/user/username/projects/myproject/a/b/main.ts`, - content: "let x =1;" + content: "let x =1;", }; const configFile: File = { path: `/user/username/projects/myproject/a/b/tsconfig.json`, @@ -48,16 +48,16 @@ describe("unittests:: tsserver:: inferredProjects", () => { "target": "es6" }, "files": [ "main.ts" ] - }` + }`, }; const file2 = { path: `/user/username/projects/myproject/a/c/main.ts`, - content: "let x =1;" + content: "let x =1;", }; const file3 = { path: `/user/username/projects/myproject/a/d/main.ts`, - content: "let x =1;" + content: "let x =1;", }; const host = createServerHost([file1, file2, file3, libFile]); @@ -74,7 +74,7 @@ describe("unittests:: tsserver:: inferredProjects", () => { it("disable inferred project", () => { const file1 = { path: "/a/b/f1.ts", - content: "let x =1;" + content: "let x =1;", }; const host = createServerHost([file1]); @@ -89,11 +89,11 @@ describe("unittests:: tsserver:: inferredProjects", () => { it("project settings for inferred projects", () => { const file1 = { path: "/a/b/app.ts", - content: `import {x} from "mod"` + content: `import {x} from "mod"`, }; const modFile = { path: "/a/mod.ts", - content: "export let x: number" + content: "export let x: number", }; const host = createServerHost([file1, modFile]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -109,7 +109,7 @@ describe("unittests:: tsserver:: inferredProjects", () => { it("should support files without extensions", () => { const f = { path: "/a/compile", - content: "let x = 1" + content: "let x = 1", }; const host = createServerHost([f]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -127,41 +127,41 @@ describe("unittests:: tsserver:: inferredProjects", () => { const session = createSession(host, { useSingleInferredProject: true, useInferredProjectPerProjectRoot: true, - logger: createLoggerWithInMemoryLogs(host) + logger: createLoggerWithInMemoryLogs(host), }); setCompilerOptionsForInferredProjectsRequestForSession({ allowJs: true, - target: ts.ScriptTarget.ESNext + target: ts.ScriptTarget.ESNext, }, session); setCompilerOptionsForInferredProjectsRequestForSession({ options: { allowJs: true, - target: ts.ScriptTarget.ES2015 + target: ts.ScriptTarget.ES2015, }, - projectRootPath: "/b" + projectRootPath: "/b", }, session); openFilesForSession([{ file: file1.path, content: file1.content, scriptKindName: "JS", - projectRootPath: file1.projectRootPath + projectRootPath: file1.projectRootPath, }], session); openFilesForSession([{ file: file2.path, content: file2.content, scriptKindName: "JS", - projectRootPath: file2.projectRootPath + projectRootPath: file2.projectRootPath, }], session); openFilesForSession([{ file: file3.path, content: file3.content, scriptKindName: "JS", - projectRootPath: file3.projectRootPath + projectRootPath: file3.projectRootPath, }], session); openFilesForSession([{ file: file4.path, content: file4.content, - scriptKindName: "JS" + scriptKindName: "JS", }], session); const projectService = session.getProjectService(); @@ -177,20 +177,20 @@ describe("unittests:: tsserver:: inferredProjects", () => { { path: "/a/file1.ts", content: "let x = 1;" }, { path: "/A/file2.ts", content: "let y = 2;" }, { path: "/b/file2.ts", content: "let x = 3;" }, - { path: "/c/file3.ts", content: "let z = 4;" } + { path: "/c/file3.ts", content: "let z = 4;" }, ]; const host = createServerHost(files, { useCaseSensitiveFileNames }); const session = createSession(host, { useSingleInferredProject: true, useInferredProjectPerProjectRoot: true, logger: createLoggerWithInMemoryLogs(host) }); setCompilerOptionsForInferredProjectsRequestForSession({ allowJs: true, - target: ts.ScriptTarget.ESNext + target: ts.ScriptTarget.ESNext, }, session); setCompilerOptionsForInferredProjectsRequestForSession({ options: { allowJs: true, - target: ts.ScriptTarget.ES2015 + target: ts.ScriptTarget.ES2015, }, - projectRootPath: "/a" + projectRootPath: "/a", }, session); openClientFiles(["/a", "/a", "/b", undefined]); @@ -202,9 +202,9 @@ describe("unittests:: tsserver:: inferredProjects", () => { setCompilerOptionsForInferredProjectsRequestForSession({ options: { allowJs: true, - target: ts.ScriptTarget.ES2017 + target: ts.ScriptTarget.ES2017, }, - projectRootPath: "/A" + projectRootPath: "/A", }, session); openClientFiles(["/a", "/a", "/b", undefined]); @@ -232,19 +232,19 @@ describe("unittests:: tsserver:: inferredProjects", () => { it("should still retain configured project created while opening the file", () => { const appFile: File = { path: `/user/username/projects/myproject/app.ts`, - content: `const app = 20;` + content: `const app = 20;`, }; const config: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: "{}" + content: "{}", }; const jsFile1: File = { path: `/user/username/projects/myproject/jsFile1.js`, - content: `const jsFile1 = 10;` + content: `const jsFile1 = 10;`, }; const jsFile2: File = { path: `/user/username/projects/myproject/jsFile2.js`, - content: `const jsFile2 = 10;` + content: `const jsFile2 = 10;`, }; const host = createServerHost([appFile, libFile, config, jsFile1, jsFile2]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -284,7 +284,7 @@ describe("unittests:: tsserver:: inferredProjects", () => { const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); setCompilerOptionsForInferredProjectsRequestForSession({ allowJs: true, - target: ts.ScriptTarget.ES2015 + target: ts.ScriptTarget.ES2015, }, session); session.testhost.logTimeoutQueueLength(); baselineTsserverLogs("inferredProjects", "Setting compiler options for inferred projects when there are no open files should not schedule any refresh", session); diff --git a/src/testRunner/unittests/tsserver/inlayHints.ts b/src/testRunner/unittests/tsserver/inlayHints.ts index 375393932892b..b2c7e0a3d1a5d 100644 --- a/src/testRunner/unittests/tsserver/inlayHints.ts +++ b/src/testRunner/unittests/tsserver/inlayHints.ts @@ -18,11 +18,11 @@ import { describe("unittests:: tsserver:: inlayHints", () => { const configFile: File = { path: "/a/b/tsconfig.json", - content: "{}" + content: "{}", }; const app: File = { path: "/a/b/app.ts", - content: "declare function foo(param: any): void;\nfoo(12);" + content: "declare function foo(param: any): void;\nfoo(12);", }; it("with updateOpen request does not corrupt documents", () => { @@ -30,29 +30,29 @@ describe("unittests:: tsserver:: inlayHints", () => { const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Open, - arguments: { file: app.path } + arguments: { file: app.path }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Configure, arguments: { preferences: { - includeInlayParameterNameHints: "all" - } as ts.UserPreferences - } + includeInlayParameterNameHints: "all", + } as ts.UserPreferences, + }, }); verifyInlayHintResponse(session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.UpdateOpen, arguments: { - changedFiles: [{ fileName: app.path, textChanges: [{ start: { line: 1, offset: 39 }, end: { line: 1, offset: 39 }, newText: "//" }] }] - } + changedFiles: [{ fileName: app.path, textChanges: [{ start: { line: 1, offset: 39 }, end: { line: 1, offset: 39 }, newText: "//" }] }], + }, }); verifyInlayHintResponse(session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.UpdateOpen, arguments: { - changedFiles: [{ fileName: app.path, textChanges: [{ start: { line: 1, offset: 41 }, end: { line: 1, offset: 41 }, newText: "c" }] }] - } + changedFiles: [{ fileName: app.path, textChanges: [{ start: { line: 1, offset: 41 }, end: { line: 1, offset: 41 }, newText: "c" }] }], + }, }); verifyInlayHintResponse(session); baselineTsserverLogs("inlayHints", "with updateOpen request does not corrupt documents", session); @@ -64,7 +64,7 @@ describe("unittests:: tsserver:: inlayHints", () => { file: app.path, start: 0, length: app.content.length, - } + }, }); } }); diff --git a/src/testRunner/unittests/tsserver/jsdocTag.ts b/src/testRunner/unittests/tsserver/jsdocTag.ts index 1c1ffd51a1003..5d4cadc24f793 100644 --- a/src/testRunner/unittests/tsserver/jsdocTag.ts +++ b/src/testRunner/unittests/tsserver/jsdocTag.ts @@ -20,7 +20,7 @@ describe("unittests:: tsserver:: jsdocTag:: jsdoc @link ", () => { } "files": ["someFile1.js"] } -` +`, }; function assertQuickInfoJSDoc(subScenario: string, file: File, options: { displayPartsForJSDoc: boolean, @@ -32,7 +32,7 @@ describe("unittests:: tsserver:: jsdocTag:: jsdoc @link ", () => { const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Configure, - arguments: { preferences: { displayPartsForJSDoc } } + arguments: { preferences: { displayPartsForJSDoc } }, }); openFilesForSession([file], session); const indexOfX = file.content.indexOf("x"); @@ -41,7 +41,7 @@ describe("unittests:: tsserver:: jsdocTag:: jsdoc @link ", () => { arguments: { file: file.path, position: indexOfX, - } as ts.server.protocol.FileLocationRequestArgs + } as ts.server.protocol.FileLocationRequestArgs, }); baselineTsserverLogs("jsdocTag", subScenario, session); }); @@ -51,14 +51,14 @@ describe("unittests:: tsserver:: jsdocTag:: jsdoc @link ", () => { path: "/a/someFile1.js", content: `class C { } /** @wat {@link C} */ -var x = 1` +var x = 1`, }; const linkInComment: File = { path: "/a/someFile1.js", content: `class C { } /** {@link C} */ var x = 1 -;` +;`, }; assertQuickInfoJSDoc("for quickinfo, should provide display parts plus a span for a working link in a tag", linkInTag, { @@ -111,7 +111,7 @@ var x = 1 content: `class C { } /** @param y - {@link C} */ function x(y) { } -x(1)` +x(1)`, }; const { command, displayPartsForJSDoc } = options; @@ -119,7 +119,7 @@ x(1)` const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Configure, - arguments: { preferences: { displayPartsForJSDoc } } + arguments: { preferences: { displayPartsForJSDoc } }, }); openFilesForSession([linkInParamTag], session); const indexOfX = linkInParamTag.content.lastIndexOf("1"); @@ -127,11 +127,11 @@ x(1)` command: command as ts.server.protocol.CommandTypes.SignatureHelp, arguments: { triggerReason: { - kind: "invoked" + kind: "invoked", }, file: linkInParamTag.path, position: indexOfX, - } as ts.server.protocol.SignatureHelpRequestArgs + } as ts.server.protocol.SignatureHelpRequestArgs, }); baselineTsserverLogs("jsdocTag", subScenario, session); }); @@ -165,14 +165,14 @@ x(1)` content: `class C { } /** @param x - see {@link C} */ function foo (x) { } -foo` +foo`, }; const { command, displayPartsForJSDoc } = options; const host = createServerHost([linkInParamJSDoc, config]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Configure, - arguments: { preferences: { displayPartsForJSDoc } } + arguments: { preferences: { displayPartsForJSDoc } }, }); openFilesForSession([linkInParamJSDoc], session); const indexOfFoo = linkInParamJSDoc.content.lastIndexOf("fo"); @@ -182,7 +182,7 @@ foo` entryNames: ["foo"], file: linkInParamJSDoc.path, position: indexOfFoo, - } as ts.server.protocol.CompletionDetailsRequestArgs + } as ts.server.protocol.CompletionDetailsRequestArgs, }); baselineTsserverLogs("jsdocTag", subScenario, session); }); diff --git a/src/testRunner/unittests/tsserver/languageService.ts b/src/testRunner/unittests/tsserver/languageService.ts index ae95669213adb..378bf9cc05842 100644 --- a/src/testRunner/unittests/tsserver/languageService.ts +++ b/src/testRunner/unittests/tsserver/languageService.ts @@ -6,11 +6,11 @@ describe("unittests:: tsserver:: languageService", () => { it("should work correctly on case-sensitive file systems", () => { const lib = { path: "/a/Lib/lib.d.ts", - content: "let x: number" + content: "let x: number", }; const f = { path: "/a/b/app.ts", - content: "let x = 1;" + content: "let x = 1;", }; const host = createServerHost([lib, f], { executingFilePath: "/a/Lib/tsc.js", useCaseSensitiveFileNames: true }); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -25,36 +25,36 @@ describe("unittests:: tsserver:: languageService", () => { path: "/project/shared.ts", content: Utils.dedent` import {foo_a} from "foo"; - ` + `, }, { path: `/project/a/tsconfig.json`, - content: `{ "compilerOptions": { "paths": { "foo": ["./foo.d.ts"] } }, "files": ["./index.ts", "./foo.d.ts"] }` + content: `{ "compilerOptions": { "paths": { "foo": ["./foo.d.ts"] } }, "files": ["./index.ts", "./foo.d.ts"] }`, }, { path: `/project/a/foo.d.ts`, content: Utils.dedent` export const foo_a = 1; - ` + `, }, { path: "/project/a/index.ts", - content: `import "../shared";` + content: `import "../shared";`, }, { path: `/project/b/tsconfig.json`, - content: `{ "compilerOptions": { "paths": { "foo": ["./foo.d.ts"] } }, "files": ["./index.ts", "./foo.d.ts"] }` + content: `{ "compilerOptions": { "paths": { "foo": ["./foo.d.ts"] } }, "files": ["./index.ts", "./foo.d.ts"] }`, }, { path: `/project/b/foo.d.ts`, content: Utils.dedent` export const foo_b = 1; - ` + `, }, { path: "/project/b/index.ts", - content: `import "../shared";` - } + content: `import "../shared";`, + }, ]; const host = createServerHost(files, { executingFilePath: "/project/tsc.js", useCaseSensitiveFileNames: true }); diff --git a/src/testRunner/unittests/tsserver/libraryResolution.ts b/src/testRunner/unittests/tsserver/libraryResolution.ts index 213e538ed70c7..f28a9e4d91f40 100644 --- a/src/testRunner/unittests/tsserver/libraryResolution.ts +++ b/src/testRunner/unittests/tsserver/libraryResolution.ts @@ -3,7 +3,7 @@ import { baselineTsserverLogs, createLoggerWithInMemoryLogs, createSession, - openFilesForSession + openFilesForSession, } from "../helpers/tsserver"; describe("unittests:: tsserver:: libraryResolution", () => { diff --git a/src/testRunner/unittests/tsserver/maxNodeModuleJsDepth.ts b/src/testRunner/unittests/tsserver/maxNodeModuleJsDepth.ts index 02b722bf0165d..2f4fe30e0d392 100644 --- a/src/testRunner/unittests/tsserver/maxNodeModuleJsDepth.ts +++ b/src/testRunner/unittests/tsserver/maxNodeModuleJsDepth.ts @@ -17,11 +17,11 @@ describe("unittests:: tsserver:: maxNodeModuleJsDepth for inferred projects", () it("should be set to 2 if the project has js root files", () => { const file1: File = { path: "/a/b/file1.js", - content: `var t = require("test"); t.` + content: `var t = require("test"); t.`, }; const moduleFile: File = { path: "/a/b/node_modules/test/index.js", - content: `var v = 10; module.exports = v;` + content: `var v = 10; module.exports = v;`, }; const host = createServerHost([file1, moduleFile]); @@ -39,11 +39,11 @@ describe("unittests:: tsserver:: maxNodeModuleJsDepth for inferred projects", () it("should return to normal state when all js root files are removed from project", () => { const file1 = { path: "/a/file1.ts", - content: "let x =1;" + content: "let x =1;", }; const file2 = { path: "/a/file2.js", - content: "let x =1;" + content: "let x =1;", }; const host = createServerHost([file1, file2, libFile]); diff --git a/src/testRunner/unittests/tsserver/metadataInResponse.ts b/src/testRunner/unittests/tsserver/metadataInResponse.ts index e69b1ab1f198c..9bc2dc2c0af79 100644 --- a/src/testRunner/unittests/tsserver/metadataInResponse.ts +++ b/src/testRunner/unittests/tsserver/metadataInResponse.ts @@ -17,8 +17,8 @@ describe("unittests:: tsserver:: with metadataInResponse::", () => { const tsconfig: File = { path: "/tsconfig.json", content: JSON.stringify({ - compilerOptions: { plugins: [{ name: "myplugin" }] } - }) + compilerOptions: { plugins: [{ name: "myplugin" }] }, + }), }; function createHostWithPlugin(files: readonly File[]) { const host = createServerHost(files); @@ -36,9 +36,9 @@ describe("unittests:: tsserver:: with metadataInResponse::", () => { return result; }; return proxy; - } + }, }), - error: undefined + error: undefined, }; }; return host; @@ -48,7 +48,7 @@ describe("unittests:: tsserver:: with metadataInResponse::", () => { const completionRequestArgs: ts.server.protocol.CompletionsRequestArgs = { file: aTs.path, line: 1, - offset: aTs.content.indexOf("this.") + 1 + "this.".length + offset: aTs.content.indexOf("this.") + 1 + "this.".length, }; it("can pass through metadata when the command returns array", () => { @@ -57,7 +57,7 @@ describe("unittests:: tsserver:: with metadataInResponse::", () => { openFilesForSession([aTs], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Completions, - arguments: completionRequestArgs + arguments: completionRequestArgs, }); baselineTsserverLogs("metadataInResponse", "can pass through metadata when the command returns array", session); }); @@ -68,7 +68,7 @@ describe("unittests:: tsserver:: with metadataInResponse::", () => { openFilesForSession([aTs], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompletionInfo, - arguments: completionRequestArgs + arguments: completionRequestArgs, }); baselineTsserverLogs("metadataInResponse", "can pass through metadata when the command returns object", session); }); @@ -80,7 +80,7 @@ describe("unittests:: tsserver:: with metadataInResponse::", () => { openFilesForSession([aTs], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Completions, - arguments: { file: aTs.path, line: 1, offset: aTs.content.indexOf("x") + 1 } + arguments: { file: aTs.path, line: 1, offset: aTs.content.indexOf("x") + 1 }, }); baselineTsserverLogs("metadataInResponse", "returns undefined correctly", session); }); diff --git a/src/testRunner/unittests/tsserver/moduleResolution.ts b/src/testRunner/unittests/tsserver/moduleResolution.ts index f0ff49c993cfb..71ea21dc503c2 100644 --- a/src/testRunner/unittests/tsserver/moduleResolution.ts +++ b/src/testRunner/unittests/tsserver/moduleResolution.ts @@ -24,26 +24,26 @@ describe("unittests:: tsserver:: moduleResolution", () => { module: "Node16", outDir: "../out", traceResolution: true, - } - }) + }, + }), }; const packageFile: File = { path: `/user/username/projects/myproject/package.json`, - content: packageFileContents + content: packageFileContents, }; const fileA: File = { path: `/user/username/projects/myproject/src/fileA.ts`, content: Utils.dedent` import { foo } from "./fileB.mjs"; foo(); - ` + `, }; const fileB: File = { path: `/user/username/projects/myproject/src/fileB.mts`, content: Utils.dedent` export function foo() { } - ` + `, }; const host = createServerHost([configFile, fileA, fileB, packageFile, { ...libFile, path: "/a/lib/lib.es2016.full.d.ts" }]); const session = createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host) }); diff --git a/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts b/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts index 5e06f62d75a52..acc39d3981dd2 100644 --- a/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts +++ b/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts @@ -13,7 +13,7 @@ import { const packageJson: File = { path: "/package.json", - content: `{ "dependencies": { "mobx": "*" } }` + content: `{ "dependencies": { "mobx": "*" } }`, }; const aTs: File = { path: "/src/a.ts", @@ -37,15 +37,15 @@ const tsconfig: File = { }; const ambientDeclaration: File = { path: "/src/ambient.d.ts", - content: "declare module 'ambient' {}" + content: "declare module 'ambient' {}", }; const mobxPackageJson: File = { path: "/node_modules/mobx/package.json", - content: `{ "name": "mobx", "version": "1.0.0" }` + content: `{ "name": "mobx", "version": "1.0.0" }`, }; const mobxDts: File = { path: "/node_modules/mobx/index.d.ts", - content: "export declare function observable(): unknown;" + content: "export declare function observable(): unknown;", }; describe("unittests:: tsserver:: moduleSpecifierCache", () => { @@ -112,7 +112,7 @@ describe("unittests:: tsserver:: moduleSpecifierCache", () => { getWithPreferences({}); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Configure, - arguments: { preferences } + arguments: { preferences }, }); // Nothing changes yet getWithPreferences({}); @@ -125,7 +125,7 @@ describe("unittests:: tsserver:: moduleSpecifierCache", () => { // Test other affecting preference session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Configure, - arguments: { preferences: { importModuleSpecifierEnding: "js" } } + arguments: { preferences: { importModuleSpecifierEnding: "js" } }, }); triggerCompletions({ file: bTs.path, line: 1, offset: 3 }); getWithPreferences(preferences); @@ -152,7 +152,7 @@ function setup() { includeCompletionsWithInsertText: true, includeCompletionsWithSnippetText: true, }, - } + }, }); triggerCompletions({ file: bTs.path, line: 1, offset: 3 }); diff --git a/src/testRunner/unittests/tsserver/navTo.ts b/src/testRunner/unittests/tsserver/navTo.ts index db9303a635ee2..883d5bdbda56b 100644 --- a/src/testRunner/unittests/tsserver/navTo.ts +++ b/src/testRunner/unittests/tsserver/navTo.ts @@ -15,11 +15,11 @@ describe("unittests:: tsserver:: navigate-to for javascript project", () => { it("should not include type symbols", () => { const file1: File = { path: "/a/b/file1.js", - content: "function foo() {}" + content: "function foo() {}", }; const configFile: File = { path: "/a/b/jsconfig.json", - content: "{}" + content: "{}", }; const host = createServerHost([file1, configFile, libFile]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -28,12 +28,12 @@ describe("unittests:: tsserver:: navigate-to for javascript project", () => { // Try to find some interface type defined in lib.d.ts session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Navto, - arguments: { searchValue: "Document", file: file1.path, projectFileName: configFile.path } + arguments: { searchValue: "Document", file: file1.path, projectFileName: configFile.path }, }).response as ts.server.protocol.NavtoItem[]; session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Navto, - arguments: { searchValue: "foo", file: file1.path, projectFileName: configFile.path } + arguments: { searchValue: "foo", file: file1.path, projectFileName: configFile.path }, }).response as ts.server.protocol.NavtoItem[]; baselineTsserverLogs("navTo", "should not include type symbols", session); }); @@ -45,11 +45,11 @@ describe("unittests:: tsserver:: navigate-to for javascript project", () => { "compilerOptions": { "composite": true } -}` +}`, }; const file1: File = { path: "/a/index.ts", - content: "export const abcdef = 1;" + content: "export const abcdef = 1;", }; const configFile2: File = { path: "/b/tsconfig.json", @@ -60,12 +60,12 @@ describe("unittests:: tsserver:: navigate-to for javascript project", () => { "references": [ { "path": "../a" } ] -}` +}`, }; const file2: File = { path: "/b/index.ts", content: `import a = require("../a"); -export const ghijkl = a.abcdef;` +export const ghijkl = a.abcdef;`, }; const host = createServerHost([configFile1, file1, configFile2, file2]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -73,7 +73,7 @@ export const ghijkl = a.abcdef;` session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Navto, - arguments: { searchValue: "abcdef", file: file1.path } + arguments: { searchValue: "abcdef", file: file1.path }, }); baselineTsserverLogs("navTo", "should de-duplicate symbols", session); @@ -85,7 +85,7 @@ export const ghijkl = a.abcdef;` content: JSON.stringify({ references: [{ path: "./a" }, { path: "./b" }], files: [], - }) + }), }; const configFile1: File = { path: "/a/tsconfig.json", @@ -93,11 +93,11 @@ export const ghijkl = a.abcdef;` "compilerOptions": { "composite": true } -}` +}`, }; const file1: File = { path: "/a/index.ts", - content: "export const abcdef = 1;" + content: "export const abcdef = 1;", }; const configFile2: File = { path: "/b/tsconfig.json", @@ -108,12 +108,12 @@ export const ghijkl = a.abcdef;` "references": [ { "path": "../a" } ] -}` +}`, }; const file2: File = { path: "/b/index.ts", content: `import a = require("../a"); -export const ghijkl = a.abcdef;` +export const ghijkl = a.abcdef;`, }; const host = createServerHost([configFile1, file1, configFile2, file2, solutionConfig]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -121,7 +121,7 @@ export const ghijkl = a.abcdef;` session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Navto, - arguments: { searchValue: "abcdef" } + arguments: { searchValue: "abcdef" }, }); baselineTsserverLogs("navTo", "should de-duplicate symbols when searching all projects", session); }); @@ -129,11 +129,11 @@ export const ghijkl = a.abcdef;` it("should work with Deprecated", () => { const file1: File = { path: "/a/b/file1.js", - content: "/** @deprecated */\nfunction foo () {}" + content: "/** @deprecated */\nfunction foo () {}", }; const configFile: File = { path: "/a/b/jsconfig.json", - content: "{}" + content: "{}", }; const host = createServerHost([file1, configFile, libFile]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -142,7 +142,7 @@ export const ghijkl = a.abcdef;` // Try to find some interface type defined in lib.d.ts session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Navto, - arguments: { searchValue: "foo", file: file1.path, projectFileName: configFile.path } + arguments: { searchValue: "foo", file: file1.path, projectFileName: configFile.path }, }); baselineTsserverLogs("navTo", "should work with Deprecated", session); }); diff --git a/src/testRunner/unittests/tsserver/occurences.ts b/src/testRunner/unittests/tsserver/occurences.ts index e9eb1552bf3e3..c89b4754db866 100644 --- a/src/testRunner/unittests/tsserver/occurences.ts +++ b/src/testRunner/unittests/tsserver/occurences.ts @@ -14,7 +14,7 @@ describe("unittests:: tsserver:: occurrence highlight on string", () => { it("should be marked if only on string values", () => { const file1: File = { path: "/a/b/file1.ts", - content: `let t1 = "div";\nlet t2 = "div";\nlet t3 = { "div": 123 };\nlet t4 = t3["div"];` + content: `let t1 = "div";\nlet t2 = "div";\nlet t3 = { "div": 123 };\nlet t4 = t3["div"];`, }; const host = createServerHost([file1]); @@ -22,17 +22,17 @@ describe("unittests:: tsserver:: occurrence highlight on string", () => { openFilesForSession([file1], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.DocumentHighlights, - arguments: { file: file1.path, line: 1, offset: 11, filesToSearch: [file1.path] } + arguments: { file: file1.path, line: 1, offset: 11, filesToSearch: [file1.path] }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.DocumentHighlights, - arguments: { file: file1.path, line: 3, offset: 13, filesToSearch: [file1.path] } + arguments: { file: file1.path, line: 3, offset: 13, filesToSearch: [file1.path] }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.DocumentHighlights, - arguments: { file: file1.path, line: 4, offset: 14, filesToSearch: [file1.path] } + arguments: { file: file1.path, line: 4, offset: 14, filesToSearch: [file1.path] }, }); baselineTsserverLogs("occurences", "should be marked if only on string values", session); }); diff --git a/src/testRunner/unittests/tsserver/openFile.ts b/src/testRunner/unittests/tsserver/openFile.ts index 3d3c9c1929a85..110357c2b0327 100644 --- a/src/testRunner/unittests/tsserver/openFile.ts +++ b/src/testRunner/unittests/tsserver/openFile.ts @@ -21,7 +21,7 @@ describe("unittests:: tsserver:: Open-file", () => { it("can be reloaded with empty content", () => { const f = { path: "/a/b/app.ts", - content: "let x = 1" + content: "let x = 1", }; const projectFileName = "externalProject"; const host = createServerHost([f]); @@ -46,22 +46,22 @@ describe("unittests:: tsserver:: Open-file", () => { it(subScenario, () => { const file1: File = { path: "/a/b/src/app.ts", - content: "let x = 10;" + content: "let x = 10;", }; const file2: File = { path: "/a/B/lib/module2.ts", - content: "let z = 10;" + content: "let z = 10;", }; const configFile: File = { path: "/a/b/tsconfig.json", - content: "" + content: "", }; const configFile2: File = { path: "/a/tsconfig.json", - content: "" + content: "", }; const host = createServerHost([file1, file2, configFile, configFile2], { - useCaseSensitiveFileNames + useCaseSensitiveFileNames, }); const service = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -90,11 +90,11 @@ describe("unittests:: tsserver:: Open-file", () => { const projectFolder = "/user/someuser/projects/myproject"; const aFile: File = { path: `${projectFolder}/src/a.ts`, - content: "export const x = 0;" + content: "export const x = 0;", }; const configFile: File = { path: `${projectFolder}/tsconfig.json`, - content: "{}" + content: "{}", }; const files = [aFile, configFile, libFile]; const host = createServerHost(files); @@ -103,7 +103,7 @@ describe("unittests:: tsserver:: Open-file", () => { const bFile: File = { path: `${projectFolder}/src/b.ts`, - content: `export {}; declare module "./a" { export const y: number; }` + content: `export {}; declare module "./a" { export const y: number; }`, }; host.writeFile(bFile.path, bFile.content); service.openClientFile(bFile.path, /*fileContent*/ undefined, ts.ScriptKind.TS, projectFolder); @@ -114,11 +114,11 @@ describe("unittests:: tsserver:: Open-file", () => { const projectFolder = "/user/someuser/projects/myproject"; const aFile: File = { path: `${projectFolder}/src/a.ts`, - content: "export const x = 0;" + content: "export const x = 0;", }; const configFile: File = { path: `${projectFolder}/tsconfig.json`, - content: "{}" + content: "{}", }; const files = [aFile, configFile, libFile]; const host = createServerHost(files); @@ -148,7 +148,7 @@ function bar() { return z; } foo(); -bar();` +bar();`, }; const host = createServerHost([file, libFile]); const session = createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host) }); @@ -165,10 +165,10 @@ bar();` fileName: file.path, textChanges: [{ newText: " ", - ...locationOfTsIgnore - }] - }] - } + ...locationOfTsIgnore, + }], + }], + }, }); verifyGetErrRequest({ session, files: [file] }); // Revert the change and no errors should be reported @@ -179,10 +179,10 @@ bar();` fileName: file.path, textChanges: [{ newText: tsIgnoreComment, - ...locationOfTsIgnore - }] - }] - } + ...locationOfTsIgnore, + }], + }], + }, }); verifyGetErrRequest({ session, files: [file] }); baselineTsserverLogs("openfile", "when file makes edits to add/remove comment directives, they are handled correcrly", session); @@ -208,10 +208,10 @@ bar();` fileName, changes: [{ span: { start: 0, length: 0 }, - newText: "export const y = 10;" - }] - }] - } + newText: "export const y = 10;", + }], + }], + }, }); } diff --git a/src/testRunner/unittests/tsserver/packageJsonInfo.ts b/src/testRunner/unittests/tsserver/packageJsonInfo.ts index 1f7e4a740c5f1..7929c36c8816c 100644 --- a/src/testRunner/unittests/tsserver/packageJsonInfo.ts +++ b/src/testRunner/unittests/tsserver/packageJsonInfo.ts @@ -12,25 +12,25 @@ import { const tsConfig: File = { path: "/tsconfig.json", - content: "{}" + content: "{}", }; const packageJsonContent = { dependencies: { - redux: "*" + redux: "*", }, peerDependencies: { - react: "*" + react: "*", }, optionalDependencies: { - typescript: "*" + typescript: "*", }, devDependencies: { - webpack: "*" - } + webpack: "*", + }, }; const packageJson: File = { path: "/package.json", - content: JSON.stringify(packageJsonContent, undefined, 2) + content: JSON.stringify(packageJsonContent, undefined, 2), }; describe("unittests:: tsserver:: packageJsonInfo::", () => { @@ -52,7 +52,7 @@ describe("unittests:: tsserver:: packageJsonInfo::", () => { // Edit package.json host.writeFile(packageJson.path, JSON.stringify({ ...packageJsonContent, - dependencies: undefined + dependencies: undefined, })); session.testhost.baselineHost("Edit package.json"); packageJsonInfo = projectService.packageJsonCache.getInDirectory("/" as ts.Path)!; diff --git a/src/testRunner/unittests/tsserver/partialSemanticServer.ts b/src/testRunner/unittests/tsserver/partialSemanticServer.ts index ed8d7a988dad4..cbe2c337ab335 100644 --- a/src/testRunner/unittests/tsserver/partialSemanticServer.ts +++ b/src/testRunner/unittests/tsserver/partialSemanticServer.ts @@ -20,25 +20,25 @@ describe("unittests:: tsserver:: Semantic operations on partialSemanticServer", path: `/user/username/projects/myproject/a.ts`, content: `import { y, cc } from "./b"; import { something } from "something"; -class c { prop = "hello"; foo() { return this.prop; } }` +class c { prop = "hello"; foo() { return this.prop; } }`, }; const file2: File = { path: `/user/username/projects/myproject/b.ts`, content: `export { cc } from "./c"; import { something } from "something"; - export const y = 10;` + export const y = 10;`, }; const file3: File = { path: `/user/username/projects/myproject/c.ts`, - content: `export const cc = 10;` + content: `export const cc = 10;`, }; const something: File = { path: `/user/username/projects/myproject/node_modules/something/index.d.ts`, - content: "export const something = 10;" + content: "export const something = 10;", }; const configFile: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: "{}" + content: "{}", }; const host = createServerHost([file1, file2, file3, something, libFile, configFile]); const session = createSession(host, { @@ -62,7 +62,7 @@ import { something } from "something"; function verifyCompletions() { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Completions, - arguments: protocolFileLocationFromSubstring(file1, "prop", { index: 1 }) + arguments: protocolFileLocationFromSubstring(file1, "prop", { index: 1 }), }); } }); @@ -74,7 +74,7 @@ import { something } from "something"; try { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.SemanticDiagnosticsSync, - arguments: { file: file1.path } + arguments: { file: file1.path }, }); } catch (e) { @@ -94,11 +94,11 @@ import { something } from "something"; it("allows syntactic diagnostic commands", () => { const file1: File = { path: `/user/username/projects/myproject/a.ts`, - content: `if (a < (b + c) { }` + content: `if (a < (b + c) { }`, }; const configFile: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: `{}` + content: `{}`, }; const expectedErrorMessage = "')' expected."; @@ -106,7 +106,7 @@ import { something } from "something"; const session = createSession(host, { serverMode: ts.LanguageServiceMode.PartialSemantic, useSingleInferredProject: true, - logger: createLoggerWithInMemoryLogs(host) + logger: createLoggerWithInMemoryLogs(host), }); const service = session.getProjectService(); @@ -115,7 +115,7 @@ import { something } from "something"; type: "request", seq: 1, command: ts.server.protocol.CommandTypes.SyntacticDiagnosticsSync, - arguments: { file: file1.path } + arguments: { file: file1.path }, }; const response = session.executeCommandSeq(request).response as ts.server.protocol.SyntacticDiagnosticsSyncResponse["body"]; assert.isDefined(response); @@ -135,7 +135,7 @@ import { something } from "something"; const { host, session, file1 } = setup(); const atTypes: File = { path: `/node_modules/@types/somemodule/index.d.ts`, - content: "export const something = 10;" + content: "export const something = 10;", }; host.ensureFileOrFolder(atTypes); openFilesForSession([file1], session); @@ -147,25 +147,25 @@ import { something } from "something"; path: `/user/username/projects/myproject/a.ts`, content: `/// /// -function fooA() { }` +function fooA() { }`, }; const file2: File = { path: `/user/username/projects/myproject/b.ts`, content: `/// /// -function fooB() { }` +function fooB() { }`, }; const file3: File = { path: `/user/username/projects/myproject/c.ts`, - content: `function fooC() { }` + content: `function fooC() { }`, }; const something: File = { path: `/user/username/projects/myproject/node_modules/something/index.d.ts`, - content: "function something() {}" + content: "function something() {}", }; const configFile: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: "{}" + content: "{}", }; const host = createServerHost([file1, file2, file3, something, libFile, configFile]); const session = createSession(host, { @@ -205,11 +205,11 @@ function fooB() { }` }; const packageJson: File = { path: "/package.json", - content: `{ "dependencies": { "@angular/forms": "*", "@angular/core": "*" } }` + content: `{ "dependencies": { "@angular/forms": "*", "@angular/core": "*" } }`, }; const indexTs: File = { path: "/index.ts", - content: "" + content: "", }; const host = createServerHost([angularFormsDts, angularFormsPackageJson, tsconfig, packageJson, indexTs, libFile]); const session = createSession(host, { serverMode: ts.LanguageServiceMode.PartialSemantic, useSingleInferredProject: true, logger: createLoggerWithInMemoryLogs(host) }); @@ -227,7 +227,7 @@ function fooB() { }` openFilesForSession([file1], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.DefinitionAndBoundSpan, - arguments: protocolFileLocationFromSubstring(file1, `"./b"`) + arguments: protocolFileLocationFromSubstring(file1, `"./b"`), }); baselineTsserverLogs("partialSemanticServer", "should support go-to-definition on module specifiers", session); }); diff --git a/src/testRunner/unittests/tsserver/plugins.ts b/src/testRunner/unittests/tsserver/plugins.ts index df0befc74e0d1..bd1dcb27ab8db 100644 --- a/src/testRunner/unittests/tsserver/plugins.ts +++ b/src/testRunner/unittests/tsserver/plugins.ts @@ -28,13 +28,13 @@ describe("unittests:: tsserver:: plugins:: loading", () => { info.session?.addProtocolHandler(testProtocolCommand, request => { session.logger.log(`addProtocolHandler: ${JSON.stringify(request, undefined, " ")}`); return { - response: testProtocolCommandResponse + response: testProtocolCommandResponse, }; }); return Harness.LanguageService.makeDefaultProxy(info); - } + }, }), - error: undefined + error: undefined, }; }; const session = createSession(host, { ...opts, logger: createLoggerWithInMemoryLogs(host) }); @@ -51,10 +51,10 @@ describe("unittests:: tsserver:: plugins:: loading", () => { compilerOptions: { plugins: [ ...[...expectedToLoad, ...notToLoad].map(name => ({ name })), - { transform: "some-transform" } - ] - } - }) + { transform: "some-transform" }, + ], + }, + }), }; const { session } = createHostWithPlugin([aTs, tsconfig, libFile]); openFilesForSession([aTs], session); @@ -67,7 +67,7 @@ describe("unittests:: tsserver:: plugins:: loading", () => { const aTs: File = { path: "/a.ts", content: `class c { prop = "hello"; foo() { return this.prop; } }` }; const tsconfig: File = { path: "/tsconfig.json", - content: "{}" + content: "{}", }; const { session } = createHostWithPlugin([aTs, tsconfig, libFile], { globalPlugins: [...expectedToLoad, ...notToLoad] }); openFilesForSession([aTs], session); @@ -82,10 +82,10 @@ describe("unittests:: tsserver:: plugins:: loading", () => { content: JSON.stringify({ compilerOptions: { plugins: [ - { name: pluginName } - ] - } - }) + { name: pluginName }, + ], + }, + }), }; const { session } = createHostWithPlugin([aTs, tsconfig, libFile]); @@ -94,7 +94,7 @@ describe("unittests:: tsserver:: plugins:: loading", () => { session.executeCommandSeq({ command: testProtocolCommand, - arguments: testProtocolCommandRequest + arguments: testProtocolCommandRequest, }); baselineTsserverLogs("plugins", "With session and custom protocol message", session); @@ -106,9 +106,9 @@ describe("unittests:: tsserver:: plugins:: loading", () => { path: `/user/username/projects/myproject/tsconfig.json`, content: JSON.stringify({ compilerOptions: { - plugins: [{ name: "some-plugin" }] - } - }) + plugins: [{ name: "some-plugin" }], + }, + }), }; const externalFiles: ts.MapLike = { @@ -124,10 +124,10 @@ describe("unittests:: tsserver:: plugins:: loading", () => { session.logger.log(`PluginFactory Invoke`); return { create: Harness.LanguageService.makeDefaultProxy, - getExternalFiles: () => externalFiles[moduleName] + getExternalFiles: () => externalFiles[moduleName], }; }, - error: undefined + error: undefined, }; }; const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -136,8 +136,8 @@ describe("unittests:: tsserver:: plugins:: loading", () => { host.writeFile(tsconfig.path, JSON.stringify({ compilerOptions: { - plugins: [{ name: "some-other-plugin" }] - } + plugins: [{ name: "some-other-plugin" }], + }, })); host.runQueuedTimeoutCallbacks(); session.logger.log(`ExternalFiles:: ${JSON.stringify(session.getProjectService().configuredProjects.get(tsconfig.path)!.getExternalFiles())}`); @@ -150,21 +150,21 @@ describe("unittests:: tsserver:: plugins:: overriding getSupportedCodeFixes", () it("getSupportedCodeFixes can be proxied", () => { const aTs: File = { path: "/a.ts", - content: `class c { prop = "hello"; foo() { const x = 0; } }` + content: `class c { prop = "hello"; foo() { const x = 0; } }`, }; const bTs: File = { path: "/b.ts", - content: aTs.content + content: aTs.content, }; const cTs: File = { path: "/c.ts", - content: aTs.content + content: aTs.content, }; const config: File = { path: "/tsconfig.json", content: JSON.stringify({ - compilerOptions: { plugins: [{ name: "myplugin" }] } - }) + compilerOptions: { plugins: [{ name: "myplugin" }] }, + }), }; const host = createServerHost([aTs, bTs, cTs, config, libFile]); host.require = () => { @@ -184,9 +184,9 @@ describe("unittests:: tsserver:: plugins:: overriding getSupportedCodeFixes", () } }; return proxy; - } + }, }), - error: undefined + error: undefined, }; }; const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -197,19 +197,19 @@ describe("unittests:: tsserver:: plugins:: overriding getSupportedCodeFixes", () }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.GetSupportedCodeFixes, - arguments: { file: aTs.path } + arguments: { file: aTs.path }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.GetSupportedCodeFixes, - arguments: { file: bTs.path } + arguments: { file: bTs.path }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.GetSupportedCodeFixes, - arguments: { file: cTs.path } + arguments: { file: cTs.path }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.GetSupportedCodeFixes, - arguments: { projectFileName: config.path } + arguments: { projectFileName: config.path }, }); baselineTsserverLogs("plugins", "getSupportedCodeFixes can be proxied", session); diff --git a/src/testRunner/unittests/tsserver/pluginsAsync.ts b/src/testRunner/unittests/tsserver/pluginsAsync.ts index 1dda2ff6d5dce..31cf05d1fd932 100644 --- a/src/testRunner/unittests/tsserver/pluginsAsync.ts +++ b/src/testRunner/unittests/tsserver/pluginsAsync.ts @@ -28,7 +28,7 @@ describe("unittests:: tsserver:: pluginsAsync:: async loaded plugins", () => { pluginInvoked = true; return { create: info => info.languageService }; }) as ts.server.PluginModuleFactory, - error: undefined + error: undefined, }; }; @@ -67,7 +67,7 @@ describe("unittests:: tsserver:: pluginsAsync:: async loaded plugins", () => { session.logger.log(`invoke plugin ${moduleName}`); return { create: info => info.languageService }; }) as ts.server.PluginModuleFactory, - error: undefined + error: undefined, }; }; @@ -93,7 +93,7 @@ describe("unittests:: tsserver:: pluginsAsync:: async loaded plugins", () => { await Promise.resolve(); // simulate at least a single turn delay return { module: (() => ({ create: info => info.languageService })) as ts.server.PluginModuleFactory, - error: undefined + error: undefined, }; }; @@ -118,7 +118,7 @@ describe("unittests:: tsserver:: pluginsAsync:: async loaded plugins", () => { create: info => info.languageService, getExternalFiles: () => ["external.txt"], })) as ts.server.PluginModuleFactory, - error: undefined + error: undefined, }; }; @@ -152,7 +152,7 @@ describe("unittests:: tsserver:: pluginsAsync:: async loaded plugins", () => { await projectClosed.promise; return { module: (() => ({ create: info => info.languageService })) as ts.server.PluginModuleFactory, - error: undefined + error: undefined, }; }; diff --git a/src/testRunner/unittests/tsserver/projectErrors.ts b/src/testRunner/unittests/tsserver/projectErrors.ts index 20f38c4ab8fc4..80a82f97fa5a9 100644 --- a/src/testRunner/unittests/tsserver/projectErrors.ts +++ b/src/testRunner/unittests/tsserver/projectErrors.ts @@ -25,25 +25,25 @@ describe("unittests:: tsserver:: projectErrors::", () => { it("external project - diagnostics for missing files", () => { const file1 = { path: "/a/b/app.ts", - content: "" + content: "", }; const file2 = { path: "/a/b/applib.ts", - content: "" + content: "", }; const host = createServerHost([file1, libFile]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); const projectFileName = "/a/b/test.csproj"; const compilerOptionsRequest: TestSessionRequest = { command: ts.server.protocol.CommandTypes.CompilerOptionsDiagnosticsFull, - arguments: { projectFileName } + arguments: { projectFileName }, }; { openExternalProjectForSession({ projectFileName, options: {}, - rootFiles: toExternalFiles([file1.path, file2.path]) + rootFiles: toExternalFiles([file1.path, file2.path]), }, session); session.executeCommandSeq(compilerOptionsRequest); @@ -66,22 +66,22 @@ describe("unittests:: tsserver:: projectErrors::", () => { it("configured projects - diagnostics for missing files", () => { const file1 = { path: "/a/b/app.ts", - content: "" + content: "", }; const file2 = { path: "/a/b/applib.ts", - content: "" + content: "", }; const config = { path: "/a/b/tsconfig.json", - content: JSON.stringify({ files: [file1, file2].map(f => ts.getBaseFileName(f.path)) }) + content: JSON.stringify({ files: [file1, file2].map(f => ts.getBaseFileName(f.path)) }), }; const host = createServerHost([file1, config, libFile]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); openFilesForSession([file1], session); const compilerOptionsRequest: TestSessionRequest = { command: ts.server.protocol.CommandTypes.CompilerOptionsDiagnosticsFull, - arguments: { projectFileName: config.path } + arguments: { projectFileName: config.path }, }; session.executeCommandSeq(compilerOptionsRequest); @@ -94,19 +94,19 @@ describe("unittests:: tsserver:: projectErrors::", () => { it("configured projects - diagnostics for corrupted config 1", () => { const file1 = { path: "/a/b/app.ts", - content: "" + content: "", }; const file2 = { path: "/a/b/lib.ts", - content: "" + content: "", }; const correctConfig = { path: "/a/b/tsconfig.json", - content: JSON.stringify({ files: [file1, file2].map(f => ts.getBaseFileName(f.path)) }) + content: JSON.stringify({ files: [file1, file2].map(f => ts.getBaseFileName(f.path)) }), }; const corruptedConfig = { path: correctConfig.path, - content: correctConfig.content.substr(1) + content: correctConfig.content.substr(1), }; const host = createServerHost([file1, file2, corruptedConfig]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -115,14 +115,14 @@ describe("unittests:: tsserver:: projectErrors::", () => { { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.SynchronizeProjectList, - arguments: { knownProjects: [] } + arguments: { knownProjects: [] }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.SemanticDiagnosticsSync, arguments: { file: corruptedConfig.path, - projectFileName: corruptedConfig.path - } + projectFileName: corruptedConfig.path, + }, }); } // fix config and trigger watcher @@ -130,14 +130,14 @@ describe("unittests:: tsserver:: projectErrors::", () => { { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.SynchronizeProjectList, - arguments: { knownProjects: [] } + arguments: { knownProjects: [] }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.SemanticDiagnosticsSync, arguments: { file: correctConfig.path, - projectFileName: correctConfig.path - } + projectFileName: correctConfig.path, + }, }); } baselineTsserverLogs("projectErrors", "configured projects - diagnostics for corrupted config 1", session); @@ -146,19 +146,19 @@ describe("unittests:: tsserver:: projectErrors::", () => { it("configured projects - diagnostics for corrupted config 2", () => { const file1 = { path: "/a/b/app.ts", - content: "" + content: "", }; const file2 = { path: "/a/b/lib.ts", - content: "" + content: "", }; const correctConfig = { path: "/a/b/tsconfig.json", - content: JSON.stringify({ files: [file1, file2].map(f => ts.getBaseFileName(f.path)) }) + content: JSON.stringify({ files: [file1, file2].map(f => ts.getBaseFileName(f.path)) }), }; const corruptedConfig = { path: correctConfig.path, - content: correctConfig.content.substr(1) + content: correctConfig.content.substr(1), }; const host = createServerHost([file1, file2, correctConfig]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -167,14 +167,14 @@ describe("unittests:: tsserver:: projectErrors::", () => { { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.SynchronizeProjectList, - arguments: { knownProjects: [] } + arguments: { knownProjects: [] }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.SemanticDiagnosticsSync, arguments: { file: correctConfig.path, - projectFileName: correctConfig.path - } + projectFileName: correctConfig.path, + }, }); } // break config and trigger watcher @@ -182,14 +182,14 @@ describe("unittests:: tsserver:: projectErrors::", () => { { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.SynchronizeProjectList, - arguments: { knownProjects: [] } + arguments: { knownProjects: [] }, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.SemanticDiagnosticsSync, arguments: { file: corruptedConfig.path, - projectFileName: corruptedConfig.path - } + projectFileName: corruptedConfig.path, + }, }); } baselineTsserverLogs("projectErrors", "configured projects - diagnostics for corrupted config 2", session); @@ -200,11 +200,11 @@ describe("unittests:: tsserver:: projectErrors:: are reported as appropriate", ( it("document is not contained in project", () => { const file1 = { path: "/a/b/app.ts", - content: "" + content: "", }; const corruptedConfig = { path: "/a/b/tsconfig.json", - content: "{" + content: "{", }; const host = createServerHost([file1, corruptedConfig]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -217,11 +217,11 @@ describe("unittests:: tsserver:: projectErrors:: are reported as appropriate", ( const folderPath = "/user/someuser/projects/someFolder"; const fileInRoot: File = { path: `/src/somefile.d.ts`, - content: "class c { }" + content: "class c { }", }; const fileInProjectRoot: File = { path: `${folderPath}/src/somefile.d.ts`, - content: "class c { }" + content: "class c { }", }; const host = createServerHost([libFile, fileInRoot, fileInProjectRoot]); const session = createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host), useInferredProjectPerProjectRoot: true }); @@ -237,8 +237,8 @@ describe("unittests:: tsserver:: projectErrors:: are reported as appropriate", ( file: untitledFile, fileContent, scriptKindName: "TS", - projectRootPath: useProjectRoot ? folderPath : undefined - } + projectRootPath: useProjectRoot ? folderPath : undefined, + }, }); appendAllScriptInfos(session); @@ -260,22 +260,22 @@ describe("unittests:: tsserver:: projectErrors:: are reported as appropriate", ( const projectDir = "/a/b/projects/myproject"; const app: File = { path: `${projectDir}/bar/app.ts`, - content: "class Bar implements foo.Foo { getFoo() { return ''; } get2() { return 1; } }" + content: "class Bar implements foo.Foo { getFoo() { return ''; } get2() { return 1; } }", }; const foo: File = { path: `${projectDir}/foo/foo.ts`, - content: "declare namespace foo { interface Foo { get2(): number; getFoo(): string; } }" + content: "declare namespace foo { interface Foo { get2(): number; getFoo(): string; } }", }; const configFile: File = { path: `${projectDir}/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { module: "none", targer: "es5" }, exclude: ["node_modules"] }) + content: JSON.stringify({ compilerOptions: { module: "none", targer: "es5" }, exclude: ["node_modules"] }), }; const host = createServerHost([app, foo, configFile]); const session = createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host) }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Open, - arguments: { file: app.path, } + arguments: { file: app.path }, }); verifyGetErrRequest({ session, files: [app] }); @@ -289,7 +289,7 @@ describe("unittests:: tsserver:: projectErrors:: are reported as appropriate", ( it("Getting errors before opening file", () => { const file: File = { path: "/a/b/project/file.ts", - content: "let x: number = false;" + content: "let x: number = false;", }; const host = createServerHost([file, libFile]); const session = createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host) }); @@ -297,8 +297,8 @@ describe("unittests:: tsserver:: projectErrors:: are reported as appropriate", ( command: ts.server.protocol.CommandTypes.Geterr, arguments: { delay: 0, - files: [file.path] - } + files: [file.path], + }, }); host.runQueuedTimeoutCallbacks(); @@ -308,15 +308,15 @@ describe("unittests:: tsserver:: projectErrors:: are reported as appropriate", ( it("Reports errors correctly when file referenced by inferred project root, is opened right after closing the root file", () => { const app: File = { path: `/user/username/projects/myproject/src/client/app.js`, - content: "" + content: "", }; const serverUtilities: File = { path: `/user/username/projects/myproject/src/server/utilities.js`, - content: `function getHostName() { return "hello"; } export { getHostName };` + content: `function getHostName() { return "hello"; } export { getHostName };`, }; const backendTest: File = { path: `/user/username/projects/myproject/test/backend/index.js`, - content: `import { getHostName } from '../../src/server/utilities';export default getHostName;` + content: `import { getHostName } from '../../src/server/utilities';export default getHostName;`, }; const files = [libFile, app, serverUtilities, backendTest]; const host = createServerHost(files); @@ -337,24 +337,24 @@ describe("unittests:: tsserver:: projectErrors:: are reported as appropriate", ( content: `import * as myModule from "@custom/plugin"; function foo() { // hello -}` +}`, }; const config: File = { path: `${projectRootPath}/tsconfig.json`, - content: JSON.stringify({ include: ["src"] }) + content: JSON.stringify({ include: ["src"] }), }; const plugin: File = { path: `${projectRootPath}/node_modules/@custom/plugin/index.d.ts`, content: `import './proposed'; declare module '@custom/plugin' { export const version: string; -}` +}`, }; const pluginProposed: File = { path: `${projectRootPath}/node_modules/@custom/plugin/proposed.d.ts`, content: `declare module '@custom/plugin' { export const bar = 10; -}` +}`, }; const files = [libFile, aFile, config, plugin, pluginProposed]; const host = createServerHost(files); @@ -371,8 +371,8 @@ declare module '@custom/plugin' { offset: 8, endLine: 3, endOffset: 8, - insertString: "o" - } + insertString: "o", + }, }); verifyGetErrRequest({ session, files: [aFile] }); baselineTsserverLogs("projectErrors", `correct errors when resolution resolves to file that has same ambient module and is also module`, session); @@ -382,11 +382,11 @@ declare module '@custom/plugin' { const file: File = { path: `/user/username/projects/myproject/ui.ts`, content: `const x = async (_action: string) => { -};` +};`, }; const config: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: "{}" + content: "{}", }; verifyGetErrScenario({ scenario: "projectErrors", @@ -404,7 +404,7 @@ describe("unittests:: tsserver:: Project Errors for Configure file diagnostics e it("are generated when the config file has errors", () => { const file: File = { path: "/a/b/app.ts", - content: "let x = 10" + content: "let x = 10", }; const configFile: File = { path: "/a/b/tsconfig.json", @@ -413,7 +413,7 @@ describe("unittests:: tsserver:: Project Errors for Configure file diagnostics e "foo": "bar", "allowJS": true } - }` + }`, }; const host = createServerHost([file, libFile, configFile]); const session = createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host) }); @@ -424,13 +424,13 @@ describe("unittests:: tsserver:: Project Errors for Configure file diagnostics e it("are generated when the config file doesn't have errors", () => { const file: File = { path: "/a/b/app.ts", - content: "let x = 10" + content: "let x = 10", }; const configFile: File = { path: "/a/b/tsconfig.json", content: `{ "compilerOptions": {} - }` + }`, }; const host = createServerHost([file, libFile, configFile]); const session = createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host) }); @@ -441,13 +441,13 @@ describe("unittests:: tsserver:: Project Errors for Configure file diagnostics e it("are generated when the config file changes", () => { const file: File = { path: "/a/b/app.ts", - content: "let x = 10" + content: "let x = 10", }; const configFile = { path: "/a/b/tsconfig.json", content: `{ "compilerOptions": {} - }` + }`, }; const host = createServerHost([file, libFile, configFile]); @@ -473,15 +473,15 @@ describe("unittests:: tsserver:: Project Errors for Configure file diagnostics e it("are not generated when the config file does not include file opened and config file has errors", () => { const file: File = { path: "/a/b/app.ts", - content: "let x = 10" + content: "let x = 10", }; const file2: File = { path: "/a/b/test.ts", - content: "let x = 10" + content: "let x = 10", }; const file3: File = { path: "/a/b/test2.ts", - content: "let xy = 10" + content: "let xy = 10", }; const configFile: File = { path: "/a/b/tsconfig.json", @@ -491,7 +491,7 @@ describe("unittests:: tsserver:: Project Errors for Configure file diagnostics e "allowJS": true }, "files": ["app.ts"] - }` + }`, }; const host = createServerHost([file, libFile, configFile]); const session = createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host) }); @@ -505,7 +505,7 @@ describe("unittests:: tsserver:: Project Errors for Configure file diagnostics e it("are not generated when the config file has errors but suppressDiagnosticEvents is true", () => { const file: File = { path: "/a/b/app.ts", - content: "let x = 10" + content: "let x = 10", }; const configFile: File = { path: "/a/b/tsconfig.json", @@ -514,7 +514,7 @@ describe("unittests:: tsserver:: Project Errors for Configure file diagnostics e "foo": "bar", "allowJS": true } - }` + }`, }; const host = createServerHost([file, libFile, configFile]); const session = createSession(host, { canUseEvents: true, suppressDiagnosticEvents: true, logger: createLoggerWithInMemoryLogs(host) }); @@ -525,21 +525,21 @@ describe("unittests:: tsserver:: Project Errors for Configure file diagnostics e it("are not generated when the config file does not include file opened and doesnt contain any errors", () => { const file: File = { path: "/a/b/app.ts", - content: "let x = 10" + content: "let x = 10", }; const file2: File = { path: "/a/b/test.ts", - content: "let x = 10" + content: "let x = 10", }; const file3: File = { path: "/a/b/test2.ts", - content: "let xy = 10" + content: "let xy = 10", }; const configFile: File = { path: "/a/b/tsconfig.json", content: `{ "files": ["app.ts"] - }` + }`, }; const host = createServerHost([file, file2, file3, libFile, configFile]); @@ -554,7 +554,7 @@ describe("unittests:: tsserver:: Project Errors for Configure file diagnostics e it("contains the project reference errors", () => { const file: File = { path: "/a/b/app.ts", - content: "let x = 10" + content: "let x = 10", }; const noSuchTsconfig = "no-such-tsconfig.json"; const configFile: File = { @@ -562,7 +562,7 @@ describe("unittests:: tsserver:: Project Errors for Configure file diagnostics e content: `{ "files": ["app.ts"], "references": [{"path":"./${noSuchTsconfig}"}] - }` + }`, }; const host = createServerHost([file, libFile, configFile]); @@ -576,7 +576,7 @@ describe("unittests:: tsserver:: projectErrors:: dont include overwrite emit err it("for inferred project", () => { const f1 = { path: "/a/b/f1.js", - content: "function test1() { }" + content: "function test1() { }", }; const host = createServerHost([f1, libFile]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -586,13 +586,13 @@ describe("unittests:: tsserver:: projectErrors:: dont include overwrite emit err const projectFileName = projectService.inferredProjects[0].getProjectName(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompilerOptionsDiagnosticsFull, - arguments: { projectFileName } + arguments: { projectFileName }, }); setCompilerOptionsForInferredProjectsRequestForSession({ module: ts.ModuleKind.CommonJS }, session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompilerOptionsDiagnosticsFull, - arguments: { projectFileName } + arguments: { projectFileName }, }); baselineTsserverLogs("projectErrors", "for inferred project", session); }); @@ -600,7 +600,7 @@ describe("unittests:: tsserver:: projectErrors:: dont include overwrite emit err it("for external project", () => { const f1 = { path: "/a/b/f1.js", - content: "function test1() { }" + content: "function test1() { }", }; const host = createServerHost([f1, libFile]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -609,22 +609,22 @@ describe("unittests:: tsserver:: projectErrors:: dont include overwrite emit err openExternalProjectForSession({ projectFileName, rootFiles: externalFiles, - options: {} + options: {}, }, session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompilerOptionsDiagnosticsFull, - arguments: { projectFileName } + arguments: { projectFileName }, }); openExternalProjectForSession({ projectFileName, rootFiles: externalFiles, - options: { module: ts.ModuleKind.CommonJS } + options: { module: ts.ModuleKind.CommonJS }, }, session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompilerOptionsDiagnosticsFull, - arguments: { projectFileName } + arguments: { projectFileName }, }); baselineTsserverLogs("projectErrors", "for external project", session); }); @@ -634,7 +634,7 @@ describe("unittests:: tsserver:: projectErrors:: reports Options Diagnostic loca it("when options change", () => { const file = { path: "/a/b/app.ts", - content: "let x = 10" + content: "let x = 10", }; const configFileContentBeforeComment = `{`; const configFileContentComment = ` @@ -650,7 +650,7 @@ describe("unittests:: tsserver:: projectErrors:: reports Options Diagnostic loca const configFile = { path: "/a/b/tsconfig.json", - content: configFileContentWithComment + content: configFileContentWithComment, }; const host = createServerHost([file, libFile, configFile]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -658,14 +658,14 @@ describe("unittests:: tsserver:: projectErrors:: reports Options Diagnostic loca session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.SemanticDiagnosticsSync, - arguments: { file: configFile.path, projectFileName: configFile.path, includeLinePosition: true } + arguments: { file: configFile.path, projectFileName: configFile.path, includeLinePosition: true }, }); host.writeFile(configFile.path, configFileContentWithoutCommentLine); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.SemanticDiagnosticsSync, - arguments: { file: configFile.path, projectFileName: configFile.path, includeLinePosition: true } + arguments: { file: configFile.path, projectFileName: configFile.path, includeLinePosition: true }, }); baselineTsserverLogs("projectErrors", "when options change", session); }); @@ -686,7 +686,7 @@ describe("unittests:: tsserver:: projectErrors:: with config file change", () => session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.SemanticDiagnosticsSync, - arguments: { file: aTs.path } + arguments: { file: aTs.path }, }); baselineTsserverLogs("projectErrors", `diagnostics after noUnusedLabels changes`, session); }); @@ -698,21 +698,21 @@ describe("unittests:: tsserver:: projectErrors:: with resolveJsonModule", () => path: `/user/username/projects/myproject/src/test.ts`, content: `import * as blabla from "./blabla.json"; declare var console: any; -console.log(blabla);` +console.log(blabla);`, }; const blabla: File = { path: `/user/username/projects/myproject/src/blabla.json`, - content: "{}" + content: "{}", }; const tsconfig: File = { path: `/user/username/projects/myproject/tsconfig.json`, content: JSON.stringify({ compilerOptions: { resolveJsonModule: true, - composite: true + composite: true, }, - include - }) + include, + }), }; const host = createServerHost([test, blabla, libFile, tsconfig]); @@ -723,7 +723,7 @@ console.log(blabla);` it("should not report incorrect error when json is root file found by tsconfig", () => { const { session, test } = createSessionForTest({ - include: ["./src/*.ts", "./src/*.json"] + include: ["./src/*.ts", "./src/*.json"], }); verifyGetErrRequest({ session, files: [test] }); baselineTsserverLogs("projectErrors", `should not report incorrect error when json is root file found by tsconfig`, session); @@ -731,7 +731,7 @@ console.log(blabla);` it("should report error when json is not root file found by tsconfig", () => { const { session, test } = createSessionForTest({ - include: ["./src/*.ts"] + include: ["./src/*.ts"], }); verifyGetErrRequest({ session, files: [test] }); baselineTsserverLogs("projectErrors", `should report error when json is not root file found by tsconfig`, session); @@ -742,16 +742,16 @@ describe("unittests:: tsserver:: projectErrors:: with npm install when", () => { function verifyNpmInstall(timeoutDuringPartialInstallation: boolean) { const main: File = { path: `/user/username/projects/myproject/src/main.ts`, - content: "import * as _a from '@angular/core';" + content: "import * as _a from '@angular/core';", }; const config: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: "{}" + content: "{}", }; // Move things from staging to node_modules without triggering watch const moduleFile: File = { path: `/user/username/projects/myproject/node_modules/@angular/core/index.d.ts`, - content: `export const y = 10;` + content: `export const y = 10;`, }; const projectFiles = [main, libFile, config]; const host = createServerHost(projectFiles); diff --git a/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts b/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts index e9f24f00bf8b0..c194242a81d34 100644 --- a/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts +++ b/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts @@ -20,14 +20,14 @@ describe("unittests:: tsserver:: with project references and compile on save", ( path: `${dependecyLocation}/fns.ts`, content: `export function fn1() { } export function fn2() { } -` +`, }; const dependencyConfig: File = { path: `${dependecyLocation}/tsconfig.json`, content: JSON.stringify({ compilerOptions: { composite: true, declarationDir: "../decls" }, - compileOnSave: true - }) + compileOnSave: true, + }), }; const usageTs: File = { path: `${usageLocation}/usage.ts`, @@ -37,14 +37,14 @@ export function fn2() { } } from '../decls/fns' fn1(); fn2(); -` +`, }; const usageConfig: File = { path: `${usageLocation}/tsconfig.json`, content: JSON.stringify({ compileOnSave: true, - references: [{ path: "../dependency" }] - }) + references: [{ path: "../dependency" }], + }), }; const localChange = "function fn3() { }"; @@ -60,19 +60,19 @@ fn2(); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "when dependency project is not open and save on usage", session); }); @@ -84,19 +84,19 @@ fn2(); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "when dependency project is not open and save on usage with project", session); }); @@ -107,26 +107,26 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); host.writeFile(dependencyTs.path, `${dependencyTs.content}${localChange}`); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "when dependency project is not open and save on usage and local change to dependency", session); }); @@ -137,26 +137,26 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); host.writeFile(dependencyTs.path, `${dependencyTs.content}${localChange}`); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "when dependency project is not open and save on usage with project and local change to dependency", session); }); @@ -167,7 +167,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(usageTs.content); const location = toLocation(usageTs.content.length); @@ -178,26 +178,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: localChange - } + insertString: localChange, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "when dependency project is not open and save on usage and local change to usage", session); }); @@ -208,7 +208,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(usageTs.content); const location = toLocation(usageTs.content.length); @@ -219,26 +219,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: localChange - } + insertString: localChange, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "when dependency project is not open and save on usage with project and local change to usage", session); }); @@ -249,26 +249,26 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); host.writeFile(dependencyTs.path, `${dependencyTs.content}${change}`); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "when dependency project is not open and save on usage and change to depenedency", session); }); @@ -279,26 +279,26 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); host.writeFile(dependencyTs.path, `${dependencyTs.content}${change}`); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "when dependency project is not open and save on usage with project and change to depenedency", session); }); @@ -309,7 +309,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(usageTs.content); const location = toLocation(usageTs.content.length); @@ -320,26 +320,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: change - } + insertString: change, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "when dependency project is not open and save on usage and change to usage", session); }); @@ -350,7 +350,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(usageTs.content); const location = toLocation(usageTs.content.length); @@ -361,26 +361,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: change - } + insertString: change, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "when dependency project is not open and save on usage with project and change to usage", session); }); @@ -395,19 +395,19 @@ fn2(); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "when dependency project is not open and save on dependency", session); }); @@ -419,19 +419,19 @@ fn2(); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "when dependency project is not open and save on dependency with project", session); }); @@ -442,26 +442,26 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); host.writeFile(dependencyTs.path, `${dependencyTs.content}${localChange}`); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "when dependency project is not open and save on dependency and local change to dependency", session); }); @@ -472,26 +472,26 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); host.writeFile(dependencyTs.path, `${dependencyTs.content}${localChange}`); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "when dependency project is not open and save on dependency with project and local change to dependency", session); }); @@ -502,7 +502,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(usageTs.content); const location = toLocation(usageTs.content.length); @@ -513,26 +513,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: localChange - } + insertString: localChange, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "when dependency project is not open and save on dependency and local change to usage", session); }); @@ -543,7 +543,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(usageTs.content); const location = toLocation(usageTs.content.length); @@ -554,26 +554,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: localChange - } + insertString: localChange, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "when dependency project is not open and save on dependency with project and local change to usage", session); }); @@ -584,26 +584,26 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); host.writeFile(dependencyTs.path, `${dependencyTs.content}${change}`); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "when dependency project is not open and save on dependency and change to dependency", session); }); @@ -614,26 +614,26 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); host.writeFile(dependencyTs.path, `${dependencyTs.content}${change}`); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "when dependency project is not open and save on dependency with project and change to dependency", session); }); @@ -644,7 +644,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(usageTs.content); const location = toLocation(usageTs.content.length); @@ -655,26 +655,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: change - } + insertString: change, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "when dependency project is not open and save on dependency and change to usage", session); }); @@ -685,7 +685,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(usageTs.content); const location = toLocation(usageTs.content.length); @@ -696,26 +696,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: change - } + insertString: change, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "when dependency project is not open and save on dependency with project and change to usage", session); }); @@ -732,19 +732,19 @@ fn2(); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on usage", session); }); @@ -756,19 +756,19 @@ fn2(); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on usage with project", session); }); @@ -779,7 +779,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(dependencyTs.content); const location = toLocation(dependencyTs.content.length); @@ -790,26 +790,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: localChange - } + insertString: localChange, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on usage and local change to dependency", session); }); @@ -820,7 +820,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(dependencyTs.content); const location = toLocation(dependencyTs.content.length); @@ -831,26 +831,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: localChange - } + insertString: localChange, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on usage and local change to dependency with file", session); }); @@ -861,7 +861,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(usageTs.content); const location = toLocation(usageTs.content.length); @@ -872,26 +872,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: localChange - } + insertString: localChange, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on usage and local change to usage", session); }); @@ -902,7 +902,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(usageTs.content); const location = toLocation(usageTs.content.length); @@ -913,26 +913,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: localChange - } + insertString: localChange, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on usage and local change to usage with project", session); }); @@ -943,7 +943,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(dependencyTs.content); const location = toLocation(dependencyTs.content.length); @@ -954,26 +954,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: change - } + insertString: change, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on usage and change to dependency", session); }); @@ -984,7 +984,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(dependencyTs.content); const location = toLocation(dependencyTs.content.length); @@ -995,26 +995,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: change - } + insertString: change, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on usage with project and change to dependency", session); }); @@ -1025,7 +1025,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(usageTs.content); const location = toLocation(usageTs.content.length); @@ -1036,26 +1036,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: change - } + insertString: change, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: usageTs.path } + arguments: { file: usageTs.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on usage and change to usage", session); }); @@ -1066,7 +1066,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(usageTs.content); const location = toLocation(usageTs.content.length); @@ -1077,25 +1077,25 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: change - } + insertString: change, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: usageTs.path, projectFileName: usageConfig.path } + arguments: { file: usageTs.path, projectFileName: usageConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on usage with project and change to usage", session); }); @@ -1110,19 +1110,19 @@ fn2(); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on dependency with usage project", session); }); @@ -1133,7 +1133,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(dependencyTs.content); const location = toLocation(dependencyTs.content.length); @@ -1144,26 +1144,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: localChange - } + insertString: localChange, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on dependency with usage project and local change to dependency", session); }); @@ -1174,7 +1174,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(usageTs.content); const location = toLocation(usageTs.content.length); @@ -1185,26 +1185,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: localChange - } + insertString: localChange, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on dependency with usage project and local change to usage", session); }); @@ -1215,7 +1215,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(dependencyTs.content); const location = toLocation(dependencyTs.content.length); @@ -1226,26 +1226,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: change - } + insertString: change, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on dependency with usage project and change to dependency", session); }); @@ -1256,7 +1256,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(usageTs.content); const location = toLocation(usageTs.content.length); @@ -1267,26 +1267,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: change - } + insertString: change, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path, projectFileName: usageConfig.path } + arguments: { file: dependencyTs.path, projectFileName: usageConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on dependency with usage project and change to usage", session); }); @@ -1301,19 +1301,19 @@ fn2(); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on dependency", session); }); @@ -1325,19 +1325,19 @@ fn2(); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path } + arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path } + arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path } + arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on dependency with project", session); }); @@ -1348,7 +1348,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(dependencyTs.content); const location = toLocation(dependencyTs.content.length); @@ -1359,26 +1359,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: localChange - } + insertString: localChange, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on dependency and local change to dependency", session); }); @@ -1389,7 +1389,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(dependencyTs.content); const location = toLocation(dependencyTs.content.length); @@ -1400,26 +1400,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: localChange - } + insertString: localChange, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path } + arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path } + arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path } + arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on dependency with project and local change to dependency", session); }); @@ -1430,7 +1430,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(usageTs.content); const location = toLocation(usageTs.content.length); @@ -1441,26 +1441,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: localChange - } + insertString: localChange, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on dependency and local change to usage", session); }); @@ -1471,7 +1471,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(usageTs.content); const location = toLocation(usageTs.content.length); @@ -1482,26 +1482,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: localChange - } + insertString: localChange, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path } + arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path } + arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path } + arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on dependency with project and local change to usage", session); }); @@ -1512,7 +1512,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(dependencyTs.content); const location = toLocation(dependencyTs.content.length); @@ -1523,26 +1523,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: change - } + insertString: change, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on dependency and change to dependency", session); }); @@ -1553,7 +1553,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(dependencyTs.content); const location = toLocation(dependencyTs.content.length); @@ -1564,26 +1564,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: change - } + insertString: change, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path } + arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path } + arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path } + arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on dependency with project and change to dependency", session); }); @@ -1594,7 +1594,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(usageTs.content); const location = toLocation(usageTs.content.length); @@ -1605,26 +1605,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: change - } + insertString: change, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on dependency and change to usage", session); }); @@ -1635,7 +1635,7 @@ fn2(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path } + arguments: { file: dependencyTs.path }, }); const toLocation = protocolToLocation(usageTs.content); const location = toLocation(usageTs.content.length); @@ -1646,26 +1646,26 @@ fn2(); ...location, endLine: location.line, endOffset: location.offset, - insertString: change - } + insertString: change, + }, }); // Verify CompileOnSaveAffectedFileList session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList, - arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path } + arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path }, }); // Verify CompileOnSaveEmit session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, - arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path } + arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path }, }); // Verify EmitOutput session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.EmitOutput, - arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path } + arguments: { file: dependencyTs.path, projectFileName: dependencyConfig.path }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "save on dependency with project and change to usage", session); }); @@ -1681,9 +1681,9 @@ describe("unittests:: tsserver:: with project references and compile on save wit compileOnSave: true, compilerOptions: { module: "none", - composite: true - } - }) + composite: true, + }, + }), }; const buttonClass = `/user/username/projects/myproject/buttonClass`; const buttonConfig: File = { @@ -1691,10 +1691,10 @@ describe("unittests:: tsserver:: with project references and compile on save wit content: JSON.stringify({ extends: "../tsbase.json", compilerOptions: { - outFile: "Source.js" + outFile: "Source.js", }, - files: ["Source.ts"] - }) + files: ["Source.ts"], + }), }; const buttonSource: File = { path: `${buttonClass}/Source.ts`, @@ -1703,7 +1703,7 @@ describe("unittests:: tsserver:: with project references and compile on save wit public static myStaticFunction() { } } -}` +}`, }; const siblingClass = `/user/username/projects/myproject/SiblingClass`; @@ -1712,13 +1712,13 @@ describe("unittests:: tsserver:: with project references and compile on save wit content: JSON.stringify({ extends: "../tsbase.json", references: [{ - path: "../buttonClass/" + path: "../buttonClass/", }], compilerOptions: { - outFile: "Source.js" + outFile: "Source.js", }, - files: ["Source.ts"] - }) + files: ["Source.ts"], + }), }; const siblingSource: File = { path: `${siblingClass}/Source.ts`, @@ -1727,7 +1727,7 @@ describe("unittests:: tsserver:: with project references and compile on save wit public mySiblingFunction() { } } -}` +}`, }; const host = createServerHost([libFile, tsbaseJson, buttonConfig, buttonSource, siblingConfig, siblingSource], { useCaseSensitiveFileNames: true }); @@ -1741,8 +1741,8 @@ describe("unittests:: tsserver:: with project references and compile on save wit command: ts.server.protocol.CommandTypes.CompileOnSaveEmitFile, arguments: { file: siblingSource.path, - projectFileName: siblingConfig.path - } + projectFileName: siblingConfig.path, + }, }); baselineTsserverLogs("projectReferenceCompileOnSave", "compile on save emits same output as project build with external project", session); }); diff --git a/src/testRunner/unittests/tsserver/projectReferenceErrors.ts b/src/testRunner/unittests/tsserver/projectReferenceErrors.ts index 9b92d6c7cf0f7..a9d0b0cbe5c7b 100644 --- a/src/testRunner/unittests/tsserver/projectReferenceErrors.ts +++ b/src/testRunner/unittests/tsserver/projectReferenceErrors.ts @@ -28,8 +28,8 @@ describe("unittests:: tsserver:: with project references and error reporting", ( usageProjectDiagnostics(), { project: dependencyTs, - files: [dependencyTs, usageTs] - } + files: [dependencyTs, usageTs], + }, ], syncDiagnostics: () => [ // Without project @@ -51,7 +51,7 @@ describe("unittests:: tsserver:: with project references and error reporting", ( getErrRequest: () => [usageTs, dependencyTs], getErrForProjectRequest: () => [ usageProjectDiagnostics(), - dependencyProjectDiagnostics() + dependencyProjectDiagnostics(), ], syncDiagnostics: () => [ // Without project @@ -74,11 +74,11 @@ export function fn2() { } // Introduce error for fnErr import in main // export function fnErr() { } // Error in dependency ts file -export let x: string = 10;` +export let x: string = 10;`, }; const dependencyConfig: File = { path: `${dependecyLocation}/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { composite: true, declarationDir: "../decls" } }) + content: JSON.stringify({ compilerOptions: { composite: true, declarationDir: "../decls" } }), }; const usageTs: File = { path: `${usageLocation}/usage.ts`, @@ -90,14 +90,14 @@ export let x: string = 10;` fn1(); fn2(); fnErr(); -` +`, }; const usageConfig: File = { path: `${usageLocation}/tsconfig.json`, content: JSON.stringify({ compilerOptions: { composite: true }, - references: [{ path: "../dependency" }] - }) + references: [{ path: "../dependency" }], + }), }; verifyUsageAndDependency("with module scenario", dependencyTs, dependencyConfig, usageTs, usageConfig); }); @@ -110,25 +110,25 @@ function fn2() { } // Introduce error for fnErr import in main // function fnErr() { } // Error in dependency ts file -let x: string = 10;` +let x: string = 10;`, }; const dependencyConfig: File = { path: `${dependecyLocation}/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { composite: true, outFile: "../dependency.js" } }) + content: JSON.stringify({ compilerOptions: { composite: true, outFile: "../dependency.js" } }), }; const usageTs: File = { path: `${usageLocation}/usage.ts`, content: `fn1(); fn2(); fnErr(); -` +`, }; const usageConfig: File = { path: `${usageLocation}/tsconfig.json`, content: JSON.stringify({ compilerOptions: { composite: true, outFile: "../usage.js" }, - references: [{ path: "../dependency" }] - }) + references: [{ path: "../dependency" }], + }), }; verifyUsageAndDependency("with non module", dependencyTs, dependencyConfig, usageTs, usageConfig); }); diff --git a/src/testRunner/unittests/tsserver/projectReferences.ts b/src/testRunner/unittests/tsserver/projectReferences.ts index e9d07963f0cab..5a63ac047e3a3 100644 --- a/src/testRunner/unittests/tsserver/projectReferences.ts +++ b/src/testRunner/unittests/tsserver/projectReferences.ts @@ -45,26 +45,26 @@ describe("unittests:: tsserver:: with project references and tsbuild", () => { service.openExternalProjects([{ projectFileName: getTsBuildProjectFilePath(project, project), rootFiles: files.map(f => ({ fileName: f.path })), - options: {} + options: {}, }]); files.forEach(f => { const args: ts.server.protocol.FileRequestArgs = { file: f.path, - projectFileName: ts.endsWith(f.path, "tsconfig.json") ? f.path : undefined + projectFileName: ts.endsWith(f.path, "tsconfig.json") ? f.path : undefined, }; session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.SyntacticDiagnosticsSync, - arguments: args + arguments: args, }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.SemanticDiagnosticsSync, - arguments: args + arguments: args, }); }); const containerProject = service.configuredProjects.get(containerConfig.path)!; session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompilerOptionsDiagnosticsFull, - arguments: { projectFileName: containerProject.projectName } + arguments: { projectFileName: containerProject.projectName }, }); baselineTsserverLogs("projectReferences", `does not error on container only project`, session); }); @@ -76,7 +76,7 @@ describe("unittests:: tsserver:: with project references and tsbuild", () => { const myConstStart = protocolLocationFromSubstring(containerCompositeExec[1].content, "myConst"); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Rename, - arguments: { file: containerCompositeExec[1].path, ...myConstStart } + arguments: { file: containerCompositeExec[1].path, ...myConstStart }, }); baselineTsserverLogs("projectReferences", `can successfully find references with out option`, session); @@ -85,7 +85,7 @@ describe("unittests:: tsserver:: with project references and tsbuild", () => { it("ancestor and project ref management", () => { const tempFile: File = { path: `/user/username/projects/temp/temp.ts`, - content: "let x = 10" + content: "let x = 10", }; const host = createHostWithSolutionBuild(files.concat([tempFile]), [containerConfig.path]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -101,8 +101,8 @@ describe("unittests:: tsserver:: with project references and tsbuild", () => { command: ts.server.protocol.CommandTypes.Rename, arguments: { file: containerCompositeExec[1].path, - ...locationOfMyConst - } + ...locationOfMyConst, + }, }); // Open temp file and verify all projects alive @@ -128,15 +128,15 @@ describe("unittests:: tsserver:: with project references and tsbuild", () => { declarationMap: true, outDir: "../../out", baseUrl: "..", - disableSourceOfProjectReferenceRedirect + disableSourceOfProjectReferenceRedirect, }, - include: ["./**/*"] - }) + include: ["./**/*"], + }), }; const keyboardTs: File = { path: `${projectLocation}/src/common/input/keyboard.ts`, content: `function bar() { return "just a random function so .d.ts location doesnt match"; } -export function evaluateKeyboardEvent() { }` +export function evaluateKeyboardEvent() { }`, }; const keyboardTestTs: File = { path: `${projectLocation}/src/common/input/keyboard.test.ts`, @@ -144,7 +144,7 @@ export function evaluateKeyboardEvent() { }` function testEvaluateKeyboardEvent() { return evaluateKeyboardEvent(); } -` +`, }; const srcConfig: File = { path: `${projectLocation}/src/tsconfig.json`, @@ -158,13 +158,13 @@ function testEvaluateKeyboardEvent() { "common/*": ["./common/*"], }, tsBuildInfoFile: "../out/src.tsconfig.tsbuildinfo", - disableSourceOfProjectReferenceRedirect + disableSourceOfProjectReferenceRedirect, }, include: ["./**/*"], references: [ - { path: "./common" } - ] - }) + { path: "./common" }, + ], + }), }; const terminalTs: File = { path: `${projectLocation}/src/terminal.ts`, @@ -172,7 +172,7 @@ function testEvaluateKeyboardEvent() { function foo() { return evaluateKeyboardEvent(); } -` +`, }; const host = createHostWithSolutionBuild( [commonConfig, keyboardTs, keyboardTestTs, srcConfig, terminalTs, libFile], @@ -184,7 +184,7 @@ function foo() { const searchStr = "evaluateKeyboardEvent"; session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.References, - arguments: protocolFileLocationFromSubstring(keyboardTs, searchStr) + arguments: protocolFileLocationFromSubstring(keyboardTs, searchStr), }); baselineTsserverLogs("projectReferences", `root file is file from referenced project${disableSourceOfProjectReferenceRedirect ? " and using declaration maps" : ""}`, session); } @@ -206,29 +206,29 @@ function foo() { outDir: "../dist/", rootDir: "../", baseUrl: "../", - paths: { "@ref/*": ["./dist/*"] } - } - }) + paths: { "@ref/*": ["./dist/*"] }, + }, + }), }; const aTs: File = { path: `/user/username/projects/myproject/compositea/a.ts`, - content: `import { b } from "@ref/compositeb/b";` + content: `import { b } from "@ref/compositeb/b";`, }; const a2Ts: File = { path: `/user/username/projects/myproject/compositea/a2.ts`, - content: `export const x = 10;` + content: `export const x = 10;`, }; const configB: File = { path: `/user/username/projects/myproject/compositeb/tsconfig.json`, - content: configA.content + content: configA.content, }; const bTs: File = { path: `/user/username/projects/myproject/compositeb/b.ts`, - content: "export function b() {}" + content: "export function b() {}", }; const bDts: File = { path: `/user/username/projects/myproject/dist/compositeb/b.d.ts`, - content: "export declare function b(): void;" + content: "export declare function b(): void;", }; const configC: File = { path: `/user/username/projects/myproject/compositec/tsconfig.json`, @@ -238,14 +238,14 @@ function foo() { outDir: "../dist/", rootDir: "../", baseUrl: "../", - paths: { "@ref/*": ["./*"] } + paths: { "@ref/*": ["./*"] }, }, - references: [{ path: "../compositeb" }] - }) + references: [{ path: "../compositeb" }], + }), }; const cTs: File = { path: `/user/username/projects/myproject/compositec/c.ts`, - content: aTs.content + content: aTs.content, }; const files = [libFile, aTs, a2Ts, configA, bDts, bTs, configB, cTs, configC]; const host = createServerHost(files); @@ -318,10 +318,10 @@ function foo() { textChanges: [{ newText: "\n", start: { line: 5, offset: 1 }, - end: { line: 5, offset: 1 } - }] - }] - } + end: { line: 5, offset: 1 }, + }], + }], + }, }); verifyGetErrRequest({ session, files: [aTest] }); baselineTsserverLogs("projectReferences", `monorepo like with symlinks ${scenario} and solution is ${alreadyBuilt ? "built" : "not built"}${extraOptions.preserveSymlinks ? " with preserveSymlinks" : ""}`, session); @@ -335,18 +335,18 @@ function foo() { outDir: "lib", rootDir: "src", composite: true, - ...extraOptions + ...extraOptions, }, include: ["src"], - ...(references ? { references: references.map(path => ({ path })) } : {}) - }) + ...(references ? { references: references.map(path => ({ path })) } : {}), + }), }; } function file(packageName: string, fileName: string, content: string): File { return { path: `/user/username/projects/myproject/packages/${packageName}/src/${fileName}`, - content + content, }; } @@ -356,8 +356,8 @@ function foo() { path: `/user/username/projects/myproject/packages/B/package.json`, content: JSON.stringify({ main: "lib/index.js", - types: "lib/index.d.ts" - }) + types: "lib/index.d.ts", + }), }, aTest: file("A", "index.ts", `import { foo } from '${scope}b'; import { bar } from '${scope}b/lib/bar'; @@ -368,14 +368,14 @@ bar(); bBar: file("B", "bar.ts", `export function bar() { }`), bSymlink: { path: `/user/username/projects/myproject/node_modules/${scope}b`, - symLink: `/user/username/projects/myproject/packages/B` - } + symLink: `/user/username/projects/myproject/packages/B`, + }, })); verifySymlinkScenario(`when referencing file from subFolder${scope ? " with scoped package" : ""}`, () => ({ bPackageJson: { path: `/user/username/projects/myproject/packages/B/package.json`, - content: "{}" + content: "{}", }, aTest: file("A", "test.ts", `import { foo } from '${scope}b/lib/foo'; import { bar } from '${scope}b/lib/bar/foo'; @@ -386,8 +386,8 @@ bar(); bBar: file("B", "bar/foo.ts", `export function bar() { }`), bSymlink: { path: `/user/username/projects/myproject/node_modules/${scope}b`, - symLink: `/user/username/projects/myproject/packages/B` - } + symLink: `/user/username/projects/myproject/packages/B`, + }, })); } @@ -408,10 +408,10 @@ bar(); allowJs: true, emitDeclarationOnly: true, outDir: "lib", - rootDir: "src" + rootDir: "src", }, - include: ["src"] - }) + include: ["src"], + }), }; const compositePackageJson: File = { path: `/user/username/projects/myproject/packages/emit-composite/package.json`, @@ -419,15 +419,15 @@ bar(); name: "emit-composite", version: "1.0.0", main: "src/index.js", - typings: "lib/index.d.ts" - }) + typings: "lib/index.d.ts", + }), }; const compositeIndex: File = { path: `/user/username/projects/myproject/packages/emit-composite/src/index.js`, content: `const testModule = require('./testModule'); module.exports = { ...testModule -}` +}`, }; const compositeTestModule: File = { path: `/user/username/projects/myproject/packages/emit-composite/src/testModule.js`, @@ -438,24 +438,24 @@ module.exports = { } module.exports = { testCompositeFunction -}` +}`, }; const consumerConfig: File = { path: `/user/username/projects/myproject/packages/consumer/tsconfig.json`, content: JSON.stringify({ include: ["src"], - references: [{ path: "../emit-composite" }] - }) + references: [{ path: "../emit-composite" }], + }), }; const consumerIndex: File = { path: `/user/username/projects/myproject/packages/consumer/src/index.ts`, content: `import { testCompositeFunction } from 'emit-composite'; testCompositeFunction('why hello there'); -testCompositeFunction('why hello there', 42);` +testCompositeFunction('why hello there', 42);`, }; const symlink: SymLink = { path: `/user/username/projects/myproject/node_modules/emit-composite`, - symLink: `/user/username/projects/myproject/packages/emit-composite` + symLink: `/user/username/projects/myproject/packages/emit-composite`, }; const host = createServerHost([libFile, compositeConfig, compositePackageJson, compositeIndex, compositeTestModule, consumerConfig, consumerIndex, symlink], { useCaseSensitiveFileNames: true }); const session = createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host) }); @@ -474,18 +474,18 @@ testCompositeFunction('why hello there', 42);` references: [ { path: "./compiler" }, { path: "./services" }, - ] - }) + ], + }), }; const compilerConfig: File = { path: `${solutionLocation}/compiler/tsconfig.json`, content: JSON.stringify({ compilerOptions: { composite: true, - module: "none" + module: "none", }, - files: ["./types.ts", "./program.ts"] - }) + files: ["./types.ts", "./program.ts"], + }), }; const typesFile: File = { path: `${solutionLocation}/compiler/types.ts`, @@ -494,7 +494,7 @@ testCompositeFunction('why hello there', 42);` export interface Program { getSourceFiles(): string[]; } - }` + }`, }; const programFile: File = { path: `${solutionLocation}/compiler/program.ts`, @@ -504,26 +504,26 @@ testCompositeFunction('why hello there', 42);` getSourceFiles: () => [getSourceFile()] }; function getSourceFile() { return "something"; } - }` + }`, }; const servicesConfig: File = { path: `${solutionLocation}/services/tsconfig.json`, content: JSON.stringify({ compilerOptions: { - composite: true + composite: true, }, files: ["./services.ts"], references: [ - { path: "../compiler" } - ] - }) + { path: "../compiler" }, + ], + }), }; const servicesFile: File = { path: `${solutionLocation}/services/services.ts`, content: ` namespace ts { const result = program.getSourceFiles(); - }` + }`, }; const files = [libFile, solution, compilerConfig, typesFile, programFile, servicesConfig, servicesFile, libFile]; @@ -535,14 +535,14 @@ testCompositeFunction('why hello there', 42);` // Shouldnt load more projects session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.References, - arguments: protocolFileLocationFromSubstring(programFile, "getSourceFile", { index: 1 }) + arguments: protocolFileLocationFromSubstring(programFile, "getSourceFile", { index: 1 }), }); // Find all references for getSourceFiles // Should load more projects session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.References, - arguments: protocolFileLocationFromSubstring(programFile, "getSourceFiles") + arguments: protocolFileLocationFromSubstring(programFile, "getSourceFiles"), }); baselineTsserverLogs("projectReferences", `finding local reference doesnt load ancestor/sibling projects`, session); }); @@ -559,38 +559,38 @@ testCompositeFunction('why hello there', 42);` { path: "./b" }, { path: "./c" }, { path: "./d" }, - ] - }) + ], + }), }; const aConfig: File = { path: `${solutionLocation}/a/tsconfig.json`, content: JSON.stringify({ compilerOptions: { composite: true, - module: "none" + module: "none", }, - files: ["./index.ts"] - }) + files: ["./index.ts"], + }), }; const aFile: File = { path: `${solutionLocation}/a/index.ts`, content: ` export interface I { M(): void; - }` + }`, }; const bConfig: File = { path: `${solutionLocation}/b/tsconfig.json`, content: JSON.stringify({ compilerOptions: { - composite: true + composite: true, }, files: ["./index.ts"], references: [ - { path: "../a" } - ] - }) + { path: "../a" }, + ], + }), }; const bFile: File = { path: `${solutionLocation}/b/index.ts`, @@ -599,20 +599,20 @@ testCompositeFunction('why hello there', 42);` export class B implements I { M() {} - }` + }`, }; const cConfig: File = { path: `${solutionLocation}/c/tsconfig.json`, content: JSON.stringify({ compilerOptions: { - composite: true + composite: true, }, files: ["./index.ts"], references: [ - { path: "../b" } - ] - }) + { path: "../b" }, + ], + }), }; const cFile: File = { path: `${solutionLocation}/c/index.ts`, @@ -621,20 +621,20 @@ testCompositeFunction('why hello there', 42);` import { B } from "../b"; export const C: I = new B(); - ` + `, }; const dConfig: File = { path: `${solutionLocation}/d/tsconfig.json`, content: JSON.stringify({ compilerOptions: { - composite: true + composite: true, }, files: ["./index.ts"], references: [ - { path: "../c" } - ] - }) + { path: "../c" }, + ], + }), }; const dFile: File = { path: `${solutionLocation}/d/index.ts`, @@ -643,7 +643,7 @@ testCompositeFunction('why hello there', 42);` import { C } from "../c"; export const D: I = C; - ` + `, }; const files = [libFile, solutionConfig, aConfig, aFile, bConfig, bFile, cConfig, cFile, dConfig, dFile, libFile]; @@ -654,14 +654,14 @@ testCompositeFunction('why hello there', 42);` // The first search will trigger project loads session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.References, - arguments: protocolFileLocationFromSubstring(bFile, "I", { index: 1 }) + arguments: protocolFileLocationFromSubstring(bFile, "I", { index: 1 }), }); // The second search starts with the projects already loaded // Formerly, this would search some projects multiple times session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.References, - arguments: protocolFileLocationFromSubstring(bFile, "I", { index: 1 }) + arguments: protocolFileLocationFromSubstring(bFile, "I", { index: 1 }), }); baselineTsserverLogs("projectReferences", `finding references in overlapping projects`, session); @@ -678,8 +678,8 @@ testCompositeFunction('why hello there', 42);` references: [ { path: "./api" }, { path: "./app" }, - ] - }) + ], + }), }; const apiConfig: File = { path: `${solutionLocation}/api/tsconfig.json`, @@ -690,21 +690,21 @@ testCompositeFunction('why hello there', 42);` rootDir: "src", }, include: ["src"], - references: [{ path: "../shared" }] - }) + references: [{ path: "../shared" }], + }), }; const apiFile: File = { path: `${solutionLocation}/api/src/server.ts`, content: `import * as shared from "../../shared/dist"; -${usage}` +${usage}`, }; const appConfig: File = { path: `${solutionLocation}/app/tsconfig.json`, - content: apiConfig.content + content: apiConfig.content, }; const appFile: File = { path: `${solutionLocation}/app/src/app.ts`, - content: apiFile.content + content: apiFile.content, }; const sharedConfig: File = { path: `${solutionLocation}/shared/tsconfig.json`, @@ -714,12 +714,12 @@ ${usage}` outDir: "dist", rootDir: "src", }, - include: ["src"] - }) + include: ["src"], + }), }; const sharedFile: File = { path: `${solutionLocation}/shared/src/index.ts`, - content: definition + content: definition, }; const host = createServerHost([libFile, solution, libFile, apiConfig, apiFile, appConfig, appFile, sharedConfig, sharedFile]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -728,7 +728,7 @@ ${usage}` // Find all references session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.References, - arguments: protocolFileLocationFromSubstring(apiFile, referenceTerm) + arguments: protocolFileLocationFromSubstring(apiFile, referenceTerm), }); baselineTsserverLogs("projectReferences", `special handling of localness ${scenario}`, session); @@ -785,8 +785,8 @@ export const foo = local;`, references: [ { path: "./compiler" }, { path: "./services" }, - ] - }) + ], + }), }; const compilerConfig: File = { path: `${solutionLocation}/compiler/tsconfig.json`, @@ -794,10 +794,10 @@ export const foo = local;`, compilerOptions: { composite: true, module: "none", - disableSolutionSearching: true + disableSolutionSearching: true, }, - files: ["./types.ts", "./program.ts"] - }) + files: ["./types.ts", "./program.ts"], + }), }; const typesFile: File = { path: `${solutionLocation}/compiler/types.ts`, @@ -806,7 +806,7 @@ export const foo = local;`, export interface Program { getSourceFiles(): string[]; } - }` + }`, }; const programFile: File = { path: `${solutionLocation}/compiler/program.ts`, @@ -816,26 +816,26 @@ export const foo = local;`, getSourceFiles: () => [getSourceFile()] }; function getSourceFile() { return "something"; } - }` + }`, }; const servicesConfig: File = { path: `${solutionLocation}/services/tsconfig.json`, content: JSON.stringify({ compilerOptions: { - composite: true + composite: true, }, files: ["./services.ts"], references: [ - { path: "../compiler" } - ] - }) + { path: "../compiler" }, + ], + }), }; const servicesFile: File = { path: `${solutionLocation}/services/services.ts`, content: ` namespace ts { const result = program.getSourceFiles(); - }` + }`, }; const files = [libFile, solution, compilerConfig, typesFile, programFile, servicesConfig, servicesFile, libFile]; @@ -847,7 +847,7 @@ export const foo = local;`, // No new solutions/projects loaded session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.References, - arguments: protocolFileLocationFromSubstring(programFile, "getSourceFiles") + arguments: protocolFileLocationFromSubstring(programFile, "getSourceFiles"), }); baselineTsserverLogs("projectReferences", `with disableSolutionSearching solution and siblings are not loaded`, session); }); @@ -863,44 +863,44 @@ export const foo = local;`, const main: File = { path: `/user/username/projects/myproject/src/main.ts`, content: `import { foo } from 'helpers/functions'; -export { foo };` +export { foo };`, }; const helper: File = { path: `/user/username/projects/myproject/src/helpers/functions.ts`, - content: `export const foo = 1;` + content: `export const foo = 1;`, }; const mainDts: File = { path: `/user/username/projects/myproject/target/src/main.d.ts`, content: `import { foo } from 'helpers/functions'; export { foo }; -//# sourceMappingURL=main.d.ts.map` +//# sourceMappingURL=main.d.ts.map`, }; const mainDtsMap: File = { path: `/user/username/projects/myproject/target/src/main.d.ts.map`, - content: `{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAC,GAAG,EAAC,CAAC"}` + content: `{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAC,GAAG,EAAC,CAAC"}`, }; const helperDts: File = { path: `/user/username/projects/myproject/target/src/helpers/functions.d.ts`, content: `export declare const foo = 1; -//# sourceMappingURL=functions.d.ts.map` +//# sourceMappingURL=functions.d.ts.map`, }; const helperDtsMap: File = { path: `/user/username/projects/myproject/target/src/helpers/functions.d.ts.map`, - content: `{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../src/helpers/functions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,GAAG,IAAI,CAAC"}` + content: `{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../src/helpers/functions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,GAAG,IAAI,CAAC"}`, }; const tsconfigIndirect3: File = { path: `/user/username/projects/myproject/indirect3/tsconfig.json`, content: JSON.stringify({ compilerOptions: { - baseUrl: "../target/src/" + baseUrl: "../target/src/", }, - }) + }), }; const fileResolvingToMainDts: File = { path: `/user/username/projects/myproject/indirect3/main.ts`, content: `import { foo } from 'main'; foo; -export function bar() {}` +export function bar() {}`, }; const tsconfigSrcPath = `/user/username/projects/myproject/tsconfig-src.json`; const tsconfigPath = `/user/username/projects/myproject/tsconfig.json`; @@ -912,22 +912,22 @@ export function bar() {}` compilerOptions: { composite: true, outDir: "./target/", - baseUrl: "./src/" + baseUrl: "./src/", }, - include: ["./src/**/*"] - }) + include: ["./src/**/*"], + }), }; const tsconfig: File = { path: tsconfigPath, content: JSON.stringify({ ... (solutionOptions ? { compilerOptions: solutionOptions } : {}), references: configRefs.map(path => ({ path })), - files: solutionFiles || [] - }) + files: solutionFiles || [], + }), }; const dummyFile: File = { path: dummyFilePath, - content: "let a = 10;" + content: "let a = 10;", }; const host = createServerHost([ tsconfigSrc, tsconfig, main, helper, @@ -970,7 +970,7 @@ export function bar() {}` // Find all refs session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.References, - arguments: protocolFileLocationFromSubstring(main, "foo", { index: 1 }) + arguments: protocolFileLocationFromSubstring(main, "foo", { index: 1 }), }).response as ts.server.protocol.ReferencesResponseBody; service.closeClientFile(main.path); @@ -982,7 +982,7 @@ export function bar() {}` // Find all refs from dts include session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.References, - arguments: protocolFileLocationFromSubstring(fileResolvingToMainDts, "foo") + arguments: protocolFileLocationFromSubstring(fileResolvingToMainDts, "foo"), }).response as ts.server.protocol.ReferencesResponseBody; baselineTsserverLogs("projectReferences", input.scenario, session); } @@ -995,15 +995,15 @@ export function bar() {}` composite: true, outDir: "./target/", baseUrl: "./src/", - ...optionsToExtend + ...optionsToExtend, }, files: [`./indirect${postfix}/main.ts`], - references: [{ path: "./tsconfig-src.json" }] - }) + references: [{ path: "./tsconfig-src.json" }], + }), }; const indirect: File = { path: `/user/username/projects/myproject/indirect${postfix}/main.ts`, - content: fileResolvingToMainDts.content + content: fileResolvingToMainDts.content, }; return { tsconfigIndirect, indirect }; } @@ -1081,14 +1081,14 @@ export function bar() {}` it("when the project found is not solution but references open file through project reference", () => { const ownMain: File = { path: `/user/username/projects/myproject/own/main.ts`, - content: fileResolvingToMainDts.content + content: fileResolvingToMainDts.content, }; verifySolutionScenario({ scenario: "solution with its own files and project found is not solution but references open file through project reference", solutionFiles: [`./own/main.ts`], solutionOptions: { outDir: "./target/", - baseUrl: "./src/" + baseUrl: "./src/", }, configRefs: ["./tsconfig-src.json"], additionalFiles: [ownMain], @@ -1099,7 +1099,7 @@ export function bar() {}` const ownMain: File = { path: `/user/username/projects/myproject/own/main.ts`, content: `import { bar } from 'main'; -bar;` +bar;`, }; const { tsconfigIndirect, indirect } = getIndirectProject("1"); const { tsconfigIndirect: tsconfigIndirect2, indirect: indirect2 } = getIndirectProject("2"); @@ -1108,7 +1108,7 @@ bar;` solutionFiles: [`./own/main.ts`], solutionOptions: { outDir: "./target/", - baseUrl: "./indirect1/" + baseUrl: "./indirect1/", }, configRefs: ["./tsconfig-indirect1.json", "./tsconfig-indirect2.json"], additionalFiles: [tsconfigIndirect, indirect, tsconfigIndirect2, indirect2, ownMain], @@ -1118,7 +1118,7 @@ bar;` it("disables looking into the child project if disableReferencedProjectLoad is set", () => { const ownMain: File = { path: `/user/username/projects/myproject/own/main.ts`, - content: fileResolvingToMainDts.content + content: fileResolvingToMainDts.content, }; verifyDisableReferencedProjectLoad({ scenario: "solution with its own files and disables looking into the child project if disableReferencedProjectLoad is set", @@ -1126,7 +1126,7 @@ bar;` solutionOptions: { outDir: "./target/", baseUrl: "./src/", - disableReferencedProjectLoad: true + disableReferencedProjectLoad: true, }, configRefs: ["./tsconfig-src.json"], additionalFiles: [ownMain], @@ -1137,7 +1137,7 @@ bar;` const ownMain: File = { path: `/user/username/projects/myproject/own/main.ts`, content: `import { bar } from 'main'; -bar;` +bar;`, }; const { tsconfigIndirect, indirect } = getIndirectProject("1", { disableReferencedProjectLoad: true }); verifyDisableReferencedProjectLoad({ @@ -1156,7 +1156,7 @@ bar;` const ownMain: File = { path: `/user/username/projects/myproject/own/main.ts`, content: `import { bar } from 'main'; -bar;` +bar;`, }; const { tsconfigIndirect, indirect } = getIndirectProject("1", { disableReferencedProjectLoad: true }); const { tsconfigIndirect: tsconfigIndirect2, indirect: indirect2 } = getIndirectProject("2"); @@ -1181,18 +1181,18 @@ bar;` content: JSON.stringify({ compilerOptions: { module: "none", - composite: true + composite: true, }, - exclude: ["temp"] - }) + exclude: ["temp"], + }), }; const class1: File = { path: `/user/username/projects/myproject/projects/project1/class1.ts`, - content: `class class1 {}` + content: `class class1 {}`, }; const class1Dts: File = { path: `/user/username/projects/myproject/projects/project1/class1.d.ts`, - content: `declare class class1 {}` + content: `declare class class1 {}`, }; const config2: File = { path: `/user/username/projects/myproject/projects/project2/tsconfig.json`, @@ -1200,16 +1200,16 @@ bar;` compilerOptions: { module: "none", composite: true, - ...(extendOptionsProject2 || {}) + ...(extendOptionsProject2 || {}), }, references: [ - { path: "../project1" } - ] - }) + { path: "../project1" }, + ], + }), }; const class2: File = { path: `/user/username/projects/myproject/projects/project2/class2.ts`, - content: `class class2 {}` + content: `class class2 {}`, }; const host = createServerHost([config1, class1, class1Dts, config2, class2, libFile]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -1310,22 +1310,22 @@ bar;` files: [], references: [ { path: "shared/src/library" }, - { path: "app/src/program" } - ] - }) + { path: "app/src/program" }, + ], + }), }; const sharedConfig: File = { path: `/user/username/projects/myproject/shared/src/library/tsconfig.json`, content: JSON.stringify({ compilerOptions: { composite: true, - outDir: "../../bld/library" - } - }) + outDir: "../../bld/library", + }, + }), }; const sharedIndex: File = { path: `/user/username/projects/myproject/shared/src/library/index.ts`, - content: `export function foo() {}` + content: `export function foo() {}`, }; const sharedPackage: File = { path: `/user/username/projects/myproject/shared/package.json`, @@ -1333,8 +1333,8 @@ bar;` name: "shared", version: "1.0.0", main: "bld/library/index.js", - types: "bld/library/index.d.ts" - }) + types: "bld/library/index.d.ts", + }), }; const appConfig: File = { path: `/user/username/projects/myproject/app/src/program/tsconfig.json`, @@ -1342,24 +1342,24 @@ bar;` compilerOptions: { composite: true, outDir: "../../bld/program", - disableSourceOfProjectReferenceRedirect + disableSourceOfProjectReferenceRedirect, }, references: [ - { path: "../../../shared/src/library" } - ] - }) + { path: "../../../shared/src/library" }, + ], + }), }; const appBar: File = { path: `/user/username/projects/myproject/app/src/program/bar.ts`, - content: `import {foo} from "shared";` + content: `import {foo} from "shared";`, }; const appIndex: File = { path: `/user/username/projects/myproject/app/src/program/index.ts`, - content: `foo` + content: `foo`, }; const sharedSymlink: SymLink = { path: `/user/username/projects/myproject/node_modules/shared`, - symLink: `/user/username/projects/myproject/shared` + symLink: `/user/username/projects/myproject/shared`, }; const files = [solnConfig, sharedConfig, sharedIndex, sharedPackage, appConfig, appBar, appIndex, sharedSymlink, libFile]; const host = createServerHost(files); @@ -1378,7 +1378,7 @@ bar;` endLine: 1, endOffset: 4, errorCodes: [ts.Diagnostics.Cannot_find_name_0.code], - } + }, }); baselineTsserverLogs("projectReferences", `auto import with referenced project${built ? " when built" : ""}${disableSourceOfProjectReferenceRedirect ? " with disableSourceOfProjectReferenceRedirect": ""}`, session); } @@ -1398,14 +1398,14 @@ bar;` function getPackageAndFile(packageName: string, references?: string[], optionsToExtend?: ts.CompilerOptions): [file: File, config: File] { const file: File = { path: `/user/username/projects/myproject/${packageName}/src/file1.ts`, - content: `export const ${packageName}Const = 10;` + content: `export const ${packageName}Const = 10;`, }; const config: File = { path: `/user/username/projects/myproject/${packageName}/tsconfig.json`, content: JSON.stringify({ compilerOptions: { composite: true, ...optionsToExtend || {} }, - references: references?.map(path => ({ path: `../${path}` })) - }) + references: references?.map(path => ({ path: `../${path}` })), + }), }; return [file, config]; } @@ -1428,7 +1428,7 @@ bar;` indirectDisabledChildLoad1File, indirectDisabledChildLoad1Config, coreRef2File, coreRef2Config, indirectDisabledChildLoad2File, indirectDisabledChildLoad2Config, coreRef3File, coreRef3Config, refToCoreRef3File, refToCoreRef3Config, - indirectNoCoreRefFile, indirectNoCoreRefConfig, noCoreRef2File, noCoreRef2Config + indirectNoCoreRefFile, indirectNoCoreRefConfig, noCoreRef2File, noCoreRef2Config, ], { useCaseSensitiveFileNames: true }); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); openFilesForSession([mainFile, coreFile], session); @@ -1436,7 +1436,7 @@ bar;` // Find all refs in coreFile session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.References, - arguments: protocolFileLocationFromSubstring(coreFile, `coreConst`) + arguments: protocolFileLocationFromSubstring(coreFile, `coreConst`), }); baselineTsserverLogs("projectReferences", `when files from two projects are open and one project references`, session); }); @@ -1446,7 +1446,7 @@ bar;` path: `/user/username/projects/myproject/a/index.ts`, content: `import { B } from "../b/lib"; -const b: B = new B();` +const b: B = new B();`, }; const configB: File = { @@ -1457,21 +1457,21 @@ const b: B = new B();` "outDir": "lib", "composite": true } -}` +}`, }; const indexB: File = { path: `/user/username/projects/myproject/b/index.ts`, content: `export class B { M() {} -}` +}`, }; const helperB: File = { path: `/user/username/projects/myproject/b/helper.ts`, content: `import { B } from "."; -const b: B = new B();` +const b: B = new B();`, }; const dtsB: File = { @@ -1479,12 +1479,12 @@ const b: B = new B();` content: `export declare class B { M(): void; } -//# sourceMappingURL=index.d.ts.map` +//# sourceMappingURL=index.d.ts.map`, }; const dtsMapB: File = { path: `/user/username/projects/myproject/b/lib/index.d.ts.map`, - content: `{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,qBAAa,CAAC;IACV,CAAC;CACJ"}` + content: `{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,qBAAa,CAAC;IACV,CAAC;CACJ"}`, }; function baselineDisableReferencedProjectLoad( @@ -1502,7 +1502,7 @@ const b: B = new B();` const compilerOptions: ts.CompilerOptions = { disableReferencedProjectLoad, disableSourceOfProjectReferenceRedirect, - composite: true + composite: true, }; it(subScenario, () => { @@ -1511,7 +1511,7 @@ const b: B = new B();` content: `{ "compilerOptions": ${JSON.stringify(compilerOptions)}, "references": [{ "path": "../b" }] - }` + }`, }; const host = createServerHost([configA, indexA, configB, indexB, helperB, dtsB, ...(dtsMapPresent ? [dtsMapB] : [])]); @@ -1520,7 +1520,7 @@ const b: B = new B();` session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.References, - arguments: protocolFileLocationFromSubstring(indexA, `B`, { index: 1 }) + arguments: protocolFileLocationFromSubstring(indexA, `B`, { index: 1 }), }); baselineTsserverLogs("projectReferences", `find refs to decl in other proj ${subScenario}`, session); }); diff --git a/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts b/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts index d4b0637994224..bddb401a219f6 100644 --- a/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts +++ b/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts @@ -27,11 +27,11 @@ export function fn2() { } export function fn3() { } export function fn4() { } export function fn5() { } -` +`, }; const dependencyConfig: File = { path: `${dependecyLocation}/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { composite: true, declarationMap: true, declarationDir: "../decls" } }) + content: JSON.stringify({ compilerOptions: { composite: true, declarationMap: true, declarationDir: "../decls" } }), }; const mainTs: File = { @@ -49,23 +49,23 @@ fn2(); fn3(); fn4(); fn5(); -` +`, }; const mainConfig: File = { path: `${mainLocation}/tsconfig.json`, content: JSON.stringify({ compilerOptions: { composite: true, declarationMap: true }, - references: [{ path: "../dependency" }] - }) + references: [{ path: "../dependency" }], + }), }; const randomFile: File = { path: `/user/username/projects/myproject/random/random.ts`, - content: "let a = 10;" + content: "let a = 10;", }; const randomConfig: File = { path: `/user/username/projects/myproject/random/tsconfig.json`, - content: "{}" + content: "{}", }; const dtsLocation = `${dependecyDeclsLocation}/FnS.d.ts`; const dtsPath = dtsLocation.toLowerCase() as ts.Path; @@ -95,14 +95,14 @@ fn5(); function goToDefFromMainTs(fn: number): TestSessionRequest { return { command: ts.server.protocol.CommandTypes.DefinitionAndBoundSpan, - arguments: { file: mainTs.path, line: fn + 8, offset: 1 } + arguments: { file: mainTs.path, line: fn + 8, offset: 1 }, }; } function renameFromDependencyTs(fn: number): TestSessionRequest { return { command: ts.server.protocol.CommandTypes.Rename, - arguments: { file: dependencyTs.path, line: fn, offset: 17 } + arguments: { file: dependencyTs.path, line: fn, offset: 17 }, }; } @@ -230,7 +230,7 @@ fn5(); const host = createHostWithSolutionBuild(files, [mainConfig.path]); // Erase project reference host.writeFile(mainConfig.path, JSON.stringify({ - compilerOptions: { composite: true, declarationMap: true } + compilerOptions: { composite: true, declarationMap: true }, })); onHostCreate?.(host); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -251,9 +251,9 @@ fn5(); compilerOptions: { composite: true, declarationMap: true, - disableSourceOfProjectReferenceRedirect: true + disableSourceOfProjectReferenceRedirect: true, }, - references: [{ path: "../dependency" }] + references: [{ path: "../dependency" }], })); onHostCreate?.(host); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -275,8 +275,8 @@ fn5(); offset: 1, endLine: 14, endOffset: 1, - insertString: "const x = 10;" - } + insertString: "const x = 10;", + }, }); } @@ -289,8 +289,8 @@ fn5(); offset: 1, endLine: 6, endOffset: 1, - insertString: "const x = 10;" - } + insertString: "const x = 10;", + }, }); } @@ -1593,7 +1593,7 @@ ${dependencyTs.content}`); command: ts.server.protocol.CommandTypes.Change, arguments: { file: dependencyTs.path, line: 1, offset: 1, endLine: 1, endOffset: 1, insertString: `function fooBar() { } -`} +`}, }); host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); @@ -1619,7 +1619,7 @@ ${dependencyTs.content}`); command: ts.server.protocol.CommandTypes.Change, arguments: { file: dependencyTs.path, line: 1, offset: 1, endLine: 1, endOffset: 1, insertString: `function fooBar() { } -`} +`}, }); // action @@ -2617,7 +2617,7 @@ ${dependencyTs.content}`); command: ts.server.protocol.CommandTypes.Change, arguments: { file: dependencyTs.path, line: 1, offset: 1, endLine: 1, endOffset: 1, insertString: `function fooBar() { } -`} +`}, }); host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); @@ -2651,7 +2651,7 @@ ${dependencyTs.content}`); command: ts.server.protocol.CommandTypes.Change, arguments: { file: dependencyTs.path, line: 1, offset: 1, endLine: 1, endOffset: 1, insertString: `function fooBar() { } - `} + `}, }); // action diff --git a/src/testRunner/unittests/tsserver/projects.ts b/src/testRunner/unittests/tsserver/projects.ts index 4745650a853d6..21b7a439b5bcb 100644 --- a/src/testRunner/unittests/tsserver/projects.ts +++ b/src/testRunner/unittests/tsserver/projects.ts @@ -32,7 +32,7 @@ describe("unittests:: tsserver:: projects::", () => { const file1: File = { path: "/a/b/commonFile1.ts", content: `/// - let x = y` + let x = y`, }; const host = createServerHost([file1, libFile]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -41,14 +41,14 @@ describe("unittests:: tsserver:: projects::", () => { // Two errors: CommonFile2 not found and cannot find name y session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.SemanticDiagnosticsSync, - arguments: { file: file1.path } + arguments: { file: file1.path }, }); host.writeFile(commonFile2.path, commonFile2.content); host.runQueuedTimeoutCallbacks(); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.SemanticDiagnosticsSync, - arguments: { file: file1.path } + arguments: { file: file1.path }, }); baselineTsserverLogs("projects", "handles the missing files added with tripleslash ref", session); }); @@ -59,7 +59,7 @@ describe("unittests:: tsserver:: projects::", () => { content: `{ "compilerOptions": {}, "files": ["${commonFile1.path}", "${commonFile2.path}"] - }` + }`, }; const files = [commonFile1, commonFile2, configFile]; const host = createServerHost(files); @@ -82,17 +82,17 @@ describe("unittests:: tsserver:: projects::", () => { const file1 = { path: "/a/b/f1.js", content: "let x =1;", - fileSize: 10 * 1024 * 1024 + fileSize: 10 * 1024 * 1024, }; const file2 = { path: "/a/b/f2.js", content: "let y =1;", - fileSize: 6 * 1024 * 1024 + fileSize: 6 * 1024 * 1024, }; const file3 = { path: "/a/b/f3.js", content: "let y =1;", - fileSize: 6 * 1024 * 1024 + fileSize: 6 * 1024 * 1024, }; const proj1name = "proj1", proj2name = "proj2", proj3name = "proj3"; @@ -112,12 +112,12 @@ describe("unittests:: tsserver:: projects::", () => { const file1 = { path: "/a/b/f1.js", content: "let x =1;", - fileSize: 50 * 1024 * 1024 + fileSize: 50 * 1024 * 1024, }; const file2 = { path: "/a/b/f2.js", content: "let x =1;", - fileSize: 100 + fileSize: 100, }; const projName = "proj1"; @@ -135,16 +135,16 @@ describe("unittests:: tsserver:: projects::", () => { it("external project including config file", () => { const file1 = { path: "/a/b/f1.ts", - content: "let x =1;" + content: "let x =1;", }; const config1 = { path: "/a/b/tsconfig.json", content: JSON.stringify( { compilerOptions: {}, - files: ["f1.ts"] + files: ["f1.ts"], } - ) + ), }; const externalProjectName = "externalproject"; @@ -153,7 +153,7 @@ describe("unittests:: tsserver:: projects::", () => { projectService.openExternalProject({ rootFiles: toExternalFiles([file1.path, config1.path]), options: {}, - projectFileName: externalProjectName + projectFileName: externalProjectName, }); baselineTsserverLogs("projects", "external project including config file", projectService); @@ -162,16 +162,16 @@ describe("unittests:: tsserver:: projects::", () => { it("loose file included in config file (openClientFile)", () => { const file1 = { path: "/a/b/f1.ts", - content: "let x =1;" + content: "let x =1;", }; const config1 = { path: "/a/b/tsconfig.json", content: JSON.stringify( { compilerOptions: {}, - files: ["f1.ts"] + files: ["f1.ts"], } - ) + ), }; const host = createServerHost([file1, config1]); @@ -183,16 +183,16 @@ describe("unittests:: tsserver:: projects::", () => { it("loose file included in config file (applyCodeChanges)", () => { const file1 = { path: "/a/b/f1.ts", - content: "let x =1;" + content: "let x =1;", }; const config1 = { path: "/a/b/tsconfig.json", content: JSON.stringify( { compilerOptions: {}, - files: ["f1.ts"] + files: ["f1.ts"], } - ) + ), }; const host = createServerHost([file1, config1]); @@ -206,11 +206,11 @@ describe("unittests:: tsserver:: projects::", () => { it("reload regular file after closing", () => { const f1 = { path: "/a/b/app.ts", - content: "x." + content: "x.", }; const f2 = { path: "/a/b/lib.ts", - content: "let x: number;" + content: "let x: number;", }; const host = createServerHost([f1, f2, libFile]); @@ -221,14 +221,14 @@ describe("unittests:: tsserver:: projects::", () => { // should contain completions for string session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompletionInfo, - arguments: { file: f1.path, line: 1, offset: 3 } + arguments: { file: f1.path, line: 1, offset: 3 }, }); closeFilesForSession([f2], session); // should contain completions for string session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompletionInfo, - arguments: { file: f1.path, line: 1, offset: 3 } + arguments: { file: f1.path, line: 1, offset: 3 }, }); baselineTsserverLogs("projects", "reload regular file after closing", session); }); @@ -236,11 +236,11 @@ describe("unittests:: tsserver:: projects::", () => { it("clear mixed content file after closing", () => { const f1 = { path: "/a/b/app.ts", - content: " " + content: " ", }; const f2 = { path: "/a/b/lib.html", - content: "" + content: "", }; const host = createServerHost([f1, f2, libFile]); @@ -250,13 +250,13 @@ describe("unittests:: tsserver:: projects::", () => { session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompletionInfo, - arguments: { file: f1.path, line: 1, offset: 1 } + arguments: { file: f1.path, line: 1, offset: 1 }, }); closeFilesForSession([f2], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.CompletionInfo, - arguments: { file: f1.path, line: 1, offset: 1 } + arguments: { file: f1.path, line: 1, offset: 1 }, }); baselineTsserverLogs("projects", "clear mixed content file after closing", session); }); @@ -264,15 +264,15 @@ describe("unittests:: tsserver:: projects::", () => { it("changes in closed files are reflected in project structure", () => { const file1 = { path: "/a/b/f1.ts", - content: `export * from "./f2"` + content: `export * from "./f2"`, }; const file2 = { path: "/a/b/f2.ts", - content: `export let x = 1` + content: `export let x = 1`, }; const file3 = { path: "/a/c/f3.ts", - content: `export let y = 1;` + content: `export let y = 1;`, }; const host = createServerHost([file1, file2, file3]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -290,15 +290,15 @@ describe("unittests:: tsserver:: projects::", () => { it("deleted files affect project structure", () => { const file1 = { path: "/a/b/f1.ts", - content: `export * from "./f2"` + content: `export * from "./f2"`, }; const file2 = { path: "/a/b/f2.ts", - content: `export * from "../c/f3"` + content: `export * from "../c/f3"`, }; const file3 = { path: "/a/c/f3.ts", - content: `export let y = 1;` + content: `export let y = 1;`, }; const host = createServerHost([file1, file2, file3]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -314,11 +314,11 @@ describe("unittests:: tsserver:: projects::", () => { it("ignores files excluded by a custom safe type list", () => { const file1 = { path: "/a/b/f1.js", - content: "export let x = 5" + content: "export let x = 5", }; const office = { path: "/lib/duckquack-3.min.js", - content: "whoa do @@ not parse me ok thanks!!!" + content: "whoa do @@ not parse me ok thanks!!!", }; const host = createServerHost([file1, office, customTypesMap]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -335,15 +335,15 @@ describe("unittests:: tsserver:: projects::", () => { it("file with name constructor.js doesnt cause issue with typeAcquisition when safe type list", () => { const file1 = { path: "/a/b/f1.js", - content: `export let x = 5; import { s } from "s"` + content: `export let x = 5; import { s } from "s"`, }; const constructorFile = { path: "/a/b/constructor.js", - content: "const x = 10;" + content: "const x = 10;", }; const bliss = { path: "/a/b/bliss.js", - content: "export function is() { return true; }" + content: "export function is() { return true; }", }; const host = createServerHost([file1, libFile, constructorFile, bliss, customTypesMap]); let request: string | undefined; @@ -357,7 +357,7 @@ describe("unittests:: tsserver:: projects::", () => { }, attach: ts.noop, onProjectClosed: ts.noop, - globalTypingsCacheLocation: cachePath + globalTypingsCacheLocation: cachePath, }; const projectName = "project"; @@ -371,7 +371,7 @@ describe("unittests:: tsserver:: projects::", () => { unresolvedImports: ["s"], projectRootPath: "/", cachePath, - kind: "discover" + kind: "discover", })); const response = JSON.parse(request!); request = undefined; @@ -392,31 +392,31 @@ describe("unittests:: tsserver:: projects::", () => { it("ignores files excluded by the default type list", () => { const file1 = { path: "/a/b/f1.js", - content: "export let x = 5" + content: "export let x = 5", }; const minFile = { path: "/c/moment.min.js", - content: "unspecified" + content: "unspecified", }; const kendoFile1 = { path: "/q/lib/kendo/kendo.all.min.js", - content: "unspecified" + content: "unspecified", }; const kendoFile2 = { path: "/q/lib/kendo/kendo.ui.min.js", - content: "unspecified" + content: "unspecified", }; const kendoFile3 = { path: "/q/lib/kendo-ui/kendo.all.js", - content: "unspecified" + content: "unspecified", }; const officeFile1 = { path: "/scripts/Office/1/excel-15.debug.js", - content: "unspecified" + content: "unspecified", }; const officeFile2 = { path: "/scripts/Office/1/powerpoint.js", - content: "unspecified" + content: "unspecified", }; const files = [file1, minFile, kendoFile1, kendoFile2, kendoFile3, officeFile1, officeFile2]; const host = createServerHost(files); @@ -440,7 +440,7 @@ describe("unittests:: tsserver:: projects::", () => { ["minimum", "minimum"], ["min", "min"], ["min.3.2", "min"], - ["jquery", "jquery"] + ["jquery", "jquery"], ]; for (const t of testData) { assert.equal(ts.removeMinAndVersionNumbers(t[0]), t[1], t[0]); @@ -450,15 +450,15 @@ describe("unittests:: tsserver:: projects::", () => { it("ignores files excluded by a legacy safe type list", () => { const file1 = { path: "/a/b/bliss.js", - content: "let x = 5" + content: "let x = 5", }; const file2 = { path: "/a/b/foo.js", - content: "" + content: "", }; const file3 = { path: "/a/b/Bacon.js", - content: "let y = 5" + content: "let y = 5", }; const host = createServerHost([file1, file2, file3, customTypesMap]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -476,15 +476,15 @@ describe("unittests:: tsserver:: projects::", () => { path: "/a/b/f1.ts", content: ` export * from "../c/f2"; - export * from "../d/f3";` + export * from "../d/f3";`, }; const file2 = { path: "/a/c/f2.ts", - content: "export let x = 1;" + content: "export let x = 1;", }; const file3 = { path: "/a/d/f3.ts", - content: "export let y = 1;" + content: "export let y = 1;", }; const host = createServerHost([file1, file2, file3]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -513,13 +513,13 @@ describe("unittests:: tsserver:: projects::", () => { const tsFile = { fileName: "/a/b/file1.ts", path: "/a/b/file1.ts", - content: "" + content: "", }; const jsFile = { path: "/a/b/file1.js", content: "var x = 10;", fileName: "/a/b/file1.js", - scriptKind: "JS" as const + scriptKind: "JS" as const, }; const host = createServerHost([]); @@ -535,15 +535,15 @@ describe("unittests:: tsserver:: projects::", () => { it("config file is deleted", () => { const file1 = { path: "/a/b/f1.ts", - content: "let x = 1;" + content: "let x = 1;", }; const file2 = { path: "/a/b/f2.ts", - content: "let y = 2;" + content: "let y = 2;", }; const config = { path: "/a/b/tsconfig.json", - content: JSON.stringify({ compilerOptions: {} }) + content: JSON.stringify({ compilerOptions: {} }), }; const host = createServerHost([file1, file2, config]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -560,29 +560,29 @@ describe("unittests:: tsserver:: projects::", () => { it("loading files with correct priority", () => { const f1 = { path: "/a/main.ts", - content: "let x = 1" + content: "let x = 1", }; const f2 = { path: "/a/main.js", - content: "var y = 1" + content: "var y = 1", }; const f3 = { path: "/main.js", - content: "var y = 1" + content: "var y = 1", }; const config = { path: "/a/tsconfig.json", content: JSON.stringify({ - compilerOptions: { allowJs: true } - }) + compilerOptions: { allowJs: true }, + }), }; const host = createServerHost([f1, f2, f3, config]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); projectService.setHostConfiguration({ extraFileExtensions: [ { extension: ".js", isMixedContent: false }, - { extension: ".html", isMixedContent: true } - ] + { extension: ".html", isMixedContent: true }, + ], }); projectService.openClientFile(f1.path); @@ -599,15 +599,15 @@ describe("unittests:: tsserver:: projects::", () => { it("tsconfig script block support", () => { const file1 = { path: "/a/b/f1.ts", - content: ` ` + content: ` `, }; const file2 = { path: "/a/b/f2.html", - content: `var hello = "hello";` + content: `var hello = "hello";`, }; const config = { path: "/a/b/tsconfig.json", - content: JSON.stringify({ compilerOptions: { allowJs: true } }) + content: JSON.stringify({ compilerOptions: { allowJs: true } }), }; const host = createServerHost([file1, file2, config]); const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -620,7 +620,7 @@ describe("unittests:: tsserver:: projects::", () => { // The configured project should now be updated to include html file session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Configure, - arguments: { extraFileExtensions } + arguments: { extraFileExtensions }, }); // Open HTML file @@ -628,7 +628,7 @@ describe("unittests:: tsserver:: projects::", () => { fileName: file2.path, hasMixedContent: true, scriptKind: ts.ScriptKind.JS, - content: `var hello = "hello";` + content: `var hello = "hello";`, })); // Now HTML file is included in the project @@ -640,7 +640,7 @@ describe("unittests:: tsserver:: projects::", () => { position: 1, line: undefined!, offset: undefined!, - } + }, }); // Close HTML file @@ -659,7 +659,7 @@ describe("unittests:: tsserver:: projects::", () => { position: 5, line: undefined!, offset: undefined!, - } + }, }); baselineTsserverLogs("projects", "tsconfig script block support", session); }); @@ -669,15 +669,15 @@ describe("unittests:: tsserver:: projects::", () => { // #1. Ensure no diagnostic errors when allowJs is true const file1 = { path: "/a/b/f1.ts", - content: ` ` + content: ` `, }; const file2 = { path: "/a/b/f2.html", - content: `var hello = "hello";` + content: `var hello = "hello";`, }; const config1 = { path: "/a/b/tsconfig.json", - content: JSON.stringify({ compilerOptions: { allowJs: true } }) + content: JSON.stringify({ compilerOptions: { allowJs: true } }), }; const logger = createLoggerWithInMemoryLogs(/*host*/ undefined!); // Special @@ -689,14 +689,14 @@ describe("unittests:: tsserver:: projects::", () => { // #2. Ensure no errors when allowJs is false const config2 = { path: "/a/b/tsconfig.json", - content: JSON.stringify({ compilerOptions: { allowJs: false } }) + content: JSON.stringify({ compilerOptions: { allowJs: false } }), }; verfiy(config2, createServerHost([file1, file2, config2, libFile], { executingFilePath: ts.combinePaths(ts.getDirectoryPath(libFile.path), "tsc.js") })); // #3. Ensure no errors when compiler options aren't specified const config3 = { path: "/a/b/tsconfig.json", - content: JSON.stringify({}) + content: JSON.stringify({}), }; verfiy(config3, createServerHost([file1, file2, config3, libFile], { executingFilePath: ts.combinePaths(ts.getDirectoryPath(libFile.path), "tsc.js") })); @@ -704,7 +704,7 @@ describe("unittests:: tsserver:: projects::", () => { // #4. Ensure no errors when files are explicitly specified in tsconfig const config4 = { path: "/a/b/tsconfig.json", - content: JSON.stringify({ compilerOptions: { allowJs: true }, files: [file1.path, file2.path] }) + content: JSON.stringify({ compilerOptions: { allowJs: true }, files: [file1.path, file2.path] }), }; verfiy(config4, createServerHost([file1, file2, config4, libFile], { executingFilePath: ts.combinePaths(ts.getDirectoryPath(libFile.path), "tsc.js") })); @@ -712,7 +712,7 @@ describe("unittests:: tsserver:: projects::", () => { // #4. Ensure no errors when files are explicitly excluded in tsconfig const config5 = { path: "/a/b/tsconfig.json", - content: JSON.stringify({ compilerOptions: { allowJs: true }, exclude: [file2.path] }) + content: JSON.stringify({ compilerOptions: { allowJs: true }, exclude: [file2.path] }), }; const session = verfiy(config5, createServerHost([file1, file2, config5, libFile], { executingFilePath: ts.combinePaths(ts.getDirectoryPath(libFile.path), "tsc.js") })); @@ -724,7 +724,7 @@ describe("unittests:: tsserver:: projects::", () => { const session = createSession(host, { logger }); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Configure, - arguments: { extraFileExtensions } + arguments: { extraFileExtensions }, }); openFilesForSession([file1], session); session.executeCommandSeq({ @@ -732,7 +732,7 @@ describe("unittests:: tsserver:: projects::", () => { arguments: { file: config.path, projectFileName: config.path, - } + }, }); return session; } @@ -741,11 +741,11 @@ describe("unittests:: tsserver:: projects::", () => { it("project structure update is deferred if files are not added or removed", () => { const file1 = { path: "/a/b/f1.ts", - content: `import {x} from "./f2"` + content: `import {x} from "./f2"`, }; const file2 = { path: "/a/b/f2.ts", - content: "export let x = 1" + content: "export let x = 1", }; const host = createServerHost([file1, file2]); const projectService = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) }); @@ -765,7 +765,7 @@ describe("unittests:: tsserver:: projects::", () => { it("files with mixed content are handled correctly", () => { const file1 = { path: "/a/b/f1.html", - content: `