microsoft / tsdoc

A doc comment standard for TypeScript
https://tsdoc.org/
MIT License
4.74k stars 131 forks source link

Trouble running ESLint plugin - `tsdoc-param-tag-with-invalid-type` #224

Closed 0xCLARITY closed 4 years ago

0xCLARITY commented 4 years ago

I'm having some trouble setting up my project with the TSDoc ESLint plugin. I'm including my ESLint configuration and the error I get when linting. I would love some help getting this set up!

This is a sample of my ESLint configuration:

module.exports = {
  root: true,

  parser: '@typescript-eslint/parser', // Make ESLint compatible with TypeScript
  parserOptions: {
    // Enable linting rules with type information from our tsconfig
    tsconfigRootDir: __dirname,
    project: ['./tsconfig.eslint.json'],

    sourceType: 'module', // Allow the use of imports / ES modules

    ecmaFeatures: {
      impliedStrict: true, // Enable global strict mode
    },
  },

  // Specify global variables that are predefined
  env: {
    node: true, // Enable node global variables & Node.js scoping
    es2020: true, // Add all ECMAScript 2020 globals and automatically set the ecmaVersion parser option to ES2020
  },

  plugins: [
    '@typescript-eslint', // Add some TypeScript specific rules, and disable rules covered by the typechecker
    'eslint-plugin-tsdoc', // Add rules for TSDoc comments
    'import', // Add rules that help validate proper imports
    'mocha', // Add rules for writing better Mocha tests
    'prettier', // Allows running prettier as an ESLint rule, and reporting differences as individual linting issues
  ],

  rules: {
    /* TSDOC PLUGIN RULES */
    // Enable the TSDoc plugin
    'tsdoc/syntax': 'warn',
  }
}

Error when Linting

And here is the error I get after attempting to add the TSDoc plugin:

> eslint . --ext .ts --fix

TypeError: context.report() called with a messageId of 'tsdoc-param-tag-with-invalid-type' which is not present in the 'messages' config: {
  "error-loading-config-file": "Error loading TSDoc config file:\n{{details}}",
  "error-applying-config": "Error applying TSDoc configuration: {{details}}",
  "tsdoc-at-sign-in-word": "tsdoc-at-sign-in-word: {{unformattedText}}",
  "tsdoc-at-sign-without-tag-name": "tsdoc-at-sign-without-tag-name: {{unformattedText}}",
  "tsdoc-code-fence-closing-indent": "tsdoc-code-fence-closing-indent: {{unformattedText}}",
  "tsdoc-code-fence-closing-syntax": "tsdoc-code-fence-closing-syntax: {{unformattedText}}",
  "tsdoc-code-fence-missing-delimiter": "tsdoc-code-fence-missing-delimiter: {{unformattedText}}",
  "tsdoc-code-fence-opening-indent": "tsdoc-code-fence-opening-indent: {{unformattedText}}",
  "tsdoc-code-fence-specifier-syntax": "tsdoc-code-fence-specifier-syntax: {{unformattedText}}",
  "tsdoc-code-span-empty": "tsdoc-code-span-empty: {{unformattedText}}",
  "tsdoc-code-span-missing-delimiter": "tsdoc-code-span-missing-delimiter: {{unformattedText}}",
  "tsdoc-comment-missing-closing-delimiter": "tsdoc-comment-missing-closing-delimiter: {{unformattedText}}",
  "tsdoc-comment-missing-opening-delimiter": "tsdoc-comment-missing-opening-delimiter: {{unformattedText}}",
  "tsdoc-comment-not-found": "tsdoc-comment-not-found: {{unformattedText}}",
  "tsdoc-config-cyclic-extends": "tsdoc-config-cyclic-extends: {{unformattedText}}",
  "tsdoc-config-file-not-found": "tsdoc-config-file-not-found: {{unformattedText}}",
  "tsdoc-config-schema-error": "tsdoc-config-schema-error: {{unformattedText}}",
  "tsdoc-config-unresolved-extends": "tsdoc-config-unresolved-extends: {{unformattedText}}",
  "tsdoc-config-unsupported-schema": "tsdoc-config-unsupported-schema: {{unformattedText}}",
  "tsdoc-escape-greater-than": "tsdoc-escape-greater-than: {{unformattedText}}",
  "tsdoc-escape-right-brace": "tsdoc-escape-right-brace: {{unformattedText}}",
  "tsdoc-extra-inheritdoc-tag": "tsdoc-extra-inheritdoc-tag: {{unformattedText}}",
  "tsdoc-html-string-missing-quote": "tsdoc-html-string-missing-quote: {{unformattedText}}",
  "tsdoc-html-tag-missing-equals": "tsdoc-html-tag-missing-equals: {{unformattedText}}",
  "tsdoc-html-tag-missing-greater-than": "tsdoc-html-tag-missing-greater-than: {{unformattedText}}",
  "tsdoc-html-tag-missing-string": "tsdoc-html-tag-missing-string: {{unformattedText}}",
  "tsdoc-inheritdoc-incompatible-summary": "tsdoc-inheritdoc-incompatible-summary: {{unformattedText}}",
  "tsdoc-inheritdoc-incompatible-tag": "tsdoc-inheritdoc-incompatible-tag: {{unformattedText}}",
  "tsdoc-inheritdoc-tag-syntax": "tsdoc-inheritdoc-tag-syntax: {{unformattedText}}",
  "tsdoc-inline-tag-missing-braces": "tsdoc-inline-tag-missing-braces: {{unformattedText}}",
  "tsdoc-inline-tag-missing-right-brace": "tsdoc-inline-tag-missing-right-brace: {{unformattedText}}",
  "tsdoc-inline-tag-unescaped-brace": "tsdoc-inline-tag-unescaped-brace: {{unformattedText}}",
  "tsdoc-link-tag-destination-syntax": "tsdoc-link-tag-destination-syntax: {{unformattedText}}",
  "tsdoc-link-tag-empty": "tsdoc-link-tag-empty: {{unformattedText}}",
  "tsdoc-link-tag-invalid-url": "tsdoc-link-tag-invalid-url: {{unformattedText}}",
  "tsdoc-link-tag-unescaped-text": "tsdoc-link-tag-unescaped-text: {{unformattedText}}",
  "tsdoc-malformed-html-name": "tsdoc-malformed-html-name: {{unformattedText}}",
  "tsdoc-malformed-inline-tag": "tsdoc-malformed-inline-tag: {{unformattedText}}",
  "tsdoc-malformed-tag-name": "tsdoc-malformed-tag-name: {{unformattedText}}",
  "tsdoc-missing-deprecation-message": "tsdoc-missing-deprecation-message: {{unformattedText}}",
  "tsdoc-missing-html-end-tag": "tsdoc-missing-html-end-tag: {{unformattedText}}",
  "tsdoc-missing-reference": "tsdoc-missing-reference: {{unformattedText}}",
  "tsdoc-missing-tag": "tsdoc-missing-tag: {{unformattedText}}",
  "tsdoc-param-tag-missing-hyphen": "tsdoc-param-tag-missing-hyphen: {{unformattedText}}",
  "tsdoc-param-tag-with-invalid-name": "tsdoc-param-tag-with-invalid-name: {{unformattedText}}",
  "tsdoc-reference-empty-identifier": "tsdoc-reference-empty-identifier: {{unformattedText}}",
  "tsdoc-reference-hash-syntax": "tsdoc-reference-hash-syntax: {{unformattedText}}",
  "tsdoc-reference-malformed-import-path": "tsdoc-reference-malformed-import-path: {{unformattedText}}",
  "tsdoc-reference-malformed-package-name": "tsdoc-reference-malformed-package-name: {{unformattedText}}",
  "tsdoc-reference-missing-colon": "tsdoc-reference-missing-colon: {{unformattedText}}",
  "tsdoc-reference-missing-dot": "tsdoc-reference-missing-dot: {{unformattedText}}",
  "tsdoc-reference-missing-hash": "tsdoc-reference-missing-hash: {{unformattedText}}",
  "tsdoc-reference-missing-identifier": "tsdoc-reference-missing-identifier: {{unformattedText}}",
  "tsdoc-reference-missing-label": "tsdoc-reference-missing-label: {{unformattedText}}",
  "tsdoc-reference-missing-quote": "tsdoc-reference-missing-quote: {{unformattedText}}",
  "tsdoc-reference-missing-right-bracket": "tsdoc-reference-missing-right-bracket: {{unformattedText}}",
  "tsdoc-reference-missing-right-paren": "tsdoc-reference-missing-right-paren: {{unformattedText}}",
  "tsdoc-reference-selector-missing-parens": "tsdoc-reference-selector-missing-parens: {{unformattedText}}",
  "tsdoc-reference-selector-syntax": "tsdoc-reference-selector-syntax: {{unformattedText}}",
  "tsdoc-reference-symbol-syntax": "tsdoc-reference-symbol-syntax: {{unformattedText}}",
  "tsdoc-reference-unquoted-identifier": "tsdoc-reference-unquoted-identifier: {{unformattedText}}",
  "tsdoc-tag-should-not-have-braces": "tsdoc-tag-should-not-have-braces: {{unformattedText}}",
  "tsdoc-text-after-html-string": "tsdoc-text-after-html-string: {{unformattedText}}",
  "tsdoc-text-after-tag": "tsdoc-text-after-tag: {{unformattedText}}",
  "tsdoc-undefined-tag": "tsdoc-undefined-tag: {{unformattedText}}",
  "tsdoc-unnecessary-backslash": "tsdoc-unnecessary-backslash: {{unformattedText}}",
  "tsdoc-unsupported-tag": "tsdoc-unsupported-tag: {{unformattedText}}"
}
Occurred while linting /Users/hbergren/Documents/MyRepository/src/config.ts:1
    at /Users/hbergren/Documents/MyRepository/node_modules/eslint/lib/linter/report-translator.js:325:23
    at Object.report (/Users/hbergren/Documents/MyRepository/node_modules/eslint/lib/linter/linter.js:905:41)
    at checkCommentBlocks (/Users/hbergren/Documents/MyRepository/node_modules/eslint-plugin-tsdoc/lib/index.js:99:37)
    at /Users/hbergren/Documents/MyRepository/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/hbergren/Documents/MyRepository/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/Users/hbergren/Documents/MyRepository/node_modules/eslint/lib/linter/node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors (/Users/hbergren/Documents/MyRepository/node_modules/eslint/lib/linter/node-event-generator.js:283:22)
    at NodeEventGenerator.enterNode (/Users/hbergren/Documents/MyRepository/node_modules/eslint/lib/linter/node-event-generator.js:297:14)
    at CodePathAnalyzer.enterNode (/Users/hbergren/Documents/MyRepository/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:634:23)
octogonz commented 4 years ago

This is fixed by PR https://github.com/microsoft/tsdoc/pull/212

It is the same issue as https://github.com/microsoft/tsdoc/issues/211

octogonz commented 4 years ago

This fix was released with tsdoc version 0.12.19 and eslint-plugin-tsdoc version 0.2.4.