From f2e7f9f50f58ebe35d31e04c8f82fb37ae9dbcef Mon Sep 17 00:00:00 2001 From: Bill Ticehurst Date: Wed, 10 Feb 2016 19:56:31 -0800 Subject: [PATCH] Removed errors for missing module specifier --- src/compiler/commandLineParser.ts | 2 +- src/compiler/diagnosticMessages.json | 10 +--------- src/compiler/program.ts | 9 --------- src/compiler/tsc.ts | 2 +- 4 files changed, 3 insertions(+), 20 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index dd16afbcea1..029388b5380 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -575,8 +575,8 @@ namespace ts { const options: CompilerOptions = {}; const errors: Diagnostic[] = []; + options.module = ModuleKind.CommonJS; if (configFileName && getBaseFileName(configFileName) === "jsconfig.json") { - options.module = ModuleKind.CommonJS; options.allowJs = true; } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 1a8a53d517c..447fdd97994 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -439,10 +439,6 @@ "category": "Error", "code": 1147 }, - "Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.": { - "category": "Error", - "code": 1148 - }, "File name '{0}' differs from already included file name '{1}' only in casing": { "category": "Error", "code": 1149 @@ -2131,10 +2127,6 @@ "category": "Error", "code": 5042 }, - "Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher.": { - "category": "Error", - "code": 5047 - }, "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.": { "category": "Error", "code": 5051 @@ -2171,7 +2163,7 @@ "category": "Error", "code": 5059 }, - + "Concatenate and emit output to single file.": { "category": "Message", diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 3c75f31add2..75de3ed5258 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1290,21 +1290,12 @@ namespace ts { const firstExternalModuleSourceFile = forEach(files, f => isExternalModule(f) ? f : undefined); if (options.isolatedModules) { - if (!options.module && languageVersion < ScriptTarget.ES6) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher)); - } - const firstNonExternalModuleSourceFile = forEach(files, f => !isExternalModule(f) && !isDeclarationFile(f) ? f : undefined); if (firstNonExternalModuleSourceFile) { const span = getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); programDiagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); } } - else if (firstExternalModuleSourceFile && languageVersion < ScriptTarget.ES6 && !options.module) { - // We cannot use createDiagnosticFromNode because nodes do not have parents yet - const span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - programDiagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided_Consider_setting_the_module_compiler_option_in_a_tsconfig_json_file)); - } // Cannot specify module gen target of es6 when below es6 if (options.module === ModuleKind.ES6 && languageVersion < ScriptTarget.ES6) { diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 9b2457d0916..998866c796c 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -376,7 +376,7 @@ namespace ts { sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); return; } - const configParseResult = parseJsonConfigFileContent(configObject, sys, getDirectoryPath(configFileName), commandLine.options); + const configParseResult = parseJsonConfigFileContent(configObject, sys, getDirectoryPath(configFileName), commandLine.options, configFileName); if (configParseResult.errors.length > 0) { reportDiagnostics(configParseResult.errors, /* compilerHost */ undefined); sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);