带有VSCode的Eslint插件找不到插件

时间:2019-10-16 12:44:43

标签: visual-studio-code eslint

使用eslint v5.16.0,我正在尝试使用经过改编的第三方插件,以允许我使用Django模板语言来编写javascript模板。

要复制我的情况,您可以执行以下操作(本质上是克隆一个仓库(我修改过),然后将其链接到npm中,显示在eslint config和vscode设置中所做的修改):

  1. cd ~/projects
  2. git clone https://github.com/alexkuz/eslint-plugin-jinja
  3. cd eslint-plugin-jinja
  4. sudo npm link
  5. cd ~/projects/myproj
  6. npm link eslint-plugin-jinja
  7. npm ls -g --depth=0 --link=true
/usr/local/lib
├── babel-core@6.26.3
├── clever-tools@1.4.2
├── UNMET PEER DEPENDENCY eslint@5.16.0
├── eslint-config-standard@13.0.1
├── eslint-plugin-import@2.18.1
├── eslint-plugin-jinja@0.1.0 -> /opt/stuff/projects/eslint-plugin-jinja
  1. nano ~/projects/myproj/.vscode/settings.json
...
    "eslint.autoFixOnSave": true,
    "eslint.enable": true,
    "eslint.options": {
        "configFile": "/opt/digglerz/projects/kapsule/.eslintrc.json",
        "useEslintrc": true
    },
    "eslint.run": "onSave",
    "eslint.validate": [
        "javascript",
        "html"
    ],
...
  1. nano ~/projects/myproj/.eslintrc.json
...
    "plugins": [
        "jinja"
    ]
...
  1. eslint --debug ~/projects/myproj/some-js.js
  eslint:cli-engine Processing /opt/digglerz/projects/kapsule/kapsule/static/kapsule/js/preview/simple/simple-preview.js +0ms
  eslint:cli-engine Linting /opt/digglerz/projects/kapsule/kapsule/static/kapsule/js/preview/simple/simple-preview.js +1ms
  eslint:config Constructing config file hierarchy for /opt/digglerz/projects/kapsule/kapsule/static/kapsule/js/preview/simple +0ms
  eslint:config Using .eslintrc and package.json files +0ms
  eslint:config Loading /opt/digglerz/projects/kapsule/.eslintrc.json +2ms
  eslint:config-file Loading JSON config file: /opt/digglerz/projects/kapsule/.eslintrc.json +0ms
  eslint:plugins Failed to load plugin eslint-plugin-jinja. +0ms

Oops! Something went wrong! :(

ESLint: 5.16.0.
ESLint couldn't find the plugin "eslint-plugin-jinja". This can happen for a couple different reasons:

1. If ESLint is installed globally, then make sure eslint-plugin-jinja is also installed globally. A globally-installed ESLint cannot find a locally-installed plugin.

2. If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

    npm i eslint-plugin-jinja@latest --save-dev

Path to ESLint package: /usr/local/lib/node_modules/eslint

If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

在我看来,我已经正确设置了链接,eslint config和.vscode / settings.json,为什么会看到此错误?

0 个答案:

没有答案