From dcec3ef2615aa842588b13215c83dc4271f8ab22 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 21 Nov 2024 16:30:14 +0300 Subject: [PATCH] Tighten type imports --- addon-test-support/audit.ts | 3 ++- addon-test-support/logger.ts | 3 ++- addon-test-support/performance.ts | 3 ++- addon-test-support/reporter.ts | 2 +- addon-test-support/run-options.ts | 2 +- addon-test-support/setup-global-a11y-hooks.ts | 2 +- addon-test-support/setup-middleware-reporter.ts | 2 +- 7 files changed, 10 insertions(+), 7 deletions(-) diff --git a/addon-test-support/audit.ts b/addon-test-support/audit.ts index bb5defb8..22726902 100644 --- a/addon-test-support/audit.ts +++ b/addon-test-support/audit.ts @@ -1,4 +1,5 @@ -import { run, RunOptions, ElementContext, ContextObject } from 'axe-core'; +import type { RunOptions, ElementContext, ContextObject } from 'axe-core'; +import { run } from 'axe-core'; import { mark, markEndAndMeasure } from './performance'; import { getRunOptions } from './run-options'; import { reportA11yAudit } from './reporter'; diff --git a/addon-test-support/logger.ts b/addon-test-support/logger.ts index 3dc43ad6..970c70ba 100644 --- a/addon-test-support/logger.ts +++ b/addon-test-support/logger.ts @@ -1,4 +1,5 @@ -import axeCore, { AxeResults, NodeResult, RelatedNode, Result } from 'axe-core'; +import axeCore from 'axe-core'; +import type { AxeResults, NodeResult, RelatedNode, Result } from 'axe-core'; /** * This file is heavily borrowed from https://github.com/dequelabs/react-axe/blob/d3245b32fc5ed19e3c7b2c43d2815fe63f5875cb/index.ts diff --git a/addon-test-support/performance.ts b/addon-test-support/performance.ts index 49fe5f93..d87bb6f4 100644 --- a/addon-test-support/performance.ts +++ b/addon-test-support/performance.ts @@ -29,10 +29,11 @@ export function measure(comment: string, startMark: string, endMark: string) { if (HAS_PERFORMANCE) { performance.measure(comment, startMark, endMark); } - } catch (e) { + } catch (e: unknown) { // eslint-disable-next-line no-console console.warn( 'performance.measure could not be executed because of ', + // @ts-ignore e.message, ); } diff --git a/addon-test-support/reporter.ts b/addon-test-support/reporter.ts index 9ea704a8..7b554a9d 100644 --- a/addon-test-support/reporter.ts +++ b/addon-test-support/reporter.ts @@ -1,7 +1,7 @@ import QUnit from 'qunit'; import { AxeResults } from 'axe-core'; import formatViolation from './format-violation'; -import { A11yAuditReporter } from './types'; +import type { A11yAuditReporter } from './types'; import { storeResults } from './logger'; export const DEFAULT_REPORTER = async (results: AxeResults) => { diff --git a/addon-test-support/run-options.ts b/addon-test-support/run-options.ts index 7509cb65..a36b6630 100644 --- a/addon-test-support/run-options.ts +++ b/addon-test-support/run-options.ts @@ -1,4 +1,4 @@ -import { RunOptions } from 'axe-core'; +import type { RunOptions } from 'axe-core'; import { getContext } from '@ember/test-helpers'; import { registerDestructor } from '@ember/destroyable'; diff --git a/addon-test-support/setup-global-a11y-hooks.ts b/addon-test-support/setup-global-a11y-hooks.ts index 5fa71416..ec1f5560 100644 --- a/addon-test-support/setup-global-a11y-hooks.ts +++ b/addon-test-support/setup-global-a11y-hooks.ts @@ -1,5 +1,5 @@ import { registerHook, type HookUnregister } from '@ember/test-helpers'; -import { InvocationStrategy, AuditFunction } from './types'; +import type { InvocationStrategy, AuditFunction } from './types'; import { getRunOptions } from './run-options'; import a11yAudit from './audit'; import { shouldForceAudit } from './should-force-audit'; diff --git a/addon-test-support/setup-middleware-reporter.ts b/addon-test-support/setup-middleware-reporter.ts index e94f94a7..7661fc7e 100644 --- a/addon-test-support/setup-middleware-reporter.ts +++ b/addon-test-support/setup-middleware-reporter.ts @@ -5,7 +5,7 @@ import { getContext, getTestMetadata, } from '@ember/test-helpers'; -import { AxeResults, Result } from 'axe-core'; +import type { AxeResults, Result } from 'axe-core'; import { setCustomReporter } from './reporter'; import { DEBUG } from '@glimmer/env'; import { setEnableA11yAudit } from './should-force-audit';