From 75aee0b1598b69452cbea35285373c2eb83dd394 Mon Sep 17 00:00:00 2001 From: Dennis Zoma <3930150+wottpal@users.noreply.github.com> Date: Thu, 3 Nov 2022 08:03:12 +0100 Subject: [PATCH] chore: update prettier setup with twin.macro plugin --- .prettierrc.json => .prettierrc.js | 4 ++-- packages/contracts/.prettierrc.js | 3 +++ packages/frontend/.prettierrc.js | 4 ++++ packages/frontend/package.json | 5 +++-- .../src/components/layout/BaseLayout.tsx | 4 ++-- .../src/components/layout/CenterBody.tsx | 2 +- .../frontend/src/components/layout/Wrapper.tsx | 6 +++--- .../frontend/src/deployments/deployments.ts | 2 +- packages/frontend/src/pages/index.tsx | 12 ++++++------ packages/frontend/src/shared/wagmiClient.ts | 4 ++-- packages/frontend/src/styles/GlobalStyles.tsx | 6 +++--- pnpm-lock.yaml | 17 +++++++++++++++-- 12 files changed, 45 insertions(+), 24 deletions(-) rename .prettierrc.json => .prettierrc.js (68%) create mode 100644 packages/contracts/.prettierrc.js create mode 100644 packages/frontend/.prettierrc.js diff --git a/.prettierrc.json b/.prettierrc.js similarity index 68% rename from .prettierrc.json rename to .prettierrc.js index c3830c7..2adbdfc 100644 --- a/.prettierrc.json +++ b/.prettierrc.js @@ -1,7 +1,7 @@ -{ +module.exports = { "semi": false, "singleQuote": true, - "trailingComma": "es5", + "trailingComma": "all", "printWidth": 100, "tabWidth": 2, "useTabs": false diff --git a/packages/contracts/.prettierrc.js b/packages/contracts/.prettierrc.js new file mode 100644 index 0000000..2d293ba --- /dev/null +++ b/packages/contracts/.prettierrc.js @@ -0,0 +1,3 @@ +module.exports = { + ...require('../../.prettierrc.js'), +} diff --git a/packages/frontend/.prettierrc.js b/packages/frontend/.prettierrc.js new file mode 100644 index 0000000..c38cd35 --- /dev/null +++ b/packages/frontend/.prettierrc.js @@ -0,0 +1,4 @@ +module.exports = { + ...require('../../.prettierrc.js'), + plugins: [require('prettier-plugin-twin.macro')], +} diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 1680c2d..2d10a9a 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -17,16 +17,16 @@ "eslint": "eslint . --ext .js,.jsx,.ts,.tsx" }, "dependencies": { - "@ethathon/contracts": "workspace:*", "@emotion/css": "^11.10.5", "@emotion/react": "^11.10.5", "@emotion/server": "^11.10.0", "@emotion/styled": "^11.10.5", + "@ethathon/contracts": "workspace:*", "@rainbow-me/rainbowkit": "^0.7.4", "ethers": "^5.7.2", "next": "^13.0.1", - "next-transpile-modules": "^10.0.0", "next-seo": "^5.13.0", + "next-transpile-modules": "^10.0.0", "nprogress": "^0.2.0", "react": "^18.2.0", "react-dom": "^18.2.0", @@ -56,6 +56,7 @@ "eslint-config-prettier": "^8.5.0", "eslint-plugin-react": "^7.31.10", "prettier": "^2.7.1", + "prettier-plugin-twin.macro": "^1.0.10", "tailwindcss": "^3.2.1", "twin.macro": "rc", "typescript": "^4.8.4" diff --git a/packages/frontend/src/components/layout/BaseLayout.tsx b/packages/frontend/src/components/layout/BaseLayout.tsx index 0b4348b..cf3170d 100644 --- a/packages/frontend/src/components/layout/BaseLayout.tsx +++ b/packages/frontend/src/components/layout/BaseLayout.tsx @@ -4,8 +4,8 @@ import 'twin.macro' export const BaseLayout: FC = ({ children }) => { return ( <> -
-
{children}
+
+
{children}
) diff --git a/packages/frontend/src/components/layout/CenterBody.tsx b/packages/frontend/src/components/layout/CenterBody.tsx index 847da93..bf578df 100644 --- a/packages/frontend/src/components/layout/CenterBody.tsx +++ b/packages/frontend/src/components/layout/CenterBody.tsx @@ -1,3 +1,3 @@ import tw from 'twin.macro' -export const CenterBody = tw.div`h-full flex flex-col justify-center items-center relative` +export const CenterBody = tw.div`relative flex h-full flex-col items-center justify-center` diff --git a/packages/frontend/src/components/layout/Wrapper.tsx b/packages/frontend/src/components/layout/Wrapper.tsx index 58fa83b..a1cb5ec 100644 --- a/packages/frontend/src/components/layout/Wrapper.tsx +++ b/packages/frontend/src/components/layout/Wrapper.tsx @@ -6,10 +6,10 @@ export interface WrapperProps { } export const Wrapper = styled.div(({ noVerticalPadding, noHorizontalPadding }: WrapperProps) => [ tw`relative mx-auto w-full max-w-[1200px]`, - noVerticalPadding ? tw`py-0` : tw`py-4 sm:(py-6) lg:py-8`, - noHorizontalPadding ? tw`px-4` : tw`sm:(px-8)`, + noVerticalPadding ? tw`py-0` : tw`py-4 sm:py-6 lg:py-8`, + noHorizontalPadding ? tw`px-4` : tw`sm:px-8`, ]) export const NegativeWrapper = styled.div(() => [ - tw`relative -mx-4 -my-4 sm:(-mx-6) lg:(-mx-8 -my-6)`, + tw`relative -mx-4 -my-4 sm:-mx-6 lg:(-mx-8 -my-6)`, ]) diff --git a/packages/frontend/src/deployments/deployments.ts b/packages/frontend/src/deployments/deployments.ts index a28dc41..e3efb00 100644 --- a/packages/frontend/src/deployments/deployments.ts +++ b/packages/frontend/src/deployments/deployments.ts @@ -12,5 +12,5 @@ export const deployments: DeploymentsType = env.supportedChains.reduce( ...acc, [chainId]: import(`@ethathon/contracts/deployments/${chainId}.json`), }), - {} + {}, ) diff --git a/packages/frontend/src/pages/index.tsx b/packages/frontend/src/pages/index.tsx index c1f9bc8..0a1a132 100644 --- a/packages/frontend/src/pages/index.tsx +++ b/packages/frontend/src/pages/index.tsx @@ -11,7 +11,7 @@ import toast from 'react-hot-toast' import tw from 'twin.macro' import { useSigner } from 'wagmi' -const Button = tw.button`m-2 px-2 py-1 rounded-lg border border-current text-gray-400 font-semibold hover:(text-white)` +const Button = tw.button`m-2 rounded-lg border border-current px-2 py-1 font-semibold text-gray-400 hover:text-white` const HomePage: NextPage = () => { const { data: signer } = useSigner() @@ -52,16 +52,16 @@ const HomePage: NextPage = () => { Github Logo -

ETHathon

-

Smart Contract & DApp Development Boilerplate

+

ETHathon

+

Smart Contract & DApp Development Boilerplate

Deploy with Vercel -
+
{/* Rainbowkit Connect Button */} @@ -70,7 +70,7 @@ const HomePage: NextPage = () => { {/* Lock.sol Contract Interactions */} {signer && (
-
Lock.sol:
+
Lock.sol:
diff --git a/packages/frontend/src/shared/wagmiClient.ts b/packages/frontend/src/shared/wagmiClient.ts index d4cca89..fd6fe3a 100644 --- a/packages/frontend/src/shared/wagmiClient.ts +++ b/packages/frontend/src/shared/wagmiClient.ts @@ -9,7 +9,7 @@ import { env } from './environment' */ export const defaultChain: Chain | undefined = allChains.find( - (chain) => env.defaultChain === chain.id + (chain) => env.defaultChain === chain.id, ) export const isChainSupported = (chainId?: number): boolean => { @@ -37,7 +37,7 @@ export const { }, }), publicProvider(), - ] + ], ) const { connectors } = getDefaultWallets({ diff --git a/packages/frontend/src/styles/GlobalStyles.tsx b/packages/frontend/src/styles/GlobalStyles.tsx index d84d857..ca386dd 100644 --- a/packages/frontend/src/styles/GlobalStyles.tsx +++ b/packages/frontend/src/styles/GlobalStyles.tsx @@ -7,13 +7,13 @@ const customStyles = css` ${tw`scroll-smooth antialiased`} } body { - ${tw`bg-black text-white font-mono`} - ${tw`h-screen min-h-screen relative`} + ${tw`bg-black font-mono text-white`} + ${tw`relative h-screen min-h-screen`} } #__next, #__next > div { - ${tw`h-full min-h-full flex flex-col relative`} + ${tw`relative flex h-full min-h-full flex-col`} } /* Progress Bar */ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e6804bf..a6ed96c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -109,6 +109,7 @@ importers: next-transpile-modules: ^10.0.0 nprogress: ^0.2.0 prettier: ^2.7.1 + prettier-plugin-twin.macro: ^1.0.10 react: ^18.2.0 react-dom: ^18.2.0 react-hot-toast: ^2.4.0 @@ -157,6 +158,7 @@ importers: eslint-config-prettier: 8.5.0_eslint@8.26.0 eslint-plugin-react: 7.31.10_eslint@8.26.0 prettier: 2.7.1 + prettier-plugin-twin.macro: 1.0.10_nm5wsfeo4qx6r53nkafkd2jgt4 tailwindcss: 3.2.1_postcss@8.4.18 twin.macro: 3.0.0-rc.5_tailwindcss@3.2.1 typescript: 4.8.4 @@ -7152,6 +7154,7 @@ packages: minimatch: 3.1.2 once: 1.4.0 path-is-absolute: 1.0.1 + dev: true /glob/7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} @@ -9285,7 +9288,7 @@ packages: /next-seo/5.13.0_cuttyyug54cjzme6dhlgj6veu4: resolution: {integrity: sha512-3n6cOjXydxXlrbMIWcU+D6TllKj72C2rg7IdgoxoKOnfC8ah3U0VUIGRApKXK0wi5ME1m+TBq9isAFFbFdbWXQ==} peerDependencies: - next: ^8.1.1-canary.54 || >=9.0.0 || ^12.0.0 + next: ^8.1.1-canary.54 || >=9.0.0 || ^13.0.0 react: '>=16.0.0 || ^18.0.0' react-dom: '>=16.0.0 || ^18.0.0' dependencies: @@ -10073,6 +10076,16 @@ packages: engines: {node: '>= 0.8.0'} dev: true + /prettier-plugin-twin.macro/1.0.10_nm5wsfeo4qx6r53nkafkd2jgt4: + resolution: {integrity: sha512-T0YPYOGezasddOYlgLz30g1QwYO+25ZfCYmMIecNJ9Typ6LkmVWGCBAD7yiuu+O0z5kQJw/wfdakkcYVkQX7vA==} + peerDependencies: + prettier: '>=2.2.0' + tailwindcss: '>=3.0.24' + dependencies: + prettier: 2.7.1 + tailwindcss: 3.2.1_postcss@8.4.18 + dev: true + /prettier/1.19.1: resolution: {integrity: sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==} engines: {node: '>=4'} @@ -10745,7 +10758,7 @@ packages: resolution: {integrity: sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==} hasBin: true dependencies: - glob: 7.2.0 + glob: 7.2.3 /rimraf/3.0.2: resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==}