From 8102144b85d22ed479328028d560b0b8dc373bc9 Mon Sep 17 00:00:00 2001 From: Lars Strojny Date: Sun, 13 Nov 2022 13:34:09 +0100 Subject: [PATCH] Explicit type imports --- .eslintrc.js | 2 ++ src/adapters/discovery/hap_node_js_client.ts | 2 +- src/adapters/http/fastify.ts | 2 +- src/platform.ts | 2 +- tests/adapters/http/fastify.test.ts | 2 +- tests/ambient.d.ts | 4 ++-- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index a76153b..2ac47b8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -19,6 +19,7 @@ module.exports = { 'import/no-default-export': 'error', 'import/no-namespace': 'error', 'import/no-useless-path-segments': 'error', + 'no-duplicate-imports': 'error', }, overrides: [ { @@ -33,6 +34,7 @@ module.exports = { }, rules: { '@typescript-eslint/explicit-module-boundary-types': 'error', + '@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }], }, settings: { 'import/resolver': { diff --git a/src/adapters/discovery/hap_node_js_client.ts b/src/adapters/discovery/hap_node_js_client.ts index 15401bc..e5e5342 100644 --- a/src/adapters/discovery/hap_node_js_client.ts +++ b/src/adapters/discovery/hap_node_js_client.ts @@ -1,6 +1,6 @@ import type { HapDiscover } from './api' import { HAPNodeJSClient } from 'hap-node-client' -import { Device, DeviceBoundary, checkBoundary } from '../../boundaries' +import { type Device, DeviceBoundary, checkBoundary } from '../../boundaries' import type { Logger } from 'homebridge' import z from 'zod' diff --git a/src/adapters/http/fastify.ts b/src/adapters/http/fastify.ts index fd4daf8..f7276fc 100644 --- a/src/adapters/http/fastify.ts +++ b/src/adapters/http/fastify.ts @@ -1,4 +1,4 @@ -import Fastify, { FastifyReply, FastifyRequest, HookHandlerDoneFunction } from 'fastify' +import Fastify, { type FastifyReply, type FastifyRequest, type HookHandlerDoneFunction } from 'fastify' import type { HttpAdapter, HttpResponse } from './api' import type { HttpServer } from '../../http' diff --git a/src/platform.ts b/src/platform.ts index 181c4ef..4806304 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -5,7 +5,7 @@ import { discover } from './adapters/discovery/hap_node_js_client' import { serve } from './adapters/http/fastify' import type { HttpServerController } from './adapters/http/api' import { PrometheusServer } from './prometheus' -import { Config, ConfigBoundary, checkBoundary } from './boundaries' +import { type Config, ConfigBoundary, checkBoundary } from './boundaries' export class PrometheusExporterPlatform implements IndependentPlatformPlugin { private readonly httpServer: PrometheusServer diff --git a/tests/adapters/http/fastify.test.ts b/tests/adapters/http/fastify.test.ts index a344e0f..49299e2 100644 --- a/tests/adapters/http/fastify.test.ts +++ b/tests/adapters/http/fastify.test.ts @@ -2,7 +2,7 @@ import { describe, test } from '@jest/globals' import request from 'supertest' import { PrometheusServer } from '../../../src/prometheus' import { serve } from '../../../src/adapters/http/fastify' -import { Server, createServer } from 'http' +import { type Server, createServer } from 'http' import type { HttpServer } from '../../../src/http' import { Metric } from '../../../src/metrics' diff --git a/tests/ambient.d.ts b/tests/ambient.d.ts index f41ffad..cf9907c 100644 --- a/tests/ambient.d.ts +++ b/tests/ambient.d.ts @@ -1,5 +1,5 @@ -import { SuperTest, Test } from 'supertest' -import { Server } from 'http' +import type { SuperTest, Test } from 'supertest' +import type { Server } from 'http' declare module 'supertest' { function supertest(app: Server): SuperTest