【问题标题】:How to fix Lint problems with --fix in Firebase Functions如何在 Firebase 函数中使用 --fix 修复 Lint 问题
【发布时间】:2021-09-09 09:23:27
【问题描述】:

我有一个具有很多 Lint 问题的 firebase 函数代码。如何使用 --fix 修复这些问题。它显示在错误消息的末尾。

firebase 部署

/Users/xxx/firebase/functions/index.js
  16:1   error  Unexpected tab character                             no-tabs
  16:1   error  Expected indentation of 6 spaces but found 1 tab     indent
  .....
  69:1   error  Unexpected tab character                             no-tabs
  69:1   error  Expected indentation of 6 spaces but found 1 tab     indent
  69:5   error  Trailing spaces not allowed                          no-trailing-spaces
  69:5   error  Block must not be padded by blank lines              padded-blocks
  71:1   error  Trailing spaces not allowed                          no-trailing-spaces

✖ 157 problems (157 errors, 0 warnings)
  45 errors and 0 warnings potentially fixable with the `--fix` option.

【问题讨论】:

    标签: node.js firebase npm google-cloud-functions lint


    【解决方案1】:

    错误信息可能来自 eslint。可以直接运行 eslint:

    $ (cd functions && npx eslint . --fix)
    # or
    $ (cd functions && node_modules/eslint/bin/eslint.js . --fix)
    

    【讨论】:

    • 会修复它吗?
    • 它将修复 eslint 可以自动修复的问题。试一试。
    猜你喜欢
    • 2021-02-05
    • 2023-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-18
    • 2019-06-07
    • 2018-12-15
    • 1970-01-01
    相关资源
    最近更新 更多