Skip to content

Commit 8da4202

Browse files
committed
Agregando una acción para correr prettier/eslint/tsc (#13)
1 parent 20d5d37 commit 8da4202

34 files changed

+527
-300
lines changed

Diff for: .env renamed to .env.local.example

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
2-
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
3-
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/
4-
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/
51
NEXT_PUBLIC_GRAPHQL_ENDPOINT='https://api.jsconf.dev/graphql'
62
NEXT_PUBLIC_TOKEN_STORAGE_KEY='HS:token_storage_key'
73
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY='pk_test_ZnVua3ktZ3JpZmZvbi04NC5jbGVyay5hY2NvdW50cy5kZXYk'

Diff for: .eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# # GQL / code-generation
2+
src/api/gql/**/*
3+
src/**/*.generated.*

Diff for: .eslintrc

+31-4
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,46 @@
22
"root": true,
33
"overrides": [
44
{
5-
"files": ["*.ts", "*.tsx", "*.js"],
5+
"files": ["*.js", "*.jsx"],
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:react/recommended",
9+
"plugin:@typescript-eslint/recommended",
10+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
11+
"plugin:tailwindcss/recommended",
12+
"plugin:@next/next/recommended"
13+
],
14+
"settings": {
15+
"react": {
16+
"version": "detect"
17+
}
18+
},
19+
"rules": {
20+
"react/react-in-jsx-scope": "off"
21+
}
22+
},
23+
{
24+
"files": ["*.ts", "*.tsx"],
625
"parser": "@typescript-eslint/parser",
726
"parserOptions": {
827
"project": "./tsconfig.json"
928
},
1029
"extends": [
1130
"eslint:recommended",
31+
"plugin:react/recommended",
32+
"plugin:@typescript-eslint/recommended",
1233
"plugin:@typescript-eslint/recommended-requiring-type-checking",
1334
"plugin:tailwindcss/recommended",
14-
"plugin:react/recommended",
15-
"next/core-web-vitals",
1635
"plugin:@next/next/recommended"
17-
]
36+
],
37+
"settings": {
38+
"react": {
39+
"version": "detect"
40+
}
41+
},
42+
"rules": {
43+
"react/react-in-jsx-scope": "off"
44+
}
1845
},
1946
{
2047
"files": ["*.graphql", "*.gql"],

Diff for: .github/workflows/lint_and_typecheck.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Lint and Typecheck
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
linting-and-typechecking:
11+
runs-on: ubuntu-latest
12+
name: Linting and Typechecking
13+
14+
# Considerar Mover clone/setup/caches a un composite action 🙏
15+
steps:
16+
- name: ⏳ Cloning repo
17+
uses: actions/checkout@v3
18+
19+
- name: ⬢ Setup Node
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: 18
23+
24+
- name: 📦 Download Cached Package Dependencies
25+
uses: actions/cache@v3
26+
env:
27+
cache-name: NPM
28+
with:
29+
path: ~/.npm
30+
key: CACHE-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
31+
32+
- name: 📦 Download Cached Eslint output
33+
uses: actions/cache@v3
34+
env:
35+
cache-name: ESLINT
36+
with:
37+
path: .eslintcache
38+
key: CACHE-${{ env.cache-name }}-${{ hashFiles('.eslintcache') }}
39+
40+
- name: 📦 Download Cached Typescript output
41+
uses: actions/cache@v3
42+
env:
43+
cache-name: TYPESCRIPT
44+
with:
45+
path: tsconfig.tsbuildinfo
46+
key: CACHE-${{ env.cache-name }}-${{ hashFiles('tsconfig.tsbuildinfo') }}
47+
48+
- name: 📥 Install dependencies
49+
run: npm ci --prefer-offline --no-audit --legacy-peer-deps --cache ~/.npm
50+
51+
- name: Run Prettier
52+
run: npm run prettier:ci
53+
54+
- name: Run Linter
55+
run: npm run lint
56+
57+
- name: Run Typecheck
58+
run: npm run typecheck
59+
60+
- name: Run Next Linter
61+
run: npx next lint

Diff for: .gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ npm-debug.log*
2424
yarn-debug.log*
2525
yarn-error.log*
2626

27-
# local env files
27+
# env files
28+
.env*
2829
.env*.local
2930

3031
# vercel
@@ -34,6 +35,9 @@ yarn-error.log*
3435
*.tsbuildinfo
3536
next-env.d.ts
3637

38+
# eslint
39+
.eslintcache
40+
3741
# # GQL / code-generation
3842
# src/api/gql/**/*
3943
# src/**/*.generated.*

Diff for: .prettierrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
{}

Diff for: app/(transition)/(root)/layout.tsx

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import PageTransition from "@/components/PageTransition";
22
import { Nav } from "@/components/nav";
3-
export default async function Template({
4-
children,
5-
}: {
6-
children: React.ReactNode;
7-
}) {
3+
4+
export default function Template({ children }: { children: React.ReactNode }) {
85
return (
96
<>
107
<Nav />

Diff for: app/(transition)/(root)/page.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ export default async function Home() {
1313
return (
1414
<main className="flex max-w-5xl flex-col items-center justify-between px-6 pt-36 transition-all md:px-10 md:pt-44 xl:px-0 xl:pt-52">
1515
<div className="flex flex-col gap-16 pb-4">
16-
<h1 className="flex flex-col justify-start gap-7 text-left text-6xl font-extrabold shadow-slate-900 transition-all text-shadow sm:text-7xl xl:text-8xl">
16+
<h1 className="flex flex-col justify-start gap-7 text-left text-6xl font-extrabold shadow-slate-900 transition-all sm:text-7xl xl:text-8xl">
1717
<span>TICKETS</span>
1818
</h1>
1919
</div>
2020
<div className="flex flex-col gap-4">
2121
<h1>RSC</h1>
22-
{variable.data?.events?.map((event) => <div>{event.id}</div>)}
22+
{variable.data?.events?.map((event) => (
23+
<div key={event.id}>{event.id}</div>
24+
))}
2325
</div>
2426
<div className="flex flex-col gap-4">
2527
<h1>Client fetching</h1>

Diff for: app/(transition)/graphiql/page.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export default function Pregunta() {
110110
}
111111
setIsLoggedIn(true);
112112
const fetcher = createGraphiQLFetcher({
113-
url: process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT!,
113+
url: process.env.NEXT_PUBLIC_JSCL_API_URL!,
114114
enableIncrementalDelivery: true,
115115
fetch(input, init) {
116116
return fetch(input, {
@@ -149,7 +149,7 @@ export default function Pregunta() {
149149
}
150150
return (
151151
<GraphiQL
152-
fetcher={fetcherRef.current!}
152+
fetcher={fetcherRef.current}
153153
defaultEditorToolsVisibility="variables"
154154
defaultTabs={[
155155
{

Diff for: app/globals.css

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,76 @@
11
@tailwind base;
22
@tailwind components;
33
@tailwind utilities;
4-
4+
55
@layer base {
66
:root {
77
--background: 0 0% 100%;
88
--foreground: 222.2 84% 4.9%;
99

1010
--card: 0 0% 100%;
1111
--card-foreground: 222.2 84% 4.9%;
12-
12+
1313
--popover: 0 0% 100%;
1414
--popover-foreground: 222.2 84% 4.9%;
15-
15+
1616
--primary: 222.2 47.4% 11.2%;
1717
--primary-foreground: 210 40% 98%;
18-
18+
1919
--secondary: 210 40% 96.1%;
2020
--secondary-foreground: 222.2 47.4% 11.2%;
21-
21+
2222
--muted: 210 40% 96.1%;
2323
--muted-foreground: 215.4 16.3% 46.9%;
24-
24+
2525
--accent: 210 40% 96.1%;
2626
--accent-foreground: 222.2 47.4% 11.2%;
27-
27+
2828
--destructive: 0 84.2% 60.2%;
2929
--destructive-foreground: 210 40% 98%;
3030

3131
--border: 214.3 31.8% 91.4%;
3232
--input: 214.3 31.8% 91.4%;
3333
--ring: 222.2 84% 4.9%;
34-
34+
3535
--radius: 0.5rem;
3636
}
37-
37+
3838
.dark {
3939
--background: 222.2 84% 4.9%;
4040
--foreground: 210 40% 98%;
41-
41+
4242
--card: 222.2 84% 4.9%;
4343
--card-foreground: 210 40% 98%;
44-
44+
4545
--popover: 222.2 84% 4.9%;
4646
--popover-foreground: 210 40% 98%;
47-
47+
4848
--primary: 210 40% 98%;
4949
--primary-foreground: 222.2 47.4% 11.2%;
50-
50+
5151
--secondary: 217.2 32.6% 17.5%;
5252
--secondary-foreground: 210 40% 98%;
53-
53+
5454
--muted: 217.2 32.6% 17.5%;
5555
--muted-foreground: 215 20.2% 65.1%;
56-
56+
5757
--accent: 217.2 32.6% 17.5%;
5858
--accent-foreground: 210 40% 98%;
59-
59+
6060
--destructive: 0 62.8% 30.6%;
6161
--destructive-foreground: 210 40% 98%;
62-
62+
6363
--border: 217.2 32.6% 17.5%;
6464
--input: 217.2 32.6% 17.5%;
65-
--ring: hsl(212.7,26.8%,83.9);
65+
--ring: hsl(212.7, 26.8%, 83.9);
6666
}
6767
}
68-
68+
6969
@layer base {
7070
* {
7171
@apply border-border;
7272
}
7373
body {
7474
@apply bg-background text-foreground;
7575
}
76-
}
76+
}

Diff for: app/layout.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const metadata = {
2323
description: "Generated by create next app",
2424
};
2525

26-
export default async function RootLayout({
26+
export default function RootLayout({
2727
children,
2828
}: {
2929
children: React.ReactNode;

Diff for: next.config.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
/** @type {import('next').NextConfig} */
22
const nextConfig = {
33
poweredByHeader: false,
4+
reactStrictMode: true,
5+
typescript: {
6+
ignoreBuildErrors: true,
7+
},
48
};
59

610
module.exports = nextConfig;

Diff for: package-lock.json

+8-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
"generate": "graphql-codegen",
1010
"prestart": "npm run generate",
1111
"predev": "npm run generate",
12-
"lint": "next lint",
13-
"prettier": "prettier ./src --write"
12+
"typecheck": "tsc",
13+
"lint": "eslint ./src --cache",
14+
"prettier:ci": "prettier ./src --cache --check",
15+
"prettier:fix": "prettier ./src --cache --write"
1416
},
1517
"dependencies": {
1618
"@apollo/client": "^3.9.0-alpha.4",
@@ -53,12 +55,13 @@
5355
"@graphql-codegen/typescript-operations": "^4.0.1",
5456
"@graphql-codegen/typescript-react-apollo": "^4.1.0",
5557
"@graphql-eslint/eslint-plugin": "^3.20.0",
56-
"@next/eslint-plugin-next": "^13.4.9",
58+
"@next/eslint-plugin-next": "^13.5.6",
5759
"@typescript-eslint/eslint-plugin": "^5.61.0",
5860
"@typescript-eslint/parser": "^5.61.0",
5961
"eslint": "^8.44.0",
6062
"eslint-plugin-react": "^7.32.2",
6163
"eslint-plugin-tailwindcss": "^3.13.0",
64+
"graphql-config": "^5.0.3",
6265
"prettier": "^3.0.0",
6366
"prettier-plugin-tailwindcss": "^0.3.0",
6467
"ts-node": "^10.9.1",

Diff for: postcss.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ module.exports = {
33
tailwindcss: {},
44
autoprefixer: {},
55
},
6-
}
6+
};

0 commit comments

Comments
 (0)