Skip to content

Commit 6299edc

Browse files
authored
Update with-prisma example. (#6571)
Updating the with-prisma example! Closes TURBO-1708 Things to pay attention to: - [x] Is tasking correct? Are all tasks successful out-of-the-box? Do I hit cache when I'm expecting? - [x] If I add an unused variable in a workspace, do I see a warning in both my editor and when I run turbo lint? - [ ] Does auto-importing work across packages? _This is suspiciously not working and I can't get it to...Is `yarn` doing something weird?_ - [x] Anything else wonky in your editor? - [x] Do I get proper hot-reloading in turbo dev? - [x] Anything else that may come up!
1 parent e5bb034 commit 6299edc

File tree

24 files changed

+1471
-1160
lines changed

24 files changed

+1471
-1160
lines changed

examples/with-prisma/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = require("./packages/config/eslint-preset.js");
1+
module.exports = require("@repo/eslint-config/library");

examples/with-prisma/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ This turborepo includes the following packages/apps:
1717
### Apps and Packages
1818

1919
- `web`: a [Next.js](https://nextjs.org/) app
20-
- `config`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`)
21-
- `database`: [Prisma](https://prisma.io/) ORM wrapper to manage & access your database
22-
- `tsconfig`: `tsconfig.json`s used throughout the monorepo
20+
- `@repo/eslint-config`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`)
21+
- `@repo/database`: [Prisma](https://prisma.io/) ORM wrapper to manage & access your database
22+
- `@repo/typescript-config`: `tsconfig.json`s used throughout the monorepo
2323

2424
Each package/app is 100% [TypeScript](https://www.typescriptlang.org/).
2525

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/** @type {import("eslint").Linter.Config} */
2+
module.exports = {
3+
extends: ["@repo/eslint-config/next.js"],
4+
parser: "@typescript-eslint/parser",
5+
parserOptions: {
6+
project: true,
7+
},
8+
};

examples/with-prisma/apps/web/app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { prisma } from "database";
1+
import { prisma } from "@repo/database";
22

33
export default async function IndexPage() {
44
const users = await prisma.user.findMany();

examples/with-prisma/apps/web/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@
66
"dev": "next dev",
77
"build": "next build",
88
"start": "next start",
9-
"lint": "next lint"
9+
"lint": "eslint . --max-warnings 0"
1010
},
1111
"dependencies": {
1212
"next": "^14.0.3",
1313
"react": "^18.2.0",
1414
"react-dom": "^18.2.0"
1515
},
1616
"devDependencies": {
17-
"@types/node": "^17.0.12",
18-
"@types/react": "^18.0.22",
19-
"@types/react-dom": "^18.0.7",
20-
"config": "*",
21-
"database": "*",
22-
"eslint": "^7.32.0",
23-
"tsconfig": "*",
24-
"typescript": "^4.5.3"
17+
"@repo/eslint-config": "*",
18+
"@repo/typescript-config": "*",
19+
"@types/node": "^20.10.0",
20+
"@types/react": "^18.2.38",
21+
"@types/react-dom": "^18.2.17",
22+
"@repo/database": "*",
23+
"eslint": "^8.54.0",
24+
"typescript": "^5.3.2"
2525
}
2626
}
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
{
2-
"extends": "tsconfig/nextjs.json",
3-
"compilerOptions": {
4-
"plugins": [{ "name": "next" }]
5-
},
6-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
2+
"extends": "@repo/typescript-config/nextjs.json",
3+
"compilerOptions": { "plugins": [{ "name": "next" }] },
4+
"include": [
5+
"next-env.d.ts",
6+
"next.config.js",
7+
"**/*.ts",
8+
"**/*.tsx",
9+
".next/types/**/*.ts"
10+
],
711
"exclude": ["node_modules"]
812
}

examples/with-prisma/package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@
1919
"lint": "turbo run lint"
2020
},
2121
"devDependencies": {
22-
"prettier": "^2.5.1",
23-
"tsx": "^3.7.1",
24-
"turbo": "^1.9.3"
22+
"@repo/eslint-config": "*",
23+
"prettier": "^3.1.0",
24+
"tsx": "^4.4.0",
25+
"turbo": "^1.10.16"
26+
},
27+
"engines": {
28+
"node": ">=18"
2529
},
2630
"packageManager": "yarn@1.22.19"
2731
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `@turbo/eslint-config`
2+
3+
Collection of internal eslint configurations.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const { resolve } = require("node:path");
2+
3+
const project = resolve(process.cwd(), "tsconfig.json");
4+
5+
/** @type {import("eslint").Linter.Config} */
6+
module.exports = {
7+
extends: ["eslint:recommended", "prettier", "eslint-config-turbo"],
8+
plugins: ["only-warn"],
9+
globals: {
10+
React: true,
11+
JSX: true,
12+
},
13+
env: {
14+
node: true,
15+
},
16+
settings: {
17+
"import/resolver": {
18+
typescript: {
19+
project,
20+
},
21+
},
22+
},
23+
ignorePatterns: [
24+
// Ignore dotfiles
25+
".*.js",
26+
"node_modules/",
27+
"dist/",
28+
],
29+
overrides: [
30+
{
31+
files: ["*.js?(x)", "*.ts?(x)"],
32+
},
33+
],
34+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const { resolve } = require("node:path");
2+
3+
const project = resolve(process.cwd(), "tsconfig.json");
4+
5+
/** @type {import("eslint").Linter.Config} */
6+
module.exports = {
7+
extends: [
8+
"eslint:recommended",
9+
"prettier",
10+
require.resolve("@vercel/style-guide/eslint/next"),
11+
"eslint-config-turbo",
12+
],
13+
globals: {
14+
React: true,
15+
JSX: true,
16+
},
17+
env: {
18+
node: true,
19+
},
20+
plugins: ["only-warn"],
21+
settings: {
22+
"import/resolver": {
23+
typescript: {
24+
project,
25+
},
26+
},
27+
},
28+
ignorePatterns: [
29+
// Ignore dotfiles
30+
".*.js",
31+
"node_modules/",
32+
],
33+
overrides: [{ files: ["*.js?(x)", "*.ts?(x)"] }],
34+
};

0 commit comments

Comments
 (0)