Skip to content

Commit

Permalink
chore: Update npm dependencies + fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
lenoxys committed Aug 2, 2024
1 parent 899da48 commit 89e7a91
Show file tree
Hide file tree
Showing 32 changed files with 75 additions and 134 deletions.
38 changes: 0 additions & 38 deletions .eslintrc

This file was deleted.

47 changes: 0 additions & 47 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/dev_build_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
node-version: [18, 20]
node-version: [20]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dev_npm_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]
node-version: [20]
steps:
- uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]
node-version: [20]
steps:
- uses: actions/checkout@v4
with:
Expand Down
49 changes: 49 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [{
ignores: ["projects/**/*"],
}, ...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates",
).map(config => ({
...config,
files: ["**/*.ts"],
})), {
files: ["**/*.ts"],

rules: {
"@angular-eslint/directive-selector": ["error", {
type: "attribute",
prefix: "app",
style: "camelCase",
}],

"@angular-eslint/component-selector": ["error", {
type: "element",
prefix: "app",
style: "kebab-case",
}],
},
}, ...compat.extends(
"plugin:@angular-eslint/template/recommended",
"plugin:@angular-eslint/template/accessibility",
).map(config => ({
...config,
files: ["**/*.html"],
})), {
files: ["**/*.html"],
rules: {},
}];
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"build-plugin": "rimraf ./dist && tsc --project tsconfig.plugin.json",
"build-configui": "rimraf ./homebridge-ui && ng build --base-href /api/plugins/settings-ui/homebridge-eufy-security/ && tsc --project tsconfig.configui.server.json",
"postbuild": "cp -r ./media ./dist/media",
"prebuild": "node -p \"'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/plugin/version.ts",
"serve-configui": "ng serve",
"prepublishOnly": "npm run lint && npm run build"
},
Expand Down Expand Up @@ -71,6 +72,8 @@
"@angular/platform-browser": "~18.1.3",
"@angular/platform-browser-dynamic": "~18.1.3",
"@angular/router": "~18.1.3",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.8.0",
"@ng-bootstrap/ng-bootstrap": "^17.0.0",
"@popperjs/core": "^2.11.8",
"@types/jasmine": "~5.1.4",
Expand Down Expand Up @@ -103,4 +106,4 @@
},
"homepage": "https://github.com/homebridge-eufy-security/plugin/wiki",
"author": "homebridge-eufy-security"
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Component, OnInit, Input, NgZone, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
import { NgbModal, ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ export class AdvancedVideoconfigComponent
this.maxFPS = undefined;
this.maxBitrate = undefined;
this.useSeparateProcesses = true;

// eslint-disable-next-line max-len
this.presetDescription = 'Most eufy cams support the same codec that HomeKit requests. You can try and \'forward\' the stream directly without encoding it with ffmpeg. This can increase performance and quality drastically.';
} else if (this.preset === 2) {
this.readRate = undefined;
Expand All @@ -114,7 +112,6 @@ export class AdvancedVideoconfigComponent
this.maxBitrate = undefined;
this.useSeparateProcesses = true;

// eslint-disable-next-line max-len
this.presetDescription = 'This preset tries to increase performance by reducing the quality of the stream. This can work for low performance hardware like raspberry pis.';
} else {
this.presetDescription = undefined;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable max-len */

import { Component, Input, OnInit } from '@angular/core';
import { L_Device } from '../../../app/util/types';
import { PluginService } from '../../../app/plugin.service';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { PluginConfig } from '@homebridge/plugin-ui-utils/dist/ui.interface';
import { L_Device, L_Station } from '../util/types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export class DownloadLogsComponent implements OnInit {
this.router.events.subscribe((event) => {
if (event instanceof NavigationStart) {
if (this.logFileLocation !== '') {
// eslint-disable-next-line no-console
console.log('revoke log zip file blob location url.');
window.URL.revokeObjectURL(this.logFileLocation);
this.logFileLocation = '';
Expand Down Expand Up @@ -68,7 +67,6 @@ export class DownloadLogsComponent implements OnInit {

this.hasDownloaded = true;
} catch (err) {
// eslint-disable-next-line no-console
console.log(err);

const error = err as { message: string };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Component } from '@angular/core';
import { RouterLink } from '@angular/router';

Expand Down
1 change: 0 additions & 1 deletion src/configui/app/login.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Injectable } from '@angular/core';
import { PluginConfig } from '@homebridge/plugin-ui-utils/dist/ui.interface';
Expand Down
1 change: 0 additions & 1 deletion src/configui/app/login/login.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';

Expand Down
1 change: 0 additions & 1 deletion src/configui/app/plugin.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class ResetConfirmationComponent {
const r = await window.homebridge.request('/reset');
this.failed = (r.result !== 1);
} catch (err) {
console.error(err);
this.failed = true;
}
this.disabled = false;
Expand Down
1 change: 0 additions & 1 deletion src/configui/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
import { importProvidersFrom } from '@angular/core';
import { AppComponent } from './app/app.component';
import { AppRoutingModule } from './app/app-routing.module';
Expand Down
5 changes: 0 additions & 5 deletions src/plugin/accessories/BaseAccessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,11 @@ export abstract class BaseAccessory extends EventEmitter {
setValueDebounceTime?: number;
}) {

// eslint-disable-next-line max-len
this.log.debug(`REGISTER CHARACTERISTIC ${serviceType.name} / ${characteristicType.name} / ${name}`);

const service = this.getService(serviceType, name, serviceSubType);
const characteristic = service.getCharacteristic(characteristicType);

// eslint-disable-next-line max-len
this.log.debug(`REGISTER CHARACTERISTIC (${service.UUID}) / (${characteristic.UUID})`);

if (getValue) {
Expand Down Expand Up @@ -189,7 +187,6 @@ export abstract class BaseAccessory extends EventEmitter {
if (onSimpleValue) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
this.device.on(onSimpleValue, (device: any, value: any) => {
// eslint-disable-next-line max-len
this.log.info(`ON '${serviceType.name} / ${characteristicType.name} / ${onSimpleValue}':`, value);
characteristic.updateValue(value);
});
Expand All @@ -205,7 +202,6 @@ export abstract class BaseAccessory extends EventEmitter {
onMultipleValue.forEach(eventType => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
this.device.on(eventType as keyof any, (device: any, value: any) => {
// eslint-disable-next-line max-len
this.log.info(`ON '${serviceType.name} / ${characteristicType.name} / ${eventType}':`, value);
characteristic.updateValue(value);
});
Expand Down Expand Up @@ -265,7 +261,6 @@ export abstract class BaseAccessory extends EventEmitter {
!this.servicesInUse.includes(service) &&
!safeServiceUUIDs.includes(service.UUID)
) {
// eslint-disable-next-line max-len
this.log.debug(`Pruning unused service ${service.UUID} ${service.displayName || service.name}`);
this.accessory.removeService(service);
}
Expand Down
5 changes: 0 additions & 5 deletions src/plugin/accessories/CameraAccessory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable max-len */
import {
PlatformAccessory,
Characteristic,
Expand Down Expand Up @@ -171,11 +170,9 @@ export class CameraAccessory extends DeviceAccessory {
try {
this.log.debug(`${serviceName} config:`, configValue);
if (configValue && this.device.hasProperty(PropertyName)) {
// eslint-disable-next-line max-len
this.log.debug(`has a ${PropertyName}, so append ${serviceType}${serviceName} characteristic to it.`);
this.setupSwitchService(serviceName, serviceType, PropertyName);
} else {
// eslint-disable-next-line max-len
this.log.debug(`Looks like not compatible with ${PropertyName} or this has been disabled within configuration`);
}
} catch (error) {
Expand Down Expand Up @@ -369,7 +366,6 @@ export class CameraAccessory extends DeviceAccessory {
this.eventTypesToHandle.forEach(eventType => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
this.device.on(eventType as keyof any, (device: any, state: any) => {
// eslint-disable-next-line max-len
this.log.info(`MOTION DETECTED (${eventType})': ${state}`);
characteristic.updateValue(state);
});
Expand Down Expand Up @@ -475,7 +471,6 @@ export class CameraAccessory extends DeviceAccessory {
propertyName === PropertyName.DeviceEnabled &&
Date.now() - this.cameraStatus.timestamp <= 60000
) {
// eslint-disable-next-line max-len
this.log.debug(`CACHED for (1 min) '${characteristic.displayName}' ${propertyName}: ${this.cameraStatus.isEnabled}`);
value = this.cameraStatus.isEnabled;
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugin/accessories/StationAccessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export class StationAccessory extends BaseAccessory {
getValue: () => this.handleSecuritySystemTargetStateGet(),
setValue: (value) => this.handleSecuritySystemTargetStateSet(value),
onValue: (service, characteristic) => {
// eslint-disable-next-line max-len
this.device.on('guard mode', (station: Station, guardMode: number) => {
this.onStationGuardModePushNotification(characteristic, station, guardMode);
});
Expand Down Expand Up @@ -433,6 +432,7 @@ export class StationAccessory extends BaseAccessory {
try {
return `${HKGuardMode[value as number]}(${value})`;
} catch (error) {
this.log.error(`Error getting guard mode name! ${error}`);
return 'Unknown';
}
}
Expand Down
1 change: 0 additions & 1 deletion src/plugin/controller/LocalLivestreamManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable max-len */
import { EventEmitter, Readable } from 'stream';
import { Station, Device, StreamMetadata, EufySecurity } from 'eufy-security-client';
import { CameraAccessory } from '../accessories/CameraAccessory';
Expand Down
Loading

0 comments on commit 89e7a91

Please sign in to comment.