Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

箭头函数中 return 不带参数时导致 fecs 检查报错 #349

Open
Sheetaa opened this issue Apr 30, 2019 · 0 comments
Open

箭头函数中 return 不带参数时导致 fecs 检查报错 #349

Sheetaa opened this issue Apr 30, 2019 · 0 comments

Comments

@Sheetaa
Copy link

Sheetaa commented Apr 30, 2019

报错信息:

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)

引发出错的代码片段:

err => {
    return;
}

分析:

if (asNeeded && firstNode && firstNode.type === 'ReturnStatement') {
     if (!needMaps[firstNode.argument.type]) {
          report(node);
     }
}

firstNode.argument 为 null 导致,应该需要提前判断一下吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant