Skip to content
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

chore: upgrade dependencies #2321

Merged
merged 2 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
],
"dependencies": {
"linguist-languages": "^7.27.0",
"mem": "^9.0.2",
"php-parser": "^3.1.5"
},
"devDependencies": {
Expand All @@ -34,13 +33,13 @@
"@rollup/plugin-node-resolve": "^15.2.1",
"@rollup/plugin-replace": "^5.0.5",
"@rollup/plugin-terser": "^0.4.3",
"c8": "^8.0.1",
"c8": "^9.1.0",
"cross-env": "^7.0.2",
"eslint": "8.56.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jest": "27.6.0",
"eslint-plugin-prettier": "5.0.1",
"eslint-plugin-jest": "27.6.3",
"eslint-plugin-prettier": "5.1.3",
"eslint-plugin-prettier-doc": "^1.1.0",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
Expand Down
2 changes: 1 addition & 1 deletion src/pragma.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import memoize from "mem";
import { memoize } from "./util.mjs";
import parse from "./parser.mjs";

const reHasPragma = /@prettier|@format/;
Expand Down
16 changes: 8 additions & 8 deletions src/printer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1018,8 +1018,8 @@ function printLines(path, options, print, childrenAttribute = "children") {
"?>",
]
: isProgramLikeNode(node) && isFirstNode && node.kind !== "namespace"
? ""
: [beforeCloseTagInlineNode, "?>"];
? ""
: [beforeCloseTagInlineNode, "?>"];

//FIXME getNode is used to get ancestors, but it seems this means to get next sibling?
const nextV = path.getNode(index + 1);
Expand All @@ -1034,8 +1034,8 @@ function printLines(path, options, print, childrenAttribute = "children") {
hardline,
]
: isProgramLikeNode(node) && isLastNode
? ""
: [openTag, " "];
? ""
: [openTag, " "];

printed = [beforeInline, printed, afterInline];
}
Expand Down Expand Up @@ -1091,8 +1091,8 @@ function printLines(path, options, print, childrenAttribute = "children") {
: "",
]
: node.comments
? hardline
: "";
? hardline
: "";

parts.push(lineSuffix([beforeCloseTag, "?>"]));
}
Expand Down Expand Up @@ -1711,8 +1711,8 @@ function printNode(path, options, print) {
hardline,
]
: hasDanglingComments(node)
? [line, printDanglingComments(path, options, true), line]
: "",
? [line, printDanglingComments(path, options, true), line]
: "",
"}",
]
: "",
Expand Down
11 changes: 11 additions & 0 deletions src/util.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,16 @@ function isSimpleCallArgument(node, depth = 2) {
return false;
}

function memoize(fn) {
const cache = new Map();
return (key) => {
if (!cache.has(key)) {
cache.set(key, fn(key));
}
return cache.get(key);
};
}

export {
printNumber,
getPrecedence,
Expand Down Expand Up @@ -715,4 +725,5 @@ export {
getAncestorNode,
normalizeMagicMethodName,
isSimpleCallArgument,
memoize,
};
4 changes: 2 additions & 2 deletions tests_config/run_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ function printOptions(options) {
return value === Infinity
? "Infinity"
: Array.isArray(value)
? `[${value.map((v) => JSON.stringify(v)).join(", ")}]`
: JSON.stringify(value);
? `[${value.map((v) => JSON.stringify(v)).join(", ")}]`
: JSON.stringify(value);
}
}

Expand Down
Loading
Loading