为什么 WebIde 显示错误提示和 console.log?
Why WebIde shows error for alert and console.log?
我用的是SAPUI5开发的WebIde。
如果我写 console.log
或 alert
它会在编辑器内部显示意外警报等错误。
虽然代码可以运行,但我不想在编辑器中看到这些错误。
如何自定义 WebIde 以不显示此类错误。
虽然不鼓励在代码中使用console.log
和alert
语句,因为
[...] such messages are considered to be for debugging purposes and therefore not suitable to ship to the client [...]
http://eslint.org/docs/rules/no-console
和
[...] JavaScripts’ alert, confirm, and prompt functions are widely considered to be obtrusive as UI elements and should be replaced by a more appropriate custom UI implementation [...]
http://eslint.org/docs/rules/no-alert
您可以将 Linter 配置为绕过这些检查(尽管我 不 建议这样做)
但请记住,这些检查并非特定于 SAPUI5 或 Web IDE,而是针对每个 Javascript 项目!
无论如何,由于 Web IDE 使用 ESLint,要禁用检查,请在受影响的 Javascript 文件顶部添加以下内容:
/*eslint-disable no-console, no-alert */
我用的是SAPUI5开发的WebIde。
如果我写 console.log
或 alert
它会在编辑器内部显示意外警报等错误。
虽然代码可以运行,但我不想在编辑器中看到这些错误。
如何自定义 WebIde 以不显示此类错误。
虽然不鼓励在代码中使用console.log
和alert
语句,因为
[...] such messages are considered to be for debugging purposes and therefore not suitable to ship to the client [...]
http://eslint.org/docs/rules/no-console
和
[...] JavaScripts’ alert, confirm, and prompt functions are widely considered to be obtrusive as UI elements and should be replaced by a more appropriate custom UI implementation [...]
http://eslint.org/docs/rules/no-alert
您可以将 Linter 配置为绕过这些检查(尽管我 不 建议这样做)
但请记住,这些检查并非特定于 SAPUI5 或 Web IDE,而是针对每个 Javascript 项目!
无论如何,由于 Web IDE 使用 ESLint,要禁用检查,请在受影响的 Javascript 文件顶部添加以下内容:
/*eslint-disable no-console, no-alert */