Skip to content

Commit

Permalink
fix(select): tslint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pimenovoleg committed Sep 20, 2018
1 parent f88a128 commit 8301590
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/lib/select/select-errors.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

/**
* Returns an exception to be thrown when attempting to change a select's `multiple` option
* after initialization.
* @docs-private
*/
export function getMcSelectDynamicMultipleError(): Error {
return Error('Cannot change `multiple` mode of select after initialization.');
return Error('Cannot change `multiple` mode of select after initialization.');
}

/**
Expand All @@ -22,7 +14,7 @@ export function getMcSelectDynamicMultipleError(): Error {
* @docs-private
*/
export function getMcSelectNonArrayValueError(): Error {
return Error('Value must be an array in multiple-selection mode.');
return Error('Value must be an array in multiple-selection mode.');
}

/**
Expand All @@ -31,5 +23,5 @@ export function getMcSelectNonArrayValueError(): Error {
* actually takes two values and returns a boolean is not checked.
*/
export function getMcSelectNonFunctionValueError(): Error {
return Error('`compareWith` must be a function.');
return Error('`compareWith` must be a function.');
}
3 changes: 3 additions & 0 deletions src/lib/select/select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,7 @@ export class McSelect extends _McSelectMixinBase implements

/** Handles keyboard events while the select is closed. */
private _handleClosedKeydown(event: KeyboardEvent): void {
/* tslint:disable-next-line */
const keyCode = event.keyCode;
const isArrowKey = keyCode === DOWN_ARROW || keyCode === UP_ARROW ||
keyCode === LEFT_ARROW || keyCode === RIGHT_ARROW;
Expand All @@ -875,6 +876,7 @@ export class McSelect extends _McSelectMixinBase implements

/** Handles keyboard events when the selected is open. */
private _handleOpenKeydown(event: KeyboardEvent): void {
/* tslint:disable-next-line */
const keyCode = event.keyCode;
const isArrowKey = keyCode === DOWN_ARROW || keyCode === UP_ARROW;
const manager = this._keyManager;
Expand Down Expand Up @@ -1135,6 +1137,7 @@ export class McSelect extends _McSelectMixinBase implements

/** Gets the index of the provided option in the option list. */
private _getOptionIndex(option: McOption): number | undefined {
/* tslint:disable-next-line */
return this.options.reduce((result: number, current: McOption, index: number) => {
/* tslint:disable-next-line:strict-type-predicates */
return result === undefined ? (option === current ? index : undefined) : result;
Expand Down

0 comments on commit 8301590

Please sign in to comment.