Lint all the things
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import React from "react";
|
||||
import { Select } from "antd";
|
||||
import i18n from "../translations/i18n";
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import React from "react";
|
||||
import { NumericFormat } from "react-number-format";
|
||||
|
||||
export default function CurrencyFormatter(props) {
|
||||
|
||||
@@ -49,7 +49,7 @@ const roundTripLink = new ApolloLink((operation, forward) => {
|
||||
});
|
||||
});
|
||||
|
||||
const TrackExecutionTime = async (operationName, time) => {
|
||||
const TrackExecutionTime = async () => {
|
||||
// if (process.env.NODE_ENV === "development") return;
|
||||
// const rdxStore = store.getState();
|
||||
// try {
|
||||
@@ -130,7 +130,7 @@ const retryLink = new RetryLink({
|
||||
},
|
||||
attempts: {
|
||||
max: 5,
|
||||
retryIf: (error, _operation) => !!error
|
||||
retryIf: (error) => !!error
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
//import NumberFormat from "react-number-format";
|
||||
import parsePhoneNumber from "libphonenumber-js";
|
||||
import React from "react";
|
||||
|
||||
export default function PhoneNumberFormatter(props) {
|
||||
const p = parsePhoneNumber(props.children || "", "CA");
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { AlertOutlined } from "@ant-design/icons";
|
||||
import { Button, notification, Space } from "antd";
|
||||
import i18n from "i18next";
|
||||
import React from "react";
|
||||
import * as serviceWorkerRegistration from "../serviceWorkerRegistration";
|
||||
import { store } from "../redux/store";
|
||||
import InstanceRenderManager from "./instanceRenderMgr";
|
||||
@@ -13,10 +12,7 @@ const onServiceWorkerUpdate = (registration) => {
|
||||
<Space flex>
|
||||
<Button
|
||||
onClick={async () => {
|
||||
window.open(
|
||||
`https://shopmanagement.canny.io/changelog`,
|
||||
"_blank"
|
||||
);
|
||||
window.open(`https://shopmanagement.canny.io/changelog`, "_blank");
|
||||
}}
|
||||
>
|
||||
{i18n.t("general.actions.viewreleasenotes")}
|
||||
@@ -24,7 +20,7 @@ const onServiceWorkerUpdate = (registration) => {
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={async () => {
|
||||
if (registration && registration.waiting) {
|
||||
if (registration?.waiting) {
|
||||
await registration.unregister();
|
||||
// Makes Workbox call skipWaiting()
|
||||
registration.waiting.postMessage({ type: "SKIP_WAITING" });
|
||||
|
||||
@@ -48,24 +48,24 @@ export default async function RenderTemplate(
|
||||
...(renderAsHtml
|
||||
? {}
|
||||
: {
|
||||
recipe: "chrome-pdf",
|
||||
...(!ignoreCustomMargins && {
|
||||
chrome: {
|
||||
marginTop:
|
||||
bodyshop.logo_img_path &&
|
||||
recipe: "chrome-pdf",
|
||||
...(!ignoreCustomMargins && {
|
||||
chrome: {
|
||||
marginTop:
|
||||
bodyshop.logo_img_path &&
|
||||
bodyshop.logo_img_path.headerMargin &&
|
||||
bodyshop.logo_img_path.headerMargin > 36
|
||||
? bodyshop.logo_img_path.headerMargin
|
||||
: "36px",
|
||||
marginBottom:
|
||||
bodyshop.logo_img_path &&
|
||||
? bodyshop.logo_img_path.headerMargin
|
||||
: "36px",
|
||||
marginBottom:
|
||||
bodyshop.logo_img_path &&
|
||||
bodyshop.logo_img_path.footerMargin &&
|
||||
bodyshop.logo_img_path.footerMargin > 50
|
||||
? bodyshop.logo_img_path.footerMargin
|
||||
: "50px"
|
||||
}
|
||||
})
|
||||
}),
|
||||
? bodyshop.logo_img_path.footerMargin
|
||||
: "50px"
|
||||
}
|
||||
})
|
||||
}),
|
||||
...(renderAsExcel ? { recipe: "html-to-xlsx" } : {}),
|
||||
...(renderAsText ? { recipe: "text" } : {})
|
||||
},
|
||||
@@ -100,14 +100,14 @@ export default async function RenderTemplate(
|
||||
chrome: {
|
||||
marginTop:
|
||||
bodyshop.logo_img_path &&
|
||||
bodyshop.logo_img_path.headerMargin &&
|
||||
bodyshop.logo_img_path.headerMargin > 36
|
||||
bodyshop.logo_img_path.headerMargin &&
|
||||
bodyshop.logo_img_path.headerMargin > 36
|
||||
? bodyshop.logo_img_path.headerMargin
|
||||
: "36px",
|
||||
marginBottom:
|
||||
bodyshop.logo_img_path &&
|
||||
bodyshop.logo_img_path.footerMargin &&
|
||||
bodyshop.logo_img_path.footerMargin > 50
|
||||
bodyshop.logo_img_path.footerMargin &&
|
||||
bodyshop.logo_img_path.footerMargin > 50
|
||||
? bodyshop.logo_img_path.footerMargin
|
||||
: "50px"
|
||||
}
|
||||
@@ -119,7 +119,7 @@ export default async function RenderTemplate(
|
||||
pdf = await pdfRender.toDataURI();
|
||||
}
|
||||
const html = await render.toString();
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise((resolve) => {
|
||||
resolve({
|
||||
pdf,
|
||||
filename: Templates[templateObject.name] && Templates[templateObject.name].title,
|
||||
@@ -182,22 +182,22 @@ export async function RenderTemplates(templateObjects, bodyshop, renderAsHtml =
|
||||
...(renderAsHtml
|
||||
? {}
|
||||
: {
|
||||
recipe: "chrome-pdf",
|
||||
chrome: {
|
||||
marginTop:
|
||||
bodyshop.logo_img_path &&
|
||||
recipe: "chrome-pdf",
|
||||
chrome: {
|
||||
marginTop:
|
||||
bodyshop.logo_img_path &&
|
||||
bodyshop.logo_img_path.headerMargin &&
|
||||
bodyshop.logo_img_path.headerMargin > 36
|
||||
? bodyshop.logo_img_path.headerMargin
|
||||
: "36px",
|
||||
marginBottom:
|
||||
bodyshop.logo_img_path &&
|
||||
? bodyshop.logo_img_path.headerMargin
|
||||
: "36px",
|
||||
marginBottom:
|
||||
bodyshop.logo_img_path &&
|
||||
bodyshop.logo_img_path.footerMargin &&
|
||||
bodyshop.logo_img_path.footerMargin > 50
|
||||
? bodyshop.logo_img_path.footerMargin
|
||||
: "50px"
|
||||
}
|
||||
}),
|
||||
? bodyshop.logo_img_path.footerMargin
|
||||
: "50px"
|
||||
}
|
||||
}),
|
||||
pdfOperations: [
|
||||
{
|
||||
template: {
|
||||
@@ -213,14 +213,14 @@ export async function RenderTemplates(templateObjects, bodyshop, renderAsHtml =
|
||||
chrome: {
|
||||
marginTop:
|
||||
bodyshop.logo_img_path &&
|
||||
bodyshop.logo_img_path.headerMargin &&
|
||||
bodyshop.logo_img_path.headerMargin > 36
|
||||
bodyshop.logo_img_path.headerMargin &&
|
||||
bodyshop.logo_img_path.headerMargin > 36
|
||||
? bodyshop.logo_img_path.headerMargin
|
||||
: "36px",
|
||||
marginBottom:
|
||||
bodyshop.logo_img_path &&
|
||||
bodyshop.logo_img_path.footerMargin &&
|
||||
bodyshop.logo_img_path.footerMargin > 50
|
||||
bodyshop.logo_img_path.footerMargin &&
|
||||
bodyshop.logo_img_path.footerMargin > 50
|
||||
? bodyshop.logo_img_path.footerMargin
|
||||
: "50px"
|
||||
},
|
||||
@@ -428,7 +428,7 @@ const fetchContextData = async (templateObject, jsrAuth) => {
|
||||
// }
|
||||
// };
|
||||
|
||||
function extend(o1, o2, o3) {
|
||||
function extend() {
|
||||
var result = {},
|
||||
obj;
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import React from "react";
|
||||
|
||||
export function PartsLabelMulti() {
|
||||
return <div></div>;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export function onlyUnique(value, index, self, key) {
|
||||
export function onlyUnique(value, index, self) {
|
||||
return self.indexOf(value) === index;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable */
|
||||
|
||||
function confirmDialog(msg) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
let confirmed = window.confirm(msg);
|
||||
|
||||
@@ -27,21 +27,17 @@ const useCountDown = (timeToCount = 60 * 1000, interval = 1000) => {
|
||||
}
|
||||
};
|
||||
|
||||
const start = React.useCallback(
|
||||
(ttc) => {
|
||||
window.cancelAnimationFrame(timer.current.requestId);
|
||||
const start = React.useCallback((ttc) => {
|
||||
window.cancelAnimationFrame(timer.current.requestId);
|
||||
|
||||
const newTimeToCount = ttc !== undefined ? ttc : timeToCount;
|
||||
timer.current.started = null;
|
||||
timer.current.lastInterval = null;
|
||||
timer.current.timeToCount = newTimeToCount;
|
||||
timer.current.requestId = window.requestAnimationFrame(run);
|
||||
const newTimeToCount = ttc !== undefined ? ttc : timeToCount;
|
||||
timer.current.started = null;
|
||||
timer.current.lastInterval = null;
|
||||
timer.current.timeToCount = newTimeToCount;
|
||||
timer.current.requestId = window.requestAnimationFrame(run);
|
||||
|
||||
setTimeLeft(newTimeToCount);
|
||||
},
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[]
|
||||
);
|
||||
setTimeLeft(newTimeToCount);
|
||||
}, []);
|
||||
|
||||
const pause = React.useCallback(() => {
|
||||
window.cancelAnimationFrame(timer.current.requestId);
|
||||
@@ -50,16 +46,12 @@ const useCountDown = (timeToCount = 60 * 1000, interval = 1000) => {
|
||||
timer.current.timeToCount = timer.current.timeLeft;
|
||||
}, []);
|
||||
|
||||
const resume = React.useCallback(
|
||||
() => {
|
||||
if (!timer.current.started && timer.current.timeLeft > 0) {
|
||||
window.cancelAnimationFrame(timer.current.requestId);
|
||||
timer.current.requestId = window.requestAnimationFrame(run);
|
||||
}
|
||||
},
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[]
|
||||
);
|
||||
const resume = React.useCallback(() => {
|
||||
if (!timer.current.started && timer.current.timeLeft > 0) {
|
||||
window.cancelAnimationFrame(timer.current.requestId);
|
||||
timer.current.requestId = window.requestAnimationFrame(run);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const reset = React.useCallback(() => {
|
||||
if (timer.current.timeLeft) {
|
||||
@@ -69,10 +61,7 @@ const useCountDown = (timeToCount = 60 * 1000, interval = 1000) => {
|
||||
}
|
||||
}, []);
|
||||
|
||||
const actions = React.useMemo(
|
||||
() => ({ start, pause, resume, reset }), // eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[]
|
||||
);
|
||||
const actions = React.useMemo(() => ({ start, pause, resume, reset }), []);
|
||||
|
||||
React.useEffect(() => {
|
||||
return () => window.cancelAnimationFrame(timer.current.requestId);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable */
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const filename = process.argv[2];
|
||||
|
||||
@@ -2,8 +2,6 @@ import { gql } from "@apollo/client";
|
||||
import { Kind, parse, print, visit } from "graphql";
|
||||
import client from "./GraphQLClient";
|
||||
|
||||
/* eslint-disable no-loop-func */
|
||||
|
||||
/**
|
||||
* The available operators for filtering (string)
|
||||
* @type {[{label: string, value: string},{label: string, value: string},{label: string, value: string},{label: string, value: string},{label: string, value: string},null,null,null]}
|
||||
@@ -117,7 +115,12 @@ export function printQuery(query) {
|
||||
* @param shopSpecificTemplate
|
||||
* @returns {Promise<{contextData: {}, useShopSpecificTemplate, shopSpecificTemplate}>}
|
||||
*/
|
||||
export async function generateTemplate(templateQueryToExecute, templateObject, useShopSpecificTemplate, shopSpecificFolder) {
|
||||
export async function generateTemplate(
|
||||
templateQueryToExecute,
|
||||
templateObject,
|
||||
useShopSpecificTemplate,
|
||||
shopSpecificFolder
|
||||
) {
|
||||
// Advanced Filtering and Sorting modifications start here
|
||||
|
||||
// Parse the query and apply the filters and sorters
|
||||
@@ -242,7 +245,7 @@ function applyTopLevelSub(node, fieldPath, filterField) {
|
||||
if (fieldPath.length > 2) {
|
||||
// More than one level deep
|
||||
let currentField = whereArg.value;
|
||||
fieldPath.slice(1, -1).forEach((path, index) => {
|
||||
fieldPath.slice(1, -1).forEach((path) => {
|
||||
let existingField = currentField.fields.find((f) => f.name.value === path);
|
||||
if (!existingField) {
|
||||
existingField = {
|
||||
@@ -382,7 +385,7 @@ function applyTopLevelFilter(node, fieldPath, filterField) {
|
||||
if (fieldPath.length > 2) {
|
||||
// More than one level deep
|
||||
let currentField = whereArg.value;
|
||||
fieldPath.slice(1, -1).forEach((path, index) => {
|
||||
fieldPath.slice(1, -1).forEach((path) => {
|
||||
let existingField = currentField.fields.find((f) => f.name.value === path);
|
||||
if (!existingField) {
|
||||
existingField = {
|
||||
@@ -468,5 +471,3 @@ function getGraphQLKind(value) {
|
||||
return Kind.STRING; // GraphQL does not have a Date type, so we return it as a string
|
||||
}
|
||||
}
|
||||
|
||||
/* eslint-enable no-loop-func */
|
||||
|
||||
@@ -30,7 +30,6 @@ const useEffectDebugger = (effectHook, dependencies, dependencyNames = []) => {
|
||||
console.log("[use-effect-debugger] ", changedDeps);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
useEffect(effectHook, dependencies);
|
||||
};
|
||||
|
||||
|
||||
@@ -6,15 +6,18 @@ export const useKeyboardSaveShortcut = (callback) =>
|
||||
|
||||
const keysReducer = (state, action) => {
|
||||
switch (action.type) {
|
||||
case "set-key-down":
|
||||
case "set-key-down": {
|
||||
const keydownState = { ...state, [action.key]: true };
|
||||
return keydownState;
|
||||
case "set-key-up":
|
||||
}
|
||||
case "set-key-up": {
|
||||
const keyUpState = { ...state, [action.key]: false };
|
||||
return keyUpState;
|
||||
case "reset-keys":
|
||||
}
|
||||
case "reset-keys": {
|
||||
const resetState = { ...action.data };
|
||||
return resetState;
|
||||
}
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
@@ -91,7 +94,6 @@ const useKeyboardShortcut = (shortcutKeys, callback, options) => {
|
||||
} else {
|
||||
setKeys({ type: null });
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [callback, keys]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user