Skip to content

Commit f6375da

Browse files
committed
enhancement(Autocomplete) coding standards eslint fixes #506
1 parent 8a53446 commit f6375da

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/autocomplete.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Dropdown, DropdownOptions } from "./dropdown";
33
import { Component, BaseOptions, InitElements, MElement } from "./component";
44

55
export interface AutocompleteData {
6-
/**
6+
/**
77
* A primitive value that can be converted to string.
88
* If "text" is not provided, it will also be used as "option text" as well
99
*/
@@ -66,7 +66,7 @@ export interface AutocompleteOptions extends BaseOptions {
6666
* @default {}
6767
*/
6868
dropdownOptions: Partial<DropdownOptions>;
69-
};
69+
}
7070

7171
const _defaults: AutocompleteOptions = {
7272
data: [], // Autocomplete data set
@@ -82,7 +82,7 @@ const _defaults: AutocompleteOptions = {
8282
onSearch: (text: string, autocomplete: Autocomplete) => {
8383
const normSearch = text.toLocaleLowerCase();
8484
autocomplete.setMenuItems(
85-
autocomplete.options.data.filter((option) =>
85+
autocomplete.options.data.filter((option) =>
8686
option.id.toString().toLocaleLowerCase().includes(normSearch)
8787
|| option.text?.toLocaleLowerCase().includes(normSearch)
8888
)
@@ -118,7 +118,7 @@ export class Autocomplete extends Component<AutocompleteOptions> {
118118
...Autocomplete.defaults,
119119
...options
120120
};
121-
121+
122122
this.isOpen = false;
123123
this.count = 0;
124124
this.activeIndex = -1;
@@ -230,6 +230,7 @@ export class Autocomplete extends Component<AutocompleteOptions> {
230230
...Autocomplete.defaults.dropdownOptions,
231231
...this.options.dropdownOptions
232232
};
233+
// @todo shouldn't we conditionally check if dropdownOptions.onItemClick is set in first place?
233234
const userOnItemClick = dropdownOptions.onItemClick;
234235
// Ensuring the select Option call when user passes custom onItemClick function to dropdown
235236
dropdownOptions.onItemClick = (li) => {
@@ -270,6 +271,7 @@ export class Autocomplete extends Component<AutocompleteOptions> {
270271
}
271272
}
272273

274+
// @todo FocusEvent not having e.key parameter, should we split up this method for Keyup/Focus?
273275
_handleInputKeyupAndFocus = (e: KeyboardEvent) => {
274276
if (e.type === 'keyup') Autocomplete._keydown = false;
275277
this.count = 0;

0 commit comments

Comments
 (0)