eslint Parsing error: Unexpected token up in migration.js
eslint Parsing error: Unexpected token up in migration.js
在我之前的项目中,我使用此语法迁移到 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 错误:
[eslint] Parsing error: Unexpected token up
(method) up(db: any): Promise<void>
我做错了什么?感谢您的帮助。
eslintrc.js/
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"ecmaVersion": 2017,
"sourceType": "module"
},
在我之前的项目中,我使用此语法迁移到 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 错误:
[eslint] Parsing error: Unexpected token up
(method) up(db: any): Promise<void>
我做错了什么?感谢您的帮助。
eslintrc.js/
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"ecmaVersion": 2017,
"sourceType": "module"
},