You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
eslint-plugin-tsdoc: allow policies to be ignored in tsdoc/syntax rule #220
Now that less-strict parsing for @param tags is merged (#128), I'd love to be able to loosen the requirements of the tsdoc/syntax rule to allow for certain deviations from the expected syntax.
Primarily, VSCode's built-in JSDoc support automatically adds a doc comment where each @param tag is followed immediately by a description, without the expected hyphen. With the following .eslintrc configuration:
{rules: {'tsdoc/syntax': 'warn'}}
This snippet is valid:
/** * Description * @param a - first number * @param b - second number */constadd=(a: number,b: number)=>a+b;
While this snippet:
/** * Description * @param a first number * @param b second number */constadd=(a: number,b: number)=>a+b;
Warns with the following:
tsdoc-param-tag-missing-hyphen: The @param block should be followed by a parameter name and then a hyphen eslint(tsdoc/syntax)
I'd love to be able to ignore this particular syntax deviation with something like:
This is a good idea. However I think we might want to approach it via the tsdoc.json config file rather than via ESLint's configuration. The reason is that you are not really suppressing a warning, but rather defining the kind of TSDoc parsing that you want for your source files. Putting the suppression in tsdoc.json will prevent other tools from reporting the same errors when they invoke the parser.
Long term, we intend to provide a "lax mode" as well as other compatibility settings for the TSDoc parser. But in the short term, this kind of problem can be solved pretty well by simply filtering out specific error IDs as you suggest. (The reason that's not a perfect solution is that the syntax highlighting may sometimes color the bad characters in red even though the error message is hidden.)
eslint-plugin-tsdoc already supports tsdoc.json, so we would simply need to improve tsdoc.schema.json to support something like this:
...and then pass that setting through to the parser. It's mostly plumbing work, since in the end all we're doing is adding a filter to ParserMessageLog.addMessage().
Reacted by Jason Dreyzehner, Martin Hochel, Rob, michkot, Denis Davidyuk, Lee Wexler, David Lakin and Peter Flynn
2:4 warning tsdoc-characters-after-block-tag: The token "@jest" looks like a TSDoc tag but contains an invalid character "-"; if it is not a tag, use a backslash to escape the "@" tsdoc/syntax
but haven't found a way to disable this rule.
Reacted by Iddan Aaronsohn, Yun Feng, Simon Bächler, Benjamin Westphal, Andrew Garrison, jchamale and Behnam 🅱🅴 (OneSchema)
I would second this request. Our use case is the need to disable the ts-doc-at-sign-in-word rule, The following should not trigger any warnings:
/** * A method description containing an example@emailaddress.com causing a linter warning. */privategetEmailAddress(): string {return'example@emailaddress.com';}
Reacted by Arnau Jiménez, Rob, Ayta G and Benjamin Westphal
Yes, please an "ignoreMessageIds" is very much needed. Unless I am missing something it seems the eslint-plugin-tsdoc is all or nothing. Is there any way to stop reporting on some message ids at the moment?
Reacted by Carlo Q, michkot, Steve Johns, Noah, Denis Davidyuk, Ayta G, Maribeth Moffatt, Adam Blaszkiewicz, Benjamin Westphal, Jonas and 1 more
I'm having somewhat similiar problem with project using Emotion.
With the way things are, I need to put the following line to the top of every file where Emotion is used.
/** @jsxImportSource @emotion/react */
Which trigger the warning:
tsdoc-undefined-tag: The TSDoc tag "@jsxImportSource" is not defined in this configurationeslint[tsdoc/syntax](https://tsdoc.org/pages/packages/eslint-plugin-tsdoc)
I've followed the workaround from #213 (comment) and added @jsxImportSource as custom tag in a tsdoc.json file:
It works, eslint-tsdoc recognizes @jsxImportSource as defined tag, but... it threw another warning
tsdoc-characters-after-block-tag: The token "@emotion" looks like a TSDoc tag but contains an invalid character "/"; if it is not a tag, use a backslash to escape the "@"eslint[tsdoc/syntax](https://tsdoc.org/pages/packages/eslint-plugin-tsdoc)
At this point, since I have no idea how to make my custom tsdoc tag @jsxImportSource from throwing tsdoc-characters-after-block-tag warning, I'm just exchanging one warning with another... 🤷
FWIW,
The jsdoc/check-tag-names rule has jsxTags options for allowing tags used to control JSX output (jsx, jsxFrag, jsxImportSource, jsxRuntime)
Please, rather than going for all or nothingtsdoc/syntax rule, let user have some way to control the tsdoc/syntax validation. Off-loading the settings to tsdoc.json is one way, but defining an eslint custom rule with options/ exceptions, like the original proposed way above (and like all other eslint-plugin-* out there have done), IMO, is also a solution, e.g:
Activity
octogonz commentedon Mar 27, 2020
This is a good idea. However I think we might want to approach it via the tsdoc.json config file rather than via ESLint's configuration. The reason is that you are not really suppressing a warning, but rather defining the kind of TSDoc parsing that you want for your source files. Putting the suppression in tsdoc.json will prevent other tools from reporting the same errors when they invoke the parser.
Long term, we intend to provide a "lax mode" as well as other compatibility settings for the TSDoc parser. But in the short term, this kind of problem can be solved pretty well by simply filtering out specific error IDs as you suggest. (The reason that's not a perfect solution is that the syntax highlighting may sometimes color the bad characters in red even though the error message is hidden.)
eslint-plugin-tsdoc already supports tsdoc.json, so we would simply need to improve tsdoc.schema.json to support something like this:
your-project/tsdoc.json
...and then pass that setting through to the parser. It's mostly plumbing work, since in the end all we're doing is adding a filter to ParserMessageLog.addMessage().
zoechi commentedon Feb 25, 2021
I just run into a problem and disabling rules doesn't work as usual where I have a section in the
.eslintrc.jsonfor*spec.tsfileshttps://jestjs.io/docs/en/configuration#testenvironment-string
but haven't found a way to disable this rule.
countzero commentedon Mar 18, 2021
I would second this request. Our use case is the need to disable the
ts-doc-at-sign-in-wordrule, The following should not trigger any warnings:rob4226 commentedon Aug 23, 2021
Yes, please an
"ignoreMessageIds"is very much needed. Unless I am missing something it seems the eslint-plugin-tsdoc is all or nothing. Is there any way to stop reporting on some message ids at the moment?hahanein commentedon Sep 7, 2022
Is there an update on this issue?
We are using a custom tag, "Author Software (@author)", which includes an email address.
Currently, it appears to be impossible to provide this address without triggering the linter.
IronGeek commentedon Nov 8, 2022
I'm having somewhat similiar problem with project using Emotion.
With the way things are, I need to put the following line to the top of every file where Emotion is used.
Which trigger the warning:
I've followed the workaround from #213 (comment) and added
@jsxImportSourceas custom tag in atsdoc.jsonfile:{ "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", "tagDefinitions": [ { "tagName": "@jsxImportSource", "syntaxKind": "modifier" } ], "supportForTags": { "@jsxImportSource": true } }It works, eslint-tsdoc recognizes
@jsxImportSourceas defined tag, but... it threw another warningAt this point, since I have no idea how to make my custom tsdoc tag
@jsxImportSourcefrom throwingtsdoc-characters-after-block-tagwarning, I'm just exchanging one warning with another... 🤷FWIW,
The
jsdoc/check-tag-namesrule hasjsxTagsoptions for allowing tags used to control JSX output (jsx,jsxFrag,jsxImportSource,jsxRuntime)Please, rather than going for all or nothing
tsdoc/syntaxrule, let user have some way to control thetsdoc/syntaxvalidation. Off-loading the settings totsdoc.jsonis one way, but defining an eslint custom rule with options/ exceptions, like the original proposed way above (and like all othereslint-plugin-*out there have done), IMO, is also a solution, e.g:ssbarnea commentedon Jan 3, 2023
So basically there is no way to keep using
@authorif we want to useeslint-plugin-tsdoc?jkowalleck commentedon Jan 29, 2023
re: #220 (comment)
of cause you could create own tags.
this is my
tsdoc.jsonfile:{ "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", "tagDefinitions": [ { "tagName": "@since", "syntaxKind": "block", "allowMultiple": false }, { "tagName": "@author", "syntaxKind": "block", "allowMultiple": true }, { "tagName": "@TODO", "syntaxKind": "block", "allowMultiple": true } ] }Patrick-clone commentedon Mar 27, 2023
This would be a great (and essential) addition. What is the status of this?
Patrick-clone commentedon Mar 28, 2023
I use tsdoc in combination with api-extractor. In
api-extractor.jsonyou can specify which error/warnings to suppress/ignore see: https://api-extractor.com/pages/configs/api-extractor_json/#messagestsdocmessagereportingadamscybot commentedon Jul 11, 2023
For anyone who just needs this, allow me to present you with something beyond horrific.
Create a file called `eslint-local-rules.cjs' next to your eslint config:
In this example I make the
@categorytag allowed.Now in your eslint config:
May the Lord forgive me for my trespasses 😂
GitMurf commentedon Apr 23, 2024
Pete Gonzalez (@octogonz) did anything ever come of this? I liked your proposed approach. Are there any solutions today? Thanks.
jeffsays commentedon Oct 8, 2025
bump. any movement here? this is a widely supported feature among the most popular of eslint plugins