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.
semicolon: add "strict-bound-class-methods" option (#3294)
[new-rule-option] `semicolon` adds `"strict-bound-class-methods"` Fixes: #3216
- Loading branch information
Showing
4 changed files
with
74 additions
and
5 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
22 changes: 22 additions & 0 deletions
22
test/rules/semicolon/strict-bound-class-methods/test.ts.fix
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,22 @@ | ||
class MyClass { | ||
public name : string; | ||
private index : number; | ||
private email : string; | ||
|
||
public initializedProperty = 6; | ||
public initializedMethodProperty = () => { | ||
return "hi"; | ||
}; | ||
|
||
public initializedMethodPropertyWithoutSemicolon = () => { | ||
return "hi again"; | ||
}; | ||
|
||
public initializedMethodProperty1Line = () => { return "hi"; }; | ||
|
||
public initializedMethodPropertyWithoutSemicolon1Line = () => { return "hi again"; }; | ||
public realMethod() {} | ||
public multilineRealMethod() { | ||
return "foo"; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
test/rules/semicolon/strict-bound-class-methods/test.ts.lint
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,27 @@ | ||
class MyClass { | ||
public name : string | ||
~nil [Missing semicolon] | ||
private index : number | ||
~nil [Missing semicolon] | ||
private email : string; | ||
|
||
public initializedProperty = 6 | ||
~nil [Missing semicolon] | ||
public initializedMethodProperty = () => { | ||
return "hi"; | ||
}; | ||
|
||
public initializedMethodPropertyWithoutSemicolon = () => { | ||
return "hi again"; | ||
} | ||
~nil [Missing semicolon] | ||
|
||
public initializedMethodProperty1Line = () => { return "hi"; }; | ||
|
||
public initializedMethodPropertyWithoutSemicolon1Line = () => { return "hi again"; } | ||
~nil [Missing semicolon] | ||
public realMethod() {} | ||
public multilineRealMethod() { | ||
return "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,5 @@ | ||
{ | ||
"rules": { | ||
"semicolon": [true, "always", "strict-bound-class-methods"] | ||
} | ||
} |