Skip to content

Commit

Permalink
fix(finnish): Guard against spread properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
cartant committed Jan 30, 2018
1 parent d348f88 commit 6c6695b
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions fixtures/finnish-with-$/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import "rxjs/add/observable/of";
const someObservable$ = Observable.of(0);

const someEmptyObject = {};
const someObject = { someKey$: someObservable$ };
const { ...someEmptyObject, someKey$ } = someObject;
const someObject = { ...someEmptyObject, someKey$: someObservable$ };
const { someKey$ } = someObject;
const { someKey$: someRenamedKey$ } = someObject;

const someArray = [someObservable$];
Expand Down
4 changes: 2 additions & 2 deletions fixtures/finnish-without-$/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import "rxjs/add/observable/of";
const someObservable = Observable.of(0);

const someEmptyObject = {};
const someObject = { someKey: someObservable };
const { ...someEmptyObject, someKey } = someObject;
const someObject = { ...someEmptyObject, someKey: someObservable };
const { someKey } = someObject;
const { someKey: someRenamedKey } = someObject;

const someArray = [someObservable];
Expand Down
4 changes: 2 additions & 2 deletions fixtures/no-finnish-with-$/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import "rxjs/add/observable/of";
const someObservable$ = Observable.of(0);

const someEmptyObject = {};
const someObject = { someKey$: someObservable$ };
const { ...someEmptyObject, someKey$ } = someObject;
const someObject = { ...someEmptyObject, someKey$: someObservable$ };
const { someKey$ } = someObject;
const { someKey$: someRenamedKey$ } = someObject;

const someArray = [someObservable$];
Expand Down
4 changes: 2 additions & 2 deletions fixtures/no-finnish-without-$/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import "rxjs/add/observable/of";
const someObservable = Observable.of(0);

const someEmptyObject = {};
const someObject = { someKey: someObservable };
const { ...someEmptyObject, someKey } = someObject;
const someObject = { ...someEmptyObject, someKey: someObservable };
const { someKey } = someObject;
const { someKey: someRenamedKey } = someObject;

const someArray = [someObservable];
Expand Down
2 changes: 1 addition & 1 deletion source/rules/rxjsFinnishRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Walker extends Lint.ProgramAwareRuleWalker {
protected visitObjectLiteralExpression(node: ts.ObjectLiteralExpression): void {

node.properties.forEach(property => {
if (property.name.kind !== ts.SyntaxKind.ComputedPropertyName) {
if (property.name && (property.name.kind !== ts.SyntaxKind.ComputedPropertyName)) {
this.validateNode(property);
}
});
Expand Down
2 changes: 1 addition & 1 deletion source/rules/rxjsNoFinnishRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class Walker extends Lint.ProgramAwareRuleWalker {
protected visitObjectLiteralExpression(node: ts.ObjectLiteralExpression): void {

node.properties.forEach(property => {
if (property.name.kind !== ts.SyntaxKind.ComputedPropertyName) {
if (property.name && (property.name.kind !== ts.SyntaxKind.ComputedPropertyName)) {
this.validateNode(property);
}
});
Expand Down

0 comments on commit 6c6695b

Please sign in to comment.