Skip to content

Commit

Permalink
chore: make error message about statics more descriptive (#253)
Browse files Browse the repository at this point in the history
Add a 'non-const' qualifier to indicate that you probably forgot
to add 'const' on your 'public static' properties.
  • Loading branch information
rix0rrr authored Oct 9, 2018
1 parent 7e600f9 commit 879d5db
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/jsii/lib/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function _defaultValidations(): ValidationFunction[] {
if (member.static && (member as spec.Property).const) { continue; }
if (member.name && member.name !== Case.camel(member.name)) {
diagnostic(ts.DiagnosticCategory.Error,
`Method and property names must use camelCase: ${member.name}`);
`Method and non-static non-readonly property names must use camelCase: ${member.name}`);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/jsii/test/negatives/neg.method-name.1.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///!MATCH_ERROR: Method and property names must use camelCase: METHOD
///!MATCH_ERROR: Method and non-static non-readonly property names must use camelCase: METHOD

export class MyClass {
public METHOD() {
Expand Down
2 changes: 1 addition & 1 deletion packages/jsii/test/negatives/neg.method-name.2.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///!MATCH_ERROR: Method and property names must use camelCase: hello_world
///!MATCH_ERROR: Method and non-static non-readonly property names must use camelCase: hello_world

export class MyClass {
public hello_world() {
Expand Down
2 changes: 1 addition & 1 deletion packages/jsii/test/negatives/neg.property-name.1.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///!MATCH_ERROR: Method and property names must use camelCase: PROP
///!MATCH_ERROR: Method and non-static non-readonly property names must use camelCase: PROP

export class MyClass {
public PROP?: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/jsii/test/negatives/neg.property-name.2.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///!MATCH_ERROR: Method and property names must use camelCase: my_Prop
///!MATCH_ERROR: Method and non-static non-readonly property names must use camelCase: my_Prop

export class MyClass {
public my_Prop?: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/jsii/test/negatives/neg.static-method-name.1.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///!MATCH_ERROR: Method and property names must use camelCase: MethodIsNotCamelCase
///!MATCH_ERROR: Method and non-static non-readonly property names must use camelCase: MethodIsNotCamelCase

export class MyClass {
MethodIsNotCamelCase() {
Expand Down
2 changes: 1 addition & 1 deletion packages/jsii/test/negatives/neg.static-method-name.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///!MATCH_ERROR: Method and property names must use camelCase: METHOD
///!MATCH_ERROR: Method and non-static non-readonly property names must use camelCase: METHOD

export class MyClass {
METHOD() {
Expand Down
2 changes: 1 addition & 1 deletion packages/jsii/test/negatives/neg.static-prop-name.1.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///!MATCH_ERROR: Method and property names must use camelCase: Prop
///!MATCH_ERROR: Method and non-static non-readonly property names must use camelCase: Prop

export class MyClass {
static get Prop() {
Expand Down
2 changes: 1 addition & 1 deletion packages/jsii/test/negatives/neg.static-prop-name.2.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///!MATCH_ERROR: Method and property names must use camelCase: PROP
///!MATCH_ERROR: Method and non-static non-readonly property names must use camelCase: PROP

export class MyClass {
static get PROP() {
Expand Down

0 comments on commit 879d5db

Please sign in to comment.