我的项目中有一个模板文件,在运行 eslint 时我遇到了各种问题。其中一些是 -
error Parsing error: Unexpected token !
error Parsing error: Unexpected token <
为了克服这个问题,我尝试使用 eslint-plugin-ejs
没有帮助。我也访问过下面的链接 -
Turning off eslint rule for a specific file
ESLint Parsing error: Unexpected token
Mysterious ESLint Parsing Error
还有很多,但还是没有运气。现在我只想将此文件从 eslint 中排除,但找不到方法。任何帮助将不胜感激。
最佳答案
作为documentation说。
您可以使用inline configuration /*eslint-disable*/
和 /*eslint-enable*/
。
@EDIT对于您在评论中所说的内容,有两种解决方案
1 您可以使用属性excludedFiles
,我在文档中找到了一个示例:
2 您可以按照 here 中所述的特定方式处理 HTML
和 EJS
文件。
3 您还可以使用 .eslintignore
文件,如 Ignoring Files and Directories 中所述。
关于node.js - 为 .ejs 文件禁用 eslint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47575167/