Linting
This commit is contained in:
parent
7173b2ec9e
commit
552e360f6f
@ -13,16 +13,16 @@
|
||||
"dist"
|
||||
],
|
||||
"rules": {
|
||||
"quotes": ["warn", "single"],
|
||||
"indent": ["warn", 2, { "SwitchCase": 1 }],
|
||||
"quotes": ["warn", "double"],
|
||||
"indent": ["warn", "tab"],
|
||||
"semi": ["off"],
|
||||
"comma-dangle": ["warn", "always-multiline"],
|
||||
"dot-notation": "off",
|
||||
"eqeqeq": "warn",
|
||||
"curly": ["warn", "all"],
|
||||
"brace-style": ["warn"],
|
||||
"brace-style": ["warn", "allman"],
|
||||
"prefer-arrow-callback": ["warn"],
|
||||
"max-len": ["warn", 140],
|
||||
"max-len": ["warn", 200],
|
||||
"no-console": ["warn"], // use the provided Homebridge log method instead
|
||||
"no-non-null-assertion": ["off"],
|
||||
"comma-spacing": ["error"],
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {API, Characteristic, DynamicPlatformPlugin, Logger, PlatformAccessory, PlatformConfig, Service} from 'homebridge';
|
||||
import {API, Characteristic, DynamicPlatformPlugin, Logger, PlatformAccessory, PlatformConfig, Service} from "homebridge";
|
||||
import NeatoApi from "node-botvac";
|
||||
import {PLATFORM_NAME, PLUGIN_NAME} from './settings';
|
||||
import {NeatoVacuumRobotAccessory} from './accessories/NeatoVacuumRobot';
|
||||
import {PLATFORM_NAME, PLUGIN_NAME} from "./settings";
|
||||
import {NeatoVacuumRobotAccessory} from "./accessories/NeatoVacuumRobot";
|
||||
|
||||
/**
|
||||
* HomebridgePlatform
|
||||
@ -21,7 +21,8 @@ export class HomebridgeNeatoPlatform implements DynamicPlatformPlugin
|
||||
public readonly config: PlatformConfig,
|
||||
public readonly api: API)
|
||||
{
|
||||
this.api.on('didFinishLaunching', () => {
|
||||
this.api.on("didFinishLaunching", () =>
|
||||
{
|
||||
this.discoverRobots();
|
||||
});
|
||||
}
|
||||
@ -38,12 +39,13 @@ export class HomebridgeNeatoPlatform implements DynamicPlatformPlugin
|
||||
|
||||
discoverRobots()
|
||||
{
|
||||
let client = new NeatoApi.Client();
|
||||
const client = new NeatoApi.Client();
|
||||
|
||||
try
|
||||
{
|
||||
// Login
|
||||
client.authorize((this.config)['email'], (this.config)['password'], false, (error) => {
|
||||
client.authorize((this.config)["email"], (this.config)["password"], false, (error) =>
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
this.log.warn("Cannot connect to neato server. No new robots will be found and existing robots will be unresponsive.");
|
||||
@ -53,7 +55,8 @@ export class HomebridgeNeatoPlatform implements DynamicPlatformPlugin
|
||||
}
|
||||
|
||||
// Get all robots from account
|
||||
client.getRobots((error, robots) => {
|
||||
client.getRobots((error, robots) =>
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
this.log.error("Successful login but can't connect to your neato robot: " + error);
|
||||
@ -67,12 +70,13 @@ export class HomebridgeNeatoPlatform implements DynamicPlatformPlugin
|
||||
return;
|
||||
}
|
||||
|
||||
this.log.info("Neato account has " + robots.length + " robot " + (robots.length == 1 ? "" : "s"));
|
||||
this.log.info("Neato account has " + robots.length + " robot " + (robots.length === 1 ? "" : "s"));
|
||||
|
||||
for (let robot of robots)
|
||||
for (const robot of robots)
|
||||
{
|
||||
// Get additional information for the robot
|
||||
robot.getState((error, state) => {
|
||||
robot.getState((error, state) =>
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
this.log.error("Error getting robot meta information: " + error + ": " + state);
|
||||
|
@ -1,11 +1,12 @@
|
||||
import { API } from 'homebridge';
|
||||
import {API} from "homebridge";
|
||||
|
||||
import { PLATFORM_NAME } from './settings';
|
||||
import { HomebridgeNeatoPlatform } from './homebridgeNeatoPlatform';
|
||||
import {PLATFORM_NAME} from "./settings";
|
||||
import {HomebridgeNeatoPlatform} from "./homebridgeNeatoPlatform";
|
||||
|
||||
/**
|
||||
* This method registers the platform with Homebridge
|
||||
*/
|
||||
export = (api: API) => {
|
||||
export = (api: API) =>
|
||||
{
|
||||
api.registerPlatform(PLATFORM_NAME, HomebridgeNeatoPlatform);
|
||||
};
|
||||
|
@ -1,9 +1,9 @@
|
||||
/**
|
||||
* This is the name of the platform that users will use to register the plugin in the Homebridge config.json
|
||||
*/
|
||||
export const PLATFORM_NAME = 'NeatoVacuumRobot';
|
||||
export const PLATFORM_NAME = "NeatoVacuumRobot";
|
||||
|
||||
/**
|
||||
* This must match the name of your plugin as defined the package.json
|
||||
*/
|
||||
export const PLUGIN_NAME = 'homebridge-neato';
|
||||
export const PLUGIN_NAME = "homebridge-neato";
|
Loading…
Reference in New Issue
Block a user