Set Prettier default to tabs instead of spaces, run on all JS
I haven't been running Prettier consistently on things in this project. Now, it's quick-runnable, and I've got it on everything! Also, I just think tabs are the right default for this kind of thing, and I'm glad to get to switch over to it! (In `package.json`.)
This commit is contained in:
parent
71ffb7f1be
commit
0e314482f7
57 changed files with 11694 additions and 11709 deletions
1
.prettierignore
Normal file
1
.prettierignore
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/app/assets/javascripts/lib
|
|
@ -1,7 +1,5 @@
|
||||||
document.addEventListener("change", ({ target }) => {
|
document.addEventListener("change", ({ target }) => {
|
||||||
if (target.matches('select[name="closet_list[visibility]"]')) {
|
if (target.matches('select[name="closet_list[visibility]"]')) {
|
||||||
target
|
target.closest("form").setAttribute("data-list-visibility", target.value);
|
||||||
.closest("form")
|
|
||||||
.setAttribute("data-list-visibility", target.value);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(function() {
|
(function () {
|
||||||
$('span.choose-outfit select').change(function(e) {
|
$("span.choose-outfit select").change(function (e) {
|
||||||
var select = $(this);
|
var select = $(this);
|
||||||
select.closest('li').find('input[type=text]').val(select.val());
|
select.closest("li").find("input[type=text]").val(select.val());
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -91,9 +91,7 @@ class MeasuredContent extends HTMLElement {
|
||||||
// as `var(--natural-width)` in the context of its CSS styles.
|
// as `var(--natural-width)` in the context of its CSS styles.
|
||||||
const container = this.closest("measured-container");
|
const container = this.closest("measured-container");
|
||||||
if (container == null) {
|
if (container == null) {
|
||||||
throw new Error(
|
throw new Error(`<measured-content> must be in a <measured-container>`);
|
||||||
`<measured-content> must be in a <measured-container>`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
container.style.setProperty("--natural-width", this.offsetWidth + "px");
|
container.style.setProperty("--natural-width", this.offsetWidth + "px");
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,9 +108,7 @@ class OutfitLayer extends HTMLElement {
|
||||||
this.#setStatus("loading");
|
this.#setStatus("loading");
|
||||||
this.#sendMessageToIframe({ type: "requestStatus" });
|
this.#sendMessageToIframe({ type: "requestStatus" });
|
||||||
window.addEventListener("message", (m) => this.#onMessage(m));
|
window.addEventListener("message", (m) => this.#onMessage(m));
|
||||||
this.iframe.addEventListener("error", () =>
|
this.iframe.addEventListener("error", () => this.#setStatus("error"));
|
||||||
this.#setStatus("error"),
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
console.warn(`<outfit-layer> contained no image or iframe: `, this);
|
console.warn(`<outfit-layer> contained no image or iframe: `, this);
|
||||||
}
|
}
|
||||||
|
@ -137,8 +135,7 @@ class OutfitLayer extends HTMLElement {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`<outfit-layer> got unexpected message: ` +
|
`<outfit-layer> got unexpected message: ` + JSON.stringify(data),
|
||||||
JSON.stringify(data),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,8 @@ import {
|
||||||
import SupportOnly from "./support/SupportOnly";
|
import SupportOnly from "./support/SupportOnly";
|
||||||
import useSupport from "./support/useSupport";
|
import useSupport from "./support/useSupport";
|
||||||
|
|
||||||
const LoadableItemSupportDrawer = loadable(() =>
|
const LoadableItemSupportDrawer = loadable(
|
||||||
import("./support/ItemSupportDrawer"),
|
() => import("./support/ItemSupportDrawer"),
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -346,14 +346,11 @@ let cachedResponseForAllValidPetPoses = null;
|
||||||
* data from GraphQL serves on the first render, without a loading state.
|
* data from GraphQL serves on the first render, without a loading state.
|
||||||
*/
|
*/
|
||||||
export function useAllValidPetPoses() {
|
export function useAllValidPetPoses() {
|
||||||
const networkResponse = useFetch(
|
const networkResponse = useFetch(buildImpress2020Url("/api/validPetPoses"), {
|
||||||
buildImpress2020Url("/api/validPetPoses"),
|
|
||||||
{
|
|
||||||
responseType: "arrayBuffer",
|
responseType: "arrayBuffer",
|
||||||
// If we already have globally-cached valids, skip the request.
|
// If we already have globally-cached valids, skip the request.
|
||||||
skip: cachedResponseForAllValidPetPoses != null,
|
skip: cachedResponseForAllValidPetPoses != null,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
|
|
||||||
// Use the globally-cached response if we have one, or await the network
|
// Use the globally-cached response if we have one, or await the network
|
||||||
// response if not.
|
// response if not.
|
||||||
|
|
|
@ -11,7 +11,7 @@ export function getSupportSecret() {
|
||||||
|
|
||||||
function readOrigin() {
|
function readOrigin() {
|
||||||
const node = document.querySelector("meta[name=impress-2020-origin]");
|
const node = document.querySelector("meta[name=impress-2020-origin]");
|
||||||
return node?.content || "https://impress-2020.openneo.net"
|
return node?.content || "https://impress-2020.openneo.net";
|
||||||
}
|
}
|
||||||
|
|
||||||
function readSupportSecret() {
|
function readSupportSecret() {
|
||||||
|
|
|
@ -13,9 +13,7 @@ export function useItemAppearances(id, options = {}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadItemAppearancesData(id) {
|
async function loadItemAppearancesData(id) {
|
||||||
const res = await fetch(
|
const res = await fetch(`/items/${encodeURIComponent(id)}/appearances.json`);
|
||||||
`/items/${encodeURIComponent(id)}/appearances.json`,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|
|
@ -44,9 +44,7 @@ async function loadSavedOutfit(id) {
|
||||||
const res = await fetch(`/outfits/${encodeURIComponent(id)}.json`);
|
const res = await fetch(`/outfits/${encodeURIComponent(id)}.json`);
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
throw new Error(
|
throw new Error(`loading outfit failed: ${res.status} ${res.statusText}`);
|
||||||
`loading outfit failed: ${res.status} ${res.statusText}`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return res.json().then(normalizeOutfit);
|
return res.json().then(normalizeOutfit);
|
||||||
|
@ -99,9 +97,7 @@ async function saveOutfit({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
throw new Error(
|
throw new Error(`saving outfit failed: ${res.status} ${res.statusText}`);
|
||||||
`saving outfit failed: ${res.status} ${res.statusText}`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return res.json().then(normalizeOutfit);
|
return res.json().then(normalizeOutfit);
|
||||||
|
@ -116,9 +112,7 @@ async function deleteOutfit(id) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
throw new Error(
|
throw new Error(`deleting outfit failed: ${res.status} ${res.statusText}`);
|
||||||
`deleting outfit failed: ${res.status} ${res.statusText}`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,9 +126,7 @@ function normalizeOutfit(outfit) {
|
||||||
appearanceId: String(outfit.pet_state_id),
|
appearanceId: String(outfit.pet_state_id),
|
||||||
altStyleId: outfit.alt_style_id ? String(outfit.alt_style_id) : null,
|
altStyleId: outfit.alt_style_id ? String(outfit.alt_style_id) : null,
|
||||||
wornItemIds: (outfit.item_ids?.worn || []).map((id) => String(id)),
|
wornItemIds: (outfit.item_ids?.worn || []).map((id) => String(id)),
|
||||||
closetedItemIds: (outfit.item_ids?.closeted || []).map((id) =>
|
closetedItemIds: (outfit.item_ids?.closeted || []).map((id) => String(id)),
|
||||||
String(id),
|
|
||||||
),
|
|
||||||
creator: outfit.user ? { id: String(outfit.user.id) } : null,
|
creator: outfit.user ? { id: String(outfit.user.id) } : null,
|
||||||
createdAt: outfit.created_at,
|
createdAt: outfit.created_at,
|
||||||
updatedAt: outfit.updated_at,
|
updatedAt: outfit.updated_at,
|
||||||
|
|
|
@ -46,8 +46,12 @@
|
||||||
"build": "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=/assets --asset-names='[name]-[hash].digested' --loader:.js=jsx --loader:.png=file --loader:.svg=file --loader:.min.js=text",
|
"build": "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=/assets --asset-names='[name]-[hash].digested' --loader:.js=jsx --loader:.png=file --loader:.svg=file --loader:.min.js=text",
|
||||||
"build:dev": "yarn build --public-path=/dev-assets",
|
"build:dev": "yarn build --public-path=/dev-assets",
|
||||||
"dev": "yarn build:dev --watch",
|
"dev": "yarn build:dev --watch",
|
||||||
|
"format": "prettier -w app/javascript app/assets/javascripts",
|
||||||
"lint": "eslint app/javascript",
|
"lint": "eslint app/javascript",
|
||||||
"prepare": "husky install"
|
"prepare": "husky install"
|
||||||
},
|
},
|
||||||
|
"prettier": {
|
||||||
|
"useTabs": true
|
||||||
|
},
|
||||||
"packageManager": "yarn@4.4.1"
|
"packageManager": "yarn@4.4.1"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue