-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
lang:javascriptIssues affecting JSIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.
Description
When contributing new polyfills to ES‑Shims, which have to use ES3, I still want to use Prettier for ES‑Shim packages that I own.
Since Prettier strips the quotes required by ES3 for object properties named with keywords, I have to run eslint ‑‑fix after running prettier --write, which is annoying.
Prettier 1.19.1
Playground link
Input:
function __generator(thisArg, body) {
var g;
return g = { next: verb(0), "throw": verb(1), return: verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
// …
}
}Output:
function __generator(thisArg, body) {
var g;
return (
(g = { next: verb(0), throw: verb(1), return: verb(2) }),
typeof Symbol === "function" &&
(g[Symbol.iterator] = function() {
return this;
}),
g
);
function verb(n) {
return function(v) {
return step([n, v]);
};
}
}Expected behavior:
function __generator(thisArg, body) {
var g;
return (
// `throw` and `return` are quoted,
// as they're invalid property names in ES3.
(g = { next: verb(0), "throw": verb(1), "return": verb(2) }),
typeof Symbol === "function" &&
(g[Symbol.iterator] = function() {
return this;
}),
g
);
function verb(n) {
return function(v) {
return step([n, v]);
};
}
}Metadata
Metadata
Assignees
Labels
lang:javascriptIssues affecting JSIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.