Skip to content

Commit 8670c16

Browse files
committed
docs: update eslint config and readme fmt
1 parent 71524e3 commit 8670c16

File tree

2 files changed

+27
-31
lines changed

2 files changed

+27
-31
lines changed

README.md

+27-24
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ A worker does the following:
1313

1414
1. Dequeues jobs that match the worker's `queue`
1515
2. Processes jobs until there are none left
16-
2. Listens for new jobs using Supabase's Realtime feature
16+
3. Listens for new jobs using Supabase's Realtime feature
1717

1818
Timeouts, delayed retries, and scale are left to the developer.
1919

@@ -35,6 +35,13 @@ Run the migration:
3535
supabase migration up --local
3636
```
3737

38+
Update your `supabase/config.toml` to include the `supaworker` schema:
39+
40+
```toml
41+
[api]
42+
schemas = ["public", "supaworker"]
43+
```
44+
3845
Sync the schema to your Supabase project:
3946

4047
```bash
@@ -73,35 +80,31 @@ Edit package.json to use ESM modules:
7380
Basic javascript example:
7481

7582
```js
76-
import { createSupaworker } from "supaworker-js";
83+
import { createSupaworker } from 'supaworker-js';
7784

7885
const clientOptions = {
79-
supabase_url: process.env.SUPABASE_URL ?? "",
80-
supabase_service_role_key: process.env.SUPABASE_SERVICE_ROLE_KEY ?? "",
86+
supabase_url: process.env.SUPABASE_URL ?? '',
87+
supabase_service_role_key: process.env.SUPABASE_SERVICE_ROLE_KEY ?? '',
8188
};
8289

8390
const workerOptions = {
84-
queue: "example",
91+
queue: 'example',
8592
};
8693

87-
const { enqueue, worker } = createSupaworker(
88-
clientOptions,
89-
workerOptions,
90-
async (job) => {
91-
console.log(job.payload.message);
92-
}
93-
);
94+
const { enqueue, worker } = createSupaworker(clientOptions, workerOptions, async (job) => {
95+
console.log(job.payload.message);
96+
});
9497

9598
await enqueue([
9699
{
97-
queue: "example",
100+
queue: 'example',
98101
payload: {
99-
message: "Hello, World!",
102+
message: 'Hello, World!',
100103
},
101104
},
102105
]);
103106

104-
process.on("SIGINT", async () => {
107+
process.on('SIGINT', async () => {
105108
await worker.stop();
106109
process.exit();
107110
});
@@ -135,35 +138,35 @@ import {
135138
createSupaworker,
136139
type SupaworkerClientOptions,
137140
type SupaworkerOptions,
138-
} from "supaworker-js";
141+
} from 'supaworker-js';
139142

140143
const clientOptions: SupaworkerClientOptions = {
141-
supabase_url: import.meta.env.SUPABASE_URL ?? "",
142-
supabase_service_role_key: import.meta.env.SUPABASE_SERVICE_ROLE_KEY ?? "",
144+
supabase_url: import.meta.env.SUPABASE_URL ?? '',
145+
supabase_service_role_key: import.meta.env.SUPABASE_SERVICE_ROLE_KEY ?? '',
143146
};
144147

145148
const workerOptions: SupaworkerOptions = {
146-
queue: "example",
149+
queue: 'example',
147150
};
148151

149152
const { enqueue, worker } = createSupaworker<{ message: string }>(
150153
clientOptions,
151154
workerOptions,
152155
async (job) => {
153156
console.log(job.payload!.message);
154-
}
157+
},
155158
);
156159

157160
await enqueue([
158161
{
159-
queue: "example",
162+
queue: 'example',
160163
payload: {
161-
message: "Hello, World!",
164+
message: 'Hello, World!',
162165
},
163166
},
164167
]);
165168

166-
process.on("SIGINT", async () => {
169+
process.on('SIGINT', async () => {
167170
await worker.stop();
168171
process.exit();
169172
});
@@ -178,4 +181,4 @@ Run the worker:
178181
SUPABASE_URL="" \
179182
SUPABASE_SERVICE_ROLE_KEY="" \
180183
bun run index.ts
181-
```
184+
```

eslint.config.js

-7
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ export default ts.config(
1515
},
1616
},
1717
},
18-
{
19-
languageOptions: {
20-
parserOptions: {
21-
parser: ts.parser,
22-
},
23-
},
24-
},
2518
{
2619
plugins: {
2720
'simple-import-sort': simpleImportSort,

0 commit comments

Comments
 (0)