Open
Conversation
sandersn
suggested changes
Sep 7, 2021
sandersn
left a comment
There was a problem hiding this comment.
Basic structure looks good.
- One question in emitter.ts (plus it needs a merge).
- A refactor in fixOverrideModifier.ts
- A code move in textChanges.ts
| case SyntaxKind.JSDocOverrideTag: | ||
| case SyntaxKind.JSDocPublicTag: | ||
| case SyntaxKind.JSDocPrivateTag: | ||
| case SyntaxKind.JSDocProtectedTag: |
There was a problem hiding this comment.
- why do these need to be emitted?
- these are now in emitter.ts as no-ops, and will need to be removed when this PR is merged from main.
| const { code, start, file } = diag; | ||
| const info = errorCodeFixIdMap[code]; | ||
| if (!info || info[1] !== context.fixId || isSourceFileJS(file)) { | ||
| if (!info || info[1] !== context.fixId || !info[3] && isSourceFileJS(file)) { |
There was a problem hiding this comment.
Not your fault, but errorCodeFixIdMap should really have object keys, not tuple ones. info[3] is way worse than info.allowInJS.
| ]; | ||
|
|
||
| const errorCodeFixIdMap: Record<number, [DiagnosticMessage, string | undefined, DiagnosticMessage | undefined]> = { | ||
| const errorCodeFixIdMap: Record<number, [message: DiagnosticMessage, fixId: string, fixAllMessage: DiagnosticMessage, allowInjs: boolean]> = { |
There was a problem hiding this comment.
Please convert this into an object type that has the same property names you just added to the tuple.
| this.insertJsdocCommentBefore(sourceFile, jsDocNode, tag); | ||
| } | ||
|
|
||
| public getJsDocNodeForArrowFunction(signature: ArrowFunction): HasJSDoc { |
There was a problem hiding this comment.
this doesn't need to be a method, especially a public one.
| return <HasJSDoc>signature.parent.parent; | ||
| } | ||
|
|
||
| public tryMergeJsdocTags(oldTag: JSDocTag, newTag: JSDocTag): JSDocTag | undefined { |
|
@Kingwl it's been quite a while since you submitted this. Do you have time to work on it? If not, one of the TS team (probably me :) can take over. |
Owner
Author
|
Sure. And I think @stkevintan might already have some work here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes microsoft#39669