New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

prisma-lint

Package Overview
Dependencies
Maintainers
5
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prisma-lint - npm Package Compare versions

Comparing version 0.0.20 to 0.0.21

9

dist/common/snake-case.js

@@ -0,1 +1,2 @@

import pluralize from 'pluralize';
/**

@@ -18,3 +19,11 @@ * Returns a snake case string expected based on input string,

const snakeCaseWithCompoundWords = compountWordsAsSnakeCase.reduce((acc, compoundWord) => acc.replace(compoundWord, compoundWord.replace(/_/g, '')), snakeCase);
if (options.pluralize) {
if (options.irregularPlurals) {
for (const [singular, plural] of Object.entries(options.irregularPlurals)) {
pluralize.addIrregularRule(singular, plural);
}
}
return pluralize(snakeCaseWithCompoundWords);
}
return snakeCaseWithCompoundWords;
}

@@ -9,2 +9,4 @@ import { z } from 'zod';

trimPrefix: z.string().optional(),
pluralize: z.boolean().optional(),
irregularPlurals: z.record(z.string()).optional(),
})

@@ -61,2 +63,20 @@ .strict()

*
*
* @example { pluralize: true }
* // good
* model UserRole {
* id String @id
* @@map(name: "user_roles")
* }
*
* // bad
* model UserRole {
* id String @id
* }
*
* model UserRole {
* id String @id
* @@map(name: "user_role")
* }
*
*/

@@ -69,2 +89,4 @@ export default {

const trimPrefix = config?.trimPrefix ?? '';
const shouldPluralize = config?.pluralize ?? false;
const irregularPlurals = config?.irregularPlurals ?? {};
return {

@@ -93,2 +115,4 @@ Model: (model) => {

trimPrefix,
pluralize: shouldPluralize,
irregularPlurals,
});

@@ -95,0 +119,0 @@ if (mappedName !== expectedSnakeCase) {

10

package.json
{
"name": "prisma-lint",
"version": "0.0.20",
"version": "0.0.21",
"description": "A linter for Prisma schema files.",

@@ -49,3 +49,3 @@ "repository": {

"@types/node": "^20.2.5",
"@types/pluralize": "^0.0.30",
"@types/pluralize": "^0.0.32",
"@typescript-eslint/eslint-plugin": "^6.1.0",

@@ -61,8 +61,8 @@ "@typescript-eslint/parser": "^6.0.0",

"jest": "^29.3.1",
"lint-staged": "^14.0.0",
"prettier": "3.0.1",
"lint-staged": "^15.0.1",
"prettier": "3.0.3",
"ts-jest": "^29.1.0",
"typescript": "^5.0.4"
},
"packageManager": "yarn@3.3.1"
"packageManager": "yarn@4.0.1"
}

@@ -106,1 +106,5 @@ # prisma-lint

Omitting `revisionNumber` and `revisionCreatedAt` fields from this model will not result in a violation. Other required fields remain required.
## Contributing
Pull requests are welcome. Please see [DEVELOPMENT.md](./DEVELOPMENT.md).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc