From b56a34c3c6b6b669b0ab92ede35103be6cc75b33 Mon Sep 17 00:00:00 2001 From: "Felipe Torres (fforres)" Date: Sat, 25 Nov 2023 00:23:12 -0800 Subject: [PATCH] =?UTF-8?q?Agregando=20una=20acci=C3=B3n=20para=20correr?= =?UTF-8?q?=20prettier/eslint/tsc=20(#13)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env => .env.local.example | 4 - .eslintignore | 3 + .eslintrc | 35 ++++++- .github/workflows/lint_and_typecheck.yml | 61 +++++++++++ .gitignore | 3 + .prettierrc | 2 +- app/(transition)/(root)/layout.tsx | 7 +- app/(transition)/(root)/page.tsx | 6 +- app/(transition)/graphiql/page.tsx | 2 +- app/globals.css | 40 +++---- app/layout.tsx | 2 +- next.config.js | 4 + package-lock.json | 15 +-- package.json | 9 +- postcss.config.js | 2 +- src/api/ApolloClient.tsx | 2 +- src/components/Navbar/MainNav.tsx | 39 ++++++- src/components/Navbar/MobileLink.tsx | 1 - src/components/Navbar/MobileNav.tsx | 54 +++++++++- src/components/Navbar/MobileNavbarItem.tsx | 15 ++- src/components/Navbar/NavbarItem.tsx | 32 ++++-- src/components/Navbar/ThemeSwitcher.tsx | 58 ++++++----- src/components/Navbar/types.d.ts | 18 ++-- src/components/PageTransition.tsx | 4 +- src/components/nav.tsx | 115 ++++++++++----------- src/components/providers.tsx | 16 ++- src/components/ui/button.tsx | 26 ++--- src/components/ui/dropdown-menu.tsx | 109 ++++++++++--------- src/components/ui/scroll-area.tsx | 31 +++--- src/components/ui/sheet.tsx | 78 ++++++++------ src/lib/utils.ts | 4 +- tailwind.config.js | 12 +-- tsconfig.json | 10 +- 33 files changed, 522 insertions(+), 297 deletions(-) rename .env => .env.local.example (57%) create mode 100644 .eslintignore create mode 100644 .github/workflows/lint_and_typecheck.yml diff --git a/.env b/.env.local.example similarity index 57% rename from .env rename to .env.local.example index 2fc88aa..65e08d6 100644 --- a/.env +++ b/.env.local.example @@ -1,7 +1,3 @@ -NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in -NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up -NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/ -NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/ NEXT_PUBLIC_GRAPHQL_ENDPOINT='https://api.jsconf.dev/graphql' NEXT_PUBLIC_TOKEN_STORAGE_KEY='HS:token_storage_key' NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY='pk_test_ZnVua3ktZ3JpZmZvbi04NC5jbGVyay5hY2NvdW50cy5kZXYk' diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..5a7019d --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +# # GQL / code-generation +src/api/gql/**/* +src/**/*.generated.* diff --git a/.eslintrc b/.eslintrc index c3377a4..0b77c75 100644 --- a/.eslintrc +++ b/.eslintrc @@ -2,19 +2,46 @@ "root": true, "overrides": [ { - "files": ["*.ts", "*.tsx", "*.js"], + "files": ["*.js", "*.jsx"], + "extends": [ + "eslint:recommended", + "plugin:react/recommended", + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking", + "plugin:tailwindcss/recommended", + "plugin:@next/next/recommended" + ], + "settings": { + "react": { + "version": "detect" + } + }, + "rules": { + "react/react-in-jsx-scope": "off" + } + }, + { + "files": ["*.ts", "*.tsx"], "parser": "@typescript-eslint/parser", "parserOptions": { "project": "./tsconfig.json" }, "extends": [ "eslint:recommended", + "plugin:react/recommended", + "plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended-requiring-type-checking", "plugin:tailwindcss/recommended", - "plugin:react/recommended", - "next/core-web-vitals", "plugin:@next/next/recommended" - ] + ], + "settings": { + "react": { + "version": "detect" + } + }, + "rules": { + "react/react-in-jsx-scope": "off" + } }, { "files": ["*.graphql", "*.gql"], diff --git a/.github/workflows/lint_and_typecheck.yml b/.github/workflows/lint_and_typecheck.yml new file mode 100644 index 0000000..d7c9a59 --- /dev/null +++ b/.github/workflows/lint_and_typecheck.yml @@ -0,0 +1,61 @@ +name: Lint and Typecheck + +on: + push: + branches: + - main + pull_request: + +jobs: + linting-and-typechecking: + runs-on: ubuntu-latest + name: Linting and Typechecking + + # Considerar Mover clone/setup/caches a un composite action 🙏 + steps: + - name: ⏳ Cloning repo + uses: actions/checkout@v3 + + - name: ⬢ Setup Node + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: 📦 Download Cached Package Dependencies + uses: actions/cache@v3 + env: + cache-name: NPM + with: + path: ~/.npm + key: CACHE-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }} + + - name: 📦 Download Cached Eslint output + uses: actions/cache@v3 + env: + cache-name: ESLINT + with: + path: .eslintcache + key: CACHE-${{ env.cache-name }}-${{ hashFiles('.eslintcache') }} + + - name: 📦 Download Cached Typescript output + uses: actions/cache@v3 + env: + cache-name: TYPESCRIPT + with: + path: tsconfig.tsbuildinfo + key: CACHE-${{ env.cache-name }}-${{ hashFiles('tsconfig.tsbuildinfo') }} + + - name: 📥 Install dependencies + run: npm ci --prefer-offline --no-audit --legacy-peer-deps --cache ~/.npm + + - name: Run Prettier + run: npm run prettier:ci + + - name: Run Linter + run: npm run lint + + - name: Run Typecheck + run: npm run typecheck + + - name: Run Next Linter + run: npx next lint diff --git a/.gitignore b/.gitignore index 0d57ee3..9a7f2f9 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,9 @@ yarn-error.log* *.tsbuildinfo next-env.d.ts +# eslint +.eslintcache + # # GQL / code-generation # src/api/gql/**/* # src/**/*.generated.* diff --git a/.prettierrc b/.prettierrc index 9e26dfe..0967ef4 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1 +1 @@ -{} \ No newline at end of file +{} diff --git a/app/(transition)/(root)/layout.tsx b/app/(transition)/(root)/layout.tsx index adf60e3..6e99975 100644 --- a/app/(transition)/(root)/layout.tsx +++ b/app/(transition)/(root)/layout.tsx @@ -1,10 +1,7 @@ import PageTransition from "@/components/PageTransition"; import { Nav } from "@/components/nav"; -export default async function Template({ - children, -}: { - children: React.ReactNode; -}) { + +export default function Template({ children }: { children: React.ReactNode }) { return ( <>