-
Notifications
You must be signed in to change notification settings - Fork 57
addComment V3 support simple string body #260
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
addComment V3 support simple string body #260
Conversation
src/version3/issueComments.ts
Outdated
@@ -145,7 +145,23 @@ export class IssueComments { | |||
*/ | |||
async addComment<T = Models.Comment>(parameters: Parameters.AddComment, callback?: never): Promise<T>; | |||
async addComment<T = Models.Comment>(parameters: Parameters.AddComment, callback?: Callback<T>): Promise<void | T> { | |||
// todo add simple comment structure (string) | |||
const getBody = (body: Parameters.AddComment['body']): Models.Document | undefined => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const getBody = (body: Parameters.AddComment['body']): Models.Document | undefined => { | |
const body = typeof parameters.body === 'string' ? { | |
type: 'doc', | |
version: 1, | |
content: [ | |
{ | |
type: 'paragraph', | |
content: [{ type: 'text', text: parameters.body }], | |
}, | |
], | |
} : parameters.body; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Install eslint-config-prettier
package and add "prettier"
in "extends"
section of eslintrc.
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
humm it does solve the error, but it looks like it simply disables that rule
https://github.com/prettier/eslint-config-prettier/blob/88ba724915c0d52c822d7c0d499be21c30c5380a/index.js#L90
I'd rather not make too big a change in your linter rules in this pull request by adding a whole other configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, okay. I will complete all work with linter by myself. Conceptually everything was done and I express my great gratitude for your contribution!
I was implementing adding a comment to an issue with api V3 and stumbled on this todo
jira.js/src/version3/issueComments.ts
Lines 147 to 150 in 5d9a19b
Since I basically implemented the same thing in my project, I figured I'd take a stab at it directly here.
I had to tweak .prettierrc to match closer the .editorconfig file because the linter was complaining a lot about some choices Prettier made.
I still had an indentation issue with a ternary, but worked around the problem by making a function instead