Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add lint and format scripts #538

Merged
merged 15 commits into from
May 13, 2023
18 changes: 9 additions & 9 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "next",
"updateInternalDependencies": "patch",
"ignore": ["@example/*"]
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "next",
"updateInternalDependencies": "patch",
"ignore": ["@example/*"]
}
48 changes: 24 additions & 24 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"mode": "pre",
"tag": "next",
"initialVersions": {
"@example/nextjs": "0.0.0",
"@example/nextjs-server-components": "0.0.0",
"@example/sveltekit": "0.0.0",
"config": "0.1.0",
"@supabase/auth-helpers-nextjs": "0.6.0",
"@supabase/auth-helpers-react": "0.3.1",
"@supabase/auth-helpers-remix": "0.1.8",
"@supabase/auth-helpers-shared": "0.3.3",
"@supabase/auth-helpers-sveltekit": "0.9.3",
"tsconfig": "0.1.1"
},
"changesets": [
"brave-lizards-thank",
"cyan-dancers-care",
"eighty-chefs-protect",
"eleven-radios-share",
"lazy-cows-shake",
"plenty-seas-build",
"silly-beds-watch",
"violet-frogs-know"
]
"mode": "pre",
"tag": "next",
"initialVersions": {
"@example/nextjs": "0.0.0",
"@example/nextjs-server-components": "0.0.0",
"@example/sveltekit": "0.0.0",
"config": "0.1.0",
"@supabase/auth-helpers-nextjs": "0.6.0",
"@supabase/auth-helpers-react": "0.3.1",
"@supabase/auth-helpers-remix": "0.1.8",
"@supabase/auth-helpers-shared": "0.3.3",
"@supabase/auth-helpers-sveltekit": "0.9.3",
"tsconfig": "0.1.1"
},
"changesets": [
"brave-lizards-thank",
"cyan-dancers-care",
"eighty-chefs-protect",
"eleven-radios-share",
"lazy-cows-shake",
"plenty-seas-build",
"silly-beds-watch",
"violet-frogs-know"
]
}
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI

on:
push:
branches:
- '**'

# cancel in-progress runs on new commits to same PR (gitub.event.number)
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true

permissions:
contents: read # to fetch code (actions/checkout)
checks: write

jobs:
Lint:
strategy:
matrix:
node: ['18']

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: pnpm/[email protected]
with:
version: 8.1.0

- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: pnpm

- run: pnpm install --frozen-lockfile

- uses: wearerequired/lint-action@v2
with:
tsc: true
prettier: true

# Lint:
# strategy:
# matrix:
# node: ['18']

# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3

# - uses: pnpm/action-setup@v2
# with:
# version: 8.1.0

# - uses: actions/setup-node@v3
# with:
# node-version: 18.x
# cache: pnpm

# - run: pnpm install --frozen-lockfile
# - run: pnpm run lint
# - run: pnpm run check
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpx lint-staged
43 changes: 43 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
.pnp
.pnp.js

# testing
coverage

# next.js
.next/
out/
build

# misc
.DS_Store
*.pem

pnpm-lock.yaml

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

# Distribution directories
dist/
package/
docs/

# turbo
.turbo

# svelte kit
.svelte-kit
27 changes: 25 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
{
"singleQuote": true,
"trailingComma": "none"
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"overrides": [
{
"files": ["*.svelte"],
"options": {
"bracketSameLine": false
}
},
{
"files": ["*.md", "*.yaml", "*.yml"],
"options": {
"useTabs": false,
"tabWidth": 2
}
},
{
"files": ["**/CHANGELOG.md"],
"options": {
"requirePragma": true
}
}
]
}
2 changes: 1 addition & 1 deletion examples/nextjs-server-components/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "next/core-web-vitals"
"extends": "next/core-web-vitals"
}
6 changes: 3 additions & 3 deletions examples/nextjs-server-components/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"typescript.tsdk": "./node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
"typescript.tsdk": "./node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
28 changes: 14 additions & 14 deletions examples/nextjs-server-components/app/globals.css
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
html,
body {
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell,
Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
}

a {
color: inherit;
text-decoration: none;
color: inherit;
text-decoration: none;
}

* {
box-sizing: border-box;
box-sizing: border-box;
}

@media (prefers-color-scheme: dark) {
html {
color-scheme: dark;
}
body {
color: white;
background: black;
}
html {
color-scheme: dark;
}
body {
color: white;
background: black;
}
}
16 changes: 8 additions & 8 deletions examples/nextjs-server-components/app/head.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export default function Head() {
return (
<>
<title>Create Next App</title>
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta name="description" content="Generated by create next app" />
<link rel="icon" href="/favicon.ico" />
</>
);
return (
<>
<title>Create Next App</title>
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta name="description" content="Generated by create next app" />
<link rel="icon" href="/favicon.ico" />
</>
);
}
40 changes: 18 additions & 22 deletions examples/nextjs-server-components/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,27 @@ export type TypedSupabaseClient = SupabaseClient<Database>;
// do not cache this layout
export const revalidate = 0;

export default async function RootLayout({
children
}: {
children: React.ReactNode;
}) {
const supabase = createServerClient();
export default async function RootLayout({ children }: { children: React.ReactNode }) {
const supabase = createServerClient();

const {
data: { session }
} = await supabase.auth.getSession();
const {
data: { session }
} = await supabase.auth.getSession();

return (
<html lang="en">
{/*
return (
<html lang="en">
{/*
<head /> will contain the components returned by the nearest parent
head.tsx. Find out more at https://beta.nextjs.org/docs/api-reference/file-conventions/head
*/}
<head />
<body>
<SupabaseProvider session={session}>
<SupabaseListener serverAccessToken={session?.access_token} />
<Login />
{children}
</SupabaseProvider>
</body>
</html>
);
<head />
<body>
<SupabaseProvider session={session}>
<SupabaseListener serverAccessToken={session?.access_token} />
<Login />
{children}
</SupabaseProvider>
</body>
</html>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export const revalidate = 0;

// this page will display with or without a user session
export default async function OptionalSession() {
const supabase = createServerClient();
const { data } = await supabase.from('posts').select('*');
const supabase = createServerClient();
const { data } = await supabase.from('posts').select('*');

return <pre>{JSON.stringify({ data }, null, 2)}</pre>;
return <pre>{JSON.stringify({ data }, null, 2)}</pre>;
}
Loading