From fe4778b28bce623daba38465f93eb04d68bec12a Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 11 Jan 2019 13:54:11 +0000 Subject: [PATCH 1/2] De-lint a few more files & remove them from the ignored list --- .eslintignore.errorfiles | 3 --- src/autocomplete/AutocompleteProvider.js | 6 +++++- src/autocomplete/Autocompleter.js | 4 ++-- src/autocomplete/UserProvider.js | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.eslintignore.errorfiles b/.eslintignore.errorfiles index 1c9e2d4413..2b57d4e9e2 100644 --- a/.eslintignore.errorfiles +++ b/.eslintignore.errorfiles @@ -1,8 +1,5 @@ # autogenerated file: run scripts/generate-eslint-error-ignore-file to update. -src/autocomplete/AutocompleteProvider.js -src/autocomplete/Autocompleter.js -src/autocomplete/UserProvider.js src/component-index.js src/components/structures/BottomLeftMenu.js src/components/structures/CompatibilityPage.js diff --git a/src/autocomplete/AutocompleteProvider.js b/src/autocomplete/AutocompleteProvider.js index f9fb61d3a3..906fed5858 100644 --- a/src/autocomplete/AutocompleteProvider.js +++ b/src/autocomplete/AutocompleteProvider.js @@ -41,8 +41,12 @@ export default class AutocompleteProvider { /** * Of the matched commands in the query, returns the first that contains or is contained by the selection, or null. + * @param {string} query The query string + * @param {SelectionRange} selection Selection to search + * @param {boolean} force True if the user is forcing completion + * @return {object} { command, range } where both onjects fields are null if no match */ - getCurrentCommand(query: string, selection: SelectionRange, force: boolean = false): ?string { + getCurrentCommand(query: string, selection: SelectionRange, force: boolean = false) { let commandRegex = this.commandRegex; if (force && this.shouldForceComplete()) { diff --git a/src/autocomplete/Autocompleter.js b/src/autocomplete/Autocompleter.js index e7b89fe576..af2744950f 100644 --- a/src/autocomplete/Autocompleter.js +++ b/src/autocomplete/Autocompleter.js @@ -60,8 +60,8 @@ const PROVIDER_COMPLETION_TIMEOUT = 3000; export default class Autocompleter { constructor(room: Room) { this.room = room; - this.providers = PROVIDERS.map((p) => { - return new p(room); + this.providers = PROVIDERS.map((Prov) => { + return new Prov(room); }); } diff --git a/src/autocomplete/UserProvider.js b/src/autocomplete/UserProvider.js index 2eae053d72..d4a5ec5e74 100644 --- a/src/autocomplete/UserProvider.js +++ b/src/autocomplete/UserProvider.js @@ -41,7 +41,7 @@ export default class UserProvider extends AutocompleteProvider { users: Array = null; room: Room = null; - constructor(room) { + constructor(room: Room) { super(USER_REGEX, FORCED_USER_REGEX); this.room = room; this.matcher = new QueryMatcher([], { From 77efa0881e9aec3ceff09a50290dd6170a499e40 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 11 Jan 2019 14:09:29 +0000 Subject: [PATCH 2/2] Gah, onjects --- src/autocomplete/AutocompleteProvider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/autocomplete/AutocompleteProvider.js b/src/autocomplete/AutocompleteProvider.js index 906fed5858..98ae83c526 100644 --- a/src/autocomplete/AutocompleteProvider.js +++ b/src/autocomplete/AutocompleteProvider.js @@ -44,7 +44,7 @@ export default class AutocompleteProvider { * @param {string} query The query string * @param {SelectionRange} selection Selection to search * @param {boolean} force True if the user is forcing completion - * @return {object} { command, range } where both onjects fields are null if no match + * @return {object} { command, range } where both objects fields are null if no match */ getCurrentCommand(query: string, selection: SelectionRange, force: boolean = false) { let commandRegex = this.commandRegex;