简体   繁体   English

firebase 函数和想法的 eslint 问题

[英]eslint problem with firebase functions and idea

I reinstalled Intellij Idea and opened my vuejs/firebase project.我重新安装了 Intellij Idea 并打开了我的 vuejs/firebase 项目。 I am able to see eslint notifications in IDE editor but inside functions directory in any js file I don't see any notifications.我可以在 IDE 编辑器中看到 eslint 通知,但在任何 js 文件的函数目录中我看不到任何通知。 But when I try to deploy firebase --only functions I see lots of errors from prettier.但是当我尝试部署 firebase --only 函数时,我看到了很多来自 prettier 的错误。

Running command: npm --prefix "$RESOURCE_DIR" run lint运行命令: npm --prefix "$RESOURCE_DIR" run lint

functions@ lint /home/madcap/Projects/Alex/functions eslint .函数@ lint /home/madcap/Projects/Alex/functions eslint 。

/home/madcap/Projects/Alex/functions/index.js
  10:3   error  Delete `··`                                 prettier/prettier
  12:1   error  Delete `··`                                 prettier/prettier
  13:3   error  Delete `··`                                 prettier/prettier
  14:1   error  Replace `····` with `··`                    prettier/prettier
  15:1   error  Delete `··`                                 prettier/prettier
  16:1   error  Replace `····` with `··`                    prettier/prettier
  17:1   error  Delete `··`                                 prettier/prettier
  19:3   error  Delete `··`                                 prettier/prettier
  20:5   error  Delete `····`                               prettier/prettier
  21:1   error  Replace `············` with `······`        prettier/prettier
  22:1   error  Replace `········` with `····`              prettier/prettier
  23:1   error  Delete `····`                               prettier/prettier
  25:5   error  Delete `····`                               prettier/prettier
  26:1   error  Replace `············` with `······`        prettier/prettier
  27:1   error  Delete `········`                           prettier/prettier
  28:1   error  Replace `················` with `········`  prettier/prettier
  29:1   error  Replace `················` with `········`  prettier/prettier
  30:7   error  Delete `······`                             prettier/prettier
  31:5   error  Delete `····`                               prettier/prettier
  33:1   error  Replace `········` with `····`              prettier/prettier
  35:5   error  Delete `····`                               prettier/prettier
  36:1   error  Replace `········` with `····`              prettier/prettier
  37:1   error  Replace `············` with `······`        prettier/prettier
  38:7   error  Delete `······`                             prettier/prettier
  39:1   error  Replace `················` with `········`  prettier/prettier
  40:1   error  Delete `··········`                         prettier/prettier
  41:11  error  Delete `··········`                         prettier/prettier
  42:1   error  Replace `················` with `········`  prettier/prettier
  43:1   error  Replace `············` with `······`        prettier/prettier
  44:1   error  Replace `········` with `····`              prettier/prettier
  46:1   error  Delete `····`                               prettier/prettier
  48:5   error  Delete `····`                               prettier/prettier
  49:3   error  Delete `··`                                 prettier/prettier
  51:1   error  Replace `····` with `··`                    prettier/prettier
  52:1   error  Replace `········` with `····`              prettier/prettier
  53:1   error  Replace `············` with `······`        prettier/prettier
  54:1   error  Replace `············` with `······`        prettier/prettier
  55:7   error  Delete `······`                             prettier/prettier
  56:1   error  Delete `····`                               prettier/prettier
  57:5   error  Delete `····`                               prettier/prettier
  61:1   error  Delete `⏎··`                                prettier/prettier
  63:3   error  Delete `··`                                 prettier/prettier
  65:3   error  Delete `··`                                 prettier/prettier
  66:1   error  Delete `··`                                 prettier/prettier
  68:3   error  Delete `··`                                 prettier/prettier
  70:1   error  Delete `··`                                 prettier/prettier
  71:3   error  Delete `··`                                 prettier/prettier
  73:1   error  Replace `····` with `··`                    prettier/prettier
  74:1   error  Delete `··`                                 prettier/prettier
  76:3   error  Delete `··`                                 prettier/prettier
  77:2   error  Insert `⏎`                                  prettier/prettier

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

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ lint: `eslint .`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the functions@ lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/madcap/.npm/_logs/2020-02-18T02_50_25_483Z-debug.log

Error: functions predeploy error: Command terminated with non-zero exit code1

I've tried to reinstall firebase functions by deleting the folder and fully reinstall it with overwriting everything (firebase init functions).我试图通过删除文件夹来重新安装 firebase 函数,并通过覆盖所有内容(firebase init 函数)完全重新安装它。

I have .eslintrc.json file that has been created automatically我有自动创建的 .eslintrc.json 文件

I have "eslint": "^5.12.0", in dev dependencies of package.json我有 "eslint": "^5.12.0", 在 package.json 的开发依赖项中

I just don't know what happened我只是不知道发生了什么

The intellij eslint configuration is not properly configured to use the project's eslint file. intellij eslint 配置未正确配置为使用项目的 eslint 文件。 So it is using the default one that has a different setting for indetation spaces.所以它使用的是默认的,它对缩进空间有不同的设置。

Here you have the official guides to do it:在这里你有官方指南来做到这一点:

IntelliJ - How to configure prettier IntelliJ - 如何配置更漂亮

IntelliJ - How to configure eslint IntelliJ - 如何配置 eslint

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM