Lint all the things
This commit is contained in:
@@ -7,7 +7,7 @@ import {
|
||||
} from "@ant-design/icons";
|
||||
import { Card, Col, Row, Space, Tooltip } from "antd";
|
||||
import Dinero from "dinero.js";
|
||||
import React, { useMemo } from "react";
|
||||
import { memo, useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router-dom";
|
||||
import { DateTimeFormatter } from "../../utils/DateFormatter";
|
||||
@@ -22,7 +22,7 @@ import { PiMicrosoftTeamsLogo } from "react-icons/pi";
|
||||
|
||||
const cardColor = (ssbuckets, totalHrs) => {
|
||||
const bucket = ssbuckets.find((bucket) => bucket.gte <= totalHrs && (!bucket.lt || bucket.lt > totalHrs));
|
||||
return bucket && bucket.color
|
||||
return bucket?.color
|
||||
? bucket.color.rgb || bucket.color
|
||||
: {
|
||||
r: 255,
|
||||
@@ -44,7 +44,7 @@ const getContrastYIQ = (bgColor, isDarkMode = document.documentElement.getAttrib
|
||||
|
||||
const findEmployeeById = (employees, id) => employees.find((e) => e.id === id);
|
||||
|
||||
const EllipsesToolTip = React.memo(({ title, children, kiosk }) => {
|
||||
const EllipsesToolTip = memo(({ title, children, kiosk }) => {
|
||||
if (kiosk || !title) {
|
||||
return <div className="ellipses no-select">{children}</div>;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ function ProductionBoardKanbanContainer({ bodyshop, currentUser, subscriptionTyp
|
||||
reconnectTimeout.current = setTimeout(() => {
|
||||
const randomDelay = Math.floor(Math.random() * (30000 - 10000 + 1)) + 10000; // Random delay between 10 and 30 seconds
|
||||
setTimeout(() => {
|
||||
if (refetch) refetch().catch((err) => console.error(`Issue `));
|
||||
if (refetch) refetch().catch(() => console.error(`Issue `));
|
||||
reconnectTimeout.current = null; // Clear the timeout reference after refetch
|
||||
}, randomDelay);
|
||||
}, acceptableReconnectTime);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useMemo } from "react";
|
||||
import { useMemo } from "react";
|
||||
import { Card, Statistic } from "antd";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import PropTypes from "prop-types";
|
||||
@@ -184,7 +184,7 @@ const ProductionStatistics = ({ data, cardSettings, reducerData }) => {
|
||||
cardSettings?.statisticsOrder ? cardSettings.statisticsOrder : defaultKanbanSettings.statisticsOrder
|
||||
).reduce((sorted, orderId) => {
|
||||
const value = statisticsMap.get(orderId);
|
||||
if (value && value.value !== null) {
|
||||
if (value?.value) {
|
||||
sorted.push(value);
|
||||
}
|
||||
return sorted;
|
||||
|
||||
@@ -102,7 +102,7 @@ const mergeWithDefaults = (settings) => {
|
||||
// Override with the provided settings, if any
|
||||
if (settings) {
|
||||
for (const key in settings) {
|
||||
if (settings.hasOwnProperty(key)) {
|
||||
if (Object.prototype.hasOwnProperty.call(settings, key)) {
|
||||
mergedSettings[key] = settings[key];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
const HeightPreservingItem = ({ children, ...props }) => {
|
||||
const [size, setSize] = useState(0);
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import React from "react";
|
||||
|
||||
const ItemComponent = ({ children, maxCardHeight, maxCardWidth, ...props }) => (
|
||||
<div style={{ minWidth: maxCardWidth, minHeight: maxCardHeight }} {...props}>
|
||||
{children}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import React from "react";
|
||||
import { memo } from "react";
|
||||
|
||||
const ItemWrapper = React.memo(({ children, ...props }) => (
|
||||
const ItemWrapper = memo(({ children, ...props }) => (
|
||||
<div {...props} className="item-wrapper">
|
||||
{children}
|
||||
</div>
|
||||
));
|
||||
|
||||
ItemWrapper.displayName = "ItemWrapper";
|
||||
|
||||
export default ItemWrapper;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import React from "react";
|
||||
import { LaneFooter } from "../styles/Base.js";
|
||||
import { CollapseBtn, ExpandBtn } from "../styles/Elements.js";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { forwardRef } from "react";
|
||||
import { forwardRef } from "react";
|
||||
|
||||
const ListComponent = forwardRef(({ style, children, ...props }, ref) => (
|
||||
<div ref={ref} {...props} style={{ ...style }}>
|
||||
@@ -6,4 +6,6 @@ const ListComponent = forwardRef(({ style, children, ...props }, ref) => (
|
||||
</div>
|
||||
));
|
||||
|
||||
ListComponent.displayName = "ListComponent";
|
||||
|
||||
export default ListComponent;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useRef } from "react";
|
||||
import { useEffect, useRef } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
const SizeMemoryWrapper = ({ children, maxHeight, setMaxHeight, maxWidth, setMaxWidth }) => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useMemo } from "react";
|
||||
import { StyleHorizontal, StyleVertical } from "../styles/Base.js";
|
||||
import { cardSizesVertical } from "../styles/Globals.js";
|
||||
|
||||
const Board = ({ id, className, orientation, cardSettings, ...additionalProps }) => {
|
||||
const Board = ({ orientation, cardSettings, ...additionalProps }) => {
|
||||
const OrientationStyle = useMemo(
|
||||
() => (orientation === "horizontal" ? StyleHorizontal : StyleVertical),
|
||||
[orientation]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { DragDropContext } from "../dnd/lib";
|
||||
import PropTypes from "prop-types";
|
||||
@@ -25,9 +25,15 @@ const useDragMap = () => {
|
||||
|
||||
const BoardContainer = ({
|
||||
data,
|
||||
onDataChange = () => {},
|
||||
onDragEnd = () => {},
|
||||
laneSortFunction = () => {},
|
||||
onDataChange = () => {
|
||||
// NO OP
|
||||
},
|
||||
onDragEnd = () => {
|
||||
// NO OP
|
||||
},
|
||||
laneSortFunction = () => {
|
||||
// NO OP
|
||||
},
|
||||
orientation = "horizontal",
|
||||
cardSettings = {},
|
||||
eventBusHandle,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback, useMemo, useRef, useState } from "react";
|
||||
import { useCallback, useMemo, useRef, useState } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { bindActionCreators } from "redux";
|
||||
import { connect } from "react-redux";
|
||||
|
||||
@@ -27,7 +27,7 @@ export const finish = (key) => {
|
||||
const now = performance.now();
|
||||
const previous = records[key];
|
||||
if (!previous) {
|
||||
// eslint-disable-next-line no-console
|
||||
|
||||
console.warn("cannot finish timing as no previous time found", key);
|
||||
return;
|
||||
}
|
||||
@@ -52,7 +52,6 @@ export const finish = (key) => {
|
||||
};
|
||||
})();
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(
|
||||
`${style.symbol} %cTiming %c${rounded} %cms %c${key}`,
|
||||
// title
|
||||
|
||||
@@ -36,7 +36,6 @@ export function log(type, message) {
|
||||
return;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console[type](...getFormattedMessage(message));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
const isProduction = import.meta.env.PROD;
|
||||
const prefix = "Invariant failed";
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-restricted-globals */
|
||||
export function isInteger(value) {
|
||||
if (Number.isInteger) {
|
||||
return Number.isInteger(value);
|
||||
|
||||
@@ -11,7 +11,7 @@ function getHasOverlap(first, second) {
|
||||
);
|
||||
}
|
||||
|
||||
function getFurthestAway({ pageBorderBox, draggable, candidates }) {
|
||||
function getFurthestAway({ draggable, candidates }) {
|
||||
// We are not comparing the center of the home list with the target list as it would
|
||||
// give preference to giant lists
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ export default class ErrorBoundary extends React.Component {
|
||||
}
|
||||
|
||||
// throwing error for other error boundaries
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
throw err;
|
||||
}
|
||||
|
||||
@@ -58,7 +57,7 @@ export default class ErrorBoundary extends React.Component {
|
||||
};
|
||||
getCallbacks = () => {
|
||||
if (!this.callbacks) {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
|
||||
throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");
|
||||
}
|
||||
return this.callbacks;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// eslint-disable-next-line
|
||||
import memoizeOne from "memoize-one";
|
||||
import { connect } from "react-redux";
|
||||
import Draggable from "./draggable";
|
||||
|
||||
@@ -54,7 +54,6 @@ export default function Draggable(props) {
|
||||
// We are violating the rules of hooks here: conditional hooks.
|
||||
// In this specific use case it is okay as an item will always either be a
|
||||
// clone or not for it's whole lifecycle
|
||||
/* eslint-disable react-hooks/rules-of-hooks */
|
||||
|
||||
// Being super sure that isClone is not changing during a draggable lifecycle
|
||||
useClonePropValidation(isClone);
|
||||
@@ -72,7 +71,6 @@ export default function Draggable(props) {
|
||||
);
|
||||
useDraggablePublisher(forPublisher);
|
||||
}
|
||||
/* eslint-enable react-hooks/rules-of-hooks */
|
||||
|
||||
const dragHandleProps = useMemo(
|
||||
() =>
|
||||
|
||||
@@ -41,10 +41,8 @@ export function useValidation(props, contextId, getRef) {
|
||||
// we expect isClone not to change for entire component's life
|
||||
export function useClonePropValidation(isClone) {
|
||||
useDev(() => {
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
const initialRef = useRef(isClone);
|
||||
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
useDevSetupWarning(() => {
|
||||
invariant(isClone === initialRef.current, "Draggable isClone prop value changed during component life");
|
||||
}, [isClone]);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
/* eslint-disable no-unused-vars */
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import memoizeOne from "memoize-one";
|
||||
import Droppable from "./droppable";
|
||||
@@ -170,7 +171,6 @@ const mapDispatchToProps = {
|
||||
|
||||
// Abstract class allows to specify props and defaults to component.
|
||||
// All other ways give any or do not let add default props.
|
||||
// eslint-disable-next-line
|
||||
/*::
|
||||
class DroppableType extends Component<OwnProps> {
|
||||
static defaultProps = defaultProps;
|
||||
|
||||
@@ -24,7 +24,6 @@ export default function Droppable({
|
||||
isDropDisabled = false,
|
||||
isCombineEnabled = false,
|
||||
ignoreContainerClipping = false,
|
||||
renderClone,
|
||||
getContainerForClone = getBody,
|
||||
...props
|
||||
}) {
|
||||
|
||||
@@ -3,7 +3,9 @@ import { useCallback } from "use-memo-one";
|
||||
import { transitions } from "../../animation";
|
||||
import { noSpacing } from "../../state/spacing";
|
||||
|
||||
function noop() {}
|
||||
function noop() {
|
||||
// NO OP
|
||||
}
|
||||
|
||||
const empty = {
|
||||
width: 0,
|
||||
|
||||
@@ -4,7 +4,6 @@ import useDev from "./use-dev";
|
||||
|
||||
export default function useDevSetupWarning(fn, inputs) {
|
||||
useDev(() => {
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
useEffect(() => {
|
||||
try {
|
||||
fn();
|
||||
@@ -15,7 +14,6 @@ export default function useDevSetupWarning(fn, inputs) {
|
||||
> ${e.message}
|
||||
`);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, inputs);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
export default function useDev(useHook) {
|
||||
// Don't run any validation in production
|
||||
if (import.meta.env.DEV) {
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
useHook();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { useEffect, useLayoutEffect } from "react"; // https://github.com/reduxjs/react-redux/blob/v7-beta/src/components/connectAdvanced.js#L35
|
||||
|
||||
// https://github.com/reduxjs/react-redux/blob/v7-beta/src/components/connectAdvanced.js#L35
|
||||
|
||||
@@ -140,7 +140,7 @@ export default function useKeyboardSensor(api) {
|
||||
const preDrag = api.tryGetLock(
|
||||
draggableId,
|
||||
// abort function not defined yet
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
|
||||
stop,
|
||||
{
|
||||
sourceEvent: event
|
||||
@@ -171,7 +171,7 @@ export default function useKeyboardSensor(api) {
|
||||
// unbind dragging bindings
|
||||
unbindEventsRef.current();
|
||||
// start listening for capture again
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
|
||||
listenForCapture();
|
||||
}
|
||||
|
||||
@@ -183,7 +183,6 @@ export default function useKeyboardSensor(api) {
|
||||
}
|
||||
}),
|
||||
// not including startPendingDrag as it is not defined initially
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[api]
|
||||
);
|
||||
const listenForCapture = useCallback(
|
||||
|
||||
@@ -187,7 +187,7 @@ export default function useMouseSensor(api) {
|
||||
const actions = api.tryGetLock(
|
||||
draggableId,
|
||||
// stop is defined later
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
|
||||
stop,
|
||||
{
|
||||
sourceEvent: event
|
||||
@@ -207,12 +207,11 @@ export default function useMouseSensor(api) {
|
||||
// unbind this listener
|
||||
unbindEventsRef.current();
|
||||
// using this function before it is defined as their is a circular usage pattern
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
|
||||
startPendingDrag(actions, point);
|
||||
}
|
||||
}),
|
||||
// not including startPendingDrag as it is not defined initially
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[api]
|
||||
);
|
||||
const preventForcePressBinding = useMemo(
|
||||
|
||||
@@ -222,7 +222,7 @@ export default function useTouchSensor(api) {
|
||||
}
|
||||
const actions = api.tryGetLock(
|
||||
draggableId,
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
|
||||
stop,
|
||||
{
|
||||
sourceEvent: event
|
||||
@@ -246,12 +246,11 @@ export default function useTouchSensor(api) {
|
||||
// unbind this event handler
|
||||
unbindEventsRef.current();
|
||||
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
|
||||
startPendingDrag(actions, point, handle);
|
||||
}
|
||||
}),
|
||||
// not including stop or startPendingDrag as it is not defined initially
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[api]
|
||||
);
|
||||
const listenForCapture = useCallback(
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* eslint-disable react-hooks/rules-of-hooks */
|
||||
import {invariant} from "../../invariant";
|
||||
import { invariant } from "../../invariant";
|
||||
import usePreviousRef from "../use-previous-ref";
|
||||
import useDevSetupWarning from "../use-dev-setup-warning";
|
||||
import useDev from "../use-dev";
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import React from "react";
|
||||
|
||||
import BoardContainer from "./controllers/BoardContainer.jsx";
|
||||
import Board from "./controllers/Board.jsx";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user