Skip to content

Commit 4dbcbf1

Browse files
authored
chore: add "type" import enforcement lint rule and apply (#1292)
Signed-off-by: Todd Baert <[email protected]>
1 parent 8d2fd48 commit 4dbcbf1

File tree

120 files changed

+379
-480
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+379
-480
lines changed

.eslintrc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
{
88
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
99
"rules": {
10+
"@typescript-eslint/consistent-type-imports": [
11+
"error",
12+
{
13+
"disallowTypeAnnotations": true,
14+
"fixStyle": "separate-type-imports",
15+
"prefer": "type-imports"
16+
}
17+
],
1018
"@nx/enforce-module-boundaries": [
1119
"error",
1220
{

libs/hooks/open-telemetry/src/lib/metrics/metrics-hook.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { BeforeHookContext, EvaluationDetails, HookContext, StandardResolutionReasons } from '@openfeature/server-sdk';
1+
import type { BeforeHookContext, EvaluationDetails, HookContext } from '@openfeature/server-sdk';
2+
import { StandardResolutionReasons } from '@openfeature/server-sdk';
23
import opentelemetry from '@opentelemetry/api';
3-
import { DataPoint, MeterProvider, MetricReader, ScopeMetrics } from '@opentelemetry/sdk-metrics';
4+
import type { DataPoint, ScopeMetrics } from '@opentelemetry/sdk-metrics';
5+
import { MeterProvider, MetricReader } from '@opentelemetry/sdk-metrics';
46
import {
57
ACTIVE_COUNT_NAME,
68
ERROR_TOTAL_NAME,
@@ -12,7 +14,7 @@ import {
1214
VARIANT_ATTR,
1315
} from '../conventions';
1416
import { MetricsHook } from './metrics-hook';
15-
import { AttributeMapper } from '../otel-hook';
17+
import type { AttributeMapper } from '../otel-hook';
1618

1719
// no-op "in-memory" reader
1820
class InMemoryMetricReader extends MetricReader {

libs/hooks/open-telemetry/src/lib/metrics/metrics-hook.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1+
import type { BeforeHookContext, Logger } from '@openfeature/server-sdk';
12
import {
2-
BeforeHookContext,
3-
Logger,
43
StandardResolutionReasons,
54
type EvaluationDetails,
65
type FlagValue,
76
type Hook,
87
type HookContext,
98
} from '@openfeature/server-sdk';
10-
import { Attributes, Counter, UpDownCounter, ValueType, metrics } from '@opentelemetry/api';
9+
import type { Attributes, Counter, UpDownCounter } from '@opentelemetry/api';
10+
import { ValueType, metrics } from '@opentelemetry/api';
11+
import type { EvaluationAttributes, ExceptionAttributes } from '../conventions';
1112
import {
1213
ACTIVE_COUNT_NAME,
1314
ERROR_TOTAL_NAME,
1415
EXCEPTION_ATTR,
15-
EvaluationAttributes,
16-
ExceptionAttributes,
1716
KEY_ATTR,
1817
PROVIDER_NAME_ATTR,
1918
REASON_ATTR,
2019
REQUESTS_TOTAL_NAME,
2120
SUCCESS_TOTAL_NAME,
2221
VARIANT_ATTR,
2322
} from '../conventions';
24-
import { OpenTelemetryHook, OpenTelemetryHookOptions } from '../otel-hook';
23+
import type { OpenTelemetryHookOptions } from '../otel-hook';
24+
import { OpenTelemetryHook } from '../otel-hook';
2525

2626
type ErrorEvaluationAttributes = EvaluationAttributes & ExceptionAttributes;
2727

libs/hooks/open-telemetry/src/lib/otel-hook.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { FlagMetadata, Logger } from '@openfeature/server-sdk';
2-
import { Attributes } from '@opentelemetry/api';
1+
import type { FlagMetadata, Logger } from '@openfeature/server-sdk';
2+
import type { Attributes } from '@opentelemetry/api';
33

44
export type AttributeMapper = (flagMetadata: FlagMetadata) => Attributes;
55

libs/hooks/open-telemetry/src/lib/traces/tracing-hook.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { EvaluationDetails, HookContext } from '@openfeature/server-sdk';
1+
import type { EvaluationDetails, HookContext } from '@openfeature/server-sdk';
22

33
const addEvent = jest.fn();
44
const recordException = jest.fn();

libs/hooks/open-telemetry/src/lib/traces/tracing-hook.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { Hook, HookContext, EvaluationDetails, FlagValue, Logger } from '@openfeature/server-sdk';
1+
import type { Hook, HookContext, EvaluationDetails, FlagValue, Logger } from '@openfeature/server-sdk';
22
import { trace } from '@opentelemetry/api';
33
import { FEATURE_FLAG, KEY_ATTR, PROVIDER_NAME_ATTR, VARIANT_ATTR } from '../conventions';
4-
import { OpenTelemetryHook, OpenTelemetryHookOptions } from '../otel-hook';
4+
import type { OpenTelemetryHookOptions } from '../otel-hook';
5+
import { OpenTelemetryHook } from '../otel-hook';
56

67
export type TracingHookOptions = OpenTelemetryHookOptions;
78

libs/providers/aws-ssm/src/integration/integration.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { OpenFeature } from '@openfeature/server-sdk';
22
import { AwsSsmProvider } from '../lib/aws-ssm-provider';
3-
import { GetParameterCommand, GetParameterCommandOutput, SSMClient } from '@aws-sdk/client-ssm';
3+
import type { GetParameterCommandOutput } from '@aws-sdk/client-ssm';
4+
import { GetParameterCommand, SSMClient } from '@aws-sdk/client-ssm';
45
import { mockClient } from 'aws-sdk-client-mock';
56

67
const ssmMock = mockClient(SSMClient);

libs/providers/aws-ssm/src/lib/aws-ssm-provider.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SSMClientConfig } from '@aws-sdk/client-ssm';
1+
import type { SSMClientConfig } from '@aws-sdk/client-ssm';
22
import { AwsSsmProvider } from './aws-ssm-provider';
33
import { ErrorCode, StandardResolutionReasons } from '@openfeature/core';
44

libs/providers/aws-ssm/src/lib/aws-ssm-provider.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
import {
2-
EvaluationContext,
3-
Provider,
4-
JsonValue,
5-
ResolutionDetails,
6-
StandardResolutionReasons,
7-
ErrorCode,
8-
} from '@openfeature/server-sdk';
1+
import type { EvaluationContext, Provider, JsonValue, ResolutionDetails } from '@openfeature/server-sdk';
2+
import { StandardResolutionReasons, ErrorCode } from '@openfeature/server-sdk';
93
import { InternalServerError } from '@aws-sdk/client-ssm';
10-
import { AwsSsmProviderConfig } from './types';
4+
import type { AwsSsmProviderConfig } from './types';
115
import { SSMService } from './ssm-service';
126
import { Cache } from './cache';
137

libs/providers/aws-ssm/src/lib/cache.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { ResolutionDetails } from '@openfeature/core';
2-
import { LRUCacheConfig } from './types';
1+
import type { ResolutionDetails } from '@openfeature/core';
2+
import type { LRUCacheConfig } from './types';
33
import { LRUCache } from 'lru-cache';
44

55
export class Cache {

0 commit comments

Comments
 (0)