Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-prisma-nestjs-graphql

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-prisma-nestjs-graphql - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

37

dist/index.js

@@ -9,3 +9,11 @@ "use strict";

const entities = JSON.parse((0, fs_1.readFileSync)(`prisma/generated/json-schema.json`, 'utf-8'));
const scalars = ['string', 'float', 'integer', 'object', 'enum', 'boolean', 'number'];
const scalars = [
'string',
'float',
'integer',
'object',
'enum',
'boolean',
'number',
];
const prismaEntities = Object.entries(entities.definitions).map(e => ({

@@ -41,2 +49,5 @@ name: e[0],

}));
const args = (name, type) => {
return `@Args({ name: '${name}', nullable: true }) ${name}: ${type}OrderByInput,`;
};
module.exports = {

@@ -92,5 +103,11 @@ rules: {

fix: function (fixer) {
const importFix = fixer.insertTextBefore(decorator, `import {${openResolvers
.map(r => r.type.replace('[', '').replace(']', ''))
.join(', ')}} from '@prisma/client/nestjs-graphql'
const imports = openResolvers.map(r => r.type.replace('[', '').replace(']', ''));
const multiImports = openResolvers
.filter(i => -1 !== i.type.search('['))
.map(r => r.type.replace('[', '').replace(']', ''));
const importFix = fixer.insertTextBefore(decorator, `import {
${imports.join(', ')},
${multiImports.map(i => i + 'WhereInput').join(', ')},
${multiImports.map(i => i + 'OrderByInput').join(', ')},
} from '@prisma/client/nestjs-graphql'
`);

@@ -103,5 +120,11 @@ const txt = `\n\n\n // FIELDRESOLVERS \n` +

@ResolveField(() => ${r.type}, {
name: '${r.name}', ${isToManyRelation ? '' : '\n nullable: true,'}
name: '${r.name}',
${isToManyRelation ? '' : '\n nullable: true,'}
})
${r.name}(@Parent() ${(0, camelcase_1.default)(decoratorName)}: ${decoratorName}) {
${r.name}(@Parent() ${(0, camelcase_1.default)(decoratorName)}: ${decoratorName}, ${isToManyRelation
? args('where', r.type) +
', \n' +
args('orderBy', r.type)
: ''}
) {
return this.${(0, camelcase_1.default)(decoratorName)}Service

@@ -111,3 +134,3 @@ .findOne({

})
.${r.name}();
.${r.name}({ where });
}

@@ -114,0 +137,0 @@ `;

2

package.json
{
"name": "eslint-plugin-prisma-nestjs-graphql",
"version": "0.0.4",
"version": "0.0.5",
"description": "eslint plugin for prisma & nestjs & graphql setups to not forget resolvers etc.",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -14,2 +14,3 @@ # eslint-plugin-prisma-nestjs-graphql

- Install it: npm i -D eslint-plugin-prisma-nestjs-graphql
- It needs you to also use https://www.npmjs.com/package/prisma-json-schema-generator as generator for your prisma setup.

@@ -28,4 +29,2 @@ - The p will look for a file called `prisma/generated/json-schema.json` which should be generated by the prisma-json-schema-generator

- Your resolver files should reside in a folder
## Known issues

@@ -32,0 +31,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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