Hi there, hope this message finds you well.
We're getting the following error when extending eslint-plugin-tsdoc from our custom ESLint configuration:
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.
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.
// 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",
},
};
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:
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.jsonfile anywhere in our monorepo.We have this
.eslintrcfile at the root of our monorepo, which extends this configuration, being@dashboard/conventionsthe 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:
Here's a screenshot of the error: