diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 0000000..60f0306 --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,2 @@ +reviews: + path_filters: ["**/.prismalintrc.json",".prismalintrc.json", "**/example.prisma", "example.prisma"] \ No newline at end of file diff --git a/.prismalintrc.json b/.prismalintrc.json new file mode 100644 index 0000000..c058382 --- /dev/null +++ b/.prismalintrc.json @@ -0,0 +1,36 @@ +{ + "rules": { + "field-name-mapping-snake-case": [ + "error", + { + "compoundWords": ["S3"] + } + ], + "field-order": [ + "error", + { + "order": ["tenantId", "..."] + } + ], + "forbid-required-ignored-field": ["error"], + "model-name-grammatical-number": [ + "error", + { + "style": "singular" + } + ], + "model-name-mapping-snake-case": [ + "error", + { + "compoundWords": ["GraphQL"] + } + ], + "require-field-index": [ + "error", + { + "forAllRelations": true, + "forNames": ["tenantId"] + } + ] + } +} diff --git a/example.prisma b/example.prisma new file mode 100644 index 0000000..aaec40c --- /dev/null +++ b/example.prisma @@ -0,0 +1,35 @@ +generator client { + provider = "prisma-client-js" + output = "../generated/prisma/client" +} + +datasource db { + provider = "postgresql" + url = "fake-url" +} + +model Users { + id String @id + emailAddress String + tenantId String + removeMe String @ignore + tenant Tenant @relation(fields: [tenantId], references: [id]) + @@map(name: "users") +} + +model Tenant { + id String @id + name String + @@map(name: "tenant") +} + +model UserRoleFoo { + id String @id + @@map(name: "unexpected_snake_case") +} + +model UserRole { + id String @id + userId String @map(name: "userid") + // No mapping. +}