refactor(cli/fmt_errors): Improve source line formatting (#4832)

This commit is contained in:
Nayeem Rahman 2020-04-20 20:39:02 +01:00 committed by GitHub
parent f72f045de5
commit ef6ee25e09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 218 additions and 271 deletions

View file

@ -1,15 +1,21 @@
[WILDCARD]
error TS2552: Cannot find name 'consol'. Did you mean 'console'?
[WILDCARD]error TS2552: Cannot find name 'consol'. Did you mean 'console'?
consol.log("hello world!");
~~~~~~
at [WILDCARD]tests/038_checkjs.js:2:1
[WILDCARD]tests/038_checkjs.js:2:1
'console' is declared here.
declare var console: Console;
~~~~~~~
at [WILDCARD]
2 consol.log("hello world!");
[WILDCARD]
error TS2552: Cannot find name 'Foo'. Did you mean 'foo'?
const foo = new Foo();
~~~
at [WILDCARD]tests/038_checkjs.js:6:17
[WILDCARD]tests/038_checkjs.js:6:17
'foo' is declared here.
const foo = new Foo();
~~~
at [WILDCARD]tests/038_checkjs.js:6:7
6 const foo = new Foo();
[WILDCARD]
Found 2 errors.
[WILDCARD]

View file

@ -1,6 +1,4 @@
[WILDCARD]
error: Uncaught BadResource: Bad resource ID
[WILDCARD]dispatch_json.ts:[WILDCARD]
[WILDCARD]error: Uncaught BadResource: Bad resource ID
at unwrapResponse ([WILDCARD]dispatch_json.ts:[WILDCARD])
at Object.sendAsync ([WILDCARD]dispatch_json.ts:[WILDCARD])
at async main ([WILDCARD]tests/044_bad_resource.ts:[WILDCARD])

View file

@ -2,10 +2,7 @@
before error
world
error: Uncaught Error: error
[WILDCARD]tests/async_error.ts:5:9
5 throw Error("error");
^
throw Error("error");
^
at foo ([WILDCARD]tests/async_error.ts:5:9)
at [WILDCARD]tests/async_error.ts:8:1

View file

@ -1,10 +1,7 @@
[WILDCARD]Unsupported compiler options in "[WILDCARD]config.tsconfig.json"
The following options were ignored:
module, target
[WILDCARD]error TS2532: Object is possibly 'undefined'.
[WILDCARD]tests/config.ts:3:5
3 if (map.get("bar").foo) {
~~~~~~~~~~~~~~
error TS2532: Object is possibly 'undefined'.
if (map.get("bar").foo) {
~~~~~~~~~~~~~~
at [WILDCARD]tests/config.ts:3:5

View file

@ -1,9 +1,6 @@
[WILDCARD]error: Uncaught Error: bad
[WILDCARD]tests/error_001.ts:2:9
2 throw Error("bad");
^
throw Error("bad");
^
at foo ([WILDCARD]tests/error_001.ts:2:9)
at bar ([WILDCARD]tests/error_001.ts:6:3)
at [WILDCARD]tests/error_001.ts:9:1

View file

@ -1,9 +1,6 @@
[WILDCARD]error: Uncaught Error: exception from mod1
[WILDCARD]tests/subdir/mod1.ts:16:9
16 throw Error("exception from mod1");
^
throw Error("exception from mod1");
^
at throwsError ([WILDCARD]tests/subdir/mod1.ts:16:9)
at foo ([WILDCARD]tests/error_002.ts:4:3)
at [WILDCARD]tests/error_002.ts:7:1

View file

@ -1,9 +1,6 @@
[WILDCARD]error TS2322: Type '{ a: { b: { c(): { d: number; }; }; }; }' is not assignable to type '{ a: { b: { c(): { d: string; }; }; }; }'.
The types of 'a.b.c().d' are incompatible between these types.
Type 'number' is not assignable to type 'string'.
[WILDCARD]/cli/tests/error_003_typescript.ts:20:1
20 x = y;
^
x = y;
^
at [WILDCARD]/tests/error_003_typescript.ts:20:1

View file

@ -1,5 +1,4 @@
[WILDCARD]error: Uncaught NotFound: Cannot resolve module "[WILDCARD]/bad-module.ts" from "[WILDCARD]/error_004_missing_module.ts"
[WILDCARD]dispatch_json.ts:[WILDCARD]
at unwrapResponse ([WILDCARD]dispatch_json.ts:[WILDCARD])
at Object.sendAsync ([WILDCARD]dispatch_json.ts:[WILDCARD])
at async processImports ([WILDCARD]compiler/imports.ts:[WILDCARD])

View file

@ -1,5 +1,4 @@
[WILDCARD]error: Uncaught NotFound: Cannot resolve module "[WILDCARD]/bad-module.ts" from "[WILDCARD]/error_005_missing_dynamic_import.ts"
[WILDCARD]dispatch_json.ts:[WILDCARD]
at unwrapResponse ([WILDCARD]dispatch_json.ts:[WILDCARD])
at Object.sendAsync ([WILDCARD]dispatch_json.ts:[WILDCARD])
at async processImports ([WILDCARD]compiler/imports.ts:[WILDCARD])

View file

@ -1,5 +1,4 @@
[WILDCARD]error: Uncaught NotFound: Cannot resolve module "[WILDCARD]/non-existent" from "[WILDCARD]/error_006_import_ext_failure.ts"
[WILDCARD]dispatch_json.ts:[WILDCARD]
at unwrapResponse ([WILDCARD]dispatch_json.ts:[WILDCARD])
at Object.sendAsync ([WILDCARD]dispatch_json.ts:[WILDCARD])
at async processImports ([WILDCARD]compiler/imports.ts:[WILDCARD])

View file

@ -1,7 +1,4 @@
[WILDCARD]error: Uncaught ReferenceError: consol is not defined
[WILDCARD]tests/error_008_checkjs.js:2:1
2 consol.log("hello world!");
^
consol.log("hello world!");
^
at [WILDCARD]tests/error_008_checkjs.js:2:1

View file

@ -1,5 +1,4 @@
[WILDCARD]error: Uncaught URIError: relative import path "bad-module.ts" not prefixed with / or ./ or ../ Imported from "[WILDCARD]/error_011_bad_module_specifier.ts"
[WILDCARD]dispatch_json.ts:[WILDCARD]
at unwrapResponse ([WILDCARD]ops/dispatch_json.ts:[WILDCARD])
at Object.sendSync ([WILDCARD]ops/dispatch_json.ts:[WILDCARD])
at resolveModules ([WILDCARD]compiler/imports.ts:[WILDCARD])

View file

@ -1,5 +1,4 @@
[WILDCARD]error: Uncaught URIError: relative import path "bad-module.ts" not prefixed with / or ./ or ../ Imported from "[WILDCARD]/error_012_bad_dynamic_import_specifier.ts"
[WILDCARD]dispatch_json.ts:[WILDCARD]
at unwrapResponse ([WILDCARD]ops/dispatch_json.ts:[WILDCARD])
at Object.sendSync ([WILDCARD]ops/dispatch_json.ts:[WILDCARD])
at resolveModules ([WILDCARD]compiler/imports.ts:[WILDCARD])

View file

@ -1,3 +1,2 @@
[WILDCARD]error TS2532: Object is possibly 'undefined'.
► file:///[WILDCARD]cli/tests/error_017_hide_long_source_ts.ts:2:1
at [WILDCARD]tests/error_017_hide_long_source_ts.ts:2:1

View file

@ -1,3 +1,2 @@
error: Uncaught TypeError: Cannot read property 'a' of undefined
► file:///[WILDCARD]cli/tests/error_018_hide_long_source_js.js:2:206
at file:///[WILDCARD]cli/tests/error_018_hide_long_source_js.js:2:206

View file

@ -1,6 +1,4 @@
error: Uncaught SyntaxError: Unexpected identifier
[WILDCARD]tests/error_syntax.js:3:6
3 (the following is a syntax error ^^ ! )
~~~~~~~~~
(the following is a syntax error ^^ ! )
~~~~~~~~~
at [WILDCARD]tests/error_syntax.js:3:6

View file

@ -1,2 +1,2 @@
error: Uncaught SyntaxError: Unexpected end of input
► file:///[WILDCARD]cli/tests/error_syntax_empty_trailing_line.mjs:[WILDCARD]
at [WILDCARD]tests/error_syntax_empty_trailing_line.mjs:[WILDCARD]

View file

@ -1,5 +1,4 @@
[WILDCARD]error: Uncaught URIError: relative import path "baz" not prefixed with / or ./ or ../ Imported from "[WILDCARD]/type_definitions/bar.d.ts"
[WILDCARD]ops/dispatch_json.ts:[WILDCARD]
at unwrapResponse ([WILDCARD]ops/dispatch_json.ts:[WILDCARD])
at Object.sendSync ([WILDCARD]ops/dispatch_json.ts:[WILDCARD])
at Object.resolveModules ([WILDCARD]ops/compiler.ts:[WILDCARD])