angular - eslint: rxjs/no-unsafe-takeuntil problem


Jag försöker lägga till en regel i mitt Angular-projekt: rxjs/no-unsafe-takeuntil

  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "module": "es2020",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "allowJs": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "es2016",
      "es2015",
      "dom"
    ]
  },
  "include": [
    "src/**/*.d.ts"
  ],
  "exclude": [
    "node_modules"
  ]
}

tsconfig.json

const { join } = require("path");

module.exports = {
  parser: "@typescript-eslint/parser",
  parserOptions: {
    ecmaVersion: 2019,
    project: join(__dirname, "./tsconfig.json"),
    sourceType: "module"
  },
  plugins: ["rxjs"],
  extends: [],
  rules: {
    "rxjs/no-unsafe-takeuntil": "error"
  }
};

eslintrc.js

Jag har .eslintrc.json förutom det.

Jag får Parsing error: "parserOptions.project" har ställts in för @typescript-eslint/parser. för en lista med filer.

Hur åtgärdar man det?

Svar #1

Hade samma problem, det berodde på att det inte korrekt hämtade tsconfig.json. Skulle föreslå att kontrollera att den är på rätt plats.