eslint-plugin-nestjs-orm
TypeScript icon, indicating that this package has built-in type declarations

0.2.5 • Public • Published

eslint-plugin-nestjs-orm

npm-badge GitHub stars npm

Guardrails to prevent bad practices or do some serious mistakes when using NestJS Moongose or ORMs.

Motivation 💡

No one likes unused variables, and we remove them. But with Mongoose there is a catch, if you attach inject model to non-model variable accidentally, you will get no error, but you will get a bug. This plugin will help you to avoid this.

One such incident is shown below:

Before After
Before After

Installation 🛠️

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-nestjs-orm:

npm install eslint-plugin-nestjs-orm --save-dev

Usage 🚀

Add nestjs-orm to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "nestjs-orm"
    ]
}

Then configure the rules you want to use under the rules section.

{
    "rules": {
        "nestjs-orm/mongoose-no-bad-model-injection": "error"
    }
}

Tools Used 💪🏻

Package Sidebar

Install

npm i eslint-plugin-nestjs-orm

Weekly Downloads

1

Version

0.2.5

License

ISC

Unpacked Size

7.95 kB

Total Files

6

Last publish

Collaborators

  • aashutoshrathi