From 80cf9e45bc81a92461808665a938e176adf8abf9 Mon Sep 17 00:00:00 2001 From: Jared Henderson Date: Wed, 29 Nov 2023 09:43:43 -0500 Subject: [PATCH] chore: switch to explicit type imports --- src/ClassParser.ts | 14 ++++---------- src/__tests__/flex.spec.ts | 2 +- src/__tests__/font-size.spec.ts | 2 +- src/__tests__/screens.spec.ts | 2 +- src/__tests__/simple-mappings.spec.ts | 2 +- src/cache.ts | 2 +- src/helpers.ts | 3 ++- src/hooks.ts | 2 +- src/parse-inputs.ts | 2 +- src/plugin.ts | 4 ++-- src/resolve/borders.ts | 4 ++-- src/resolve/color.ts | 5 +++-- src/resolve/flex.ts | 4 ++-- src/resolve/font-family.ts | 4 ++-- src/resolve/font-size.ts | 5 +++-- src/resolve/inset.ts | 4 ++-- src/resolve/letter-spacing.ts | 5 +++-- src/resolve/line-height.ts | 5 +++-- src/resolve/opacity.ts | 4 ++-- src/resolve/shadow.ts | 2 +- src/resolve/spacing.ts | 5 +++-- src/resolve/width-height.ts | 4 ++-- src/screens.ts | 2 +- src/styles.ts | 2 +- src/tw-config.ts | 2 +- 25 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/ClassParser.ts b/src/ClassParser.ts index 430dfd1..0f63eae 100644 --- a/src/ClassParser.ts +++ b/src/ClassParser.ts @@ -1,16 +1,11 @@ +import type { TwConfig } from './tw-config'; +import type { StyleIR, DeviceContext, ParseContext, Platform } from './types'; +import type Cache from './cache'; import fontSize from './resolve/font-size'; import lineHeight from './resolve/line-height'; import spacing from './resolve/spacing'; import screens from './screens'; -import { TwConfig } from './tw-config'; -import { - StyleIR, - isOrientation, - isPlatform, - DeviceContext, - ParseContext, - Platform, -} from './types'; +import { isOrientation, isPlatform } from './types'; import fontFamily from './resolve/font-family'; import { color, colorOpacity } from './resolve/color'; import { border, borderRadius } from './resolve/borders'; @@ -28,7 +23,6 @@ import { widthHeight, minMaxWidthHeight } from './resolve/width-height'; import { letterSpacing } from './resolve/letter-spacing'; import { opacity } from './resolve/opacity'; import { shadowOpacity, shadowOffset } from './resolve/shadow'; -import Cache from './cache'; export default class ClassParser { private position = 0; diff --git a/src/__tests__/flex.spec.ts b/src/__tests__/flex.spec.ts index 78d34bc..fd675ab 100644 --- a/src/__tests__/flex.spec.ts +++ b/src/__tests__/flex.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, test } from '@jest/globals'; +import type { TwTheme } from '../tw-config'; import { create } from '..'; -import { TwTheme } from '../tw-config'; describe(`flex grow/shrink`, () => { let tw = create(); diff --git a/src/__tests__/font-size.spec.ts b/src/__tests__/font-size.spec.ts index 9910fb6..39124b5 100644 --- a/src/__tests__/font-size.spec.ts +++ b/src/__tests__/font-size.spec.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from '@jest/globals'; +import type { TwConfig } from '../tw-config'; import { create } from '..'; -import { TwConfig } from '../tw-config'; describe(`font size`, () => { let tw = create(); diff --git a/src/__tests__/screens.spec.ts b/src/__tests__/screens.spec.ts index 5498a61..282ba05 100644 --- a/src/__tests__/screens.spec.ts +++ b/src/__tests__/screens.spec.ts @@ -1,5 +1,5 @@ import { expect, test, describe } from '@jest/globals'; -import { TwTheme } from '../tw-config'; +import type { TwTheme } from '../tw-config'; import screens from '../screens'; describe(`screens()`, () => { diff --git a/src/__tests__/simple-mappings.spec.ts b/src/__tests__/simple-mappings.spec.ts index d0ff3d9..f4a7fdb 100644 --- a/src/__tests__/simple-mappings.spec.ts +++ b/src/__tests__/simple-mappings.spec.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from '@jest/globals'; +import type { Style } from '../types'; import { create } from '../'; -import { Style } from '../types'; describe(`simple style mappings`, () => { const tw = create(); diff --git a/src/cache.ts b/src/cache.ts index ff792f4..cdd48c3 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -1,4 +1,4 @@ -import { StyleIR, Style } from './types'; +import type { StyleIR, Style } from './types'; import defaultStyles from './styles'; export default class Cache { diff --git a/src/helpers.ts b/src/helpers.ts index dfa23c6..eb14749 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -1,4 +1,5 @@ -import { Unit, Style, Direction, CompleteStyle, ParseContext } from './types'; +import type { Style, Direction, CompleteStyle, ParseContext } from './types'; +import { Unit } from './types'; export function complete(style: Style): CompleteStyle { return { kind: `complete`, style }; diff --git a/src/hooks.ts b/src/hooks.ts index 7a139f8..dc4b4fd 100644 --- a/src/hooks.ts +++ b/src/hooks.ts @@ -1,6 +1,6 @@ import { useState } from 'react'; import { useColorScheme, useWindowDimensions, Appearance } from 'react-native'; -import { TailwindFn, RnColorScheme } from './types'; +import type { TailwindFn, RnColorScheme } from './types'; type Options = { withDeviceColorScheme: boolean; diff --git a/src/parse-inputs.ts b/src/parse-inputs.ts index 3f75063..411c6e1 100644 --- a/src/parse-inputs.ts +++ b/src/parse-inputs.ts @@ -1,4 +1,4 @@ -import { ClassInput, Style } from './types'; +import type { ClassInput, Style } from './types'; export function parseInputs( inputs: ClassInput[], diff --git a/src/plugin.ts b/src/plugin.ts index a064a12..860b010 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -1,5 +1,5 @@ -import { TwConfig } from './tw-config'; -import { AddedUtilities, CreatePlugin, PluginFunction } from './types'; +import type { TwConfig } from './tw-config'; +import type { AddedUtilities, CreatePlugin, PluginFunction } from './types'; const plugin: CreatePlugin = (handler) => { return { handler, config: undefined }; diff --git a/src/resolve/borders.ts b/src/resolve/borders.ts index 54f7ad8..bcdb29d 100644 --- a/src/resolve/borders.ts +++ b/src/resolve/borders.ts @@ -1,5 +1,5 @@ -import { TwTheme } from '../tw-config'; -import { ColorStyleType, Direction, StyleIR } from '../types'; +import type { TwTheme } from '../tw-config'; +import type { ColorStyleType, Direction, StyleIR } from '../types'; import { parseAndConsumeDirection, complete, diff --git a/src/resolve/color.ts b/src/resolve/color.ts index 555b41e..8453992 100644 --- a/src/resolve/color.ts +++ b/src/resolve/color.ts @@ -1,5 +1,6 @@ -import { ColorStyleType, isObject, isString, Style, StyleIR } from '../types'; -import { TwColors } from '../tw-config'; +import type { ColorStyleType, Style, StyleIR } from '../types'; +import type { TwColors } from '../tw-config'; +import { isObject, isString } from '../types'; import { warn, complete } from '../helpers'; export function color( diff --git a/src/resolve/flex.ts b/src/resolve/flex.ts index a675274..ec81d05 100644 --- a/src/resolve/flex.ts +++ b/src/resolve/flex.ts @@ -1,5 +1,5 @@ -import { TwTheme } from '../tw-config'; -import { ParseContext, StyleIR } from '../types'; +import type { TwTheme } from '../tw-config'; +import type { ParseContext, StyleIR } from '../types'; import { getCompleteStyle, complete, parseStyleVal, unconfiggedStyle } from '../helpers'; export function flexGrowShrink( diff --git a/src/resolve/font-family.ts b/src/resolve/font-family.ts index 901fba6..accdcfa 100644 --- a/src/resolve/font-family.ts +++ b/src/resolve/font-family.ts @@ -1,5 +1,5 @@ -import { TwTheme } from '../tw-config'; -import { StyleIR } from '../types'; +import type { TwTheme } from '../tw-config'; +import type { StyleIR } from '../types'; import { complete } from '../helpers'; export default function fontFamily( diff --git a/src/resolve/font-size.ts b/src/resolve/font-size.ts index e373584..e7ce36e 100644 --- a/src/resolve/font-size.ts +++ b/src/resolve/font-size.ts @@ -1,5 +1,6 @@ -import { TwTheme } from '../tw-config'; -import { ParseContext, Style, StyleIR, Unit } from '../types'; +import type { TwTheme } from '../tw-config'; +import type { ParseContext, Style, StyleIR } from '../types'; +import { Unit } from '../types'; import { getCompleteStyle, complete, diff --git a/src/resolve/inset.ts b/src/resolve/inset.ts index 5df0af7..9a10edb 100644 --- a/src/resolve/inset.ts +++ b/src/resolve/inset.ts @@ -1,5 +1,5 @@ -import { TwTheme } from '../tw-config'; -import { StyleIR } from '../types'; +import type { TwTheme } from '../tw-config'; +import type { StyleIR } from '../types'; import { complete, parseStyleVal, parseUnconfigged } from '../helpers'; type Inset = 'bottom' | 'top' | 'left' | 'right' | 'inset'; diff --git a/src/resolve/letter-spacing.ts b/src/resolve/letter-spacing.ts index 4fa8473..1e58415 100644 --- a/src/resolve/letter-spacing.ts +++ b/src/resolve/letter-spacing.ts @@ -1,5 +1,6 @@ -import { TwTheme } from '../tw-config'; -import { DependentStyle, StyleIR, Unit } from '../types'; +import type { TwTheme } from '../tw-config'; +import type { DependentStyle, StyleIR } from '../types'; +import { Unit } from '../types'; import { parseNumericValue, complete, diff --git a/src/resolve/line-height.ts b/src/resolve/line-height.ts index 84e25ed..adf1c00 100644 --- a/src/resolve/line-height.ts +++ b/src/resolve/line-height.ts @@ -1,5 +1,6 @@ -import { TwTheme } from '../tw-config'; -import { Unit, StyleIR } from '../types'; +import type { TwTheme } from '../tw-config'; +import type { StyleIR } from '../types'; +import { Unit } from '../types'; import { parseNumericValue, complete, toStyleVal } from '../helpers'; export default function lineHeight( diff --git a/src/resolve/opacity.ts b/src/resolve/opacity.ts index 2b73d0d..3135c07 100644 --- a/src/resolve/opacity.ts +++ b/src/resolve/opacity.ts @@ -1,5 +1,5 @@ -import { TwTheme } from '../tw-config'; -import { StyleIR } from '../types'; +import type { TwTheme } from '../tw-config'; +import type { StyleIR } from '../types'; import { parseNumericValue, complete } from '../helpers'; export function opacity(value: string, config?: TwTheme['opacity']): StyleIR | null { diff --git a/src/resolve/shadow.ts b/src/resolve/shadow.ts index c5f402d..19e2972 100644 --- a/src/resolve/shadow.ts +++ b/src/resolve/shadow.ts @@ -1,4 +1,4 @@ -import { StyleIR } from '../types'; +import type { StyleIR } from '../types'; import { parseUnconfigged } from '../helpers'; export function shadowOpacity(value: string): StyleIR | null { diff --git a/src/resolve/spacing.ts b/src/resolve/spacing.ts index 8009a41..2e8f902 100644 --- a/src/resolve/spacing.ts +++ b/src/resolve/spacing.ts @@ -1,5 +1,6 @@ -import { TwTheme } from '../tw-config'; -import { Direction, Unit, StyleIR } from '../types'; +import type { TwTheme } from '../tw-config'; +import type { Direction, StyleIR } from '../types'; +import { Unit } from '../types'; import { parseNumericValue, parseUnconfigged, toStyleVal } from '../helpers'; export default function spacing( diff --git a/src/resolve/width-height.ts b/src/resolve/width-height.ts index f7eb735..d611972 100644 --- a/src/resolve/width-height.ts +++ b/src/resolve/width-height.ts @@ -1,5 +1,5 @@ -import { TwTheme } from '../tw-config'; -import { ParseContext, StyleIR } from '../types'; +import type { TwTheme } from '../tw-config'; +import type { ParseContext, StyleIR } from '../types'; import { getCompleteStyle, complete, parseStyleVal, unconfiggedStyle } from '../helpers'; export function widthHeight( diff --git a/src/screens.ts b/src/screens.ts index d149942..30e93a2 100644 --- a/src/screens.ts +++ b/src/screens.ts @@ -1,4 +1,4 @@ -import { TwTheme } from './tw-config'; +import type { TwTheme } from './tw-config'; import { toPx, warn } from './helpers'; type Screens = Record; diff --git a/src/styles.ts b/src/styles.ts index 03ef7c5..ee837a9 100644 --- a/src/styles.ts +++ b/src/styles.ts @@ -1,4 +1,4 @@ -import { StyleIR, DependentStyle } from './types'; +import type { StyleIR, DependentStyle } from './types'; import { complete } from './helpers'; const defaultStyles: Array<[string, StyleIR]> = [ diff --git a/src/tw-config.ts b/src/tw-config.ts index 9ebc74a..26769b3 100644 --- a/src/tw-config.ts +++ b/src/tw-config.ts @@ -1,4 +1,4 @@ -import { PluginFunction } from './types'; +import type { PluginFunction } from './types'; type TwFontSize = | string