Skip to content

Commit e7b6ee0

Browse files
NicolappsConvex, Inc.
authored andcommitted
Add @convex-dev/eslint-plugin to monorepo projects (#42383)
GitOrigin-RevId: 816592ef1f443c90019b92104da06aa69a790188
1 parent eee8c7d commit e7b6ee0

39 files changed

+141
-45
lines changed

npm-packages/common/config/rush/pnpm-lock.yaml

Lines changed: 32 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

npm-packages/components/ratelimiter/eslint.config.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import eslint from "@eslint/js";
22
import tseslint from "typescript-eslint";
3-
import convex from "@convex-dev/eslint-plugin";
3+
import convexPlugin from "@convex-dev/eslint-plugin";
44

55
export default tseslint.config(
66
{
7-
ignores: ["dist", "convex/_generated/**"],
7+
ignores: ["dist", "src/ratelimiter/_generated/**"],
88
},
99
eslint.configs.recommended,
10-
...convex.configs.recommended,
10+
{
11+
files: ["src/ratelimiter/**/*.ts"],
12+
plugins: {
13+
"@convex-dev": convexPlugin,
14+
},
15+
rules: convexPlugin.configs.recommended[0].rules,
16+
},
1117
...tseslint.configs.recommended,
1218

1319
{

npm-packages/demos/nextjs-app-router/convex/counter.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
import { v } from "convex/values";
12
import { mutation, query } from "./_generated/server";
23

3-
export const get = query(
4-
async ({ db }, { counterName }: { counterName: string }) => {
4+
export const get = query({
5+
args: {
6+
counterName: v.string(),
7+
},
8+
handler: async ({ db }, { counterName }) => {
59
const counterDoc = await db
610
.query("counter_table")
711
.filter((q) => q.eq(q.field("name"), counterName))
@@ -12,10 +16,13 @@ export const get = query(
1216
}
1317
return counterDoc.counter;
1418
},
15-
);
19+
});
1620

17-
export const increment = mutation(
18-
async ({ db }, { counterName }: { counterName: string }) => {
21+
export const increment = mutation({
22+
args: {
23+
counterName: v.string(),
24+
},
25+
handler: async ({ db }, { counterName }) => {
1926
const counterDoc = await db
2027
.query("counter_table")
2128
.filter((q) => q.eq(q.field("name"), counterName))
@@ -36,4 +43,4 @@ export const increment = mutation(
3643
);
3744
}
3845
},
39-
);
46+
});

npm-packages/demos/nextjs-app-router/eslint.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import path from "node:path";
33
import { fileURLToPath } from "node:url";
44
import js from "@eslint/js";
55
import { FlatCompat } from "@eslint/eslintrc";
6+
import convexPlugin from "@convex-dev/eslint-plugin";
67

78
const __filename = fileURLToPath(import.meta.url);
89
const __dirname = path.dirname(__filename);
@@ -19,4 +20,5 @@ export default defineConfig([
1920
{
2021
ignores: [".next/**", "convex/_generated/**"],
2122
},
23+
...convexPlugin.configs.recommended,
2224
]);

npm-packages/demos/nextjs-app-router/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"prettier": "3.6.2"
2020
},
2121
"devDependencies": {
22+
"@convex-dev/eslint-plugin": "workspace:*",
2223
"@eslint/js": "~9.34.0",
2324
"@eslint/eslintrc": "^3",
2425
"@radix-ui/react-slot": "^1.0.2",

npm-packages/demos/nextjs-pages-router/convex/counter.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
import { v } from "convex/values";
12
import { mutation, query } from "./_generated/server";
23

3-
export const get = query(
4-
async ({ db }, { counterName }: { counterName: string }): Promise<number> => {
4+
export const get = query({
5+
args: {
6+
counterName: v.string(),
7+
},
8+
handler: async ({ db }, { counterName }): Promise<number> => {
59
const counterDoc = await db
610
.query("counter_table")
711
.filter((q) => q.eq(q.field("name"), counterName))
@@ -12,13 +16,14 @@ export const get = query(
1216
}
1317
return counterDoc.counter;
1418
},
15-
);
19+
});
1620

17-
export const increment = mutation(
18-
async (
19-
{ db, auth },
20-
{ counterName, increment }: { counterName: string; increment: number },
21-
) => {
21+
export const increment = mutation({
22+
args: {
23+
counterName: v.string(),
24+
increment: v.number(),
25+
},
26+
handler: async ({ db, auth }, { counterName, increment }) => {
2227
const identity = await auth.getUserIdentity();
2328
if (!identity) {
2429
throw new Error("Unauthenticated call to incrementCounter");
@@ -40,4 +45,4 @@ export const increment = mutation(
4045
console.log(`Value of counter is now ${counterDoc.counter}.`);
4146
}
4247
},
43-
);
48+
});

npm-packages/demos/nextjs-pages-router/eslint.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import path from "node:path";
33
import { fileURLToPath } from "node:url";
44
import js from "@eslint/js";
55
import { FlatCompat } from "@eslint/eslintrc";
6+
import convexPlugin from "@convex-dev/eslint-plugin";
67

78
const __filename = fileURLToPath(import.meta.url);
89
const __dirname = path.dirname(__filename);
@@ -19,4 +20,5 @@ export default defineConfig([
1920
{
2021
ignores: [".next/**", "convex/_generated/**"],
2122
},
23+
...convexPlugin.configs.recommended,
2224
]);

npm-packages/demos/nextjs-pages-router/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"prettier": "3.6.2"
2121
},
2222
"devDependencies": {
23+
"@convex-dev/eslint-plugin": "workspace:*",
2324
"@eslint/js": "~9.34.0",
2425
"@eslint/eslintrc": "^3",
2526
"@types/babel__core": "^7.20.0",

npm-packages/private-demos/actions/eslint.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import eslint from "@eslint/js";
22
import tseslint from "typescript-eslint";
3-
import convex from "@convex-dev/eslint-plugin";
3+
import convexPlugin from "@convex-dev/eslint-plugin";
44

55
export default tseslint.config(
66
{
77
ignores: ["dist", "convex/_generated/**"],
88
},
99
eslint.configs.recommended,
10-
...convex.configs.recommended,
10+
...convexPlugin.configs.recommended,
1111
...tseslint.configs.recommended,
1212

1313
{

npm-packages/private-demos/nextjs-15-app-clerk/eslint.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { dirname } from "path";
22
import { fileURLToPath } from "url";
33
import { FlatCompat } from "@eslint/eslintrc";
4+
import convexPlugin from "@convex-dev/eslint-plugin";
45

56
const __filename = fileURLToPath(import.meta.url);
67
const __dirname = dirname(__filename);
@@ -20,6 +21,7 @@ const eslintConfig = [
2021
"next-env.d.ts",
2122
],
2223
},
24+
...convexPlugin.configs.recommended,
2325
];
2426

2527
export default eslintConfig;

0 commit comments

Comments
 (0)