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.1.0 to 0.1.1

25

dist/index.js

@@ -103,13 +103,16 @@ "use strict";

fix: function (fixer) {
const imports = openResolvers.map(r => r.type.replace('[', '').replace(']', ''));
const multiImports = openResolvers
const importNode = context
.getSourceCode()
.ast.body.find(i => i.type === 'ImportDeclaration' &&
i.source.value.split('/').pop() ===
'nestjs-graphql');
const existingImports = importNode.specifiers.map(i => i.imported.name);
const entityImports = openResolvers.map(r => r.type.replace('[', '').replace(']', ''));
const findManyImports = openResolvers
.filter(i => -1 !== i.type.indexOf('['))
.map(r => r.type.replace('[', '').replace(']', ''));
const importFix = fixer.insertTextBefore(decorator, `import {
${imports.join(', ')},
${multiImports
.map(i => 'FindMany' + i + 'Args, ')
.join('')}
} from '@prisma/client/nestjs-graphql'
`);
.map(r => r.type.replace('[', '').replace(']', ''))
.map(i => 'FindMany' + i + 'Args');
const newImports = [...entityImports, ...findManyImports];
const missingImports = newImports.filter(ni => !existingImports.includes(ni));
const importFixer = fixer.insertTextAfter(importNode.specifiers.pop(), missingImports.map(i => '\n,' + i).join(''));
const txt = `\n\n\n // FIELDRESOLVERS \n` +

@@ -134,3 +137,3 @@ openResolvers

const resolverFix = fixer.insertTextAfter(classNode.body.body.find(b => b.key.name === 'constructor'), txt);
return [importFix, resolverFix];
return [importFixer, resolverFix];
},

@@ -137,0 +140,0 @@ });

{
"name": "eslint-plugin-prisma-nestjs-graphql",
"version": "0.1.0",
"version": "0.1.1",
"description": "eslint plugin for prisma & nestjs & graphql setups to not forget resolvers etc.",

@@ -22,3 +22,3 @@ "main": "./dist/index.js",

"@typescript-eslint/eslint-plugin": "^5.6.0",
"@typescript-eslint/parser": "^5.6.0",
"@typescript-eslint/parser": "^5.10.0",
"@typescript-eslint/typescript-estree": "^5.6.0",

@@ -25,0 +25,0 @@ "fs": "^0.0.1-security",

@@ -30,4 +30,2 @@ # eslint-plugin-prisma-nestjs-graphql

- Imports are added automatically (and naively) => if an import in a resolver file already exists before linting and the same one gets added by the linter => it will exist twice => error
- Just delete the second (generated) import.
- Paths are inflexible

@@ -34,0 +32,0 @@ - Will hopefully be adressed in the future

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