No restricted globals

2020-05-13 04:11发布

I am using React and Redux to develop a webapp and when I started up my project I got this:

Line 13:  Unexpected use of 'location'  no-restricted-globals

Search for the keywords to learn more about each error.

I search a lot about how to resolve it, but none of the answers I found helped me, so I turned to Stack overflow.

Does anyone know how to fix this error? I appreciate all the help I can get.

3条回答
来,给爷笑一个
2楼-- · 2020-05-13 04:19
/* eslint no-restricted-globals:0 */

is another alternate approach

查看更多
Deceive 欺骗
3楼-- · 2020-05-13 04:21

This is a simple and maybe not the best solution, but it works.

On the line above the line you get your error, paste this:

// eslint-disable-next-line no-restricted-globals

查看更多
甜甜的少女心
4楼-- · 2020-05-13 04:36

Try adding window before location (i.e. window.location).

查看更多
登录 后发表回答