2

我试图将 pinterest-linter 添加到我的项目中,但是当我arc lint.

 ARGV  '/Users/lushali/somewhere/arcanist/bin/../scripts/arcanist.php' 'lint' '--trace'
 LOAD  Loaded "phutil" from "/Users/lushali/somewhere/libphutil/src".
 LOAD  Loaded "arcanist" from "/Users/lushali/somewhere/arcanist/src".
Config: Reading user configuration file "/Users/lushali/.arcrc"...
Config: Did not find system configuration at "/etc/arcconfig".
Working Copy: Reading .arcconfig from "/Users/lushali/code/nexus_admin/.arcconfig".
Working Copy: Path "/Users/lushali/code/nexus_admin" is part of `git` working copy "/Users/lushali/code/nexus_admin".
Working Copy: Project root is at "/Users/lushali/code/nexus_admin".
Config: Did not find local configuration at "/Users/lushali/code/nexus_admin/.git/arc/config".
Loading phutil library from 'pinterest-linters'...
>>> [0] (+0) <exec> $ git rev-parse --verify HEAD^
<<< [0] (+10) <exec> 10,455 us
>>> [1] (+10) <exec> $ git rev-parse --abbrev-ref --symbolic-full-name '@{upstream}'
<<< [1] (+20) <exec> 9,782 us
>>> [2] (+20) <exec> $ git cat-file -t 'origin/master'
<<< [2] (+34) <exec> 13,470 us
>>> [3] (+34) <exec> $ git merge-base 'origin/master' HEAD
<<< [3] (+46) <exec> 11,523 us
>>> [4] (+46) <exec> $ git diff --no-ext-diff --no-textconv --submodule=short --raw '1bba3081e23c945b3f795eedc73b99e3f509b5ed' HEAD --
<<< [4] (+59) <exec> 12,633 us
>>> [5] (+59) <exec> $ git --version
<<< [5] (+71) <exec> 11,867 us
>>> [6] (+71) <exec> $ git status --porcelain=2 -z
<<< [6] (+88) <exec> 16,486 us
>>> [7] (+88) <exec> $ git diff --no-ext-diff --no-textconv --submodule=short --no-color --src-prefix=a/ --dst-prefix=b/ -U32767 -M -C '1bba3081e23c945b3f795eedc73b99e3f509b5ed' --
<<< [7] (+120) <exec> 31,626 us
Examining paths for linter 'spelling'.
Found 6 matching paths for linter 'spelling'.
Examining paths for linter 'generated'.
Found 6 matching paths for linter 'generated'.
Examining paths for linter 'merge-conflict'.
Found 6 matching paths for linter 'merge-conflict'.
Examining paths for linter 'general-text'.
Found 4 matching paths for linter 'general-text'.
Examining paths for linter 'json'.
Found 4 matching paths for linter 'json'.

[2019-06-03 22:05:07] EXCEPTION: (PhutilProxyException) Error in parsing '.arclint' file, in key 'bin' for linter 'prettier-eslint'. {>} (Exception) None of the configured binaries can be located. at [<arcanist>/src/lint/linter/ArcanistExternalLinter.php:543]
arcanist(head=master, ref.master=7329bc7c32b9), phutil(head=master, ref.master=86ee6e90797c), pinterest-linters(head=master, ref.master=3628e14b6f57)
  #0 <#2> ArcanistExternalLinter::setLinterConfigurationValue(string, string) called at [<pinterest-linters>/src/PrettierESLintLinter.php:114]
  #1 <#2> PrettierESLintLinter::setLinterConfigurationValue(string, string) called at [<arcanist>/src/lint/engine/ArcanistConfigurationDrivenLintEngine.php:103]
  #2 ArcanistConfigurationDrivenLintEngine::buildLinters() called at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:166]
  #3 ArcanistLintEngine::run() called at [<arcanist>/src/workflow/ArcanistLintWorkflow.php:337]
  #4 ArcanistLintWorkflow::run() called at [<arcanist>/scripts/arcanist.php:394]

我按照 github 的说明进行操作(https://github.com/pinterest/arcanist-linters#global-installation

这是我的.arcconfig文件:

{
  "phabricator.uri" : "https://code.XXXXX.com/",
  "load": [
    "pinterest-linters"
  ]
}

.bin/prettier-eslint我在我的node_modules文件夹中找不到。我认为 Arcanist 加载模块时可能有问题。我花了很多时间在网上搜索,但没有任何有用的东西。有人可以帮忙吗?非常感谢!

4

1 回答 1

0

根据您的错误消息,我认为您需要.arclint在添加pinterest-linters到文件的基础上创建一个.arcconfig文件。例如,和的.arclint文件看起来像这样:prettiereslint

{
  "linters": {
    "eslint": {
      "type": "eslint",
      "include": ["(\\.js$)", "(\\.jsx$)"],
      "bin": "./node_modules/.bin/eslint",
      "eslint.config": ".eslintrc",
      "eslint.env": "browser,node"
    },
    "prettier": {
      "type": "prettier",
      "include": ["(\\.js$)", "(\\.jsx$)"],
      "bin": "./node_modules/.bin/prettier",
      "prettier.cwd": "./"
    }
  }
}

但是,您的错误消息可能会有所不同,因为您使用prettier-eslint.

于 2019-08-20T22:43:35.663 回答