prettier
3.10.1 · 12 Nov 2026MIT196.9M / weekRepositoryHomepagenpmAtom feed
3.10.1 is the newest release of 3.x.
Release note
Fix cursor positioning for a special case
// <|> is the cursor position
/* Input */
// All messages are represented in JSON.
// So, the prettier.py controls a subprocess which spawns "node {this_file}".
import {<|> } from "fs"
/* Prettier 3.0.0 */
// All messages are represented in JSON.
// So, the prettier.py <|>controls a subprocess which spawns "node {this_file}".
import {} from "fs"
/* Prettier 3.0.1 */
// All messages are represented in JSON.
// So, the prettier.py controls a subprocess which spawns "node {this_file}".
import {<|>} from "fs"Fix plugins/estree.d.ts to make it a module
Add export {} in plugins/estree.d.ts to fix the "File is not a module" error
Add parenthesis around leading multiline comment in return statement
// Input
function fn() {
return (
/**
* @type {...}
*/ expression
)
}
// Prettier 3.0.0
function fn() {
return /**
* @type {...}
*/ expression;
}
// Prettier 3.0.1
function fn() {
return (
/**
* @type {...}
*/ expression
);
}Add support for Vue "Generic Components"
<!-- Input -->
<script setup lang="ts" generic="T extends Type1 & Type2 & (Type3 | Type4), U extends string | number | boolean"></script>
<!-- Prettier 3.0.0 -->
<script
setup
lang="ts"
generic="T extends Type1 & Type2 & (Type3 | Type4), U extends string | number | boolean"
></script>
<!-- Prettier 3.0.1 -->
<script
setup
lang="ts"
generic="
T extends Type1 & Type2 & (Type3 | Type4),
U extends string | number | boolean
"
></script>Fix comments print in IfStatement
function a(b) {
if (b) return 1; // comment
else return 2;
}
/* Prettier 3.0.0 */
Error: Comment "comment" was not printed. Please report this error!
/* Prettier 3.0.1 */
function a(b) {
if (b) return 1; // comment
else return 2;
}Add missing type definition for printer.preprocess
export interface Printer<T = any> {
// ...
+ preprocess?:
+ | ((ast: T, options: ParserOptions<T>) => T | Promise<T>)
+ | undefined;
}Add missing getVisitorKeys method type definition for Printer
const printer: Printer = {
print: () => [],
getVisitorKeys(node, nonTraversableKeys) {
return ["body"];
},
};Add typing to support readonly array properties of AST Node
// Input
interface TestNode {
readonlyArray: readonly string[];
}
declare const path: AstPath<TestNode>;
path.map(() => "", "readonlyArray");
// Prettier 3.0.0
interface TestNode {
readonlyArray: readonly string[];
}
declare const path: AstPath<TestNode>;
path.map(() => "", "readonlyArray");
// ^ Argument of type '"readonlyArray"' is not assignable to parameter of type '"regularArray"'. ts(2345)
// Prettier 3.0.1
interface TestNode {
readonlyArray: readonly string[];
}
declare const path: AstPath<TestNode>;
path.map(() => "", "readonlyArray");Add space before unary minus followed by a function call
// Input
div {
margin: - func();
}
// Prettier 3.0.0
div {
margin: -func();
}
// Prettier 3.0.1
div {
margin: - func();
}A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.