Skip to content

Commit 5a06e8e

Browse files
lint
1 parent c5d56fd commit 5a06e8e

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

docs/tools/prisma-lint.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
title: Prisma Lint
3+
sidebar_label: Prisma Lint
4+
description: CodeRabbit's guide to Prisma Lint.
5+
---
6+
7+
```mdx-code-block
8+
import ProPlanNotice from '@site/src/components/ProPlanNotice.mdx';
9+
10+
<ProPlanNotice />
11+
```
12+
13+
[Prisma Lint](https://github.com/loop-payments/prisma-lint) is a linter for Prisma schema files that helps enforce consistent conventions and best practices in your Prisma schemas.
14+
15+
## Files
16+
17+
Prisma Lint will run on files with the following extensions:
18+
19+
- `.prisma`
20+
21+
## Configuration
22+
23+
Prisma Lint supports the following config files:
24+
25+
- `.prismalintrc.json`
26+
- User-defined config file set at `reviews.tools.prismalint.config_file` in your project's `.coderabbit.yaml` file or setting the "Review → Tools → Prisma Lint → Config File" field in CodeRabbit's settings page.
27+
28+
:::note
29+
30+
By default, Prisma Lint looks for schema files at `prisma/schema.prisma`. If you have a custom schema path specified in the `prisma.schema` field within `package.json`, that will be used instead.
31+
32+
:::
33+
34+
## Rule Configuration
35+
36+
Rules can be configured in your `.prismalintrc.json` file. Here's an example configuration:
37+
38+
```json
39+
{
40+
"rules": {
41+
"field-name-mapping-snake-case": [
42+
"error",
43+
{
44+
"compoundWords": ["S3"]
45+
}
46+
],
47+
"model-name-grammatical-number": [
48+
"error",
49+
{
50+
"style": "singular"
51+
}
52+
],
53+
"require-field-index": [
54+
"error",
55+
{
56+
"forAllRelations": true,
57+
"forNames": ["tenantId"]
58+
}
59+
]
60+
}
61+
}
62+
```
63+
64+
## Ignoring Rules
65+
66+
You can ignore rules using three-slash (`///`) comments inside your Prisma models:
67+
68+
```prisma
69+
model User {
70+
/// prisma-lint-ignore-model
71+
// Ignores all lint rules for this model
72+
}
73+
74+
model Post {
75+
/// prisma-lint-ignore-model require-field
76+
// Ignores specific rules for this model
77+
}
78+
```
79+
80+
## Links
81+
82+
- [Prisma Lint GitHub Repository](https://github.com/loop-payments/prisma-lint)
83+
- [Prisma Lint Rules Documentation](https://github.com/loop-payments/prisma-lint/blob/main/RULES.md)

docs/tools/tools.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ Remove extraneous f prefix
7676
| TSX | [Biome][Biome] | Code Quality |
7777
| Typescript | [Biome][Biome] | Code Quality |
7878
| YAML | [YAMLlint][YAMLlint] | Code Quality |
79+
| Prisma | [Prisma Lint][PrismaLint] | Code Quality |
7980

8081
[ShellCheck]: ./shellcheck.md
8182
[SQLFluff]: ./sqlfluff.md
@@ -100,3 +101,4 @@ Remove extraneous f prefix
100101
[CircleCI]: ./circleci.md
101102
[Semgrep]: ./semgrep.md
102103
[Pipeline]: ./pipeline-remediation.md
104+
[PrismaLint]: ./prisma-lint.md

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy