mirror of
https://github.com/github/codeql.git
synced 2026-04-29 02:35:15 +02:00
JS: Update OK-style comments to $-style
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// OK: don't report anything in .js files.
|
||||
// OK - don't report anything in .js files.
|
||||
function getStuff(number) {
|
||||
return {
|
||||
"new": function() {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
var foo: MyInterface = 123 as any;
|
||||
|
||||
interface MyInterface {
|
||||
function (): number; // OK. Highly unlikely that it is an accident when there are other named methods in the interface.
|
||||
(): number; // OK: What was probably meant above.
|
||||
new:() => void; // OK! This is a property, not a method, we ignore those.
|
||||
constructor(): string; // NOT OK! This a called "constructor"
|
||||
new(): Date; // OK! This a constructor signature.
|
||||
function (): number; // OK - Highly unlikely that it is an accident when there are other named methods in the interface.
|
||||
(): number; // OK - What was probably meant above.
|
||||
new:() => void; // OK - This is a property, not a method, we ignore those.
|
||||
constructor(): string; // $ Alert - This a called "constructor"
|
||||
new(): Date; // OK - This a constructor signature.
|
||||
|
||||
myNumber: 123;
|
||||
}
|
||||
@@ -13,15 +13,15 @@ interface MyInterface {
|
||||
var a : MyFunction = null as any;
|
||||
|
||||
interface MyFunction {
|
||||
function(): number; // NOT OK!
|
||||
function(): number; // $ Alert
|
||||
}
|
||||
|
||||
|
||||
class Foo {
|
||||
new(): number { // OK! Highly unlikely that a developer confuses "constructor" and "new" when both are present.
|
||||
new(): number { // OK - Highly unlikely that a developer confuses "constructor" and "new" when both are present.
|
||||
return 123;
|
||||
}
|
||||
constructor() { // OK! This is a constructor.
|
||||
constructor() { // OK - This is a constructor.
|
||||
|
||||
}
|
||||
myString = "foobar"
|
||||
@@ -34,18 +34,18 @@ class Foo {
|
||||
var b : FunctionClass = new FunctionClass();
|
||||
|
||||
declare class FunctionClass {
|
||||
function(): number; // NOT OK:
|
||||
function(): number; // $ Alert
|
||||
}
|
||||
|
||||
class Baz {
|
||||
new(): Baz { // OK! When there is a method body I assume the developer knows what they are doing.
|
||||
new(): Baz { // OK - When there is a method body I assume the developer knows what they are doing.
|
||||
return null as any;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
declare class Quz {
|
||||
new(): Quz; // NOT OK! The developer likely meant to write constructor.
|
||||
new(): Quz; // $ Alert - The developer likely meant to write constructor.
|
||||
}
|
||||
|
||||
var bla = new Foo();
|
||||
|
||||
Reference in New Issue
Block a user