mirror of
https://github.com/github/codeql.git
synced 2026-04-23 07:45:17 +02:00
Merge pull request #19741 from Napalys/js/quality/suspicious_method_names
JS: Promote `js/suspicious-method-name-declaration` to the Code Quality suite.
This commit is contained in:
@@ -2,3 +2,14 @@
|
||||
| tst.ts:16:3:16:21 | function(): number; | The member name 'function' does not declare a function, it declares a method named 'function'. |
|
||||
| tst.ts:37:3:37:21 | function(): number; | The member name 'function' does not declare a function, it declares a method named 'function'. |
|
||||
| tst.ts:48:3:48:13 | new(): Quz; | The member name 'new' does not declare a constructor, but 'constructor' does in class declarations. |
|
||||
| tst.ts:60:3:60:21 | function(): number; | The member name 'function' does not declare a function, it declares a method named 'function'. |
|
||||
| tst.ts:64:3:64:24 | constru ... number; | The member name 'constructor' does not declare a constructor in interfaces, but it does in classes. |
|
||||
| tst.ts:74:3:74:30 | functio ... string; | The member name 'function' does not declare a function, it declares a method named 'function'. |
|
||||
| tst.ts:75:3:75:30 | functio ... number; | The member name 'function' does not declare a function, it declares a method named 'function'. |
|
||||
| tst.ts:76:3:76:24 | functio ... ): any; | The member name 'function' does not declare a function, it declares a method named 'function'. |
|
||||
| tst.ts:80:3:80:23 | abstrac ... : void; | The member name 'new' does not declare a constructor, but 'constructor' does in class declarations. |
|
||||
| tst.ts:84:3:84:30 | abstrac ... number; | The member name 'function' does not declare a function, it declares a method named 'function'. |
|
||||
| tst.ts:93:5:93:21 | function(): void; | The member name 'function' does not declare a function, it declares a method named 'function'. |
|
||||
| tst.ts:98:3:98:21 | function(): number; | The member name 'function' does not declare a function, it declares a method named 'function'. |
|
||||
| tst.ts:110:3:110:24 | constru ... number; | The member name 'constructor' does not declare a constructor in interfaces, but it does in classes. |
|
||||
| tst.ts:116:3:116:24 | constru ... number; | The member name 'constructor' does not declare a constructor in interfaces, but it does in classes. |
|
||||
|
||||
@@ -50,3 +50,70 @@ declare class Quz {
|
||||
|
||||
var bla = new Foo();
|
||||
var blab = new Baz();
|
||||
|
||||
|
||||
interface X {
|
||||
constructor: () => string; // Just a property, not a method.
|
||||
}
|
||||
|
||||
type A = {
|
||||
function(): number; // $ Alert
|
||||
};
|
||||
|
||||
type B = {
|
||||
constructor(): number; // $ Alert
|
||||
new(): number;
|
||||
};
|
||||
|
||||
class StaticMethods {
|
||||
static function(): void {}
|
||||
static new(): void {}
|
||||
}
|
||||
|
||||
interface Overloaded {
|
||||
function(x: string): string; // $Alert
|
||||
function(x: number): number; // $Alert
|
||||
function(x: any): any; // $Alert
|
||||
}
|
||||
|
||||
abstract class AbstractFoo {
|
||||
abstract new(): void; // $Alert
|
||||
}
|
||||
|
||||
abstract class AbstractFooFunction {
|
||||
abstract function(): number; // $Alert
|
||||
}
|
||||
|
||||
abstract class AbstractFooConstructor {
|
||||
constructor(){}
|
||||
}
|
||||
|
||||
declare module "some-module" {
|
||||
interface ModuleInterface {
|
||||
function(): void; // $Alert
|
||||
}
|
||||
}
|
||||
|
||||
type Intersection = {
|
||||
function(): number; // $Alert
|
||||
} & {
|
||||
other(): string;
|
||||
};
|
||||
|
||||
type Union = {
|
||||
new(): number;
|
||||
} | {
|
||||
valid(): string;
|
||||
};
|
||||
|
||||
type Union2 = {
|
||||
constructor(): number; // $Alert
|
||||
} | {
|
||||
valid(): string;
|
||||
};
|
||||
|
||||
type Intersection2 = {
|
||||
constructor(): number; // $Alert
|
||||
} & {
|
||||
other(): string;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user