-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Plain JS binder errors Issue select errors from the binder in JS files that do not have checkJS explicitly turned on or off. These errors mirror runtime checks done by Javascript. * Rest of plain JS binder errors * address PR comments * Only issue binder errors in plain JS. Checker errors require requesting diagnostics, which stll needs to be peformance tested. This commit removes one cross-file duplicate declaration error in the tests. * fix const lint
- Loading branch information
Showing
32 changed files
with
893 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
tests/baselines/reference/argumentsReferenceInConstructor4_Js.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/a.js(18,9): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. | ||
|
||
|
||
==== /a.js (1 errors) ==== | ||
class A { | ||
/** | ||
* Constructor | ||
* | ||
* @param {object} [foo={}] | ||
*/ | ||
constructor(foo = {}) { | ||
const key = "bar"; | ||
|
||
/** | ||
* @type object | ||
*/ | ||
this.foo = foo; | ||
|
||
/** | ||
* @type object | ||
*/ | ||
const arguments = this.arguments; | ||
~~~~~~~~~ | ||
!!! error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. | ||
|
||
/** | ||
* @type object | ||
*/ | ||
this.bar = arguments.bar; | ||
|
||
/** | ||
* @type object | ||
*/ | ||
this.baz = arguments[key]; | ||
|
||
/** | ||
* @type object | ||
*/ | ||
this.options = arguments; | ||
} | ||
|
||
get arguments() { | ||
return { bar: {} }; | ||
} | ||
} | ||
|
44 changes: 44 additions & 0 deletions
44
tests/baselines/reference/argumentsReferenceInMethod4_Js.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/a.js(16,9): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. | ||
|
||
|
||
==== /a.js (1 errors) ==== | ||
class A { | ||
/** | ||
* @param {object} [foo={}] | ||
*/ | ||
m(foo = {}) { | ||
const key = "bar"; | ||
|
||
/** | ||
* @type object | ||
*/ | ||
this.foo = foo; | ||
|
||
/** | ||
* @type object | ||
*/ | ||
const arguments = this.arguments; | ||
~~~~~~~~~ | ||
!!! error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. | ||
|
||
/** | ||
* @type object | ||
*/ | ||
this.bar = arguments.bar; | ||
|
||
/** | ||
* @type object | ||
*/ | ||
this.baz = arguments[key]; | ||
|
||
/** | ||
* @type object | ||
*/ | ||
this.options = arguments; | ||
} | ||
|
||
get arguments() { | ||
return { bar: {} }; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
tests/cases/compiler/export.js(1,13): error TS2451: Cannot redeclare block-scoped variable 'foo'. | ||
tests/cases/compiler/export.js(1,13): error TS8008: Type aliases can only be used in TypeScript files. | ||
tests/cases/compiler/export.js(6,14): error TS2451: Cannot redeclare block-scoped variable 'foo'. | ||
|
||
|
||
==== tests/cases/compiler/export.js (1 errors) ==== | ||
==== tests/cases/compiler/export.js (3 errors) ==== | ||
export type foo = 5; | ||
~~~ | ||
!!! error TS2451: Cannot redeclare block-scoped variable 'foo'. | ||
~~~ | ||
!!! error TS8008: Type aliases can only be used in TypeScript files. | ||
/** | ||
* @typedef {{ | ||
* }} | ||
*/ | ||
export const foo = 5; | ||
export const foo = 5; | ||
~~~ | ||
!!! error TS2451: Cannot redeclare block-scoped variable 'foo'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
tests/cases/conformance/salsa/plainJSBinderErrors.js(1,1): error TS2528: A module cannot have multiple default exports. | ||
tests/cases/conformance/salsa/plainJSBinderErrors.js(2,1): error TS2528: A module cannot have multiple default exports. | ||
tests/cases/conformance/salsa/plainJSBinderErrors.js(3,7): error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module. | ||
tests/cases/conformance/salsa/plainJSBinderErrors.js(4,7): error TS1214: Identifier expected. 'yield' is a reserved word in strict mode. Modules are automatically in strict mode. | ||
tests/cases/conformance/salsa/plainJSBinderErrors.js(6,11): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. | ||
tests/cases/conformance/salsa/plainJSBinderErrors.js(9,11): error TS1214: Identifier expected. 'yield' is a reserved word in strict mode. Modules are automatically in strict mode. | ||
tests/cases/conformance/salsa/plainJSBinderErrors.js(12,5): error TS18012: '#constructor' is a reserved word. | ||
tests/cases/conformance/salsa/plainJSBinderErrors.js(15,20): error TS1102: 'delete' cannot be called on an identifier in strict mode. | ||
tests/cases/conformance/salsa/plainJSBinderErrors.js(18,16): error TS1102: 'delete' cannot be called on an identifier in strict mode. | ||
tests/cases/conformance/salsa/plainJSBinderErrors.js(19,16): error TS1102: 'delete' cannot be called on an identifier in strict mode. | ||
tests/cases/conformance/salsa/plainJSBinderErrors.js(22,15): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'eval'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. | ||
tests/cases/conformance/salsa/plainJSBinderErrors.js(23,15): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. | ||
tests/cases/conformance/salsa/plainJSBinderErrors.js(26,27): error TS1121: Octal literals are not allowed in strict mode. | ||
tests/cases/conformance/salsa/plainJSBinderErrors.js(27,9): error TS1101: 'with' statements are not allowed in strict mode. | ||
tests/cases/conformance/salsa/plainJSBinderErrors.js(33,13): error TS1344: 'A label is not allowed here. | ||
tests/cases/conformance/salsa/plainJSBinderErrors.js(39,7): error TS1215: Invalid use of 'eval'. Modules are automatically in strict mode. | ||
tests/cases/conformance/salsa/plainJSBinderErrors.js(40,7): error TS1215: Invalid use of 'arguments'. Modules are automatically in strict mode. | ||
|
||
|
||
==== tests/cases/conformance/salsa/plainJSBinderErrors.js (17 errors) ==== | ||
export default 12 | ||
~~~~~~~~~~~~~~~~~ | ||
!!! error TS2528: A module cannot have multiple default exports. | ||
!!! related TS2753 tests/cases/conformance/salsa/plainJSBinderErrors.js:2:1: Another export default is here. | ||
export default 13 | ||
~~~~~~~~~~~~~~~~~ | ||
!!! error TS2528: A module cannot have multiple default exports. | ||
!!! related TS2752 tests/cases/conformance/salsa/plainJSBinderErrors.js:1:1: The first export default is here. | ||
const await = 1 | ||
~~~~~ | ||
!!! error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module. | ||
const yield = 2 | ||
~~~~~ | ||
!!! error TS1214: Identifier expected. 'yield' is a reserved word in strict mode. Modules are automatically in strict mode. | ||
async function f() { | ||
const await = 3 | ||
~~~~~ | ||
!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. | ||
} | ||
function* g() { | ||
const yield = 4 | ||
~~~~~ | ||
!!! error TS1214: Identifier expected. 'yield' is a reserved word in strict mode. Modules are automatically in strict mode. | ||
} | ||
class C { | ||
#constructor = 5 | ||
~~~~~~~~~~~~ | ||
!!! error TS18012: '#constructor' is a reserved word. | ||
deleted() { | ||
function container(f) { | ||
delete f | ||
~ | ||
!!! error TS1102: 'delete' cannot be called on an identifier in strict mode. | ||
} | ||
var g = 6 | ||
delete g | ||
~ | ||
!!! error TS1102: 'delete' cannot be called on an identifier in strict mode. | ||
delete container | ||
~~~~~~~~~ | ||
!!! error TS1102: 'delete' cannot be called on an identifier in strict mode. | ||
} | ||
evalArguments() { | ||
const eval = 7 | ||
~~~~ | ||
!!! error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'eval'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. | ||
const arguments = 8 | ||
~~~~~~~~~ | ||
!!! error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. | ||
} | ||
withOctal() { | ||
const redundant = 010 | ||
~~~ | ||
!!! error TS1121: Octal literals are not allowed in strict mode. | ||
with (redundant) { | ||
~~~~ | ||
!!! error TS1101: 'with' statements are not allowed in strict mode. | ||
return toFixed() | ||
} | ||
} | ||
label() { | ||
for(;;) { | ||
label: var x = 1 | ||
~~~~~ | ||
!!! error TS1344: 'A label is not allowed here. | ||
break label | ||
} | ||
return x | ||
} | ||
} | ||
const eval = 9 | ||
~~~~ | ||
!!! error TS1215: Invalid use of 'eval'. Modules are automatically in strict mode. | ||
const arguments = 10 | ||
~~~~~~~~~ | ||
!!! error TS1215: Invalid use of 'arguments'. Modules are automatically in strict mode. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
//// [plainJSBinderErrors.js] | ||
export default 12 | ||
export default 13 | ||
const await = 1 | ||
const yield = 2 | ||
async function f() { | ||
const await = 3 | ||
} | ||
function* g() { | ||
const yield = 4 | ||
} | ||
class C { | ||
#constructor = 5 | ||
deleted() { | ||
function container(f) { | ||
delete f | ||
} | ||
var g = 6 | ||
delete g | ||
delete container | ||
} | ||
evalArguments() { | ||
const eval = 7 | ||
const arguments = 8 | ||
} | ||
withOctal() { | ||
const redundant = 010 | ||
with (redundant) { | ||
return toFixed() | ||
} | ||
} | ||
label() { | ||
for(;;) { | ||
label: var x = 1 | ||
break label | ||
} | ||
return x | ||
} | ||
} | ||
const eval = 9 | ||
const arguments = 10 | ||
|
||
|
||
//// [plainJSBinderErrors.js] | ||
export default 12; | ||
export default 13; | ||
const await = 1; | ||
const yield = 2; | ||
async function f() { | ||
const await = 3; | ||
} | ||
function* g() { | ||
const yield = 4; | ||
} | ||
class C { | ||
#constructor = 5; | ||
deleted() { | ||
function container(f) { | ||
delete f; | ||
} | ||
var g = 6; | ||
delete g; | ||
delete container; | ||
} | ||
evalArguments() { | ||
const eval = 7; | ||
const arguments = 8; | ||
} | ||
withOctal() { | ||
const redundant = 010; | ||
with (redundant) { | ||
return toFixed(); | ||
} | ||
} | ||
label() { | ||
for (;;) { | ||
label: var x = 1; | ||
break label; | ||
} | ||
return x; | ||
} | ||
} | ||
const eval = 9; | ||
const arguments = 10; |
Oops, something went wrong.