Consolidate option error messages into two

This commit is contained in:
Mohamed Hegazy 2015-08-20 15:58:57 -07:00
parent 8ad9138828
commit cfc164b044
13 changed files with 56 additions and 97 deletions

View file

@ -506,19 +506,11 @@ namespace ts {
Unknown_compiler_option_0: { code: 5023, category: DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." },
Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." },
Could_not_write_file_0_Colon_1: { code: 5033, category: DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" },
Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." },
Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." },
Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." },
Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." },
Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." },
Option_declaration_cannot_be_specified_with_option_isolatedModules: { code: 5044, category: DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'isolatedModules'." },
Option_noEmitOnError_cannot_be_specified_with_option_isolatedModules: { code: 5045, category: DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'isolatedModules'." },
Option_out_cannot_be_specified_with_option_isolatedModules: { code: 5046, category: DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'isolatedModules'." },
Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: DiagnosticCategory.Error, key: "Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." },
Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap: { code: 5048, category: DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'inlineSourceMap'." },
Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5049, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'." },
Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5050, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified with option 'inlineSourceMap'." },
Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." },
Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: DiagnosticCategory.Error, key: "Option '{0}' cannot be specified without specifying option '{1}'." },
Option_0_cannot_be_specified_with_option_1: { code: 5053, category: DiagnosticCategory.Error, key: "Option '{0}' cannot be specified with option '{1}'." },
Concatenate_and_emit_output_to_single_file: { code: 6001, category: DiagnosticCategory.Message, key: "Concatenate and emit output to single file." },
Generates_corresponding_d_ts_file: { code: 6002, category: DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." },
Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." },
@ -569,7 +561,6 @@ namespace ts {
Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." },
Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: DiagnosticCategory.Message, key: "Specify JSX code generation: 'preserve' or 'react'" },
Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." },
Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified: { code: 6064, category: DiagnosticCategory.Error, key: "Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified." },
Enables_experimental_support_for_ES7_decorators: { code: 6065, category: DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." },
Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." },
Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." },

View file

@ -2013,59 +2013,27 @@
"category": "Error",
"code": 5033
},
"Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.": {
"category": "Error",
"code": 5038
},
"Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.": {
"category": "Error",
"code": 5039
},
"Option 'noEmit' cannot be specified with option 'out' or 'outDir'.": {
"category": "Error",
"code": 5040
},
"Option 'noEmit' cannot be specified with option 'declaration'.": {
"category": "Error",
"code": 5041
},
"Option 'project' cannot be mixed with source files on a command line.": {
"category": "Error",
"code": 5042
},
"Option 'declaration' cannot be specified with option 'isolatedModules'.": {
"category": "Error",
"code": 5044
},
"Option 'noEmitOnError' cannot be specified with option 'isolatedModules'.": {
"category": "Error",
"code": 5045
},
"Option 'out' cannot be specified with option 'isolatedModules'.": {
"category": "Error",
"code": 5046
},
"Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher.": {
"category": "Error",
"code": 5047
},
"Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.": {
"category": "Error",
"code": 5048
},
"Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'.": {
"category": "Error",
"code": 5049
},
"Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.": {
"category": "Error",
"code": 5050
},
"Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.": {
"category": "Error",
"code": 5051
},
"Option '{0}' cannot be specified without specifying option '{1}'.": {
"category": "Error",
"code": 5052
},
"Option '{0}' cannot be specified with option '{1}'.": {
"category": "Error",
"code": 5053
},
"Concatenate and emit output to single file.": {
"category": "Message",
"code": 6001
@ -2266,10 +2234,6 @@
"category": "Message",
"code": 6081
},
"Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified.": {
"category": "Error",
"code": 6064
},
"Enables experimental support for ES7 decorators.": {
"category": "Message",
"code": 6065
@ -2286,7 +2250,7 @@
"category": "Message",
"code": 6068
},
"Variable '{0}' implicitly has an '{1}' type.": {
"category": "Error",
"code": 7005

View file

@ -794,27 +794,27 @@ namespace ts {
function verifyCompilerOptions() {
if (options.isolatedModules) {
if (options.declaration) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_declaration_cannot_be_specified_with_option_isolatedModules));
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules"));
}
if (options.noEmitOnError) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_isolatedModules));
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules"));
}
if (options.out) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_out_cannot_be_specified_with_option_isolatedModules));
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules"));
}
}
if (options.inlineSourceMap) {
if (options.sourceMap) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap));
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap"));
}
if (options.mapRoot) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap));
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap"));
}
if (options.sourceRoot) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap));
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap"));
}
}
@ -828,10 +828,10 @@ namespace ts {
if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) {
// Error to specify --mapRoot or --sourceRoot without mapSourceFiles
if (options.mapRoot) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option));
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap"));
}
if (options.sourceRoot) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option));
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap"));
}
return;
}
@ -886,18 +886,22 @@ namespace ts {
}
if (options.noEmit) {
if (options.out || options.outDir) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmit_cannot_be_specified_with_option_out_or_outDir));
if (options.out) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out"));
}
if (options.outDir) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir"));
}
if (options.declaration) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmit_cannot_be_specified_with_option_declaration));
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration"));
}
}
if (options.emitDecoratorMetadata &&
!options.experimentalDecorators) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified));
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));
}
if (options.experimentalAsyncFunctions &&

View file

@ -1,12 +1,12 @@
error TS5048: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.
error TS5049: Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'.
error TS5050: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.
error TS5053: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.
error TS5053: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.
error TS5053: Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'.
tests/cases/compiler/inlineSourceMap2.ts(5,1): error TS2304: Cannot find name 'console'.
!!! error TS5048: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.
!!! error TS5049: Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'.
!!! error TS5050: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.
!!! error TS5053: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.
!!! error TS5053: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.
!!! error TS5053: Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'.
==== tests/cases/compiler/inlineSourceMap2.ts (1 errors) ====
// configuration errors

View file

@ -1,7 +1,7 @@
error TS5044: Option 'declaration' cannot be specified with option 'isolatedModules'.
error TS5053: Option 'declaration' cannot be specified with option 'isolatedModules'.
!!! error TS5044: Option 'declaration' cannot be specified with option 'isolatedModules'.
!!! error TS5053: Option 'declaration' cannot be specified with option 'isolatedModules'.
==== tests/cases/compiler/isolatedModulesDeclaration.ts (0 errors) ====
export var x;

View file

@ -1,7 +1,7 @@
error TS5045: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'.
error TS5053: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'.
!!! error TS5045: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'.
!!! error TS5053: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'.
==== tests/cases/compiler/isolatedModulesNoEmitOnError.ts (0 errors) ====
export var x;

View file

@ -1,8 +1,8 @@
error TS5046: Option 'out' cannot be specified with option 'isolatedModules'.
error TS5053: Option 'out' cannot be specified with option 'isolatedModules'.
tests/cases/compiler/file2.ts(1,1): error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided.
!!! error TS5046: Option 'out' cannot be specified with option 'isolatedModules'.
!!! error TS5053: Option 'out' cannot be specified with option 'isolatedModules'.
==== tests/cases/compiler/file1.ts (0 errors) ====
export var x;

View file

@ -1,9 +1,9 @@
error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'.
error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'.
!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'.
!!! error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {

View file

@ -1,9 +1,9 @@
error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'.
error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'.
!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'.
!!! error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {

View file

@ -1,7 +1,7 @@
error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'.
!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {

View file

@ -1,7 +1,7 @@
error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'.
!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {

View file

@ -1,7 +1,7 @@
error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'.
!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {

View file

@ -1,7 +1,7 @@
error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'.
!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {