A
A
Alexey2020-08-15 12:52:12
Linter
Alexey, 2020-08-15 12:52:12

How to get rid of the error that ESLint throws on private class properties?

Installed @babel/eslint-parser and @babel/eslint-plugin plugin in webpack. When using private class properties, ESLint throws an error. What needs to be done so that the linter correctly processes private properties

Cannot read property 'type' of undefined

Config ESLint

{
  "parser": "@babel/eslint-parser",
  "plugins": ["@babel"],
  "env": {
    "es6": true,
    "browser": true,
    "node": true
  },
  "parserOptions": {
    "ecmaVersion": 2020,
    "sourceType": "module",
    "ecmaFeatures": {
      "impliedStrict": true,
      "allowImportExportEverywhere": true
    }
  },
  "extends": ["eslint:recommended", "google"],
  "rules": {
    "new-cap": "off",
    "no-invalid-this": "off",
    "no-unused-expressions": "off",
    "object-curly-spacing": "off",
    "semi": "off",
    "@babel/new-cap": "error",
    "@babel/no-invalid-this": "error",
    "@babel/no-unused-expressions": "error",
    "@babel/object-curly-spacing": "error",
    "@babel/semi": "error",
    "require-jsdoc": "off",
    "no-multi-spaces": "off",
    "operator-linebreak": ["error", "before"],
    "max-len": "off",
    "no-undef": "off",
    "no-unused-vars": ["error", { "vars": "local" }],
    "no-trailing-spaces": ["error", {"skipBlankLines": true}]
  }
}


.babelrc config

{
  "presets": [
    "@babel/preset-env"
  ],
  "plugins": [
    "@babel/plugin-proposal-pконфrivate-methods",
    "@babel/plugin-proposal-class-properties"
  ]
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question