Skip to content

Instantly share code, notes, and snippets.

View baptisteArno's full-sized avatar

Baptiste Arnaud baptisteArno

View GitHub Profile
@baptisteArno
baptisteArno / chakra-to-tailwind.ts
Created October 27, 2025 14:20
Chakra UI V2 to Tailwind codemode
import type { API, FileInfo, JSXAttribute, Options } from "jscodeshift";
/**
* JSCodeshift codemod to transform Chakra UI layout components to HTML elements with Tailwind CSS classes.
*
* This codemod handles:
* - Component transformations (Stack, HStack, VStack, Box, Flex, Grid, etc.)
* - Prop-to-class mappings for common Chakra props (spacing, sizing, colors, etc.)
* - Conditional prop handling with cx utility
* - Import management (adds cx, removes converted Chakra components)
function cloneProps(props) {
const propKeys = Object.keys(props);
return propKeys.reduce((memo, k) => {
const prop = props[k];
memo[k] = Object.assign({}, prop);
if (isObject$4(prop.value) && !isFunction$3(prop.value) && !Array.isArray(prop.value)) memo[k].value = Object.assign({}, prop.value);
if (Array.isArray(prop.value)) memo[k].value = prop.value.slice(0);
return memo;
}, {});
}
@baptisteArno
baptisteArno / taxIdTypes.ts
Last active March 7, 2023 06:39
Tax ID types list
export const taxIdTypes = [
{
type: 'ae_trn',
code: 'AE TRN',
name: 'United Arab Emirates',
emoji: '🇦🇪',
placeholder: '123456789012345',
},
{
type: 'au_abn',
@baptisteArno
baptisteArno / stripe.ts
Created June 2, 2022 08:11
Function to check if currency is "zero-decimal" - Stripe
// https://stripe.com/docs/currencies#zero-decimal
const isZeroDecimalCurrency = (currency: string) =>
[
'BIF',
'CLP',
'DJF',
'GNF',
'JPY',
'KMF',
'KRW',