From 781b94c8f43350b4c5f3457f56e35cc1831499ec Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Sun, 5 Nov 2017 15:37:06 -0700 Subject: [PATCH] Appease the linter Signed-off-by: Travis Ralston --- src/components/structures/MatrixChat.js | 2 +- src/components/views/elements/LanguageDropdown.js | 1 - src/components/views/elements/SettingsFlag.js | 2 +- src/settings/Settings.js | 4 ++-- src/settings/SettingsStore.js | 5 ++--- src/settings/controllers/SettingController.js | 2 +- src/settings/handlers/ConfigSettingsHandler.js | 1 - src/settings/handlers/LocalEchoWrapper.js | 2 +- src/settings/handlers/SettingsHandler.js | 8 ++++++-- 9 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index fc1257922a..6d225191a8 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -1118,7 +1118,7 @@ module.exports = React.createClass({ if (cli.isCryptoEnabled()) { const blacklistEnabled = SettingsStore.getValueAt( SettingLevel.DEVICE, - "blacklistUnverifiedDevices" + "blacklistUnverifiedDevices", ); cli.setGlobalBlacklistUnverifiedDevices(blacklistEnabled); } diff --git a/src/components/views/elements/LanguageDropdown.js b/src/components/views/elements/LanguageDropdown.js index 82fa9b869e..8f2ba006cf 100644 --- a/src/components/views/elements/LanguageDropdown.js +++ b/src/components/views/elements/LanguageDropdown.js @@ -18,7 +18,6 @@ limitations under the License. import React from 'react'; import sdk from '../../../index'; -import UserSettingsStore from '../../../UserSettingsStore'; import * as languageHandler from '../../../languageHandler'; import SettingsStore from "../../../settings/SettingsStore"; diff --git a/src/components/views/elements/SettingsFlag.js b/src/components/views/elements/SettingsFlag.js index cb6a001cf4..782dc30ede 100644 --- a/src/components/views/elements/SettingsFlag.js +++ b/src/components/views/elements/SettingsFlag.js @@ -59,7 +59,7 @@ module.exports = React.createClass({ this.props.name, this.props.roomId, this.props.level, - val !== undefined ? val : this.state.value + val !== undefined ? val : this.state.value, ); }, diff --git a/src/settings/Settings.js b/src/settings/Settings.js index ef8f9ae259..3aab27bf04 100644 --- a/src/settings/Settings.js +++ b/src/settings/Settings.js @@ -185,7 +185,7 @@ export const SETTINGS = { }, "language": { supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG, - default: "en" + default: "en", }, "analyticsOptOut": { supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG, @@ -240,4 +240,4 @@ export const SETTINGS = { supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS, default: false, }, -}; \ No newline at end of file +}; diff --git a/src/settings/SettingsStore.js b/src/settings/SettingsStore.js index 9b7fe42c97..db7ae807e3 100644 --- a/src/settings/SettingsStore.js +++ b/src/settings/SettingsStore.js @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -import Promise from 'bluebird'; import DeviceSettingsHandler from "./handlers/DeviceSettingsHandler"; import RoomDeviceSettingsHandler from "./handlers/RoomDeviceSettingsHandler"; import DefaultSettingsHandler from "./handlers/DefaultSettingsHandler"; @@ -210,14 +209,14 @@ export default class SettingsStore { const handlers = SettingsStore._getHandlers(settingName); if (explicit) { - let handler = handlers[level]; + const handler = handlers[level]; if (!handler) return SettingsStore._tryControllerOverride(settingName, level, roomId, null); const value = handler.getValue(settingName, roomId); return SettingsStore._tryControllerOverride(settingName, level, roomId, value); } for (let i = minIndex; i < LEVEL_ORDER.length; i++) { - let handler = handlers[LEVEL_ORDER[i]]; + const handler = handlers[LEVEL_ORDER[i]]; if (!handler) continue; if (excludeDefault && LEVEL_ORDER[i] === "default") continue; diff --git a/src/settings/controllers/SettingController.js b/src/settings/controllers/SettingController.js index 194e7af93b..a91b616da9 100644 --- a/src/settings/controllers/SettingController.js +++ b/src/settings/controllers/SettingController.js @@ -46,4 +46,4 @@ export default class SettingController { onChange(level, roomId, newValue) { // do nothing by default } -} \ No newline at end of file +} diff --git a/src/settings/handlers/ConfigSettingsHandler.js b/src/settings/handlers/ConfigSettingsHandler.js index e28e12c02c..7a370249a7 100644 --- a/src/settings/handlers/ConfigSettingsHandler.js +++ b/src/settings/handlers/ConfigSettingsHandler.js @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -import Promise from 'bluebird'; import SettingsHandler from "./SettingsHandler"; import SdkConfig from "../../SdkConfig"; diff --git a/src/settings/handlers/LocalEchoWrapper.js b/src/settings/handlers/LocalEchoWrapper.js index e9a17d7698..d616edd9fb 100644 --- a/src/settings/handlers/LocalEchoWrapper.js +++ b/src/settings/handlers/LocalEchoWrapper.js @@ -66,4 +66,4 @@ export default class LocalEchoWrapper extends SettingsHandler { isSupported() { return this._handler.isSupported(); } -} \ No newline at end of file +} diff --git a/src/settings/handlers/SettingsHandler.js b/src/settings/handlers/SettingsHandler.js index 49265feb9a..69f633c650 100644 --- a/src/settings/handlers/SettingsHandler.js +++ b/src/settings/handlers/SettingsHandler.js @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ +import Promise from "bluebird"; + /** * Represents the base class for all level handlers. This class performs no logic * and should be overridden. @@ -28,7 +30,8 @@ export default class SettingsHandler { * @returns {*} The setting value, or null if not found. */ getValue(settingName, roomId) { - throw new Error("Operation not possible: getValue was not overridden"); + console.error("Invalid operation: getValue was not overridden"); + return null; } /** @@ -43,7 +46,8 @@ export default class SettingsHandler { * @returns {Promise} Resolves when the setting has been saved. */ setValue(settingName, roomId, newValue) { - throw new Error("Operation not possible: setValue was not overridden"); + console.error("Invalid operation: setValue was not overridden"); + return Promise.reject(); } /**