Explicit type imports

This commit is contained in:
Lars Strojny 2022-11-13 13:34:09 +01:00
parent 83f64d3999
commit 8102144b85
6 changed files with 8 additions and 6 deletions

View file

@ -19,6 +19,7 @@ module.exports = {
'import/no-default-export': 'error', 'import/no-default-export': 'error',
'import/no-namespace': 'error', 'import/no-namespace': 'error',
'import/no-useless-path-segments': 'error', 'import/no-useless-path-segments': 'error',
'no-duplicate-imports': 'error',
}, },
overrides: [ overrides: [
{ {
@ -33,6 +34,7 @@ module.exports = {
}, },
rules: { rules: {
'@typescript-eslint/explicit-module-boundary-types': 'error', '@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
}, },
settings: { settings: {
'import/resolver': { 'import/resolver': {

View file

@ -1,6 +1,6 @@
import type { HapDiscover } from './api' import type { HapDiscover } from './api'
import { HAPNodeJSClient } from 'hap-node-client' 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 type { Logger } from 'homebridge'
import z from 'zod' import z from 'zod'

View file

@ -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 { HttpAdapter, HttpResponse } from './api'
import type { HttpServer } from '../../http' import type { HttpServer } from '../../http'

View file

@ -5,7 +5,7 @@ import { discover } from './adapters/discovery/hap_node_js_client'
import { serve } from './adapters/http/fastify' import { serve } from './adapters/http/fastify'
import type { HttpServerController } from './adapters/http/api' import type { HttpServerController } from './adapters/http/api'
import { PrometheusServer } from './prometheus' import { PrometheusServer } from './prometheus'
import { Config, ConfigBoundary, checkBoundary } from './boundaries' import { type Config, ConfigBoundary, checkBoundary } from './boundaries'
export class PrometheusExporterPlatform implements IndependentPlatformPlugin { export class PrometheusExporterPlatform implements IndependentPlatformPlugin {
private readonly httpServer: PrometheusServer private readonly httpServer: PrometheusServer

View file

@ -2,7 +2,7 @@ import { describe, test } from '@jest/globals'
import request from 'supertest' import request from 'supertest'
import { PrometheusServer } from '../../../src/prometheus' import { PrometheusServer } from '../../../src/prometheus'
import { serve } from '../../../src/adapters/http/fastify' 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 type { HttpServer } from '../../../src/http'
import { Metric } from '../../../src/metrics' import { Metric } from '../../../src/metrics'

4
tests/ambient.d.ts vendored
View file

@ -1,5 +1,5 @@
import { SuperTest, Test } from 'supertest' import type { SuperTest, Test } from 'supertest'
import { Server } from 'http' import type { Server } from 'http'
declare module 'supertest' { declare module 'supertest' {
function supertest(app: Server): SuperTest<Test> function supertest(app: Server): SuperTest<Test>