V
V
Vasaho2021-06-22 02:27:42
typescript
Vasaho, 2021-06-22 02:27:42

Why is @typescript-eslint/parser needed?

Explain why @typescript-eslint/parser is needed
I don’t understand why I need to specify it

{
  "root": true,
  "env": {
    "es2020": true,
    "jasmine": true,
    "jest": true,
    "node": true
  },
  "parserOptions": {
    "sourceType": "script",
    "ecmaVersion": 2020,
    "project": "./tsconfig.json",
    "ecmaFeatures": {
      "impliedStrict": true
    }
  },
  "settings": {
    "noInlineConfig": true,
    "import/resolver": {
      "node": {
        "extensions": [".js", ".jsx", ".ts", ".tsx"]
      }
    }
  },

  "extends": [
    "plugin:@typescript-eslint/recommended",
    "plugin:node/recommended",
    "plugin:prettier/recommended"
  ],
  "rules": {
    "linebreak-style": "off",
    "no-underscore-dangle": "off",
    "import/prefer-default-export": "off"
  }
}

Although plugin:@typescript-eslint/recommended requires a doc-based parser, everything works without it. ParserOption work out as it should.
Even if I remove parserOptions and change tsconfig.json, the rules from there will still be pulled up. Please explain, I'm completely confused.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2021-06-22
@Vasaho

If the config is inherited from "plugin:@typescript-eslint/recommended", then it is not needed, it is simply already registered there .
The bottom line is that you may not like a set of rules recommendedand you can throw it out, sketching your own to taste. And then everything will break. Therefore, it is better to specify the parser explicitly at once.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question