eslint-plugin-payfit
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -61,7 +61,6 @@ /** | ||
fix: (fixer) => { | ||
const sourceCode = context.getSourceCode() | ||
const fixedText = sourceCode | ||
.getText(node) | ||
.split(':') | ||
.join(': new') | ||
const text = context.getSourceCode().getText(node) | ||
const fixedText = text | ||
.split(': ObjectId') | ||
.join(': new ObjectId') | ||
return fixer.replaceText(node, fixedText) | ||
@@ -68,0 +67,0 @@ }, |
{ | ||
"name": "eslint-plugin-payfit", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "eslint-payfit-plugin", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -34,3 +34,3 @@ /** | ||
{ | ||
code: 'var invalid = { id: ObjectId() }', | ||
code: 'var invalid = { id: ObjectId(), createdAt: Date(), companyId: ObjectId() }', | ||
errors: [ | ||
@@ -41,6 +41,10 @@ { | ||
}, | ||
{ | ||
message: 'Mongo ObjectId must be used with "new" keyword.', | ||
type: 'VariableDeclarator', | ||
}, | ||
], | ||
output: 'var invalid = { id: new ObjectId() }', | ||
output: 'var invalid = { id: new ObjectId(), createdAt: Date(), companyId: new ObjectId() }', | ||
}, | ||
], | ||
}) |
7290
128