Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Getting "Error loading TSDoc config file: Unexpected exception" warning in all files, when using eslint-plugin-tsdoc

Abierto
#440 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
42/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Tranquilo
Stack tecnológico
eslint, typescript
Área
tooling

Línea de trabajo

Comienza reproduciendo la advertencia con la configuración de ESLint index.js proporcionada y el .eslintrc del monorepo, prestando atención a la ausencia de un archivo tsdoc.json y a la disposición del workspace de Lerna/Yarn. Traza cómo eslint-plugin-tsdoc localiza su configuración y, después, verifica que al analizar archivos ya no se emita la advertencia, mientras la regla tsdoc/syntax siga habilitada.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Description

Hi there, hope this message finds you well.

We're getting the following error when extending eslint-plugin-tsdoc from our custom ESLint configuration:

Error loading TSDoc config file:
Unexpected exception: The "paths[0]" argument must be of type string. Received undefinedeslint[tsdoc/syntax](https://tsdoc.org/pages/packages/eslint-plugin-tsdoc)

The problem occurs within our monorepo, managed with Lerna and Yarn v1. In there, we have a package whose sole responsibility is to create and export a custom ESLint config. This config extends eslint-plugin-tsdoc, and all it does with it is to toggle its warnings.

We have no tsdoc.json file anywhere in our monorepo.

We have this .eslintrc file at the root of our monorepo, which extends this configuration, being @dashboard/conventions the name of the package that holds our custom ESLint config.

{
  "root": true,
  "extends": ["@dashboard/conventions"],
  "ignorePatterns": ["**/dist/**", "**/build/**"],
  "rules": {
    "import/no-unresolved": [2, { "ignore": ["extension", "@/*"] }],
    "import/extensions": "off",
    "react/jsx-no-bind": "off",
    "no-restricted-imports": [
      "error",
      {
        "name": "styled-components",
        "importNames": ["default"],
        "message": "Please use @xstyled/styled-components instead."
      }
    ]
  }
}

The error appears at the very beginning of every file from our monorepo. It doesn't occur in any of the projects that do import this package and extend from our custom ESLint config that are not inside this monorepo.

Can you please help me out with this?

More context

Here's the config file:

// index.js
module.exports = {
  parser: "@typescript-eslint/parser",
  extends: [
    "plugin:@typescript-eslint/recommended",
    "plugin:@typescript-eslint/eslint-recommended",
    "airbnb",
    "eslint:recommended",
    "plugin:react/recommended",
    "plugin:import/typescript",
    "plugin:import/warnings",
    "plugin:json/recommended-legacy",
    "prettier",
  ],
  plugins: [
    "@typescript-eslint",
    "react-hooks",
    "json",
    "import",
    "eslint-plugin-tsdoc",
    "prettier",
    "eslint-plugin-import-alias",
  ],
  parserOptions: {
    ecmaVersion: 2022,
    sourceType: "module",
    ecmaFeatures: {
      jsx: true,
    },
  },
  rules: {
    "no-shadow": "off",
    "no-underscore-dangle": "off",
    "@typescript-eslint/no-shadow": "error",
    "@typescript-eslint/no-non-null-asserted-optional-chain": "off",
    semi: "warn",
    "no-unused-vars": "off",
    "no-void": "off",
    radix: "off",
    camelcase: "off",
    "tsdoc/syntax": "warn",
    "import/first": "error",
    "import/newline-after-import": "error",
    "import/no-duplicates": "error",
    "import/prefer-default-export": "off",
    "import/no-cycle": "off",
    "import/extensions": [
      "error",
      "ignorePackages",
      {
        js: "never",
        jsx: "never",
        ts: "never",
        tsx: "never",
      },
    ],
    "import/order": [
      "error",
      {
        groups: ["builtin", "external", "parent", "sibling", "internal"],
        pathGroups: [
          {
            pattern: "react",
            group: "external",
            position: "before",
          },
          {
            pattern: "styled-components",
            group: "external",
            position: "before",
          },
        ],
        pathGroupsExcludedImportTypes: ["react"],
        "newlines-between": "always",
        alphabetize: {
          order: "asc",
          caseInsensitive: true,
        },
      },
    ],
    "import/no-extraneous-dependencies": [
      "error",
      {
        devDependencies: true,
      },
    ],
    "jsx-a11y/label-has-associated-control": [
      2,
      {
        labelComponents: ["CustomInputLabel"],
        labelAttributes: ["label"],
        controlComponents: ["CustomInput"],
        depth: 3,
      },
    ],
    "react/jsx-filename-extension": [
      "warn",
      {
        extensions: [".tsx"],
      },
    ],
    "react/jsx-props-no-spreading": [
      "off",
      {
        custom: "ignore",
      },
    ],
    "react/react-in-jsx-scope": "off",
    "react/prop-types": "off",
    "react/require-default-props": "off",
    "react/display-name": "off",
    "react-hooks/rules-of-hooks": "error",
    "react/no-unstable-nested-components": "warn",
    "react/jsx-no-useless-fragment": "warn",
    "global-require": "off",
    "react-hooks/exhaustive-deps": "warn",
    "react/jsx-one-expression-per-line": "off",
    "react/button-has-type": "warn",
    "@typescript-eslint/explicit-function-return-type": "off",
    "@typescript-eslint/naming-convention": [
      "warn",
      {
        selector: "default",
        format: ["camelCase", "PascalCase", "UPPER_CASE"],
        leadingUnderscore: "allow",
        filter: {
          regex: "^(__typename|__html|__ref|__esModule|data-test)$",
          match: false,
        },
      },
      { selector: "enum", format: ["UPPER_CASE"] },
    ],
    "@typescript-eslint/no-unused-vars": [
      "error",
      { varsIgnorePattern: "^_", argsIgnorePattern: "^_" },
    ],
    curly: ["error", "all"],
    "@typescript-eslint/explicit-module-boundary-types": "off",
    "@typescript-eslint/no-non-null-assertion": "off",
    "no-use-before-define": "off",
    "@typescript-eslint/no-use-before-define": ["warn"],
    "default-case": "warn",
    "no-unused-expressions": [
      "warn",
      { allowShortCircuit: true, allowTernary: true },
    ],
    "no-restricted-globals": "warn",
    "no-restricted-syntax": "warn",
    "react/jsx-no-bind": "warn",
    "react/no-array-index-key": "warn",
    "react/no-unused-prop-types": "warn",
  },
  overrides: [
    {
      files: ["*.ts"],
      rules: {
        "@typescript-eslint/explicit-module-boundary-types": ["error"],
        "no-undef": "off",
      },
    },
    {
      files: ["*.test.ts*"],
      rules: {
        "react/jsx-no-constructed-context-values": "off",
        "func-names": "off",
      },
    },
  ],
  settings: {
    react: {
      version: "detect",
    },
    "import/parsers": {
      "@typescript-eslint/parser": [".ts", ".tsx"],
    },
    "import/resolver": {
      typescript: {
        alwaysTryTypes: true,
        project: "./tsconfig.json",
      },
    },
  },
  env: {
    es6: true,
    jest: true,
    browser: true,
  },
  globals: {
    JSX: "readonly",
    EventListener: "readonly",
    React: "readonly",
  },
};

Here's a screenshot of the error:

Image
Lenguaje dominante
TypeScript
Estrellas
5k
Forks
162
Merge medio
2 d 4 h
PR fusionados (30 d)
12

Preparar el entorno

Aún no hemos revisado los archivos de configuración de este proyecto. Empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/tsdoc

Todos los issues de microsoft/tsdoc

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.