Lint against console.log
and replace `console.log` instances in the codebase with better alternatives!
This commit is contained in:
parent
71a6dbdad7
commit
ec3aa1747d
11 changed files with 27 additions and 14 deletions
15
package.json
15
package.json
|
@ -71,7 +71,20 @@
|
||||||
"export-users-to-auth0": "ts-node --compiler=typescript-cached-transpile --transpile-only -r dotenv/config scripts/export-users-to-auth0.js"
|
"export-users-to-auth0": "ts-node --compiler=typescript-cached-transpile --transpile-only -r dotenv/config scripts/export-users-to-auth0.js"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": "react-app"
|
"extends": "react-app",
|
||||||
|
"rules": {
|
||||||
|
"no-console": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"allow": [
|
||||||
|
"debug",
|
||||||
|
"info",
|
||||||
|
"warn",
|
||||||
|
"error"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
"production": [
|
"production": [
|
||||||
|
|
|
@ -542,7 +542,7 @@ function useDownloadableImage(visibleLayers) {
|
||||||
context.drawImage(image, 0, 0);
|
context.drawImage(image, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(
|
console.debug(
|
||||||
"Generated image for download",
|
"Generated image for download",
|
||||||
layerIds,
|
layerIds,
|
||||||
canvas.toDataURL("image/png")
|
canvas.toDataURL("image/png")
|
||||||
|
|
|
@ -77,7 +77,7 @@ function WardrobeDevHacks() {
|
||||||
data: { zone: { __ref: `Zone:${zone.id}` } },
|
data: { zone: { __ref: `Zone:${zone.id}` } },
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(
|
console.info(
|
||||||
`Updated layer ${layerId} to zone ${zone.id} (was ${layer?.zone?.id})`
|
`Updated layer ${layerId} to zone ${zone.id} (was ${layer?.zone?.id})`
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -171,7 +171,7 @@ function WardrobeDevHacks() {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(
|
console.info(
|
||||||
`Added restricted zone ${zone.id} to item ${itemId} ` +
|
`Added restricted zone ${zone.id} to item ${itemId} ` +
|
||||||
`(now it's zones ${[...restrictedZoneIds].join(", ")})`
|
`(now it's zones ${[...restrictedZoneIds].join(", ")})`
|
||||||
);
|
);
|
||||||
|
@ -262,7 +262,7 @@ function WardrobeDevHacks() {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(
|
console.info(
|
||||||
`Removed restricted zone ${zone.id} from item ${itemId} ` +
|
`Removed restricted zone ${zone.id} from item ${itemId} ` +
|
||||||
`(now it's zones ${[...restrictedZoneIds].join(", ")})`
|
`(now it's zones ${[...restrictedZoneIds].join(", ")})`
|
||||||
);
|
);
|
||||||
|
|
|
@ -32,7 +32,7 @@ function WardrobePage() {
|
||||||
// isn't very common, so this lil toast notification seems good enough!
|
// isn't very common, so this lil toast notification seems good enough!
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
toast({
|
toast({
|
||||||
title: "We couldn't load this outfit 😖",
|
title: "We couldn't load this outfit 😖",
|
||||||
description: "Please reload the page to try again. Sorry!",
|
description: "Please reload the page to try again. Sorry!",
|
||||||
|
|
|
@ -248,7 +248,7 @@ function useOutfitState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const outfitStateReducer = (apolloClient) => (baseState, action) => {
|
const outfitStateReducer = (apolloClient) => (baseState, action) => {
|
||||||
console.log("[Outfit state] Action:", action);
|
console.info("[Outfit state] Action:", action);
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case "rename":
|
case "rename":
|
||||||
return produce(baseState, (state) => {
|
return produce(baseState, (state) => {
|
||||||
|
|
|
@ -288,7 +288,7 @@ export function useLocalStorage(key, initialValue) {
|
||||||
const item = window.localStorage.getItem(key);
|
const item = window.localStorage.getItem(key);
|
||||||
return item ? JSON.parse(item) : initialValue;
|
return item ? JSON.parse(item) : initialValue;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return initialValue;
|
return initialValue;
|
||||||
}
|
}
|
||||||
}, [key, initialValue]);
|
}, [key, initialValue]);
|
||||||
|
@ -301,7 +301,7 @@ export function useLocalStorage(key, initialValue) {
|
||||||
window.localStorage.setItem(key, JSON.stringify(value));
|
window.localStorage.setItem(key, JSON.stringify(value));
|
||||||
storageListeners.forEach((l) => l());
|
storageListeners.forEach((l) => l());
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ async function getUserIdFromToken(token) {
|
||||||
|
|
||||||
const subMatch = payload.sub.match(/auth0\|impress-([0-9]+)/);
|
const subMatch = payload.sub.match(/auth0\|impress-([0-9]+)/);
|
||||||
if (!subMatch) {
|
if (!subMatch) {
|
||||||
console.log("Unexpected auth token sub format", payload.sub);
|
console.error("Unexpected auth token sub format", payload.sub);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const userId = subMatch[1];
|
const userId = subMatch[1];
|
||||||
|
|
|
@ -91,7 +91,7 @@ if (require.main === module) {
|
||||||
const { ApolloServer } = require("apollo-server");
|
const { ApolloServer } = require("apollo-server");
|
||||||
const server = new ApolloServer(config);
|
const server = new ApolloServer(config);
|
||||||
server.listen().then(({ url }) => {
|
server.listen().then(({ url }) => {
|
||||||
console.log(`🚀 Server ready at ${url}`);
|
console.info(`🚀 Server ready at ${url}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ async function saveModelingData(customPetData, petMetaData, context) {
|
||||||
|
|
||||||
const modelingLogs = [];
|
const modelingLogs = [];
|
||||||
const addToModelingLogs = (entry) => {
|
const addToModelingLogs = (entry) => {
|
||||||
console.log("[Modeling] " + JSON.stringify(entry, null, 4));
|
console.info("[Modeling] " + JSON.stringify(entry, null, 4));
|
||||||
modelingLogs.push(entry);
|
modelingLogs.push(entry);
|
||||||
};
|
};
|
||||||
context = { ...context, addToModelingLogs };
|
context = { ...context, addToModelingLogs };
|
||||||
|
|
|
@ -490,7 +490,7 @@ async function loadAndCacheAssetManifest(db, layer) {
|
||||||
`Expected to affect 1 asset, but affected ${result.affectedRows}`
|
`Expected to affect 1 asset, but affected ${result.affectedRows}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
console.log(
|
console.info(
|
||||||
`Loaded and saved manifest for ${layer.type} ${layer.remoteId}. ` +
|
`Loaded and saved manifest for ${layer.type} ${layer.remoteId}. ` +
|
||||||
`DTI ID: ${layer.id}. Exists?: ${Boolean(manifest)}`
|
`DTI ID: ${layer.id}. Exists?: ${Boolean(manifest)}`
|
||||||
);
|
);
|
||||||
|
|
|
@ -235,7 +235,7 @@ const resolvers = {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Saved outfit ${newOutfitId}`);
|
console.info(`Saved outfit ${newOutfitId}`);
|
||||||
|
|
||||||
return { id: newOutfitId };
|
return { id: newOutfitId };
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue