在上一个项目中,我使用以下语法迁移到mongoDB:
my_migration.js //
'use strict';
import slug from 'slugify';
module.exports = {
async up(db) {
const categories = [
{
title: 'football',
slug: slug('football'),
createdAt: new Date().getTime(),
updatedAt: new Date().getTime()
},
];
await db.collection('categories').insertMany(categories);
}
};
它有效,但是另一个项目(Nextjs,Reactjs,Nodejs)却出现错误:
[eslint] Parsing error: Unexpected token up
(method) up(db: any): Promise<void>
我在做什么不正确?感谢您的帮助。
答案 0 :(得分:0)
eslintrc.js/
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"ecmaVersion": 2017,
"sourceType": "module"
},