Eslint 和 SAPUI5:如何删除 "sap/$ not defined"?
Eslint & SAPUI5: How to remove "sap/$ not defined"?
我正在为我的 SAPUI5 项目使用可视化代码中的 Eslint。每当我使用
定义控制器时
sap.ui.define([...
Eslint 抛出错误 sap not defined.
。 $/jQuery 也是如此。有办法解决吗?
谢谢
您可以在 eslint 配置中将全局变量列入白名单:https://eslint.org/docs/user-guide/configuring(参见 "Specifying Globals")。
To configure global variables inside of a configuration file, use the
globals key and indicate the global variables you want to use. Set
each global variable name equal to true to allow the variable to be
overwritten or false to disallow overwriting. For example:
{
"globals": {
"var1": true,
"var2": false
}
}
通常你有某种 .eslintrc.js
文件,你可以在其中包含它。
这里有一个例子:https://github.com/pulseshift/openui5-gulp-starter-kit/blob/master/.eslintrc.js
我正在为我的 SAPUI5 项目使用可视化代码中的 Eslint。每当我使用
定义控制器时 sap.ui.define([...
Eslint 抛出错误 sap not defined.
。 $/jQuery 也是如此。有办法解决吗?
谢谢
您可以在 eslint 配置中将全局变量列入白名单:https://eslint.org/docs/user-guide/configuring(参见 "Specifying Globals")。
To configure global variables inside of a configuration file, use the globals key and indicate the global variables you want to use. Set each global variable name equal to true to allow the variable to be overwritten or false to disallow overwriting. For example:
{
"globals": {
"var1": true,
"var2": false
}
}
通常你有某种 .eslintrc.js
文件,你可以在其中包含它。
这里有一个例子:https://github.com/pulseshift/openui5-gulp-starter-kit/blob/master/.eslintrc.js