File tree Expand file tree Collapse file tree 7 files changed +64
-35
lines changed Expand file tree Collapse file tree 7 files changed +64
-35
lines changed Original file line number Diff line number Diff line change 11import { mutation } from "./_generated/server.js" ;
22import { query } from "./_generated/server.js" ;
3- import { Doc , Id } from "./_generated/dataModel.js" ;
43import { v } from "convex/values" ;
5- import schema , { vv } from "./schema.js" ;
4+ import { vv } from "./schema.js" ;
65
76export const list = query ( {
7+ args : { } ,
88 returns : v . array (
99 v . object ( {
1010 ...vv . doc ( "messages" ) . fields ,
@@ -27,6 +27,7 @@ export const list = query({
2727} ) ;
2828
2929export const count = query ( {
30+ args : { } ,
3031 returns : v . string ( ) ,
3132 handler : async ( ctx ) => {
3233 const messages = await ctx . db . query ( "messages" ) . take ( 1001 ) ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { Doc } from "./_generated/dataModel";
33import { query } from "./_generated/server" ;
44
55export const getCurrent = query ( {
6+ args : { } ,
67 handler : async ( ctx ) : Promise < Doc < "users" > | null > => {
78 const userId = await getAuthUserId ( ctx ) ;
89 if ( ! userId ) {
Original file line number Diff line number Diff line change 11import { action } from "./_generated/server.js" ;
22
3- export const getSFWeather = action ( async ( ) => {
4- const stationUrl = "https://api.weather.gov/stations/SFOC1" ;
5- const observationData = await (
6- await fetch ( `${ stationUrl } /observations/latest` , {
7- headers : { "User-Agent" : "Convex/1.0" } ,
8- } )
9- ) . json ( ) ;
10- const celsius = observationData . properties . temperature . value ;
11- return {
12- fahrenheit : Math . round ( ( ( celsius * 9 ) / 5 + 32 ) * 100 ) / 100 ,
13- fetchedAt : Date . now ( ) ,
14- timestamp : observationData . properties . timestamp ,
15- } ;
3+ export const getSFWeather = action ( {
4+ args : { } ,
5+ handler : async ( ) => {
6+ const stationUrl = "https://api.weather.gov/stations/SFOC1" ;
7+ const observationData = await (
8+ await fetch ( `${ stationUrl } /observations/latest` , {
9+ headers : { "User-Agent" : "Convex/1.0" } ,
10+ } )
11+ ) . json ( ) ;
12+ const celsius = observationData . properties . temperature . value ;
13+ return {
14+ fahrenheit : Math . round ( ( ( celsius * 9 ) / 5 + 32 ) * 100 ) / 100 ,
15+ fetchedAt : Date . now ( ) ,
16+ timestamp : observationData . properties . timestamp ,
17+ } ;
18+ } ,
1619} ) ;
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ import path from "node:path";
44import { fileURLToPath } from "node:url" ;
55import js from "@eslint/js" ;
66import { FlatCompat } from "@eslint/eslintrc" ;
7+ import convexPlugin from "@convex-dev/eslint-plugin" ;
8+ import tseslint from "typescript-eslint" ;
79
810const __filename = fileURLToPath ( import . meta. url ) ;
911const __dirname = path . dirname ( __filename ) ;
@@ -23,5 +25,22 @@ export default defineConfig([
2325 ) ,
2426 ) ,
2527 } ,
26- globalIgnores ( [ "convex/_generated/**" ] ) ,
28+ globalIgnores ( [ "convex/_generated/**" , "dist" ] ) ,
29+ ...tseslint . configs . recommended ,
30+ ...convexPlugin . configs . recommended ,
31+ {
32+ rules : {
33+ // allow (_arg: number) => {}
34+ "@typescript-eslint/no-unused-vars" : [
35+ "error" ,
36+ {
37+ argsIgnorePattern : "^_" ,
38+ varsIgnorePattern : "^_" ,
39+ } ,
40+ ] ,
41+
42+ "@typescript-eslint/no-explicit-any" : "off" ,
43+ "@typescript-eslint/no-empty-object-type" : "off" ,
44+ } ,
45+ } ,
2746] ) ;
Original file line number Diff line number Diff line change 4040 },
4141 "devDependencies" : {
4242 "@convex-dev/auth" : " ^0.0.90" ,
43+ "@convex-dev/eslint-plugin" : " workspace:*" ,
4344 "@eslint/compat" : " ~1.3.0" ,
4445 "@eslint/eslintrc" : " ^3" ,
4546 "@eslint/js" : " ~9.34.0" ,
5960 "react-dom" : " ^18.0.0" ,
6061 "tshy" : " ^3.0.0" ,
6162 "typescript" : " ~5.0.3" ,
63+ "typescript-eslint" : " ^8.45.0" ,
6264 "vite" : " ^6.4.1" ,
6365 "vitest" : " ^3.2.4"
6466 },
Original file line number Diff line number Diff line change 1- /* eslint-disable jsx-a11y/anchor-is-valid */
21import {
32 QueryClient ,
43 QueryClientProvider ,
54 useMutation ,
65 useQuery ,
7- useSuspenseQuery ,
86} from "@tanstack/react-query" ;
97import { ReactQueryDevtools } from "@tanstack/react-query-devtools" ;
108import {
119 Authenticated ,
1210 AuthLoading ,
13- ConvexProvider ,
1411 ConvexReactClient ,
1512 Unauthenticated ,
1613} from "convex/react" ;
@@ -156,8 +153,8 @@ function App() {
156153 } ) ;
157154 const {
158155 data : user ,
159- error : userError ,
160- isPending : userIsPending ,
156+ error : _userError ,
157+ isPending : _userIsPending ,
161158 } = useQuery ( {
162159 ...convexQuery ( api . user . getCurrent , { } ) ,
163160 initialData : null ,
You can’t perform that action at this time.
0 commit comments