Getting "Error loading TSDoc config file: Unexpected exception" warning in all files, when using eslint-plugin-tsdoc
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5k
- Forks
- 162
- Avg merge
- 17h 24m
- Merged PRs (30d)
- 8
Description
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:
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the warning with the provided index.js ESLint configuration and the monorepo .eslintrc, paying attention to the absence of a tsdoc.json file and the Lerna/Yarn workspace layout. Trace how eslint-plugin-tsdoc locates its configuration, then verify that linting files no longer emits the warning while the tsdoc/syntax rule remains enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100