Skip to content

Commit

Permalink
Remove uses of deprected path.getValue()
Browse files Browse the repository at this point in the history
  • Loading branch information
nene committed Jan 22, 2024
1 parent b86c1d4 commit 9021905
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/embedJs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { hardline, indent, stripTrailingHardline } from "./print_utils";

export const embedJs: NonNullable<Printer<Node>["embed"]> = (path, options) => {
const node = path.getValue(); // TODO: Don't use deprecated method
const node = path.node;
const parent = path.getParentNode(0);
const grandParent = path.getParentNode(1);
if (
Expand Down
2 changes: 1 addition & 1 deletion src/embedJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const embedJson: NonNullable<Printer<Node>["embed"]> = (
path,
options,
) => {
const node = path.getValue(); // TODO: Don't use deprecated method
const node = path.node;
const parent = path.getParentNode();
if (
isStringLiteral(node) &&
Expand Down
2 changes: 1 addition & 1 deletion src/printComment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { AstPath } from "prettier";
import { Whitespace } from "sql-parser-cst";

export const printComment = (path: AstPath<Whitespace>): string => {
const node = path.getValue();
const node = path.node;
if (node.type === "line_comment") {
if (/^--[^ \t]/.test(node.text)) {
return node.text.replace(/^--/, "-- ");
Expand Down
6 changes: 3 additions & 3 deletions src/syntax/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ export const baseMap: CstToDocMap<Keyword | Empty | AllColumns> = {
keyword: (print, node, path, options) => {
switch (options.sqlKeywordCase) {
case "preserve":
return path.getValue().text;
return path.node.text;
case "upper":
return path.getValue().text.toUpperCase();
return path.node.text.toUpperCase();
case "lower":
return path.getValue().text.toLowerCase();
return path.node.text.toLowerCase();
}
},
all_columns: () => "*",
Expand Down

0 comments on commit 9021905

Please sign in to comment.