diff --git a/src/__test_support__/fake_state.ts b/src/__test_support__/fake_state.ts index 99f5f1b66..87a2da732 100644 --- a/src/__test_support__/fake_state.ts +++ b/src/__test_support__/fake_state.ts @@ -1,4 +1,3 @@ -import * as React from "react"; import { noop } from "lodash"; import { Everything } from "../interfaces"; import { location } from "./fake_state/location"; @@ -8,8 +7,6 @@ import { bot } from "./fake_state/bot"; import { config } from "./fake_state/config"; import { draggable } from "./fake_state/draggable"; import { resources } from "./fake_state/resources"; -import { createStore } from "redux"; -import { rootReducer } from "../redux/root_reducer"; /** Factory function for empty state object. */ export function fakeState(dispatcher: Function = noop): Everything { diff --git a/src/__test_support__/resource_index_builder.ts b/src/__test_support__/resource_index_builder.ts index ebd8573fd..1c6f950c9 100644 --- a/src/__test_support__/resource_index_builder.ts +++ b/src/__test_support__/resource_index_builder.ts @@ -1,9 +1,6 @@ import { resourceReducer, emptyState } from "../resources/reducer"; import { TaggedResource } from "../resources/tagged_resources"; import * as _ from "lodash"; -import { createStore } from "redux"; -import { RestResources } from "../resources/interfaces"; -import { ReduxAction } from "../redux/interfaces"; export let FAKE_RESOURCES: TaggedResource[] = [ { diff --git a/src/__tests__/controls_popup_test.tsx b/src/__tests__/controls_popup_test.tsx index 0d3a3e6b4..98309a58b 100644 --- a/src/__tests__/controls_popup_test.tsx +++ b/src/__tests__/controls_popup_test.tsx @@ -1,17 +1,9 @@ import * as React from "react"; import { ControlsPopup } from "../controls_popup"; import { mount } from "enzyme"; -import { State } from "../controls_popup"; -import { DirectionButton } from "../controls/direction_button"; describe("", () => { let wrapper = mount(); - let button = mount(); it("Has a false initial state", () => { expect(wrapper.state("isOpen")).toBeFalsy(); diff --git a/src/__tests__/resource_index_builder_test.ts b/src/__tests__/resource_index_builder_test.ts index 6c2ba050c..c3ebc26d4 100644 --- a/src/__tests__/resource_index_builder_test.ts +++ b/src/__tests__/resource_index_builder_test.ts @@ -2,7 +2,6 @@ import { buildResourceIndex, FAKE_RESOURCES } from "../__test_support__/resource_index_builder"; -import { betterCompact } from "../util"; import { TaggedFarmEvent } from "../resources/tagged_resources"; const STUB_RESOURCE: TaggedFarmEvent = { diff --git a/src/account/__tests__/actions_test.ts b/src/account/__tests__/actions_test.ts index 6c3733dc0..6a4b3c9d1 100644 --- a/src/account/__tests__/actions_test.ts +++ b/src/account/__tests__/actions_test.ts @@ -1,6 +1,6 @@ -import { deleteUser } from "../actions"; import { API } from "../../api/api"; import * as moxios from "moxios"; +import { deleteUser } from "../actions"; describe("deleteUser()", () => { beforeEach(function () { @@ -20,7 +20,7 @@ describe("deleteUser()", () => { let dispatch = jest.fn(); let getState = jest.fn(); getState.mockImplementation(() => ({ auth: {} })); - let result = thunk(dispatch, getState); + thunk(dispatch, getState); moxios.wait(function () { let request = moxios.requests.mostRecent(); request.respondWith({ diff --git a/src/account/interfaces.ts b/src/account/interfaces.ts index a3aa56e64..07a4a9536 100644 --- a/src/account/interfaces.ts +++ b/src/account/interfaces.ts @@ -1,4 +1,4 @@ -import { AuthState, User } from "../auth/interfaces"; +import { User } from "../auth/interfaces"; import { TaggedUser } from "../resources/tagged_resources"; export interface Props { diff --git a/src/api/crud.ts b/src/api/crud.ts index 44cea5419..26ec27b92 100644 --- a/src/api/crud.ts +++ b/src/api/crud.ts @@ -17,7 +17,6 @@ import { ResourceIndex } from "../resources/interfaces"; import { SequenceBodyItem } from "farmbot/dist"; import * as _ from "lodash"; import { Actions } from "../constants"; -let WHOAH = "COOL"; export function edit(tr: TaggedResource, changes: Partial): ReduxAction { diff --git a/src/controls/__tests__/axis_display_group_test.ts b/src/controls/__tests__/axis_display_group_test.ts index 7329d0e42..ec545e746 100644 --- a/src/controls/__tests__/axis_display_group_test.ts +++ b/src/controls/__tests__/axis_display_group_test.ts @@ -1,4 +1,3 @@ -import * as React from "react"; import { mount } from "enzyme"; import { AxisDisplayGroup } from "../axis_display_group"; import { bot } from "../../__test_support__/fake_state/bot"; diff --git a/src/controls/axis_input_box.tsx b/src/controls/axis_input_box.tsx index 0137b0165..853821c2a 100644 --- a/src/controls/axis_input_box.tsx +++ b/src/controls/axis_input_box.tsx @@ -1,6 +1,5 @@ import * as React from "react"; -import { isNaN } from "lodash"; -import { AxisInputBoxProps, AxisInputBoxState } from "./interfaces"; +import { AxisInputBoxProps } from "./interfaces"; import { Col, BlurableInput } from "../ui/index"; import { isUndefined } from "lodash"; diff --git a/src/controls_popup.tsx b/src/controls_popup.tsx index 4975046f3..6f1a37b51 100644 --- a/src/controls_popup.tsx +++ b/src/controls_popup.tsx @@ -1,5 +1,4 @@ import * as React from "react"; -import { connect } from "react-redux"; import { DirectionButton } from "./controls/direction_button"; diff --git a/src/devices/actions.ts b/src/devices/actions.ts index a0c7c57ad..065368291 100644 --- a/src/devices/actions.ts +++ b/src/devices/actions.ts @@ -1,7 +1,6 @@ import { Farmbot } from "farmbot"; import { t } from "i18next"; import axios from "axios"; -import * as Axios from "axios"; import * as _ from "lodash"; import { success, warning, info, error } from "farmbot-toastr"; import { devices } from "../device"; @@ -145,7 +144,6 @@ export let saveAccountChanges: Thunk = function (dispatch, getState) { }; let commandErr = (noun = "Command") => () => { - let msg = noun + " request failed."; console.info("Took longer than 6 seconds: " + noun); }; @@ -373,10 +371,10 @@ 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; + let m = log.meta.type as ALLOWED_MESSAGE_TYPES; const TITLE = "New message from bot"; if (chanList.includes(TOAST)) { - switch (t) { + switch (m) { case "success": return success(log.message, TITLE); case "busy": diff --git a/src/devices/components/__tests__/calibration_row_test.tsx b/src/devices/components/__tests__/calibration_row_test.tsx index 5bf368ae9..e620ca4fd 100644 --- a/src/devices/components/__tests__/calibration_row_test.tsx +++ b/src/devices/components/__tests__/calibration_row_test.tsx @@ -18,9 +18,9 @@ describe("", () => { it("calls device", () => { let { mock } = devices.current.calibrate as jest.Mock<{}>; let result = mount(); - let thunkx = result.find("LockableButton").at(0).simulate("click"); - let thunky = result.find("LockableButton").at(1).simulate("click"); - let thunkz = result.find("LockableButton").at(2).simulate("click"); + result.find("LockableButton").at(0).simulate("click"); + result.find("LockableButton").at(1).simulate("click"); + result.find("LockableButton").at(2).simulate("click"); expect(mock.calls.length).toEqual(2); expect(mock.calls[0][0].axis).toEqual("x"); expect(mock.calls[1][0].axis).toEqual("y"); diff --git a/src/devices/components/__tests__/homing_row_test.tsx b/src/devices/components/__tests__/homing_row_test.tsx index 2ae3c76df..70dd1051d 100644 --- a/src/devices/components/__tests__/homing_row_test.tsx +++ b/src/devices/components/__tests__/homing_row_test.tsx @@ -31,9 +31,9 @@ describe("", () => { it("calls device", () => { let { mock } = devices.current.findHome as jest.Mock<{}>; let result = mount(); - let thunkx = result.find("LockableButton").at(0).simulate("click"); - let thunky = result.find("LockableButton").at(1).simulate("click"); - let thunkz = result.find("LockableButton").at(2).simulate("click"); + result.find("LockableButton").at(0).simulate("click"); + result.find("LockableButton").at(1).simulate("click"); + result.find("LockableButton").at(2).simulate("click"); expect(mock.calls.length).toEqual(2); expect(mock.calls[0][0].axis).toEqual("x"); expect(mock.calls[1][0].axis).toEqual("y"); diff --git a/src/devices/components/__tests__/zero_row_test.tsx b/src/devices/components/__tests__/zero_row_test.tsx index a1e4c873e..efd274474 100644 --- a/src/devices/components/__tests__/zero_row_test.tsx +++ b/src/devices/components/__tests__/zero_row_test.tsx @@ -8,7 +8,6 @@ jest.mock("../../../device", () => ({ import * as React from "react"; import { mount } from "enzyme"; import { ZeroRow } from "../zero_row"; -import { bot } from "../../../__test_support__/fake_state/bot"; import { devices } from "../../../device"; describe("", () => { @@ -18,9 +17,9 @@ describe("", () => { it("calls device", () => { let { mock } = devices.current.setZero as jest.Mock<{}>; let result = mount(); - let thunkx = result.find("ZeroButton").at(0).simulate("click"); - let thunky = result.find("ZeroButton").at(1).simulate("click"); - let thunkz = result.find("ZeroButton").at(2).simulate("click"); + result.find("ZeroButton").at(0).simulate("click"); + result.find("ZeroButton").at(1).simulate("click"); + result.find("ZeroButton").at(2).simulate("click"); expect(mock.calls.length).toEqual(3); expect(mock.calls[0][0]).toEqual("x"); expect(mock.calls[1][0]).toEqual("y"); diff --git a/src/devices/components/boolean_mcu_input_group.tsx b/src/devices/components/boolean_mcu_input_group.tsx index 12f97b7a6..9da8e7fce 100644 --- a/src/devices/components/boolean_mcu_input_group.tsx +++ b/src/devices/components/boolean_mcu_input_group.tsx @@ -9,7 +9,6 @@ export function BooleanMCUInputGroup(props: BooleanMCUInputGroupProps) { let { bot, - dispatch, tooltip, name, x, diff --git a/src/devices/components/hardware_settings.tsx b/src/devices/components/hardware_settings.tsx index c623b655a..6e1fb8235 100644 --- a/src/devices/components/hardware_settings.tsx +++ b/src/devices/components/hardware_settings.tsx @@ -1,5 +1,4 @@ import * as React from "react"; -import { t } from "i18next"; import { MCUFactoryReset } from "../actions"; import { Widget, WidgetHeader, WidgetBody } from "../../ui/index"; import { HardwareSettingsProps } from "../interfaces"; diff --git a/src/devices/interfaces.ts b/src/devices/interfaces.ts index 2016966e7..2603c8922 100644 --- a/src/devices/interfaces.ts +++ b/src/devices/interfaces.ts @@ -1,6 +1,5 @@ import { BotStateTree } from "farmbot"; import { - ALLOWED_MESSAGE_TYPES, McuParamName, ConfigurationName, Dictionary, @@ -34,17 +33,6 @@ export interface DeviceAccountSettings { name: string; webcam_url?: string; timezone?: string | undefined; -}; - -/** Meta information about a log message. */ -interface Meta { - type: ALLOWED_MESSAGE_TYPES; - /** Bot Position X */ - x: number | undefined; - /** Bot Position Y */ - y: number | undefined; - /** Bot Position Z */ - z: number | undefined; } export interface BotState { diff --git a/src/entry.tsx b/src/entry.tsx index c82cb51f1..82f3ecd28 100644 --- a/src/entry.tsx +++ b/src/entry.tsx @@ -1,5 +1,4 @@ /// -import * as React from "react"; import { RootComponent } from "./routes"; import { store } from "./redux/store"; import { ready } from "./config/actions"; diff --git a/src/farm_designer/farm_events/__tests__/edit_fe_form_test.tsx b/src/farm_designer/farm_events/__tests__/edit_fe_form_test.tsx index becf41dc9..d33cd6d76 100644 --- a/src/farm_designer/farm_events/__tests__/edit_fe_form_test.tsx +++ b/src/farm_designer/farm_events/__tests__/edit_fe_form_test.tsx @@ -3,7 +3,6 @@ import { fakeFarmEvent, fakeSequence } from "../../../__test_support__/fake_stat import { mount } from "enzyme"; import { EditFEForm, EditFEProps, FarmEventViewModel, recombine } from "../edit_fe_form"; import { isString } from "lodash"; -import { TightlyCoupledFarmEventDropDown } from "../map_state_to_props_add_edit"; describe("", () => { let props = (): EditFEForm["props"] => ({ diff --git a/src/farm_designer/farm_events/__tests__/farm_event_repeat_form.tsx b/src/farm_designer/farm_events/__tests__/farm_event_repeat_form.tsx index 65ca197ce..b07e54c4b 100644 --- a/src/farm_designer/farm_events/__tests__/farm_event_repeat_form.tsx +++ b/src/farm_designer/farm_events/__tests__/farm_event_repeat_form.tsx @@ -2,7 +2,6 @@ import * as React from "react"; import { RepeatFormProps, FarmEventRepeatForm } from "../farm_event_repeat_form"; import { betterMerge } from "../../../util"; import { shallow, ShallowWrapper, render } from "enzyme"; -import { FBSelectProps } from "../../../ui/new_fb_select"; import { get } from "lodash"; const DEFAULTS: RepeatFormProps = { diff --git a/src/farm_designer/farm_events/__tests__/map_state_to_props_test.ts b/src/farm_designer/farm_events/__tests__/map_state_to_props_test.ts index eb2843b8b..4e47a7b09 100644 --- a/src/farm_designer/farm_events/__tests__/map_state_to_props_test.ts +++ b/src/farm_designer/farm_events/__tests__/map_state_to_props_test.ts @@ -1,9 +1,6 @@ -import { fakeState } from "../../../__test_support__/fake_state"; import { mapResourcesToCalendar } from "../map_state_to_props"; -import { ResourceIndex } from "../../../resources/interfaces"; import { buildResourceIndex } from "../../../__test_support__/resource_index_builder"; import { TaggedResource } from "../../../resources/tagged_resources"; -import * as moment from "moment"; describe("mapResourcesToCalendar()", () => { it("returns a `Calendar` instance when given a resource index and unix time.", diff --git a/src/farm_designer/farm_events/__tests__/util_test.ts b/src/farm_designer/farm_events/__tests__/util_test.ts index 3455c29eb..4e0493d63 100644 --- a/src/farm_designer/farm_events/__tests__/util_test.ts +++ b/src/farm_designer/farm_events/__tests__/util_test.ts @@ -1,4 +1,3 @@ -import { maybeWarnAboutMissedTasks } from "../util"; describe("utils", () => { it("warns about missed tasks", () => { diff --git a/src/farm_designer/farm_events/calendar/__tests__/index_test.ts b/src/farm_designer/farm_events/calendar/__tests__/index_test.ts index 138075411..0e9d31659 100644 --- a/src/farm_designer/farm_events/calendar/__tests__/index_test.ts +++ b/src/farm_designer/farm_events/calendar/__tests__/index_test.ts @@ -1,5 +1,4 @@ import { Calendar } from "../index"; -import * as moment from "moment"; import { occurrence } from "../occurrence"; import { TIME, diff --git a/src/farm_designer/farm_events/calendar/__tests__/scheduler_test.ts b/src/farm_designer/farm_events/calendar/__tests__/scheduler_test.ts index 138a8ccbd..27afc6610 100644 --- a/src/farm_designer/farm_events/calendar/__tests__/scheduler_test.ts +++ b/src/farm_designer/farm_events/calendar/__tests__/scheduler_test.ts @@ -54,7 +54,6 @@ describe("scheduler", () => { "repeat": 2, "time_unit": "daily", }; - let now = moment("2017-08-01T19:22:38.502Z"); let intervalSeconds = farmEventIntervalSeconds(fakeEvent.repeat, fakeEvent.time_unit as TimeUnit); let result = scheduler({ @@ -85,7 +84,6 @@ it("schedules a FarmEvent", () => { "repeat": 2, "time_unit": "daily", }; - let now = moment("2017-08-01T19:22:38.502Z"); const EXPECTED = [ moment("2017-08-01T17:30:00.000Z"), moment("2017-08-03T17:30:00.000Z"), diff --git a/src/farm_designer/farm_events/calendar/index.ts b/src/farm_designer/farm_events/calendar/index.ts index 9f706a857..32a1cf111 100644 --- a/src/farm_designer/farm_events/calendar/index.ts +++ b/src/farm_designer/farm_events/calendar/index.ts @@ -3,13 +3,6 @@ import { CalendarOccurrence, CalendarDay } from "../../interfaces"; import * as moment from "moment"; import * as _ from "lodash"; -interface CalendarData { - sortKey: number; - month: string; - day: number; - items: CalendarOccurrence[] -} - export class Calendar { /** We sort by this attribute. Left as const so that the comiler can catch * name changes. */ diff --git a/src/farm_designer/farm_events/calendar/scheduler.ts b/src/farm_designer/farm_events/calendar/scheduler.ts index ca46f1601..ecc513fc1 100644 --- a/src/farm_designer/farm_events/calendar/scheduler.ts +++ b/src/farm_designer/farm_events/calendar/scheduler.ts @@ -53,11 +53,6 @@ const LOOKUP: Record = { "yearly": "years", }; -interface ConversionProps { - repeat: number; - time_unit: TimeUnit; -} - /** GIVEN: A time unit (hourly, weekly, etc) and a repeat (number) * RETURNS: Number of seconds for interval. * EXAMPLE: f(2, "minutely") => 120; diff --git a/src/farm_designer/farm_events/calendar/selectors.ts b/src/farm_designer/farm_events/calendar/selectors.ts index 924427df2..8d1ed05fd 100644 --- a/src/farm_designer/farm_events/calendar/selectors.ts +++ b/src/farm_designer/farm_events/calendar/selectors.ts @@ -1,10 +1,4 @@ -import * as moment from "moment"; -import { - NewCalendarItem, - FarmEventWithSequence, - FarmEventWithExecutable, - FarmEventWithRegimen -} from "./interfaces"; +import { FarmEventWithExecutable } from "./interfaces"; import { ResourceIndex } from "../../../resources/interfaces"; import { selectAllFarmEvents, diff --git a/src/farm_designer/farm_events/edit_fe_form.tsx b/src/farm_designer/farm_events/edit_fe_form.tsx index d336bbeab..4fca08788 100644 --- a/src/farm_designer/farm_events/edit_fe_form.tsx +++ b/src/farm_designer/farm_events/edit_fe_form.tsx @@ -30,7 +30,7 @@ import { import { DropDownItem } from "../../ui/fb_select"; import { history } from "../../history"; // TIL: https://stackoverflow.com/a/24900248/1064917 -import { betterMerge, fancyDebug } from "../../util"; +import { betterMerge } from "../../util"; import { maybeWarnAboutMissedTasks } from "./util"; import { TzWarning } from "./tz_warning"; import { FarmEventRepeatForm } from "./farm_event_repeat_form"; diff --git a/src/farm_designer/farm_events/farm_event_repeat_form.tsx b/src/farm_designer/farm_events/farm_event_repeat_form.tsx index 78f73683c..e9ec5c589 100644 --- a/src/farm_designer/farm_events/farm_event_repeat_form.tsx +++ b/src/farm_designer/farm_events/farm_event_repeat_form.tsx @@ -2,7 +2,6 @@ import * as React from "react"; import { t } from "i18next"; import { Row, Col, BlurableInput, DropDownItem } from "../../ui/index"; import { FBSelect } from "../../ui/new_fb_select"; -import { betterMerge } from "../../util"; import { repeatOptions } from "./map_state_to_props_add_edit"; import { keyBy } from "lodash"; import { TimeUnit } from "../interfaces"; diff --git a/src/farm_designer/farm_events/farm_events.tsx b/src/farm_designer/farm_events/farm_events.tsx index 535d0abf9..377440fd1 100644 --- a/src/farm_designer/farm_events/farm_events.tsx +++ b/src/farm_designer/farm_events/farm_events.tsx @@ -2,10 +2,9 @@ import * as React from "react"; import { Link } from "react-router"; import { connect } from "react-redux"; import { t } from "i18next"; -import { Row, Col } from "../../ui"; +import { Row } from "../../ui"; import { mapStateToProps } from "./map_state_to_props"; import { FarmEventProps, CalendarOccurrence } from "../interfaces"; -import { FBSelect } from "../../ui/new_fb_select"; import * as _ from "lodash"; export class PureFarmEvents extends React.Component { diff --git a/src/farm_designer/farm_events/map_state_to_props.ts b/src/farm_designer/farm_events/map_state_to_props.ts index c38baeb84..35984b718 100644 --- a/src/farm_designer/farm_events/map_state_to_props.ts +++ b/src/farm_designer/farm_events/map_state_to_props.ts @@ -7,11 +7,10 @@ import { occurrence } from "./calendar/occurrence"; import { findSequenceById } from "../../resources/selectors"; import { ResourceIndex } from "../../resources/interfaces"; import { FarmEventWithRegimen, FarmEventWithSequence } from "./calendar/interfaces"; -import { scheduler, farmEventIntervalSeconds, scheduleForFarmEvent } from "./calendar/scheduler"; +import { scheduleForFarmEvent } from "./calendar/scheduler"; /** Prepares a FarmEvent[] for use with */ export function mapStateToProps(state: Everything): FarmEventProps { - let x = joinFarmEventsToExecutable(state.resources.index); let push = (state && state.router && state.router.push) || (() => { }); let calendar = mapResourcesToCalendar(state.resources.index, moment.now()); let calendarRows = calendar.getAll(); diff --git a/src/farm_designer/farm_events/util.ts b/src/farm_designer/farm_events/util.ts index e3144faf4..082546d3b 100644 --- a/src/farm_designer/farm_events/util.ts +++ b/src/farm_designer/farm_events/util.ts @@ -1,8 +1,6 @@ import { TaggedFarmEvent } from "../../resources/tagged_resources"; import { GetState } from "../../redux/interfaces"; -import { findRegimenById } from "../../resources/selectors"; import * as moment from "moment"; -import * as _ from "lodash"; /** * PROBLEMS SOLVED: @@ -17,13 +15,12 @@ import * as _ from "lodash"; */ export function maybeWarnAboutMissedTasks(tfe: TaggedFarmEvent, cb: Function) { return function (dispatch: Function, getState: GetState) { - let state = getState(); let fe = tfe.body; // STEP 1: Only do this check if it is a Regimen - // sequences don't have this issue. if (fe.executable_type === "Regimen") { - var NOW = moment(); - var START_TIME = moment(fe.start_time); + let NOW = moment(); + let START_TIME = moment(fe.start_time); let TIMEFMT = "YYYY-MM-DD"; // STEP 2: Continue checking if the farm event is supposed to run today. diff --git a/src/farm_designer/map/farmbot_position_point.tsx b/src/farm_designer/map/farmbot_position_point.tsx index 4a4e79b6a..5f5cb1f3a 100644 --- a/src/farm_designer/map/farmbot_position_point.tsx +++ b/src/farm_designer/map/farmbot_position_point.tsx @@ -1,5 +1,4 @@ import * as React from "react"; -import { Props } from "../interfaces"; import { getXYFromQuadrant } from "./util"; import { BotOriginQuadrant } from "../interfaces"; import { BotState } from "../../devices/interfaces"; @@ -16,7 +15,7 @@ export class VirtualFarmBot extends React.Component> { render() { - let { x, y, z } = this.props.bot.hardware.location_data.position; + let { x, y } = this.props.bot.hardware.location_data.position; let { quadrant } = this.props; let { qx, qy } = getXYFromQuadrant((x || 0), (y || 0), quadrant); return diff --git a/src/farm_designer/map/garden_map.tsx b/src/farm_designer/map/garden_map.tsx index e61e28923..4822dc24d 100644 --- a/src/farm_designer/map/garden_map.tsx +++ b/src/farm_designer/map/garden_map.tsx @@ -64,7 +64,7 @@ export class GardenMap extends if (el && map && page) { let zoomLvl = parseFloat(window.getComputedStyle(map).zoom || DRAG_ERROR); let { pageX, pageY } = e; - let box = el.getBoundingClientRect(); + // let box = el.getBoundingClientRect(); let crop = history.getCurrentLocation().pathname.split("/")[5]; let OFEntry = this.findCrop(crop); let params: ScreenToGardenParams = { diff --git a/src/farmware/camera_calibration/camera_calibration.tsx b/src/farmware/camera_calibration/camera_calibration.tsx index ee9981023..093213003 100644 --- a/src/farmware/camera_calibration/camera_calibration.tsx +++ b/src/farmware/camera_calibration/camera_calibration.tsx @@ -7,7 +7,6 @@ import { ImageWorkspace } from "../weed_detector/image_workspace"; import { ToolTips } from "../../constants"; import { envSave } from "../weed_detector/remote_env/actions"; import { WDENVKey } from "../weed_detector/remote_env/interfaces"; -import { devices } from "../../device"; import { selectImage } from "../images/actions"; import { calibrate, scanImage } from "./actions"; diff --git a/src/farmware/camera_calibration/interfaces.ts b/src/farmware/camera_calibration/interfaces.ts index e5a4b7166..f59491dd9 100644 --- a/src/farmware/camera_calibration/interfaces.ts +++ b/src/farmware/camera_calibration/interfaces.ts @@ -1,5 +1,4 @@ import { TaggedImage } from "../../resources/tagged_resources"; -import { SyncStatus, Dictionary, FarmwareManifest } from "farmbot/dist"; import { WD_ENV } from "../weed_detector/remote_env/interfaces"; export interface CameraCalibrationState { diff --git a/src/farmware/images/__tests__/image_flipper_test.tsx b/src/farmware/images/__tests__/image_flipper_test.tsx index d07d4f7fa..d56e43f89 100644 --- a/src/farmware/images/__tests__/image_flipper_test.tsx +++ b/src/farmware/images/__tests__/image_flipper_test.tsx @@ -1,8 +1,6 @@ import "../../../unmock_i18next"; -import * as React from "react"; import { ImageFlipper } from "../image_flipper"; import { fakeImages } from "../../../__test_support__/fake_state/images"; -import * as freeze from "deep-freeze"; import { TaggedImage } from "../../../resources/tagged_resources"; import { defensiveClone } from "../../../util"; diff --git a/src/farmware/images/image_flipper.tsx b/src/farmware/images/image_flipper.tsx index 0f1595233..61bc02007 100644 --- a/src/farmware/images/image_flipper.tsx +++ b/src/farmware/images/image_flipper.tsx @@ -1,9 +1,6 @@ import * as React from "react"; import { t } from "i18next"; -import * as _ from "lodash"; -import * as moment from "moment"; import { ImageFlipperProps, ImageFlipperState } from "./interfaces"; -import { safeStringFetch } from "../../util"; export const PLACEHOLDER_FARMBOT = "/placeholder_farmbot.jpg"; diff --git a/src/farmware/index.tsx b/src/farmware/index.tsx index 74340fdd7..338946f21 100644 --- a/src/farmware/index.tsx +++ b/src/farmware/index.tsx @@ -1,6 +1,6 @@ import * as React from "react"; import { connect } from "react-redux"; -import { Page, Col, Row, Widget, WidgetHeader, WidgetBody } from "../ui/index"; +import { Page, Col, Row } from "../ui/index"; import { FarmwarePanel } from "./farmware_panel"; import { mapStateToProps } from "./state_to_props"; import { Photos } from "./images/photos"; diff --git a/src/farmware/weed_detector/__tests__/image_workspace_test.tsx b/src/farmware/weed_detector/__tests__/image_workspace_test.tsx index c2b33ab67..7e78f94ae 100644 --- a/src/farmware/weed_detector/__tests__/image_workspace_test.tsx +++ b/src/farmware/weed_detector/__tests__/image_workspace_test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { ImageWorkspace } from "../image_workspace"; describe("", () => { diff --git a/src/farmware/weed_detector/actions.tsx b/src/farmware/weed_detector/actions.tsx index eb9e30349..be99a447c 100644 --- a/src/farmware/weed_detector/actions.tsx +++ b/src/farmware/weed_detector/actions.tsx @@ -2,7 +2,7 @@ import * as _ from "lodash"; import axios from "axios"; import { t } from "i18next"; import { success, error } from "farmbot-toastr"; -import { Thunk, GetState } from "../../redux/interfaces"; +import { Thunk } from "../../redux/interfaces"; import { API } from "../../api"; import { Progress, ProgressCallback, HttpData } from "../../util"; import { GenericPointer } from "../../interfaces"; diff --git a/src/farmware/weed_detector/image_workspace.tsx b/src/farmware/weed_detector/image_workspace.tsx index 5d1378b0c..a1715ce8a 100644 --- a/src/farmware/weed_detector/image_workspace.tsx +++ b/src/farmware/weed_detector/image_workspace.tsx @@ -6,7 +6,6 @@ import { HSV } from "./interfaces"; import { WeedDetectorSlider } from "./slider"; import { TaggedImage } from "../../resources/tagged_resources"; import { t } from "i18next"; -import * as _ from "lodash"; const RANGES = { H: { LOWEST: 0, HIGHEST: 179 }, diff --git a/src/farmware/weed_detector/index.tsx b/src/farmware/weed_detector/index.tsx index 32c1a8a51..8ed9b644e 100644 --- a/src/farmware/weed_detector/index.tsx +++ b/src/farmware/weed_detector/index.tsx @@ -1,6 +1,5 @@ import * as React from "react"; import { connect } from "react-redux"; -import { Pair } from "farmbot"; import { DetectorState, HSV } from "./interfaces"; import { TitleBar } from "./title"; import { devices } from "../../device"; @@ -13,9 +12,8 @@ import { FarmwareProps } from "../../devices/interfaces"; import { mapStateToProps } from "../../farmware/state_to_props"; import { ToolTips } from "../../constants"; import { ImageWorkspace } from "./image_workspace"; -import { WD_ENV, WDENVKey as ENVKey, WDENVKey } from "./remote_env/interfaces"; +import { WDENVKey as ENVKey } from "./remote_env/interfaces"; import { envGet } from "./remote_env/selectors"; -import { envSave } from "./remote_env/actions"; import { translateImageWorkspaceAndSave } from "./actions"; @connect(mapStateToProps) diff --git a/src/farmware/weed_detector/remote_env/__tests__/translators_test.ts b/src/farmware/weed_detector/remote_env/__tests__/translators_test.ts index 2a712b981..016975f6c 100644 --- a/src/farmware/weed_detector/remote_env/__tests__/translators_test.ts +++ b/src/farmware/weed_detector/remote_env/__tests__/translators_test.ts @@ -1,6 +1,6 @@ import { formatEnvKey, parseEnvKey } from "../translators"; import { SPECIAL_VALUES, getSpecialValue } from "../constants"; -import { WD_ENV, WDENVKey } from "../interfaces"; +import { WDENVKey } from "../interfaces"; import { getDropdownSelection } from "../../selectors"; import { prepopulateEnv } from "../selectors"; @@ -21,7 +21,7 @@ describe("getSpecialValue()", () => { it("crashes on malformed inputs", () => { expect(() => { - getSpecialValue("FOo_bar!!") + getSpecialValue("FOo_bar!!"); }).toThrow(); }); }); diff --git a/src/farmware/weed_detector/remote_env/translators.ts b/src/farmware/weed_detector/remote_env/translators.ts index 05335d303..d9b79460f 100644 --- a/src/farmware/weed_detector/remote_env/translators.ts +++ b/src/farmware/weed_detector/remote_env/translators.ts @@ -1,4 +1,3 @@ -import * as _ from "lodash"; import { TRANSLATORS, DEFAULT_FORMATTER } from "./constants"; import { WDENVKey } from "./interfaces"; diff --git a/src/farmware/weed_detector/slider.tsx b/src/farmware/weed_detector/slider.tsx index 31c13501c..672d9ec2f 100644 --- a/src/farmware/weed_detector/slider.tsx +++ b/src/farmware/weed_detector/slider.tsx @@ -2,7 +2,7 @@ import * as React from "react"; import { RangeSlider } from "@blueprintjs/core/dist/components/slider/rangeSlider"; -import { isNumber, get } from "lodash"; +import { get } from "lodash"; interface SliderProps { onRelease(value: [number, number]): void; @@ -32,10 +32,7 @@ export class WeedDetectorSlider extends React.Component { render() { let { highest, - lowest, - lowValue, - highValue, - onRelease + lowest } = this.props; return { it("does an HTTP request if the icon can't be found locally", (done) => { cachedCrop("lettuce") diff --git a/src/open_farm/index.ts b/src/open_farm/index.ts index 9ea3928dd..6955075a4 100644 --- a/src/open_farm/index.ts +++ b/src/open_farm/index.ts @@ -1,6 +1,5 @@ import axios from "axios"; import { Dictionary } from "farmbot/dist"; -import * as _ from "lodash"; import { HttpData } from "../util"; const BASE = "https://openfarm.cc/api/v1/crops/"; diff --git a/src/password_reset/__tests__/password_reset_test.tsx b/src/password_reset/__tests__/password_reset_test.tsx index c48eead68..51310ecfa 100644 --- a/src/password_reset/__tests__/password_reset_test.tsx +++ b/src/password_reset/__tests__/password_reset_test.tsx @@ -2,7 +2,6 @@ import * as React from "react"; import { mount } from "enzyme"; import { PasswordReset } from "../password_reset"; import * as moxios from "moxios"; -import { API } from "../../api/api"; import { State } from "../interfaces"; describe("", () => { diff --git a/src/redux/generate_reducer.ts b/src/redux/generate_reducer.ts index 3a4b31711..bafbc70e6 100644 --- a/src/redux/generate_reducer.ts +++ b/src/redux/generate_reducer.ts @@ -34,7 +34,7 @@ export function generateReducer(initialState: State, let clonedState = defensiveClone(state); let clonedAction = defensiveClone(action); let result: State = handler(clonedState, clonedAction); - result = (afterEach || NOOP)(defensiveClone(result), action) + result = (afterEach || NOOP)(defensiveClone(result), action); return defensiveClone(result); } as GeneratedReducer; diff --git a/src/regimens/actions.ts b/src/regimens/actions.ts index f25d6cc67..46a1cd7d4 100644 --- a/src/regimens/actions.ts +++ b/src/regimens/actions.ts @@ -1,5 +1,5 @@ import { Regimen } from "./interfaces"; -import { destroy, save, init, edit } from "../api/crud"; +import { destroy, save, edit } from "../api/crud"; import { TaggedRegimen, isTaggedRegimen } from "../resources/tagged_resources"; export function editRegimen(r: TaggedRegimen | undefined, diff --git a/src/regimens/bulk_scheduler/__tests__/actions_test.ts b/src/regimens/bulk_scheduler/__tests__/actions_test.ts index 4bd744f71..c65e3e18a 100644 --- a/src/regimens/bulk_scheduler/__tests__/actions_test.ts +++ b/src/regimens/bulk_scheduler/__tests__/actions_test.ts @@ -9,7 +9,7 @@ describe("commitBulkEditor()", () => { it("does nothing if no regimen is selected", () => { let getState = () => fakeState(); let dispatch = jest.fn(); - let results = commitBulkEditor()(dispatch, getState); + commitBulkEditor()(dispatch, getState); expect(dispatch.mock.calls.length).toEqual(0); expect(mockErr.mock.calls.length).toEqual(1); }); diff --git a/src/regimens/bulk_scheduler/actions.ts b/src/regimens/bulk_scheduler/actions.ts index 268ec133d..4502ec934 100644 --- a/src/regimens/bulk_scheduler/actions.ts +++ b/src/regimens/bulk_scheduler/actions.ts @@ -2,7 +2,7 @@ import { isNaN, isNumber } from "lodash"; import { t } from "i18next"; import { error, warning } from "farmbot-toastr"; import { ReduxAction, Thunk } from "../../redux/interfaces"; -import { ToggleDayParams, Week } from "./interfaces"; +import { ToggleDayParams } from "./interfaces"; import { assertUuid, findSequence, findRegimen } from "../../resources/selectors"; import { groupRegimenItemsByWeek } from "./group_regimen_items_by_week"; import { defensiveClone } from "../../util"; diff --git a/src/regimens/bulk_scheduler/index.tsx b/src/regimens/bulk_scheduler/index.tsx index 63554bf36..283ce720d 100644 --- a/src/regimens/bulk_scheduler/index.tsx +++ b/src/regimens/bulk_scheduler/index.tsx @@ -47,7 +47,6 @@ export class BulkSchedulerWidget extends React.Component { render() { let { dispatch, - selectedSequence, dailyOffsetMs, weeks, sequences diff --git a/src/regimens/editor/__tests__/copy_button_test.tsx b/src/regimens/editor/__tests__/copy_button_test.tsx index 3db19a175..fcff578af 100644 --- a/src/regimens/editor/__tests__/copy_button_test.tsx +++ b/src/regimens/editor/__tests__/copy_button_test.tsx @@ -2,7 +2,6 @@ jest.unmock("../../../api/crud"); import * as React from "react"; import { mount } from "enzyme"; import { CopyButton } from "../copy_button"; -import { TaggedRegimen } from "../../../resources/tagged_resources"; import { fakeRegimen } from "../../../__test_support__/fake_state/resources"; describe("Copy button", () => { diff --git a/src/regimens/editor/active_editor.tsx b/src/regimens/editor/active_editor.tsx index 2de847cd0..96c4b1fc4 100644 --- a/src/regimens/editor/active_editor.tsx +++ b/src/regimens/editor/active_editor.tsx @@ -2,7 +2,7 @@ import * as React from "react"; import { RegimenNameInput } from "./regimen_name_input"; import { ActiveEditorProps } from "./interfaces"; import { t } from "i18next"; -import { RegimenItem, RegimenItemCalendarRow } from "../interfaces"; +import { RegimenItem } from "../interfaces"; import { TaggedRegimen } from "../../resources/tagged_resources"; import { defensiveClone } from "../../util"; import { overwrite } from "../../api/crud"; diff --git a/src/regimens/editor/interfaces.ts b/src/regimens/editor/interfaces.ts index cb2879946..5d4a74cee 100644 --- a/src/regimens/editor/interfaces.ts +++ b/src/regimens/editor/interfaces.ts @@ -1,9 +1,7 @@ import { - RegimenItem, RegimenProps, CalendarRow, - RegimenItemCalendarRow, - Regimen + RegimenItemCalendarRow } from "../interfaces"; import { AuthState } from "../../auth/interfaces"; import { BotState } from "../../devices/interfaces"; @@ -45,4 +43,4 @@ export interface CopyButtnProps { export interface DeleteButtonProps extends RegimenProps { baseUrl: string; -}; +} diff --git a/src/regimens/list/index.tsx b/src/regimens/list/index.tsx index b30a603db..873cb728a 100644 --- a/src/regimens/list/index.tsx +++ b/src/regimens/list/index.tsx @@ -60,7 +60,7 @@ export class RegimensList extends } render() { - let { dispatch, regimen, regimens } = this.props; + let { dispatch, regimens } = this.props; return (
diff --git a/src/regimens/list/regimen_list_item.tsx b/src/regimens/list/regimen_list_item.tsx index 94f0899d4..554728a65 100644 --- a/src/regimens/list/regimen_list_item.tsx +++ b/src/regimens/list/regimen_list_item.tsx @@ -1,7 +1,7 @@ import * as React from "react"; import { Link } from "react-router"; import { RegimenListItemProps } from "../interfaces"; -import { isMobile, lastUrlChunk, urlFriendly } from "../../util"; +import { lastUrlChunk, urlFriendly } from "../../util"; import { selectRegimen } from "../actions"; import { TaggedRegimen, diff --git a/src/resources/__tests__/selectors_test.ts b/src/resources/__tests__/selectors_test.ts index 6f7aa21dc..58a339187 100644 --- a/src/resources/__tests__/selectors_test.ts +++ b/src/resources/__tests__/selectors_test.ts @@ -1,7 +1,6 @@ import { buildResourceIndex } from "../../__test_support__/resource_index_builder"; import { findSlotByToolId } from "../selectors"; import { resourceReducer } from "../reducer"; -import { Actions } from "../../constants"; import { TaggedTool, TaggedToolSlotPointer } from "../tagged_resources"; import { createOK } from "../actions"; import { generateUuid } from "../util"; diff --git a/src/resources/reducer.ts b/src/resources/reducer.ts index 865bbcac7..c9f2362ed 100644 --- a/src/resources/reducer.ts +++ b/src/resources/reducer.ts @@ -1,13 +1,11 @@ import * as _ from "lodash"; -import * as moment from "moment"; import { generateReducer } from "../redux/generate_reducer"; import { RestResources, ResourceIndex } from "./interfaces"; import { TaggedResource, ResourceName, sanityCheck, - isTaggedResource, - TaggedSequence + isTaggedResource } from "./tagged_resources"; import { generateUuid, arrayWrap } from "./util"; import { EditResourceParams } from "../api/interfaces"; @@ -32,7 +30,6 @@ import { farmwareState } from "../farmware/reducer"; import { Actions } from "../constants"; -import { uuid as rando } from "farmbot/dist"; let consumerReducer = combineReducers({ regimens, diff --git a/src/resources/selectors.ts b/src/resources/selectors.ts index 573ec1ced..6c5e241be 100644 --- a/src/resources/selectors.ts +++ b/src/resources/selectors.ts @@ -27,8 +27,7 @@ import { TaggedToolSlotPointer, TaggedUser } from "./tagged_resources"; -import { CowardlyDictionary, betterCompact, sortResourcesById, betterMerge } from "../util"; -import { ToolSlotPointer } from "../interfaces"; +import { CowardlyDictionary, betterCompact, sortResourcesById } from "../util"; type StringMap = CowardlyDictionary; export let findId = (index: ResourceIndex, kind: ResourceName, id: number) => { diff --git a/src/resources/util.ts b/src/resources/util.ts index 6cd7df7ae..c517189c4 100644 --- a/src/resources/util.ts +++ b/src/resources/util.ts @@ -4,7 +4,7 @@ import { Dictionary } from "farmbot/dist"; import { betterCompact } from "../util"; import * as _ from "lodash"; -var count = 0; +let count = 0; export function generateUuid(id: number | undefined, kind: ResourceName) { return `${joinKindAndId(kind, id)}.${count++}` } diff --git a/src/sequences/inputs/__tests__/input_default_test.tsx b/src/sequences/inputs/__tests__/input_default_test.tsx index d8622788d..c8a7bd68b 100644 --- a/src/sequences/inputs/__tests__/input_default_test.tsx +++ b/src/sequences/inputs/__tests__/input_default_test.tsx @@ -4,14 +4,11 @@ import { InputDefault } from "../input_default"; import { mount } from "enzyme"; import { TaggedSequence } from "../../../resources/tagged_resources"; import { MoveAbsolute } from "farmbot/dist"; -import { updateStep } from "../../step_tiles/index"; -import { fakeState } from "../../../__test_support__/fake_state"; import { Wrapper } from "../../../__test_support__/wrapper"; describe("", () => { it("updates the step", () => { let dispatcher = jest.fn(); - let state = fakeState(); let step: MoveAbsolute = { "kind": "move_absolute", "args": { @@ -57,7 +54,6 @@ describe("", () => { dispatch={dispatcher} sequence={tr} /> ); - let x: jest.Mock<{}> = (updateStep as any).mock; let input = c.find("input").first(); input.simulate("change"); input.simulate("blur"); diff --git a/src/sequences/inputs/step_input_box.tsx b/src/sequences/inputs/step_input_box.tsx index 1cffc6b04..725f8935b 100644 --- a/src/sequences/inputs/step_input_box.tsx +++ b/src/sequences/inputs/step_input_box.tsx @@ -3,10 +3,6 @@ import { InputUnknown } from "./input_unknown"; import { InputDefault } from "./input_default"; import { StepInputProps } from "../interfaces"; -type ArgType = "speed" | "pin_number" | "pin_value" | "pin_mode" | "operator" - | "x" | "y" | "z" | "stub" | "variable" | "label" | "milliseconds" | "message" - | "lhs" | "op" | "rhs" | "sequence_id" | "location"; - export function StepInputBox(props: StepInputProps) { switch (props.field) { case "label": case "lhs": case "message": case "milliseconds": case "op": diff --git a/src/sequences/sequence_editor_middle_active.tsx b/src/sequences/sequence_editor_middle_active.tsx index 41e402176..a74b9a161 100644 --- a/src/sequences/sequence_editor_middle_active.tsx +++ b/src/sequences/sequence_editor_middle_active.tsx @@ -6,7 +6,7 @@ import { editCurrentSequence } from "./actions"; import { renderCeleryNode, splice, move } from "./step_tiles/index"; import { ColorPicker } from "../ui"; import { t } from "i18next"; -import { BlurableInput, Row, Col, SaveBtn, ToolTip } from "../ui"; +import { BlurableInput, Row, Col, SaveBtn } from "../ui"; import { DropArea } from "../draggable/drop_area"; import { stepGet } from "../draggable/actions"; import { pushStep } from "./actions"; @@ -15,7 +15,6 @@ import { copySequence } from "./actions"; import { TaggedSequence } from "../resources/tagged_resources"; import { save, edit, destroy } from "../api/crud"; import { GetState } from "../redux/interfaces"; -import { ToolTips } from "../constants"; import { get } from "lodash"; import { TestButton } from "./test_button"; import { warning } from "farmbot-toastr"; diff --git a/src/sequences/sequence_editor_middle_inactive.tsx b/src/sequences/sequence_editor_middle_inactive.tsx index ab1938eaf..30f8f6377 100644 --- a/src/sequences/sequence_editor_middle_inactive.tsx +++ b/src/sequences/sequence_editor_middle_inactive.tsx @@ -1,5 +1,4 @@ import * as React from "react"; -import { Col } from "../ui/index"; import { t } from "i18next"; /** The bottom half of the Sequence editor panel (when no Sequence is selected). */ diff --git a/src/sequences/sequences_list.tsx b/src/sequences/sequences_list.tsx index 74a2aacd3..0056e0a3c 100644 --- a/src/sequences/sequences_list.tsx +++ b/src/sequences/sequences_list.tsx @@ -1,12 +1,10 @@ import * as React from "react"; import { Link } from "react-router"; -import * as _ from "lodash"; import { t } from "i18next"; -import { history, push } from "../history"; +import { push } from "../history"; import { selectSequence } from "./actions"; import { SequencesListProps, SequencesListState } from "./interfaces"; import { - isMobile, sortResourcesById, urlFriendly, lastUrlChunk diff --git a/src/sequences/step_buttons/__tests__/index_test.tsx b/src/sequences/step_buttons/__tests__/index_test.tsx index 18fdd5902..44f72abd1 100644 --- a/src/sequences/step_buttons/__tests__/index_test.tsx +++ b/src/sequences/step_buttons/__tests__/index_test.tsx @@ -1,7 +1,7 @@ import * as React from "react"; import { StepButtonParams } from "../../interfaces"; import { StepButton } from "../index"; -import { mount, shallow } from "enzyme"; +import { shallow } from "enzyme"; import { fakeSequence } from "../../../__test_support__/fake_state/resources"; import { ReduxAction } from "../../../redux/interfaces"; import { EditResourceParams } from "../../../api/interfaces"; diff --git a/src/sequences/step_tiles/index.tsx b/src/sequences/step_tiles/index.tsx index 2550ad475..19683eab3 100644 --- a/src/sequences/step_tiles/index.tsx +++ b/src/sequences/step_tiles/index.tsx @@ -31,7 +31,6 @@ export function move({ step, sequence, to, from }: MoveParams) { let next = defensiveClone(sequence); let seq = next.body; seq.body = seq.body || []; - let both = [from, to]; // WEIRD EDGE CASE: TODO: // Works when from > to but not the other way around. // Wish I could use one function for both cases, but don't have diff --git a/src/sequences/step_tiles/step_title_bar.tsx b/src/sequences/step_tiles/step_title_bar.tsx index fac529343..c223287e0 100644 --- a/src/sequences/step_tiles/step_title_bar.tsx +++ b/src/sequences/step_tiles/step_title_bar.tsx @@ -1,6 +1,5 @@ import * as React from "react"; -import { SequenceBodyItem as Step, Dictionary } from "farmbot"; -import { addComment } from "../actions"; +import { SequenceBodyItem as Step } from "farmbot"; import { t } from "i18next"; import { CowardlyDictionary } from "../../util"; import { StepTitleBarProps } from "../interfaces"; diff --git a/src/sequences/step_tiles/tile_execute.tsx b/src/sequences/step_tiles/tile_execute.tsx index a3d453547..eb156ae41 100644 --- a/src/sequences/step_tiles/tile_execute.tsx +++ b/src/sequences/step_tiles/tile_execute.tsx @@ -53,9 +53,9 @@ export class RefactoredExecuteBlock extends React.Component .map(function (x) { let { id, name } = x.body; if (_.isNumber(id) && (id !== p.currentStep.args.sequence_id)) { - output.push({ label: name, value: id }) + output.push({ label: name, value: id }); } - }) + }); return output; } @@ -71,7 +71,7 @@ export class RefactoredExecuteBlock extends React.Component let { sequence_id } = p.currentStep.args; if (sequence_id) { let s = findSequenceById(p.resources, sequence_id); - return { label: s.body.name, value: (s.body.id as number) } + return { label: s.body.name, value: (s.body.id as number) }; } else { return undefined; } diff --git a/src/sequences/step_tiles/tile_execute_script.tsx b/src/sequences/step_tiles/tile_execute_script.tsx index cc3b4ff85..ce7408014 100644 --- a/src/sequences/step_tiles/tile_execute_script.tsx +++ b/src/sequences/step_tiles/tile_execute_script.tsx @@ -1,10 +1,10 @@ import * as React from "react"; import { StepParams } from "../interfaces"; import { StepTitleBar } from "./step_title_bar"; -import { Help } from "../../ui"; import { splice, remove } from "./index"; import { t } from "i18next"; import { ToolTips } from "../../constants"; +import { StepIconGroup } from "../step_icon_group"; export function TileExecuteScript({ dispatch, currentStep, index, currentSequence }: StepParams) { if (currentStep.kind === "execute_script") { @@ -17,16 +17,14 @@ export function TileExecuteScript({ dispatch, currentStep, index, currentSequenc dispatch={dispatch} step={currentStep} sequence={currentSequence} /> - - dispatch(splice({ + dispatch(splice({ step: currentStep, index, sequence: currentSequence - }))} /> - remove({ dispatch, index, sequence: currentSequence })} /> - + }))} + onTrash={() => remove({ dispatch, index, sequence: currentSequence })} + helpText={t(ToolTips.EXECUTE_SCRIPT)} />
diff --git a/src/sequences/step_tiles/tile_find_home.tsx b/src/sequences/step_tiles/tile_find_home.tsx index 4c9cc6c0e..50d3e3976 100644 --- a/src/sequences/step_tiles/tile_find_home.tsx +++ b/src/sequences/step_tiles/tile_find_home.tsx @@ -2,15 +2,14 @@ import * as React from "react"; import { t } from "i18next"; import { splice, remove } from "./index"; import { StepTitleBar } from "./step_title_bar"; -import { Help } from "../../ui"; import { FindHome, ALLOWED_AXIS } from "farmbot"; -import * as _ from "lodash"; import { StepParams } from "../interfaces"; import { TaggedSequence } from "../../resources/tagged_resources"; import { ResourceIndex } from "../../resources/interfaces"; -import { edit, overwrite } from "../../api/crud"; +import { overwrite } from "../../api/crud"; import { defensiveClone } from "../../util"; import { ToolTips } from "../../constants"; +import { StepIconGroup } from "../step_icon_group"; export function TileFindHome(props: StepParams) { if (props.currentStep.kind === "find_home") { @@ -60,16 +59,14 @@ class InnerFindHome extends React.Component { dispatch={dispatch} step={currentStep} sequence={currentSequence} /> - - dispatch(splice({ + remove({ dispatch, index, sequence: currentSequence })} + onClone={() => dispatch(splice({ step: currentStep, sequence: currentSequence, index - }))} /> - remove({ dispatch, index, sequence: currentSequence })} /> - + }))} + helpText={t(ToolTips.FIND_HOME)} /> @@ -81,8 +78,8 @@ class InnerFindHome extends React.Component {
- {AXIS_CHOICES.map((axis, index) => { - return
+ {AXIS_CHOICES.map((axis, i) => { + return
diff --git a/src/sequences/step_tiles/tile_read_pin.tsx b/src/sequences/step_tiles/tile_read_pin.tsx index 62af404c6..503188d57 100644 --- a/src/sequences/step_tiles/tile_read_pin.tsx +++ b/src/sequences/step_tiles/tile_read_pin.tsx @@ -1,11 +1,11 @@ import * as React from "react"; import { StepTitleBar } from "./step_title_bar"; import { splice, remove } from "./index"; -import { Help } from "../../ui"; import { t } from "i18next"; import { StepInputBox } from "../inputs/step_input_box"; import { StepParams } from "../interfaces"; import { ToolTips } from "../../constants"; +import { StepIconGroup } from "../step_icon_group"; export function TileReadPin({ dispatch, currentStep, index, currentSequence }: StepParams) { return (
@@ -17,16 +17,14 @@ export function TileReadPin({ dispatch, currentStep, index, currentSequence }: S dispatch={dispatch} step={currentStep} sequence={currentSequence} /> - - dispatch(splice({ + dispatch(splice({ step: currentStep, index, sequence: currentSequence - }))} /> - remove({ dispatch, index, sequence: currentSequence })} /> - + }))} + onTrash={() => remove({ dispatch, index, sequence: currentSequence })} + helpText={t(ToolTips.READ_PIN)} />
@@ -64,4 +62,4 @@ export function TileReadPin({ dispatch, currentStep, index, currentSequence }: S ); -}; +} diff --git a/src/sequences/step_tiles/tile_send_message.tsx b/src/sequences/step_tiles/tile_send_message.tsx index 270a17af7..042e3267a 100644 --- a/src/sequences/step_tiles/tile_send_message.tsx +++ b/src/sequences/step_tiles/tile_send_message.tsx @@ -1,7 +1,7 @@ import * as React from "react"; import { splice, remove } from "./index"; import { StepTitleBar } from "./step_title_bar"; -import { Help, DropDownItem } from "../../ui"; +import { DropDownItem } from "../../ui"; import { t } from "i18next"; import { StepInputBox } from "../inputs/step_input_box"; import { SendMessage, ALLOWED_CHANNEL_NAMES } from "farmbot"; @@ -17,6 +17,7 @@ import { EACH_CHANNEL, channel } from "./tile_send_message_support"; +import { StepIconGroup } from "../step_icon_group"; type ChannelName = ALLOWED_CHANNEL_NAMES; export function TileSendMessage(props: StepParams) { if (props.currentStep.kind === "send_message") { @@ -41,16 +42,16 @@ interface SendMessageParams { class RefactoredSendMessage extends React.Component { get args() { return this.props.currentStep.args; } - get message() { return this.args.message }; - get message_type() { return this.args.message_type } + get message() { return this.args.message; } + get message_type() { return this.args.message_type; } get step() { return this.props.currentStep; } - get dispatch() { return this.props.dispatch } + get dispatch() { return this.props.dispatch; } get sequence() { return this.props.currentSequence; } - get index() { return this.props.index } + get index() { return this.props.index; } get currentSelection() { return { label: _.capitalize(this.message_type), value: this.message_type }; - }; - get channels() { return (this.step.body || []).map(x => x.args.channel_name) } + } + get channels() { return (this.step.body || []).map(x => x.args.channel_name); } hasChannel = (name: ChannelName) => { return this.channels.includes(name); } @@ -80,7 +81,7 @@ class RefactoredSendMessage extends React.Component { index: this.index, executor: (step: SendMessage) => { if (_.isString(x.value)) { - step.args.message_type = x.value + step.args.message_type = x.value; } else { throw new Error("Strings only in send_message."); } @@ -100,16 +101,14 @@ class RefactoredSendMessage extends React.Component { dispatch={dispatch} step={currentStep} sequence={currentSequence} /> - - dispatch(splice({ + dispatch(splice({ step: currentStep, sequence: currentSequence, index - }))} /> - remove({ dispatch, index, sequence: currentSequence })} /> - + }))} + onTrash={() => remove({ dispatch, index, sequence: currentSequence })} + helpText={t(ToolTips.SEND_MESSAGE)} /> diff --git a/src/sequences/step_tiles/tile_take_photo.tsx b/src/sequences/step_tiles/tile_take_photo.tsx index 4ff769354..74ed36ba9 100644 --- a/src/sequences/step_tiles/tile_take_photo.tsx +++ b/src/sequences/step_tiles/tile_take_photo.tsx @@ -1,11 +1,11 @@ import * as React from "react"; import { StepParams } from "../interfaces"; import { StepTitleBar } from "./step_title_bar"; -import { Help } from "../../ui"; import { splice, remove } from "./index"; import { t } from "i18next"; import { Link } from "react-router"; import { ToolTips } from "../../constants"; +import { StepIconGroup } from "../step_icon_group"; export function TileTakePhoto({ dispatch, currentStep, index, currentSequence }: StepParams) { return (
@@ -17,16 +17,14 @@ export function TileTakePhoto({ dispatch, currentStep, index, currentSequence }: dispatch={dispatch} step={currentStep} sequence={currentSequence} /> - - dispatch(splice({ + dispatch(splice({ step: currentStep, index, sequence: currentSequence - }))} /> - remove({ dispatch, index, sequence: currentSequence })} /> - + }))} + onTrash={() => remove({ dispatch, index, sequence: currentSequence })} + helpText={t(ToolTips.TAKE_PHOTO)} />
diff --git a/src/sequences/step_tiles/tile_wait.tsx b/src/sequences/step_tiles/tile_wait.tsx index d6de3bd4e..58ee6187e 100644 --- a/src/sequences/step_tiles/tile_wait.tsx +++ b/src/sequences/step_tiles/tile_wait.tsx @@ -1,11 +1,11 @@ import * as React from "react"; import { StepTitleBar } from "./step_title_bar"; -import { Help } from "../../ui"; import { splice, remove } from "./index"; import { t } from "i18next"; import { StepInputBox } from "../inputs/step_input_box"; import { StepParams } from "../interfaces"; import { ToolTips } from "../../constants"; +import { StepIconGroup } from "../step_icon_group"; export function TileWait({ dispatch, currentStep, index, currentSequence }: StepParams) { return (
@@ -17,16 +17,14 @@ export function TileWait({ dispatch, currentStep, index, currentSequence }: Step dispatch={dispatch} step={currentStep} sequence={currentSequence} /> - - dispatch(splice({ + dispatch(splice({ step: currentStep, sequence: currentSequence, index - }))} /> - remove({ dispatch, index, sequence: currentSequence })} /> - + }))} + onTrash={() => remove({ dispatch, index, sequence: currentSequence })} + helpText={t(ToolTips.WAIT)} />
diff --git a/src/sequences/step_tiles/tile_write_pin.tsx b/src/sequences/step_tiles/tile_write_pin.tsx index b6733876c..c0f1f3573 100644 --- a/src/sequences/step_tiles/tile_write_pin.tsx +++ b/src/sequences/step_tiles/tile_write_pin.tsx @@ -1,11 +1,11 @@ import * as React from "react"; import { StepTitleBar } from "./step_title_bar"; -import { Help } from "../../ui"; import { splice, remove } from "./index"; import { t } from "i18next"; import { StepInputBox } from "../inputs/step_input_box"; import { StepParams } from "../interfaces"; import { ToolTips } from "../../constants"; +import { StepIconGroup } from "../step_icon_group"; export function TileWritePin({ dispatch, currentStep, index, currentSequence }: StepParams) { return (
@@ -17,16 +17,14 @@ export function TileWritePin({ dispatch, currentStep, index, currentSequence }: dispatch={dispatch} step={currentStep} sequence={currentSequence} /> - - dispatch(splice({ + dispatch(splice({ step: currentStep, index, sequence: currentSequence - }))} /> - remove({ dispatch, index, sequence: currentSequence })} /> - + }))} + onTrash={() => remove({ dispatch, index, sequence: currentSequence })} + helpText={t(ToolTips.WRITE_PIN)} />
diff --git a/src/session.ts b/src/session.ts index f0d6cc28a..8f2efc37b 100644 --- a/src/session.ts +++ b/src/session.ts @@ -21,7 +21,7 @@ export namespace Session { } catch (error) { clear(); return undefined; - }; + } } /** Clear localstorage and sessionstorage. */ diff --git a/src/tos_update/__tests__/index_test.tsx b/src/tos_update/__tests__/index_test.tsx index e66c6b626..dce56427a 100644 --- a/src/tos_update/__tests__/index_test.tsx +++ b/src/tos_update/__tests__/index_test.tsx @@ -12,7 +12,7 @@ jest.mock("../../i18n", () => { import * as React from "react"; import { Wow } from "../index"; -import { mount, shallow } from "enzyme"; +import { shallow } from "enzyme"; describe("", () => { it("toggles server options", () => { let x = shallow(); diff --git a/src/ui/__tests__/back_arrow_test.ts b/src/ui/__tests__/back_arrow_test.ts index dbfddf2ab..3db997c11 100644 --- a/src/ui/__tests__/back_arrow_test.ts +++ b/src/ui/__tests__/back_arrow_test.ts @@ -1,4 +1,3 @@ -import * as React from "react"; import { BackArrow } from "../back_arrow"; import { mount } from "enzyme"; diff --git a/src/ui/__tests__/help_test.ts b/src/ui/__tests__/help_test.ts index bf56cc143..2e015ec82 100644 --- a/src/ui/__tests__/help_test.ts +++ b/src/ui/__tests__/help_test.ts @@ -1,4 +1,3 @@ -import * as React from "react"; import { Help } from "../help"; import { mount } from "enzyme"; diff --git a/src/ui/__tests__/markdown_test.ts b/src/ui/__tests__/markdown_test.ts index 52b220e42..d1535a58a 100644 --- a/src/ui/__tests__/markdown_test.ts +++ b/src/ui/__tests__/markdown_test.ts @@ -1,4 +1,3 @@ -import * as React from "react"; import { Markdown } from "../markdown"; import { mount } from "enzyme"; diff --git a/src/ui/__tests__/page_test.ts b/src/ui/__tests__/page_test.ts index 1f67a0080..c3071515f 100644 --- a/src/ui/__tests__/page_test.ts +++ b/src/ui/__tests__/page_test.ts @@ -1,4 +1,3 @@ -import * as React from "react"; import { Page } from "../page"; import { mount } from "enzyme"; diff --git a/src/ui/__tests__/saucer_test.ts b/src/ui/__tests__/saucer_test.ts index ee14b9a09..6ec0ff812 100644 --- a/src/ui/__tests__/saucer_test.ts +++ b/src/ui/__tests__/saucer_test.ts @@ -1,4 +1,3 @@ -import * as React from "react"; import { Saucer } from "../saucer"; import { mount } from "enzyme"; diff --git a/src/ui/__tests__/tooltip_test.ts b/src/ui/__tests__/tooltip_test.ts index a79ee3894..a8875cc27 100644 --- a/src/ui/__tests__/tooltip_test.ts +++ b/src/ui/__tests__/tooltip_test.ts @@ -1,4 +1,3 @@ -import * as React from "react"; import { ToolTip } from "../tooltip"; import { mount } from "enzyme"; diff --git a/src/ui/__tests__/widget_footer_test.ts b/src/ui/__tests__/widget_footer_test.ts index c0456bfbe..683ed6487 100644 --- a/src/ui/__tests__/widget_footer_test.ts +++ b/src/ui/__tests__/widget_footer_test.ts @@ -1,4 +1,3 @@ -import * as React from "react"; import { WidgetFooter } from "../widget_footer"; import { mount } from "enzyme"; diff --git a/src/ui/__tests__/widget_test.ts b/src/ui/__tests__/widget_test.ts index 4b014eed8..0fef1685e 100644 --- a/src/ui/__tests__/widget_test.ts +++ b/src/ui/__tests__/widget_test.ts @@ -1,4 +1,3 @@ -import * as React from "react"; import { Widget } from "../widget"; import { mount } from "enzyme"; diff --git a/src/ui/blurable_input.tsx b/src/ui/blurable_input.tsx index 5562d709f..9c8d732a8 100644 --- a/src/ui/blurable_input.tsx +++ b/src/ui/blurable_input.tsx @@ -1,5 +1,4 @@ import * as React from "react"; -import * as _ from "lodash"; interface BIProps { value: string | number; diff --git a/src/ui/fallback_img.tsx b/src/ui/fallback_img.tsx index c92d21580..0887040f7 100644 --- a/src/ui/fallback_img.tsx +++ b/src/ui/fallback_img.tsx @@ -1,7 +1,6 @@ import * as React from "react"; import { defensiveClone } from "../util"; import { t } from "i18next"; -import { Col } from "./index"; type ImgTag = React.HTMLProps; diff --git a/src/ui/fb_select.tsx b/src/ui/fb_select.tsx index 1d997da89..44d45c632 100644 --- a/src/ui/fb_select.tsx +++ b/src/ui/fb_select.tsx @@ -1,5 +1,4 @@ import * as React from "react"; -import * as _ from "lodash"; type OptionComponent = | React.ComponentClass diff --git a/src/ui/filter_search.tsx b/src/ui/filter_search.tsx index 0559becde..3a8da1579 100644 --- a/src/ui/filter_search.tsx +++ b/src/ui/filter_search.tsx @@ -70,7 +70,7 @@ export class FilterSearch extends React.Component> { } private subMenu = (params: ISelectItemRendererProps) => { - let { handleClick, item, index } = params; + let { handleClick, item } = params; return ( = left.split("."); - var pb: Array = right.split("."); - for (var i = 0; i < 3; i++) { - var num_left = Number(pa[i]); - var num_right = Number(pb[i]); + let pa: Array = left.split("."); + let pb: Array = right.split("."); + for (let i = 0; i < 3; i++) { + let num_left = Number(pa[i]); + let num_right = Number(pb[i]); if (num_left > num_right) { return SemverResult.LEFT_IS_GREATER; @@ -445,12 +444,12 @@ export function hardRefresh() { * NOTE: We will need to remove this if we ever add google analytics. * -RC 23 jun 17 */ function deleteAllCookies() { - var cookies = document.cookie.split(";"); + let cookies = document.cookie.split(";"); - for (var i = 0; i < cookies.length; i++) { - var cookie = cookies[i]; - var eqPos = cookie.indexOf("="); - var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; + for (let i = 0; i < cookies.length; i++) { + let cookie = cookies[i]; + let eqPos = cookie.indexOf("="); + let name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT"; } } diff --git a/tsconfig.json b/tsconfig.json index fedf0ee4f..4b4d29f90 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,6 +11,7 @@ "experimentalDecorators": true, "noImplicitAny": true, "noImplicitThis": true, + "noUnusedLocals": true, "allowUnreachableCode": false, "strictNullChecks": true, "sourceMap": true, diff --git a/tslint.json b/tslint.json index 8a2c7f48e..a9fda2f38 100644 --- a/tslint.json +++ b/tslint.json @@ -1,51 +1,5 @@ { "rules": { - "max-line-length": [ - true, - 100 - ], - "no-inferrable-types": true, - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "cyclomatic-complexity": [ - true, - 21 - ], - "indent": [ - true, - "spaces" - ], - "no-invalid-this": true, - "no-switch-case-fall-through": true, - "no-eval": true, - "no-any": true, - "no-duplicate-variable": true, - "no-arg": true, - "no-internal-module": true, - "no-trailing-whitespace": true, - "no-bitwise": true, - "no-var-requires": false, - "no-shadowed-variable": true, - "no-unused-locals": true, - "no-unused-parameters": true, - "no-consecutive-blank-lines": true, - "no-angle-bracket-type-assertion": true, - "eofline": true, - "one-line": [ - true, - "check-catch", - "check-else", - "check-open-brace", - "check-whitespace" - ], - "quotemark": [ - true, - "double", - "avoid-escape" - ], "semicolon": [ true, "ignore-interfaces", @@ -61,7 +15,62 @@ "variable-declaration": "nospace" } ], + "max-line-length": [ + true, + 100 + ], + "no-inferrable-types": true, + "class-name": true, + "comment-format": [ + true, + "check-space" + ], + "cyclomatic-complexity": [ + true, + 14 + ], + "indent": [ + true, + "spaces" + ], + "one-line": [ + true, + "check-catch", + "check-else", + "check-open-brace", + "check-whitespace" + ], + "quotemark": [ + true, + "double", + "avoid-escape" + ], "curly": true, + "eofline": true, + "no-angle-bracket-type-assertion": true, + "no-any": true, + "no-arg": true, + "no-bitwise": true, + "no-conditional-assignment": true, + "no-consecutive-blank-lines": true, + "no-default-export": true, + "no-duplicate-variable": true, + "no-eval": true, + "no-for-in-array": true, + "no-internal-module": true, + "no-invalid-this": true, + "no-null-keyword": true, + "no-shadowed-variable": true, + "no-switch-case-fall-through": true, + "no-trailing-whitespace": true, + "no-unused-locals": true, + "no-unused-parameters": true, + "no-unused-variable": [ + true + ], + "no-use-before-declare": true, + "no-var-keyword": true, + "no-var-requires": false, "whitespace": [ true, "check-branch",