Gedewon / eslint-plugin-mongoidcompare

MongoDB is a popular NoSQL database. The primary key for each record (in javascript/typescript) is an ObjectId, a javascript object. However, this has one major unexpected behavior:

Home Page:https://www.npmjs.com/package/eslint-plugin-mongoidcompare

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

eslint-plugin-mongoidcompare

NPM

Custom eslint rules

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Since We have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project"

{
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "project": "./tsconfig.json"
  },
}

Next, install eslint-plugin-mongoidcompare:

$ npm install eslint-plugin-mongoidcompare --save-dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-mongoidcompare globally.

Usage

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

{
    "plugins": [
        "mongoidcompare"
    ]
}

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

{
    "rules": {
        "mongoidcompare/no-triple-equality-check": 2
    }
}

Supported Rules

Take a look at doc.md to see when we would want to use this linting rule.

Future Work

implement fix a function that applies a fix to resolve the problem.

About

MongoDB is a popular NoSQL database. The primary key for each record (in javascript/typescript) is an ObjectId, a javascript object. However, this has one major unexpected behavior:

https://www.npmjs.com/package/eslint-plugin-mongoidcompare

License:MIT License


Languages

Language:TypeScript 94.3%Language:JavaScript 5.7%