eslint-plugin-objectid-compare v2.0.4
eslint-plugin-objectid-compare
Comparing ObjectId from mongodb module
Installation
You'll first need to install ESLint:
npm i eslint --save-devNext, install eslint-plugin-objectid-compare:
npm install eslint-plugin-objectid-compare --save-devUsage
Add objectid-compare to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
{
"plugins": [
"objectid-compare"
]
}Also this plugin required parser options, so please add in your .eslintrc configuration file:
{
"parserOptions": {
"project": ["path/to/your/tsconfig/file"]
},
}Then configure the rules you want to use under the rules section.
{
"rules": {
"objectid-compare/rule-name": "warn"
}
}For currently supported rule:
{
"rules": {
"objectid-compare/objectid-compare": "warn"
}
}Supported Rules
- objectid-compare
Usage - Examples
When comparation sign '===' is used, and both sides are type of ObjectId, or can be ObjectId, warning will be shown.
Example 1:
Example 2:

Author Info
- LinkedIn - @almedin
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago