loop-payments / prisma-lint

A linter for Prisma schema files.
https://www.npmjs.com/package/prisma-lint
MIT License
131 stars 6 forks source link

Add support for require plural field name for lists #540

Open mmeinzer opened 1 hour ago

mmeinzer commented 1 hour ago

It would be nice to have a rule for enforcing plural naming of list fields - possibly list-field-name-grammatical-number. Below are some examples. Non-list fields would be entirely ignored by this rule.

With { style: "singular" }

// good
model User {
  email String[]
}

// bad
model Users {
  email String[]
}

With { style: "plural" }

// good
model User {
  emails String[]
}

// bad
model Users {
  email String[]
}
mmeinzer commented 1 hour ago

Happy to put up a PR for this if there's interest