Skip to content

Commit

Permalink
feat(useedgedbpkce): fix imports on all occurences; also add linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Tahul committed Nov 22, 2023
1 parent 36402b8 commit a6595bc
Show file tree
Hide file tree
Showing 48 changed files with 2,291 additions and 1,068 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

7 changes: 0 additions & 7 deletions .eslintrc

This file was deleted.

41 changes: 41 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
// Enable the ESlint flat config support
"eslint.experimental.useFlatConfig": true,

// Disable the default formatter, use eslint instead
"prettier.enable": false,
"editor.formatOnSave": false,

// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},

// Silent the stylistic rules in you IDE, but still auto fix them
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off" },
{ "rule": "*-indent", "severity": "off" },
{ "rule": "*-spacing", "severity": "off" },
{ "rule": "*-spaces", "severity": "off" },
{ "rule": "*-order", "severity": "off" },
{ "rule": "*-dangle", "severity": "off" },
{ "rule": "*-newline", "severity": "off" },
{ "rule": "*quotes", "severity": "off" },
{ "rule": "*semi", "severity": "off" }
],

// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml"
]
}
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,8 @@ You will also need a call back page, that can use `EdgeDbAuthCallback`.
<p v-if="loading">
Loading...
</p>
</UCard>
</UCard>
</div>
</EdgeDbOAuthCallback>
</template>
```
Expand Down Expand Up @@ -594,8 +595,8 @@ I guess that can be useful for a super-admin/internal dashboard, but use it at y
<script setup lang="ts">
import e, { type $infer } from '@db/builder'
const query = e.select(e.Movie, () => ({ id: true, title: true }));
type result = $infer<typeof query>;
const query = e.select(e.Movie, () => ({ id: true, title: true }))
type result = $infer<typeof query>
// ^ { id: string; title: string }[]
</script>
```
Expand Down
4 changes: 2 additions & 2 deletions build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ export default defineBuildConfig({
'chalk',
'prompts',
'edgedb',
'@edgedb/generate'
]
'@edgedb/generate',
],
})
17 changes: 17 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import antfu from '@antfu/eslint-config'

export default await antfu(
{
ignores: [
'dist',
'node_modules',
'*.md',
],
},
{
rules: {
'no-console': 'off',
'node/prefer-global/process': 'off',
},
},
)
6 changes: 3 additions & 3 deletions minimal-starter/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export default defineNuxtConfig({
modules: [
'../src/module'
'../src/module',
],
edgeDb: {
auth: true,
oauth: true
oauth: true,
},
devtools: { enabled: true }
devtools: { enabled: true },
})
8 changes: 4 additions & 4 deletions minimal-starter/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"private": true,
"name": "my-module-playground",
"type": "module",
"private": true,
"scripts": {
"dev": "nuxi dev",
"build": "nuxi build",
"generate": "nuxi generate"
},
"dependencies": {
"@edgedb/generate": "^0.4.1"
},
"devDependencies": {
"@nuxt/devtools": "latest",
"nuxt": "latest"
},
"dependencies": {
"@edgedb/generate": "^0.4.1"
}
}
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "nuxt-edgedb-module",
"type": "module",
"version": "0.0.10",
"description": "Nuxt 3 integration for EdgeDB.",
"repository": "tahul/nuxt-edgedb",
"license": "MIT",
"type": "module",
"repository": "tahul/nuxt-edgedb",
"exports": {
".": {
"types": "./dist/types.d.ts",
Expand All @@ -30,22 +30,22 @@
},
"dependencies": {
"@edgedb/generate": "^0.4.1",
"@nuxt/kit": "^3.8.1",
"@nuxt/kit": "^3.8.2",
"edgedb": "^1.4.1",
"execa": "^8.0.1",
"prompts": "^2.4.2"
},
"devDependencies": {
"@antfu/eslint-config": "^2.1.0",
"@nuxt/devtools": "latest",
"@nuxt/eslint-config": "^0.2.0",
"@nuxt/module-builder": "^0.5.4",
"@nuxt/schema": "^3.8.1",
"@nuxt/schema": "^3.8.2",
"@nuxt/test-utils": "^3.8.1",
"@types/node": "^20.9.0",
"@types/prompts": "^2.4.8",
"@types/node": "^20.9.4",
"@types/prompts": "^2.4.9",
"changelogen": "^0.5.5",
"eslint": "^8.53.0",
"nuxt": "^3.8.1",
"eslint": "^8.54.0",
"nuxt": "^3.8.2",
"vitest": "^0.34.6"
}
}
}
18 changes: 9 additions & 9 deletions playground/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const links = computed(() => {
{
label: 'Home',
icon: 'i-heroicons-home',
to: '/'
to: '/',
},
]
Expand All @@ -15,37 +15,37 @@ const links = computed(() => {
{
label: 'New blogpost',
icon: 'i-heroicons-newspaper-20-solid',
to: '/new'
to: '/new',
},
{
label: 'Logout',
icon: 'i-heroicons-newspaper-20-solid',
to: '/auth/logout'
}
to: '/auth/logout',
},
)
} else {
}
else {
links.push(
{
label: 'Register',
icon: 'i-heroicons-key-20-solid',
to: '/auth/signup'
to: '/auth/signup',
},
{
label: 'Login',
icon: 'i-heroicons-lock-open-20-solid',
to: '/auth/login'
to: '/auth/login',
},
{
label: 'Forgot my password',
icon: 'i-heroicons-sparkles-20-solid',
to: '/auth/forgot-password'
to: '/auth/forgot-password',
},
)
}
return links
})
</script>

<template>
Expand Down
8 changes: 4 additions & 4 deletions playground/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
export default defineNuxtConfig({
modules: [
'../src/module',
'@nuxt/ui'
'@nuxt/ui',
],
edgeDb: {
auth: true,
oauth: true
oauth: true,
},
devtools: { enabled: true },
tailwindcss: {
viewer: false
}
viewer: false,
},
})
10 changes: 5 additions & 5 deletions playground/package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"private": true,
"name": "my-module-playground",
"type": "module",
"private": true,
"scripts": {
"dev": "nuxi dev",
"build": "nuxi build",
"generate": "nuxi generate"
},
"devDependencies": {
"@nuxt/devtools": "latest",
"nuxt": "latest"
},
"dependencies": {
"@edgedb/generate": "^0.4.1",
"@iconify-json/heroicons": "^1.1.13",
"@nuxt/ui": "^2.10.0"
},
"devDependencies": {
"@nuxt/devtools": "latest",
"nuxt": "latest"
}
}
22 changes: 11 additions & 11 deletions playground/pages/blogposts/[id].vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
<script setup lang="ts">
import type { BlogPost } from '~/dbschema/interfaces'
const { params } = useRoute()
const { data: blogpost } = await useAsyncData<BlogPost>(
`blogpost-${params.id}`,
async () => await $fetch(`/api/blogpost/${params.id}`),
)
</script>

<template>
<UContainer class="p-8 flex flex-col gap-4">
<UCard v-if="blogpost">
Expand All @@ -19,17 +30,6 @@
</UContainer>
</template>

<script setup lang="ts">
import type { BlogPost } from '~/dbschema/interfaces';
const { params } = useRoute()
const { data: blogpost } = await useAsyncData<BlogPost>(
`blogpost-${params.id}`,
async () => await $fetch(`/api/blogpost/${params.id}`)
)
</script>

<style scoped>
h1 {
margin-bottom: 1.33rem;
Expand Down
42 changes: 21 additions & 21 deletions playground/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
<script setup lang="ts">
import type { BlogPost } from '@db/interfaces'
const { isLoggedIn } = useEdgeDbIdentity()
const { data, refresh } = await useAsyncData<BlogPost[]>(
'blogpost-index',
async () => await $fetch('/api/blogpost'),
)
async function deleteBlogPost(id: string) {
await $fetch('/api/blogpost', {
method: 'DELETE',
body: {
id,
},
})
await refresh()
}
</script>

<template>
<UContainer class="p-8 flex flex-col gap-4">
<UCard
Expand Down Expand Up @@ -27,24 +48,3 @@
</UCard>
</UContainer>
</template>

<script setup lang="ts">
import type { BlogPost } from '@db/interfaces'
const { isLoggedIn } = useEdgeDbIdentity()
const { data, refresh } = await useAsyncData<BlogPost[]>(
'blogpost-index',
async () => await $fetch('/api/blogpost')
)
const deleteBlogPost = async (id: string) => {
await $fetch('/api/blogpost', {
method: 'DELETE',
body: {
id
}
})
await refresh()
}
</script>
Loading

0 comments on commit a6595bc

Please sign in to comment.