问题描述:
在 Vue-cli 创建的项目中,使用了 ESLint 规范代码的项目中
如何针对单个 js 文件禁用 ESLint 语法校验,但整个项目依然保留 ESLint 的校验规则?
解决方案:
在代码顶部添加一行注释
/* eslint-disable */
ESLint 在校验的时候就会跳过后面的代码
还可以在注释后加入详细规则,这样就能避开指定的校验规则了
/* eslint-disable no-new */
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUgAAACtCAIAAABdiHHhAAAQ1klEQVR4nO2dTWsbSR6H/REWqg/DEmbXWkPGIbbxGDZoEFkkDDYxkYhNXuSAFBgT7D4ku8RDHBxinzI5xfJhfUqOGee4Bn2Lca76KtJxD9Xdqq73lvpNld+DDnar1FVd6qf/9dKqnvM87+HDhx4AwCHmPIgNgHNAbAAcBGID4CAQGwAHgdgAOAjEBsBBIDYADgKxAXAQiA2Ag0BsABxkKrHJfG273d2uVvjtpFJrdTeWyLSlm6BIS5vd3WfRS1+GSnWnu/tMLH/+qGrSy6yQhKxsKHIMEiSpSWCDvRea88GSycWmZ4a0lGS+tt2qVUgBp0JlPqiL5fVuR1sGWsud9s7GUvFiV6o7nfbmslDa7ApJljalOY6LZF2TwBJLLzRm2TO52Mvr3c76SqxAS5t0y/J6cLFZXi8obpvC0fSoVJyAwN54ZWaKfY451KTzJPVCNGsCJhRbvN4TUqlVV5bXu2Vov5GlzU57pzafVe7pnu603ZVnXdnnmHVNOk9SL4wtKUsmEZuQlQ3Fl03P+O7us4kvObRLSV/iTqL9BwkUDRtV65HdeXf3mXjKRnE4SsmmoYGO3UP0SiQ5u59Oq7YcD/7GQtrUA1dUribDw4wVI1FNikVN+o3rq1p6FEmvfTZZqI6Ca9SwFzha+YmO19ILjVlJSSw2PWDpeRz1DSa76tAwMq5KYfygUt0RNVPJLx+ICvuN0s8Gh7a+GeXLF4lUKvPEm66xRAelouLRs4rdm76QnkU98AmWNlkrIlvGZ6pyEFRZk8Yvy1AJpqoWi00ryt5tqyzUR8Eee2ByeEpXqjuJBh0svdCYNQ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