-
Notifications
You must be signed in to change notification settings - Fork 2
fix: recognise options that are overwritten unnecessarily #12
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
Changes from all commits
60113e5
07eaec1
b35f22c
9a46d4e
12d18ad
3fa5c22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,7 @@ import { ASTNode, PropertyASTNode } from "vscode-json-languageservice"; | |||||
| import { | ||||||
| getPropertyNameFromNode, | ||||||
| getPropertyValueFromNode, | ||||||
| isJSONDifferentToAST, | ||||||
| nodeIsPropertyNameOrValue, | ||||||
| rangeFromNode, | ||||||
| } from "../astUtils"; | ||||||
|
|
@@ -62,14 +63,13 @@ export function generateImportOverrideDiagnostics( | |||||
| const properties = s | ||||||
| .map((s) => config.getNodeFromSymbol(s)) | ||||||
| .filter(nodeIsPropertyNameOrValue) | ||||||
| .map( | ||||||
| (n) => | ||||||
| [ | ||||||
| getPropertyNameFromNode(n), | ||||||
| getPropertyValueFromNode(n), | ||||||
| n, | ||||||
| ] as const, | ||||||
| ) | ||||||
| .map((n) => { | ||||||
| return [ | ||||||
| getPropertyNameFromNode(n), | ||||||
| n.parent.valueNode, | ||||||
|
||||||
| n.parent.valueNode, | |
| getPropertyValueFromNode(n), |
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.
Hmm I missed this change. The change itself is fine, so ignore Copilot's review here. Given that the array now contains the AST node and not its value, the variable in line 82 should be renamed to valueNode.
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.
I'm wondering if the array could be reduced to just the property name , and the ASTNode.
Line 94 could be changed to: value: getPropertyValueFromNode(propNode),.
And line 85 to if (!isJSONDifferentToAST(originalValue, propNode.parent.valueNode))
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.
Hmm that wouldn't change the other type issue with the value possibly being undefined. Let's just stick to renaming then and making sure we pass the actual value to the diagnostic and not the AST node (see other comment).
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.
I've changed the variable name as suggested
Uh oh!
There was an error while loading. Please reload this page.