checkout-sheet-kit-react-native icon indicating copy to clipboard operation
checkout-sheet-kit-react-native copied to clipboard

Enable verbatimModuleSyntax and related eslint rule, fix imports

Open moimael opened this issue 1 year ago • 3 comments

What changes are you making?

Currently @shopify/checkout-sheet-kit is broken when used in a codebase with verbatimModuleSyntax enabled.

Some type imports were not imported correctly using import type.

This PR aims to fix this.

  • fixed the faulty imports
  • enable TS verbatimModuleSyntax
  • enable the eslint rule to enforce this behaviour

How to test


PR Checklist

[!IMPORTANT]


Checklist for releasing a new version

[!TIP] See the Contributing documentation for instructions on how to publish a new version of the library.

moimael avatar Oct 09 '24 08:10 moimael

I have signed the CLA!

moimael avatar Oct 09 '24 08:10 moimael

Thanks for this @moimael!

Do you mind separating the type imports from the non-types?

Like this:

import {NativeModules, NativeEventEmitter} from 'react-native';
import type {EmitterSubscription} from 'react-native';
import {ShopifyCheckoutSheetProvider, useShopifyCheckoutSheet} from './context';
import {ColorScheme} from './index.d';
import type {
  CheckoutEvent,
  CheckoutEventCallback,
  Configuration,
  ShopifyCheckoutSheetKit,
} from './index.d';
import type {CheckoutException, CheckoutNativeError} from './errors.d';
import {
  CheckoutErrorCode,
  CheckoutExpiredError,
  CheckoutClientError,
  CheckoutHTTPError,
  ConfigurationError,
  InternalError,
  CheckoutNativeErrorType,
  GenericError,
} from './errors.d';
import type {CheckoutCompletedEvent} from './events.d';
import type {CustomEvent, PixelEvent, StandardEvent} from './pixels.d';

Done!

moimael avatar Oct 10 '24 07:10 moimael

@markmur Can you approve the CI workflow again? I forced push to be able to sign my commits since it was a requirement in the CI.

moimael avatar Oct 11 '24 08:10 moimael

This was released as part of 3.0.4. Thanks for contributing!

markmur avatar Oct 14 '24 14:10 markmur