-
-
Notifications
You must be signed in to change notification settings - Fork 159
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
[match-description] Pattern is not correctly applied (newlines not preserved) #692
Comments
It looks like my /**
* Tasks map
*
* - `key`: The `Worker`
* - `value`: Number of tasks that has been assigned to that worker since it started
*/ I want to enforce that Can you give me a hint how to fix this? |
The first part of your pattern ( If you add some debug output somewhere there you will notice, that the parsed description does not contain any newlines, with makes it virtually impossible to prevent the patterns from matching in this scenario. AFAICT the only way to solve this, is to not strip the newlines inside this plugin. However this might break existing patterns, so to avoid breaking existing patterns, the regex should be created with the |
There is not a sophisticated parser for this rule, so currently you would either need punctuation at the end of
... or you would need to change your regex to allow for this. So yes, @ST-DDT 's observation is quite correct, and the suggestion apt. I just pushed a fix/release so that one can supply slash-delimited regexes with flags to I'm still working on a fix so that newlines are preserved in |
…or purposes of regex matching; fixes part of gajus#692 Should now include fix for `comment-parser` update's dropping of newlines in jsdoc block `description`; still need to preserve newlines across rules in the `.description` of tags
I've pushed a fix/release now which should address the immediate concern of this issue. However, I'll keep the issue open as the following rules need to be investigated for their lack of preservation of newlines within checks of individual tag
|
I applied 74bbe38 locally and it's working 😃 When I have setup my complete pattern, I will send it here, so you can see what edge cases I have solved with it. |
So my current patterns are these: "jsdoc/match-description": [
"warn",
{
"mainDescription": "/^[A-Z`].+?(\\.|:)(\\n\\n.*((\\n{1,2}- .+)|(_.+_)|`.+`|\\n\\n---))?$/us",
"matchDescription": "^[A-Z`].+(\\.|`.+`)$",
"contexts": ["any"],
"tags": {
"param": true,
"returns": true
}
}
] I only have a wired problem with jsdocs like /** Wrap attributes threshold. */
export const WRAP_ATTRIBUTES_THRESHOLD: IntSupportOption = { // This line shows warning: "eslintjsdoc/match-description"
since: '1.8.0',
category: CATEGORY_PUG,
type: 'int',
default: -1,
description: 'The maximum amount of attributes that an element can appear with on one line before it gets wrapped.',
range: { start: -1, end: Infinity, step: 1 }
}; But this could be an issue on my side. IMO you could release the new version because it is a HUGE improvement 🎉 |
…trailing whitespace is stripped for comparisons; for gajus#692
Released in 32.0.2 along with a fix for your last example. (FWIW, after preserving whitespace, the reason your last example was failing was because I was only stripping trailing newlines, but for single-line examples at least, it becomes necessary to allow for trailing spaces since the final space in Still not handled for tags, however. |
If you all could test out #718 , it'd be nice to ensure the fixes are working. Should now be applied to all relevant rules. |
🎉 This issue has been resolved in version 32.3.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@brettz9 Until now I didn't encountered any issue in my projects 🙂 |
Expected behavior
No warnings should be printed / detected
I have setup following pattern:
"^([A-Z`].*(\\.|:)|-\\s.*)$"
[A-Z`]
.*
(\\.|:)
-\\s.*
Actual behavior
ESLint Config
https://github.com/mib200/vue-gtm/blob/fa0b139417b09c871ae27c629415dea06ec50a49/.eslintrc.json#L49-L60
https://github.com/mib200/vue-gtm/blob/fa0b139417b09c871ae27c629415dea06ec50a49/src/plugin.ts#L70-L80
Environment
eslint-plugin-jsdoc
version: 32.0.0If I do anything wrong on my side, please explain how I can fix it 🙂
The text was updated successfully, but these errors were encountered: