Skip to content

Commit

Permalink
chore: switch to explicit type imports
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredh159 committed Nov 29, 2023
1 parent ffde7e6 commit 80cf9e4
Show file tree
Hide file tree
Showing 25 changed files with 46 additions and 46 deletions.
14 changes: 4 additions & 10 deletions src/ClassParser.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/flex.spec.ts
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/font-size.spec.ts
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/screens.spec.ts
Original file line number Diff line number Diff line change
@@ -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()`, () => {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/simple-mappings.spec.ts
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/cache.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StyleIR, Style } from './types';
import type { StyleIR, Style } from './types';
import defaultStyles from './styles';

export default class Cache {
Expand Down
3 changes: 2 additions & 1 deletion src/helpers.ts
Original file line number Diff line number Diff line change
@@ -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 };
Expand Down
2 changes: 1 addition & 1 deletion src/hooks.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/parse-inputs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ClassInput, Style } from './types';
import type { ClassInput, Style } from './types';

export function parseInputs(
inputs: ClassInput[],
Expand Down
4 changes: 2 additions & 2 deletions src/plugin.ts
Original file line number Diff line number Diff line change
@@ -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 };
Expand Down
4 changes: 2 additions & 2 deletions src/resolve/borders.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
5 changes: 3 additions & 2 deletions src/resolve/color.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
4 changes: 2 additions & 2 deletions src/resolve/flex.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
4 changes: 2 additions & 2 deletions src/resolve/font-family.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
5 changes: 3 additions & 2 deletions src/resolve/font-size.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/resolve/inset.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
5 changes: 3 additions & 2 deletions src/resolve/letter-spacing.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
5 changes: 3 additions & 2 deletions src/resolve/line-height.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
4 changes: 2 additions & 2 deletions src/resolve/opacity.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/resolve/shadow.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StyleIR } from '../types';
import type { StyleIR } from '../types';
import { parseUnconfigged } from '../helpers';

export function shadowOpacity(value: string): StyleIR | null {
Expand Down
5 changes: 3 additions & 2 deletions src/resolve/spacing.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
4 changes: 2 additions & 2 deletions src/resolve/width-height.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/screens.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TwTheme } from './tw-config';
import type { TwTheme } from './tw-config';
import { toPx, warn } from './helpers';

type Screens = Record<string, [min: number, max: number, order: number]>;
Expand Down
2 changes: 1 addition & 1 deletion src/styles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StyleIR, DependentStyle } from './types';
import type { StyleIR, DependentStyle } from './types';
import { complete } from './helpers';

const defaultStyles: Array<[string, StyleIR]> = [
Expand Down
2 changes: 1 addition & 1 deletion src/tw-config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PluginFunction } from './types';
import type { PluginFunction } from './types';

type TwFontSize =
| string
Expand Down

0 comments on commit 80cf9e4

Please sign in to comment.