-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eslint-plugin-tsdoc: allow policies to be ignored in tsdoc/syntax rule #220
Comments
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 {
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
"ignoreMessageIds": [
"tsdoc-config-file-not-found"
]
} ...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(). |
I just run into a problem and disabling rules doesn't work as usual where I have a section in the https://jestjs.io/docs/en/configuration#testenvironment-string
but haven't found a way to disable this rule. |
I would second this request. Our use case is the need to disable the /**
* A method description containing an [email protected] causing a linter warning.
*/
private getEmailAddress (): string {
return '[email protected]';
} |
Yes, please an |
Is there an update on this issue? We are using a custom tag, "@author", which includes an email address. Currently, it appears to be impossible to provide this address without triggering the linter. |
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 {
"$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
At this point, since I have no idea how to make my custom tsdoc tag FWIW, The Please, rather than going for all or nothing
|
So basically there is no way to keep using |
re: #220 (comment)
of cause you could create own tags. this is my {
"$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
}
]
} |
This would be a great (and essential) addition. What is the status of this? |
I use tsdoc in combination with api-extractor. In |
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 Now in your eslint config:
May the Lord forgive me for my trespasses 😂 |
@octogonz did anything ever come of this? I liked your proposed approach. Are there any solutions today? Thanks. |
Now that less-strict parsing for
@param
tags is merged (#128), I'd love to be able to loosen the requirements of thetsdoc/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:This snippet is valid:
While this snippet:
Warns with the following:
I'd love to be able to ignore this particular syntax deviation with something like:
The text was updated successfully, but these errors were encountered: