Переменная ESLint определена, но никогда не используется (no-unsed-vars) - PullRequest
0 голосов
/ 29 августа 2018

Я настроил ESLint и проверил его в течение нескольких дней, и меня что-то беспокоило.

Я получаю сообщение об ошибке: 'Book' is defined but never used. (no-unused-vars)

class Book extends REST {
  sayHi() {
    return `Hi! I am the book ${this.title}. I was written in ${this.year} by ${this.author}!`;
  }
}

В этом случае Book получает ошибку. В другом файле это REST, который получает ту же ошибку. Они определены и используются .. Я не понимаю, что я делаю неправильно. Я бы лучше не выключал no-unused-vars.

Это .eslintrc.json, где у меня есть все мои правила:

{
"env": {
    "browser": true,
    "node": true
},
"extends": "recommended",
"parserOptions": {
    "ecmaVersion": 6,
    "sourceType": "module",
    "ecmaFeatures": {
        "modules": true,
        "experimentalObjectRestSpread": true
    }
},
"rules": {
    "no-restricted-syntax": 0,
    "no-param-reassign": 0,
    "no-return-await": 0,
    "no-underscore-dangle": 0,
    "prefer-template": 0,
    "no-undef": "off",
    "spaced-comment": 0,
    "no-trailing-spaces": 0,
    "no-undefined": 0,
    "space-before-blocks": 0,
    "comma-dangle": 0,
    "no-tabs": 0,
    "no-mixed-spaces-and-tabs": 0,
    "indent": 0,
    "linebreak-style": 0,
    "avoidEscape": true,
    "prefer-const": 0,
    "no-console": 0,
    "getter-return": 1,
    "no-compare-neg-zero": 0,
    "no-constant-condition": 0,
    "no-control-regex": 0,
    "no-empty": 1,
    "no-extra-parens": 1,
    "no-extra-semi": 1,
    "no-inner-declarations": 0,
    "class-methods-use-this": 1,
    "guard-for-in": 0,
    "eqeqeq": 1,
    "dot-notation": 1,
    "no-empty-function": 1,
    "no-empty-pattern": 0,
    "no-eval": 0,
    "no-multi-spaces": 1
  }
}

Я видел, как эта проблема всплывала в Интернете, когда я пытался найти решение в Google, но я не могу найти подходящее для меня. Кто-нибудь есть идеи, что случилось?

...