【发布时间】:2021-04-12 20:33:28
【问题描述】:
几个月前我用firebase创建了一个云功能项目,并使用了linting。
我最近使用 linting 创建了一个新的云函数项目,现在 linter 抱怨我从未设置的随机规则。我不记得它在几个月前执行了几乎数量的样式规则。
类似的东西:
This line has a length of 95. Maximum allowed is 80
Missing JSDoc comment
Missing Trailing comma
expected indentation of 2 spaces but found 4
Strings must use singlequote
它也不让我使用 async/await。
我发现我可以在我的 .eslintrc.js 文件中单独设置这些规则,但这很烦人,我不想这样做。默认情况下,为什么不禁用这些规则?我只想要确保我的代码在运行时不会失败的基本规则,而不是像单引号/双引号和最大行长这样的随机样式偏好。
有什么方法可以将基本的 linting 功能与 firebase 函数一起使用?
【问题讨论】:
-
它们在 9.1.1 中确实发生了变化,但您可以随意设置 rules - 请务必阅读该文档。您必须自己决定“基本 linting 功能”的实际含义。但是没有 linter 会告诉你你的代码是否绝对不会失败。您必须运行它才能找到答案。
标签: firebase google-cloud-functions eslint