Bunch of little tslint warnings found while debugging
parent
aeeac425d9
commit
425a613450
|
@ -21,5 +21,5 @@ export function fakeState(dispatcher: Function = noop): Everything {
|
|||
config,
|
||||
draggable,
|
||||
resources
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -52,4 +52,4 @@ export let fakeImages: TaggedImage[] = [
|
|||
},
|
||||
"uuid": "images.7.5"
|
||||
}
|
||||
]
|
||||
];
|
||||
|
|
|
@ -8,10 +8,26 @@ export let auth: Everything["auth"] = {
|
|||
"iss": "//localhost:3000",
|
||||
"exp": 1499025084,
|
||||
"mqtt": "10.0.0.6",
|
||||
"os_update_server": "https://api.github.com/repos/farmbot/farmbot_os/releases/latest",
|
||||
"fw_update_server": "https://api.github.com/repos/FarmBot/farmbot-arduino-firmware/releases/latest",
|
||||
"os_update_server": "https://api.github.com/repos/farmbot/" +
|
||||
"farmbot_os/releases/latest",
|
||||
"fw_update_server": "https://api.github.com/repos/FarmBot/" +
|
||||
"farmbot-arduino-firmware/releases/latest",
|
||||
"bot": "device_403"
|
||||
},
|
||||
"encoded": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJhZG1pbkBhZG1pbi5jb20iLCJpYXQiOjE0OTU1NjkwODQsImp0aSI6ImIzODkxNWNhLTNkN2EtNDc1NC04MTUyLWQ0MzA2Yjg4NTA0YyIsImlzcyI6Ii8vbG9jYWxob3N0OjMwMDAiLCJleHAiOjE0OTkwMjUwODQsIm1xdHQiOiIxMC4wLjAuNiIsIm9zX3VwZGF0ZV9zZXJ2ZXIiOiJodHRwczovL2FwaS5naXRodWIuY29tL3JlcG9zL2Zhcm1ib3QvZmFybWJvdF9vcy9yZWxlYXNlcy9sYXRlc3QiLCJmd191cGRhdGVfc2VydmVyIjoiaHR0cHM6Ly9hcGkuZ2l0aHViLmNvbS9yZXBvcy9GYXJtQm90L2Zhcm1ib3QtYXJkdWluby1maXJtd2FyZS9yZWxlYXNlcy9sYXRlc3QiLCJib3Qi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XTnJgbIJXKipBVN9UQ4PqcYgjAVdZ678A-Xq" +
|
||||
"XV6SGE624zdr7S7mQ6uj7qpa2LMH4P37R3BIB26G7E8xDcVOGqL5Oiwr9DPajBX3zd" +
|
||||
"hXSbH3k4PyxqvPOLYso-R7kjfpOnfFCMfMZLW8TQtg-yj82zs93RP2DHOOx-jxek69" +
|
||||
"tmgNyP3FJaoWHwHW7bXOEv09p3dhNVTCSVNKD9LZczLpuXV7U4oSmL6KLkbzsM6G0P" +
|
||||
|
||||
"9rrbJ9ASYaOw"
|
||||
}
|
||||
};
|
||||
|
|
|
@ -26,5 +26,5 @@ export let fake_fe = (): FarmEventWithExecutable => {
|
|||
kind: "sequence",
|
||||
args: { version: 0 }
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -16,7 +16,7 @@ describe("util", () => {
|
|||
"number": 0,
|
||||
"string": "hello",
|
||||
"boolean": false,
|
||||
"other": () => { "not allowed!" }
|
||||
"other": () => { "not allowed!"; }
|
||||
};
|
||||
|
||||
it("fetches null", () => {
|
||||
|
@ -101,7 +101,7 @@ describe("util", () => {
|
|||
it("determines non-matches", () => {
|
||||
expect(oneOf(["foo"], "QMMADSDASDASD")).toBeFalsy();
|
||||
expect(oneOf(["foo", "baz"], "nothing to see here.")).toBeFalsy();
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
describe("semver compare", () => {
|
||||
|
@ -132,5 +132,5 @@ describe("util", () => {
|
|||
expect(semverCompare("2.0.2", "1.1.9"))
|
||||
.toBe(SemverResult.LEFT_IS_GREATER);
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
|
|
|
@ -12,7 +12,7 @@ export function mapStateToProps(props: Everything): Props {
|
|||
user,
|
||||
saveUser(dispatch: Function, update: Partial<User>) {
|
||||
dispatch(edit(user, update));
|
||||
dispatch(save(user.uuid))
|
||||
dispatch(save(user.uuid));
|
||||
},
|
||||
enactDeletion(dispatch: Function, password: string | undefined) {
|
||||
dispatch(deleteUser({ password: password || "NEVER SET" }));
|
||||
|
|
|
@ -68,7 +68,7 @@ export class API {
|
|||
Tried to access API before URL was resolved.
|
||||
Call API.setBaseUrl() before using API.current .`);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** "https:" or "http:". NO "//"! */
|
||||
private readonly protocol: ProtocolString;
|
||||
|
@ -97,31 +97,31 @@ export class API {
|
|||
}
|
||||
|
||||
/** http://localhost:3000 */
|
||||
get baseUrl() { return `${this.protocol}//${this.host}`; };
|
||||
get baseUrl() { return `${this.protocol}//${this.host}`; }
|
||||
/** /api/tokens/ */
|
||||
get tokensPath() { return `${this.baseUrl}/api/tokens/`; };
|
||||
get tokensPath() { return `${this.baseUrl}/api/tokens/`; }
|
||||
/** /api/password_resets/ */
|
||||
get passwordResetPath() { return `${this.baseUrl}/api/password_resets/`; };
|
||||
get passwordResetPath() { return `${this.baseUrl}/api/password_resets/`; }
|
||||
/** /api/device/ */
|
||||
get devicePath() { return `${this.baseUrl}/api/device/`; };
|
||||
get devicePath() { return `${this.baseUrl}/api/device/`; }
|
||||
/** /api/users/ */
|
||||
get usersPath() { return `${this.baseUrl}/api/users/`; };
|
||||
get usersPath() { return `${this.baseUrl}/api/users/`; }
|
||||
/** /api/peripherals/ */
|
||||
get peripheralsPath() { return `${this.baseUrl}/api/peripherals/`; };
|
||||
get peripheralsPath() { return `${this.baseUrl}/api/peripherals/`; }
|
||||
/** /api/farm_events/ */
|
||||
get farmEventsPath() { return `${this.baseUrl}/api/farm_events/`; };
|
||||
get farmEventsPath() { return `${this.baseUrl}/api/farm_events/`; }
|
||||
/** /api/regimens/ */
|
||||
get regimensPath() { return `${this.baseUrl}/api/regimens/`; };
|
||||
get regimensPath() { return `${this.baseUrl}/api/regimens/`; }
|
||||
/** /api/sequences/ */
|
||||
get sequencesPath() { return `${this.baseUrl}/api/sequences/`; };
|
||||
get sequencesPath() { return `${this.baseUrl}/api/sequences/`; }
|
||||
/** /api/tools/ */
|
||||
get toolsPath() { return `${this.baseUrl}/api/tools/`; };
|
||||
get toolsPath() { return `${this.baseUrl}/api/tools/`; }
|
||||
/** /api/images/ */
|
||||
get imagesPath() { return `${this.baseUrl}/api/images/`; };
|
||||
get imagesPath() { return `${this.baseUrl}/api/images/`; }
|
||||
/** /api/points/ */
|
||||
get pointsPath() { return `${this.baseUrl}/api/points/`; };
|
||||
get pointsPath() { return `${this.baseUrl}/api/points/`; }
|
||||
/** /api/points/search */
|
||||
get pointSearchPath() { return `${this.pointsPath}/search/`; };
|
||||
get pointSearchPath() { return `${this.pointsPath}/search/`; }
|
||||
/** /api/logs */
|
||||
get logsPath() { return `${this.baseUrl}/api/logs/`; };
|
||||
get logsPath() { return `${this.baseUrl}/api/logs/`; }
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ export function didLogin(authState: AuthState, dispatch: Function) {
|
|||
|
||||
Sync.fetchSyncData(dispatch);
|
||||
dispatch(connectDevice(authState.token.encoded));
|
||||
};
|
||||
}
|
||||
|
||||
// We need to handle OK logins for numerous use cases (Ex: login & registration)
|
||||
function onLogin(dispatch: Function) {
|
||||
|
@ -34,7 +34,7 @@ function onLogin(dispatch: Function) {
|
|||
didLogin(data, dispatch);
|
||||
push("/app/controls");
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export function login(username: string, password: string, url: string): Thunk {
|
||||
return dispatch => {
|
||||
|
|
|
@ -6,6 +6,6 @@ import { Session } from "../session";
|
|||
export function ready(): Thunk {
|
||||
return (dispatch, getState) => {
|
||||
let state = Session.get() || getState().auth;
|
||||
if (state) { didLogin(state, dispatch); };
|
||||
if (state) { didLogin(state, dispatch); }
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/** Payload of CHANGE_API_HOST */
|
||||
export interface ChangeApiHost { host: string; };
|
||||
export interface ChangeApiHost { host: string; }
|
||||
|
||||
/** Payload of CHANGE_API_PORT */
|
||||
export interface ChangeApiPort { port: string; };
|
||||
export interface ChangeApiPort { port: string; }
|
||||
|
||||
/** This is a subset of attributes found on window.location. */
|
||||
export interface ConfigState {
|
||||
|
|
|
@ -176,8 +176,8 @@ export function save(input: TaggedDevice) {
|
|||
return Axios
|
||||
.put<User>(API.current.devicePath, input.body)
|
||||
.then(resp => dispatch({ type: "SAVE_DEVICE_OK", payload: resp.data }))
|
||||
.catch(resp => error("Error saving device settings."))
|
||||
}
|
||||
.catch(resp => error("Error saving device settings."));
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -193,7 +193,7 @@ export function changeDevice(device: TaggedDevice,
|
|||
return function (dispatch, getState) {
|
||||
dispatch(edit(device, update));
|
||||
dispatch(save(getDeviceAccountSettings(getState().resources.index)));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
@ -208,7 +208,7 @@ export function botConfigChange(key: configKey, value: number) {
|
|||
.current
|
||||
.updateMcu({ [key]: value })
|
||||
.then(_.noop, commandErr(noun));
|
||||
};
|
||||
}
|
||||
|
||||
export function settingToggle(name: configKey, bot: BotState) {
|
||||
let noun = "Setting toggle";
|
||||
|
@ -218,7 +218,7 @@ export function settingToggle(name: configKey, bot: BotState) {
|
|||
[name]: ((bot.hardware.mcu_params)[name] === 0) ? ON : OFF
|
||||
})
|
||||
.then(_.noop, commandErr(noun));
|
||||
};
|
||||
}
|
||||
|
||||
export function moveRelative(props: MoveRelProps) {
|
||||
return devices
|
||||
|
@ -310,7 +310,7 @@ export function connectDevice(token: string): {} | ((dispatch: Function) => any)
|
|||
});
|
||||
}, (err) => dispatch(fetchDeviceErr(err)));
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
function fetchDeviceErr(err: Error) {
|
||||
return {
|
||||
|
@ -321,17 +321,17 @@ function fetchDeviceErr(err: Error) {
|
|||
|
||||
let startUpdate = (dispatch: Function) => {
|
||||
dispatch({ type: "SETTING_UPDATE_START", payload: undefined });
|
||||
}
|
||||
};
|
||||
|
||||
let updateOK = (dispatch: Function, noun: string) => {
|
||||
dispatch({ type: "SETTING_UPDATE_END", payload: undefined });
|
||||
commandOK(noun);
|
||||
}
|
||||
};
|
||||
|
||||
let updateNO = (dispatch: Function, noun: string) => {
|
||||
dispatch({ type: "SETTING_UPDATE_END", payload: undefined });
|
||||
commandErr(noun);
|
||||
}
|
||||
};
|
||||
|
||||
export function updateMCU(key: configKey, val: string) {
|
||||
let noun = "configuration update";
|
||||
|
@ -342,7 +342,7 @@ export function updateMCU(key: configKey, val: string) {
|
|||
.updateMcu({ [key]: val })
|
||||
.then(() => updateOK(dispatch, noun))
|
||||
.catch(() => updateNO(dispatch, noun));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function updateConfig(config: Configuration) {
|
||||
|
@ -353,7 +353,7 @@ export function updateConfig(config: Configuration) {
|
|||
.updateConfig(config)
|
||||
.then(() => updateOK(dispatch, noun))
|
||||
.catch(() => updateNO(dispatch, noun));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function changeStepSize(integer: number) {
|
||||
|
@ -369,15 +369,15 @@ const TOAST: ALLOWED_CHANNEL_NAMES = "toast";
|
|||
function maybeShowLog(log: Log) {
|
||||
let chanList = _.get(log, CHANNELS, ["ERROR FETCHING CHANNELS"]);
|
||||
let t = log.meta.type as ALLOWED_MESSAGE_TYPES;
|
||||
const TITLE = "New message from bot"
|
||||
const TITLE = "New message from bot";
|
||||
if (chanList.includes(TOAST)) {
|
||||
switch (t) {
|
||||
case "success":
|
||||
return success(log.message, TITLE)
|
||||
return success(log.message, TITLE);
|
||||
case "busy":
|
||||
case "warn":
|
||||
case "error":
|
||||
return error(log.message, TITLE)
|
||||
return error(log.message, TITLE);
|
||||
case "fun":
|
||||
case "info":
|
||||
default:
|
||||
|
@ -387,7 +387,7 @@ function maybeShowLog(log: Log) {
|
|||
}
|
||||
|
||||
export function setSyncStatus(payload: SyncStatus) {
|
||||
return { type: "SET_SYNC_STATUS", payload }
|
||||
return { type: "SET_SYNC_STATUS", payload };
|
||||
}
|
||||
|
||||
function badVersion() {
|
||||
|
|
|
@ -40,7 +40,7 @@ export class WeedDetector
|
|||
H: ["CAMERA_CALIBRATION_H_LO", "CAMERA_CALIBRATION_H_HI"],
|
||||
S: ["CAMERA_CALIBRATION_S_LO", "CAMERA_CALIBRATION_S_HI"],
|
||||
V: ["CAMERA_CALIBRATION_V_LO", "CAMERA_CALIBRATION_V_LO"]
|
||||
}
|
||||
};
|
||||
|
||||
test = () => {
|
||||
let settings = this.props.env;
|
||||
|
|
|
@ -325,7 +325,7 @@ export let currentToolInSlot = (index: ResourceIndex) =>
|
|||
/** FINDS: all tagged resources with particular ID */
|
||||
export function findAllById(i: ResourceIndex, ids: number[], k: ResourceName) {
|
||||
let output: TaggedResource[] = [];
|
||||
findAll(i, k).map(x => x.kind === k ? output.push(x) : "")
|
||||
findAll(i, k).map(x => x.kind === k ? output.push(x) : "");
|
||||
return output;
|
||||
}
|
||||
|
||||
|
@ -338,7 +338,7 @@ export function toolsInUse(index: ResourceIndex): TaggedTool[] {
|
|||
export let byId = <T extends TaggedResource>(name: ResourceName) =>
|
||||
(index: ResourceIndex, id: number): T | undefined => {
|
||||
let tools = findAll(index, name);
|
||||
let f = (x: TaggedResource) => (x.kind === name) && (x.body.id === id)
|
||||
let f = (x: TaggedResource) => (x.kind === name) && (x.body.id === id);
|
||||
// Maybe we should add a throw here?
|
||||
return tools.filter(f)[0] as T | undefined;
|
||||
};
|
||||
|
@ -403,14 +403,14 @@ export let findSlotByToolId = (index: ResourceIndex, tool_id: number) => {
|
|||
if (x && isTaggedToolSlotPointer(x)) {
|
||||
return x.body.tool_id === tool_id;
|
||||
}
|
||||
}
|
||||
};
|
||||
let tts = where(index, { tool_id: tool.body.id }).filter(filter)[0];
|
||||
if (tts && isTaggedToolSlotPointer(tts) && sanityCheck(tts)) {
|
||||
return tts;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export function maybeGetSequence(index: ResourceIndex,
|
||||
uuid: string | undefined): TaggedSequence | undefined {
|
||||
|
@ -424,7 +424,7 @@ export function maybeGetSequence(index: ResourceIndex,
|
|||
export function maybeGetRegimen(index: ResourceIndex,
|
||||
uuid: string | undefined): TaggedRegimen | undefined {
|
||||
let tr = uuid && getRegimenByUUID(index, uuid);
|
||||
if (tr && isTaggedRegimen(tr)) { return tr; };
|
||||
if (tr && isTaggedRegimen(tr)) { return tr; }
|
||||
}
|
||||
|
||||
/** Unlike other findById methods, this one allows undefined (missed) values */
|
||||
|
@ -456,7 +456,7 @@ export function maybeFetchUser(index: ResourceIndex):
|
|||
|
||||
if (user && sanityCheck(user) && list.length > 1) {
|
||||
throw new Error("Index is broke. Expected exactly 1 user.");
|
||||
};
|
||||
}
|
||||
if ((list.length === 1) && user && user.kind === "users") {
|
||||
return user;
|
||||
} else {
|
||||
|
@ -485,7 +485,7 @@ export function joinToolsAndSlot(index: ResourceIndex): SlotWithTool[] {
|
|||
return {
|
||||
toolSlot,
|
||||
tool: maybeFindToolById(index, toolSlot.body.tool_id)
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
"no-bitwise": true,
|
||||
"no-var-requires": false,
|
||||
"no-shadowed-variable": true,
|
||||
"no-unused-variable": true,
|
||||
"no-unused-vars": true,
|
||||
"eofline": true,
|
||||
"one-line": [
|
||||
true,
|
||||
|
|
Loading…
Reference in New Issue