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.25 to 0.0.26

26

dist/rules/field-name-mapping-snake-case.js

@@ -54,9 +54,14 @@ import { z } from 'zod';

Field: (model, field) => {
if (allowedToHaveNoMapping(field)) {
if (isAssociation(field.fieldType)) {
return;
}
// A helper function to report a problem with the field.
const report = (message) => context.report({ model, field, message });
const { attributes } = field;
const { name, attributes } = field;
const expectedSnakeCase = toSnakeCase(name, { compoundWords });
const isMappingRequired = !isAllLowerCase(name);
if (!attributes) {
report('Field name must be mapped to snake case.');
if (isMappingRequired) {
report('Field name must be mapped to snake case.');
}
return;

@@ -66,3 +71,5 @@ }

if (!mapAttribute || !mapAttribute.args) {
report('Field name must be mapped to snake case.');
if (isMappingRequired) {
report('Field name must be mapped to snake case.');
}
return;

@@ -72,9 +79,7 @@ }

if (!mappedName) {
report('Field name must be mapped to snake case.');
if (isMappingRequired) {
report('Field name must be mapped to snake case.');
}
return;
}
const fieldName = field.name;
const expectedSnakeCase = toSnakeCase(fieldName, {
compoundWords,
});
if (mappedName !== expectedSnakeCase) {

@@ -97,5 +102,2 @@ report(`Field name must be mapped to "${expectedSnakeCase}".`);

}
export function allowedToHaveNoMapping(field) {
return isAllLowerCase(field.name) || isAssociation(field.fieldType);
}
function isAssociation(fieldType) {

@@ -102,0 +104,0 @@ if (typeof fieldType != 'string') {

import { z } from 'zod';
const RULE_NAME = 'forbid-required-ignored-field';
const Config = z.object({}).strict();
const Config = z.object({}).strict().optional();
/**

@@ -21,9 +21,2 @@ * Forbids required ignored fields without default values.

*
* // bad
* type Product {
* uuid String
* toBeRemoved String @ignore
* }
*
* @example
* // good

@@ -38,3 +31,3 @@ * type Product {

* uuid String
* toBeRemoved Boolean @ignore
* toBeRemoved String @ignore
* }

@@ -41,0 +34,0 @@ */

{
"name": "prisma-lint",
"version": "0.0.25",
"version": "0.0.26",
"description": "A linter for Prisma schema files.",

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

"lint-staged": "^15.0.1",
"prettier": "3.1.0",
"prettier": "3.1.1",
"ts-jest": "^29.1.0",

@@ -64,0 +64,0 @@ "typescript": "^5.0.4"

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