报错信息:
TypeError: Cannot read property 'type' of null(~/lib/js/rules/arrow-body-style.js). (syntax)
TypeError: Cannot read property 'type' of null
at validate (/Users/xxx/xxx/fecs/lib/js/rules/arrow-body-style.js:77:54)
引发出错的代码片段:
分析:
if (asNeeded && firstNode && firstNode.type === 'ReturnStatement') {
if (!needMaps[firstNode.argument.type]) {
report(node);
}
}
firstNode.argument 为 null 导致,应该需要提前判断一下吧
报错信息:
引发出错的代码片段:
分析:
firstNode.argument 为 null 导致,应该需要提前判断一下吧