xo lint error:`document` is not defined
问题描述:
我一直是Standard的长期用户,现在我正在开发一个新项目,我被要求开始编写分号。xo lint error:`document` is not defined
我试图同时使用XO,巴贝尔和反应,但是当我尝试皮棉我的代码,我不断收到一个错误: document is not defined. no-undef
我尝试添加在env
选项给xo
场我的package.json文件,但没有成功。
我xo
配置:
"xo": {
"esnext": true,
"extends": "xo-react",
"space": true,
"rules": {
"react/jsx-space-before-closing": 0
}
}
答
你必须ESLint定义全局。有两种方法可以做到这一点,首先在你的代码中的注释:
/* global document */
或者您也可以在配置文件中像这样配置:
{ "globals": { "var1": true, "var2": false } }
更多
见 ESLint docs