Skip to content

Commit

Permalink
chore: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
nytamin committed Nov 2, 2023
1 parent 7566e7d commit 36a5b95
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ yarn test # To ensure that your code passes the unit tests.
If you're adding a new functionality, adding unit tests for it is much appreciated.

### Notes to maintainers
### Notes for maintainers

#### Making a nightly build

Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ export function literal<T>(o: T): T {

export function describeEvent(event: string, args: any[]): string {
const metadataStr = (metadata: any) => {
if (typeof metadata == 'object') return `${metadata}`
if (metadata === null) return 'null'

const strs: string[] = []
Object.entries(metadata).forEach(([key, value]) => {
Object.entries<any>(metadata).forEach(([key, value]) => {
strs.push(`${key}: ${value}`)
})
return strs.join(', ')
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/xkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class XKeys extends EventEmitter {
}
private _setupDevice(deviceInfo: DeviceInfo) {
const findProduct = (): { product: Product; productId: number; interface: number } => {
for (const product of Object.values(PRODUCTS)) {
for (const product of Object.values<Product>(PRODUCTS)) {
for (const hidDevice of product.hidDevices) {
if (
hidDevice[0] === deviceInfo.productId &&
Expand Down
4 changes: 2 additions & 2 deletions packages/node/src/methods.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { XKeys } from '@xkeys-lib/core'
import { Product, XKeys } from '@xkeys-lib/core'
import { PRODUCTS } from '@xkeys-lib/core'
import * as HID from 'node-hid'
import { NodeHIDDevice } from './node-hid-wrapper'
Expand Down Expand Up @@ -103,7 +103,7 @@ export function listAllConnectedPanels(): HID_Device[] {
if (!device.path) return false

let found = false
for (const product of Object.values(PRODUCTS)) {
for (const product of Object.values<Product>(PRODUCTS)) {
for (const hidDevice of product.hidDevices) {
if (hidDevice[0] === device.productId && hidDevice[1] === device.interface) {
found = true
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export class XKeysWatcher extends EventEmitter {
let removed = 0
let added = 0
// Removed devices:
for (const [devicePath, o] of Object.entries(this.seenDevicePaths)) {
for (const [devicePath, o] of Object.entries<{ xkeys?: XKeys }>(this.seenDevicePaths)) {
if (!pathMap[devicePath]) {
// A device has been removed
this.debugLog('removed')
Expand Down

0 comments on commit 36a5b95

Please sign in to comment.