forked from palantir/tslint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
member-ordering: Support categories (palantir#2041)
- Loading branch information
1 parent
2ce15c7
commit 18e7604
Showing
21 changed files
with
347 additions
and
187 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,10 @@ | ||
class C { | ||
static foo() {} | ||
protected static bar = 0; | ||
static baz(); | ||
|
||
constructor(); | ||
|
||
static bang(); | ||
~~~~~~~~~~~~~~ [Declaration of static non-private not allowed after declaration of constructor. Instead, this should come at the beginning of the class/interface.] | ||
} |
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,18 @@ | ||
{ | ||
"rules": { | ||
"member-ordering": [true, { | ||
"order": [ | ||
{ | ||
"name": "static non-private", | ||
"kinds": [ | ||
"public-static-field", | ||
"protected-static-field", | ||
"public-static-method", | ||
"protected-static-method" | ||
] | ||
}, | ||
"constructor" | ||
] | ||
}] | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
test/rules/member-ordering/omit-access-modifier/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,12 @@ | ||
class C { | ||
private static x = 0; | ||
static y = 1; | ||
|
||
x = 0; | ||
private y = 1; | ||
|
||
constructor() {} | ||
|
||
static z = 2; | ||
~~~~~~~~~~~~~ [Declaration of static field not allowed after declaration of constructor. Instead, this should come at the beginning of the class/interface.] | ||
} |
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,9 @@ | ||
{ | ||
"rules": { | ||
"member-ordering": [true, { "order": [ | ||
"static-field", | ||
"instance-field", | ||
"constructor" | ||
]}] | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
test/rules/member-ordering/public-before-private/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,10 @@ | ||
class Foo { | ||
private x: number; | ||
private bar(): any { | ||
var bla: { a: string } = {a: '1'}; | ||
} | ||
y: number; | ||
~~~~~~~~~~ [0] | ||
} | ||
|
||
[0]: Declaration of public member not allowed after declaration of private member. Instead, this should come at the beginning of the class/interface. |
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
test/rules/member-ordering/static-before-instance/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,10 @@ | ||
class Foo { | ||
x: number; | ||
static y: number; | ||
~~~~~~~~~~~~~~~~~ [0] | ||
constructor() { | ||
// nothing to do | ||
} | ||
} | ||
|
||
[0]: Declaration of static member not allowed after declaration of instance member. Instead, this should come at the beginning of the class/interface. |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.