gajus / eslint-plugin-jsdoc

JSDoc specific linting rules for ESLint.
Other
1.1k stars 160 forks source link

jsdoc/no-undefined-types is particularly slow #1334

Open raineorshine opened 1 month ago

raineorshine commented 1 month ago

Reproducible on https://github.com/cybersemics/em. See steps below.

Expected behavior

jsdoc/no-undefined-types should complete within a few seconds.

Actual behavior

jsdoc/no-undefined-types takes 20–40 seconds.

Here is the output of TIMING=1 eslint . with the full eslint config from https://github.com/cybersemics/em:

$ TIMING=1 eslint .
Rule                                        | Time (ms) | Relative
:-------------------------------------------|----------:|--------:
jsdoc/no-undefined-types                    | 34967.171 |    78.0%
prettier/prettier                           |  6415.243 |    14.3%
@typescript-eslint/no-redeclare             |   414.381 |     0.9%
@typescript-eslint/no-unused-vars           |   354.871 |     0.8%
jsdoc/require-description-complete-sentence |   256.207 |     0.6%
jsdoc/check-alignment                       |   217.525 |     0.5%
react/display-name                          |   192.365 |     0.4%
react/no-direct-mutation-state              |   181.148 |     0.4%
jsdoc/check-types                           |   162.873 |     0.4%
jsdoc/check-indentation                     |   159.531 |     0.4%

Here is the output of TIMING=1 eslint . with a minimal eslint config (see below):

Rule                                    | Time (ms) | Relative
:---------------------------------------|----------:|--------:
jsdoc/no-undefined-types                | 20566.286 |    93.8%
@typescript-eslint/no-unused-vars       |   353.893 |     1.6%
react/no-direct-mutation-state          |   203.983 |     0.9%
@typescript-eslint/no-redeclare         |   149.874 |     0.7%
react/no-typos                          |    78.769 |     0.4%
react/require-render-return             |    66.024 |     0.3%
react/jsx-no-target-blank               |    28.896 |     0.1%
no-restricted-globals                   |    26.832 |     0.1%
flowtype/define-flow-type               |    20.690 |     0.1%
@typescript-eslint/no-use-before-define |    19.603 |     0.1%

Steps to Reproduce

  1. git clone https://github.com/cybersemics/em
  2. cd em
  3. yarn
  4. TIMING=1 eslint .

ESLint Config

module.exports = {
  env: {
    browser: true,
    es6: true,
    mocha: true,
    jest: true,
  },
  extends: ['react-app'],
  plugins: ['jsdoc'],
  rules: {
    'jsdoc/no-undefined-types': 2,
  },
}

Environment