-
Notifications
You must be signed in to change notification settings - Fork 10k
Commit
This only happens when it's safe to do so. The exceptions are: - when the class extends another subclass: removing the constructor would remove the error about the missing super() call - when there are default parameters, that could have side effects - when there are destructured prameters, that could have side effects
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class A { | ||
constructor() { | ||
console.log("Hi!"); | ||
} | ||
} | ||
class B { | ||
Check notice Code scanning / CodeQL Unused variable, import, function or class Note library
Unused class B.
|
||
constructor(x = console.log("Hi!")) {} | ||
} | ||
class C { | ||
Check notice Code scanning / CodeQL Unused variable, import, function or class Note library
Unused class C.
|
||
constructor({ | ||
x | ||
}) {} | ||
} | ||
class D {} | ||
Check notice Code scanning / CodeQL Unused variable, import, function or class Note library
Unused class D.
|
||
class E extends A { | ||
Check notice Code scanning / CodeQL Unused variable, import, function or class Note library
Unused class E.
|
||
constructor() {} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class A { | ||
constructor() { | ||
console.log("Hi!"); | ||
} | ||
} | ||
|
||
class B { | ||
Check notice Code scanning / CodeQL Unused variable, import, function or class Note library
Unused class B.
|
||
constructor(x = console.log("Hi!")) {} | ||
} | ||
|
||
class C { | ||
Check notice Code scanning / CodeQL Unused variable, import, function or class Note library
Unused class C.
|
||
constructor({ x }) {} | ||
} | ||
|
||
class D { | ||
Check notice Code scanning / CodeQL Unused variable, import, function or class Note library
Unused class D.
|
||
constructor(x, y, z) {} | ||
} | ||
|
||
class E extends A { | ||
Check notice Code scanning / CodeQL Unused variable, import, function or class Note library
Unused class E.
|
||
constructor() {} | ||
} |