【问题标题】:eslint-plugin-angular TypeError: Cannot read property 'johnpapa' of undefinedeslint-plugin-angular TypeError:无法读取未定义的属性“johnpapa”
【发布时间】:2018-01-03 01:22:33
【问题描述】:

我已经在全球范围内安装了eslint-plugin-angular

例如: npm install -g eslint npm install -g eslint-plugin-angular

根据http://eslint.org/docs/user-guide/configuring,使用 .json 文件是一种选择。

这是我的.eslintrc.json 文件。

json { "env" : { "browser": true, "jquery": true }, "plugins": [ "angular" ], "extends": [ "eslint:recommended", "plugin:angular/johnpapa" ], "rules": { "semi": ["error", "always"] } }

我遇到的主要错误是: TypeError: Cannot read property 'johnpapa' of undefined

查看文档:https://github.com/Gillespie59/eslint-plugin-angular#usage-without-shareable-config

我不明白为什么plugin:angular/johnpapa 不起作用。你必须使用 .yml 吗?

【问题讨论】:

    标签: eslint


    【解决方案1】:

    请查看下面更改的.eslintrc.json

    {
      "env": {
        "browser": true,
        "es6": true
      },
      "globals": {
        "angular": true,
        "require": true
      },
      "parserOptions": {
        "sourceType": "module"
      },
      "extends": [
        "eslint:recommended",
        "plugin:angular/johnpapa"
      ],
      "rules": { /* rules here */ }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-11-29
      • 2018-10-29
      • 2021-07-21
      • 2018-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多