This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 889
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a fixer for "unnecessary-constructor" rule. (#4694)
* Add a fixer for "unnecessary-constructor" rule. * Handle decorated parameters.
- Loading branch information
Showing
3 changed files
with
88 additions
and
1 deletion.
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
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,69 @@ | ||
export class ExportedClass { | ||
} | ||
|
||
class PublicConstructor { | ||
} | ||
|
||
class ProtectedConstructor { | ||
protected constructor() { } | ||
} | ||
|
||
class PrivateConstructor { | ||
private constructor() { } | ||
} | ||
|
||
class SameLine { } | ||
|
||
class WithPrecedingMember { | ||
public member: string; | ||
} | ||
|
||
class WithFollowingMethod { | ||
public method() {} | ||
} | ||
|
||
const classExpression = class { | ||
} | ||
|
||
class ContainsContents { | ||
constructor() { | ||
console.log("Hello!"); | ||
} | ||
} | ||
|
||
class CallsSuper extends PublicConstructor { | ||
constructor() { | ||
super(); | ||
} | ||
} | ||
|
||
class ContainsParameter { | ||
} | ||
|
||
class PrivateContainsParameter { | ||
private constructor(x: number) { } | ||
} | ||
|
||
class ProtectedContainsParameter { | ||
protected constructor(x: number) { } | ||
} | ||
|
||
class ContainsParameterDeclaration { | ||
constructor(public x: number) { } | ||
} | ||
|
||
class ContainsParameterAndParameterDeclaration { | ||
constructor(x: number, public y: number) { } | ||
} | ||
|
||
class ConstructorOverload { | ||
} | ||
|
||
interface IConstructorSignature { | ||
new(): {}; | ||
} | ||
|
||
class DecoratedParameters { | ||
constructor(@Optional x: number) {} | ||
} | ||
|
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