代码{ display: 'block',}
带有逗号逗号
我的babel配置文件
const parserOption = {
sourceType: 'module',
presets: ['typescript', ['env', { targets: { node: true }} ]],
plugins: ['jsx', '@babel/plugin-syntax-object-rest-spread', 'syntax-trailing-function-commas']
}
module.exports = parserOption
测试用例
// babel 7
const parse = require('@babel/parser').parse
parse("{ display: 'block',}", parserOption)