ESLint: No unused variables (#1981)
* Update eslint config to inform about unused variables * Remove unused variables
This commit is contained in:
parent
ab6e13ecaa
commit
58d2a2b438
24 changed files with 10 additions and 39 deletions
|
@ -72,6 +72,10 @@
|
|||
"@typescript-eslint/triple-slash-reference": "error",
|
||||
"@typescript-eslint/type-annotation-spacing": "off",
|
||||
"@typescript-eslint/unified-signatures": "error",
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{ "argsIgnorePattern": "^_" }
|
||||
],
|
||||
"arrow-body-style": "error",
|
||||
"arrow-parens": ["off", "as-needed"],
|
||||
"camelcase": "off",
|
||||
|
|
|
@ -27,14 +27,12 @@ import { useStyles } from "../../styles";
|
|||
|
||||
export interface AppsInProgressProps {
|
||||
appsList: AppsInstallationsQuery["appsInstallations"];
|
||||
disabled: boolean;
|
||||
onAppInstallRetry: (id: string) => void;
|
||||
onRemove: (id: string) => void;
|
||||
}
|
||||
|
||||
const AppsInProgress: React.FC<AppsInProgressProps> = ({
|
||||
appsList,
|
||||
disabled,
|
||||
onAppInstallRetry,
|
||||
onRemove,
|
||||
...props
|
||||
|
|
|
@ -27,7 +27,6 @@ const props: AppsListPageProps = {
|
|||
customAppsList,
|
||||
disabled: false,
|
||||
installedAppsList: appsList,
|
||||
loadingAppsInProgress: false,
|
||||
getCustomAppHref: () => "",
|
||||
onAppInProgressRemove: () => undefined,
|
||||
onAppInstallRetry: () => undefined,
|
||||
|
@ -51,7 +50,6 @@ storiesOf("Views / Apps / Apps list", module)
|
|||
{...props}
|
||||
appsInProgressList={undefined}
|
||||
disabled={true}
|
||||
loadingAppsInProgress={true}
|
||||
installedAppsList={undefined}
|
||||
customAppsList={undefined}
|
||||
/>
|
||||
|
|
|
@ -15,7 +15,6 @@ export interface AppsListPageProps extends ListProps {
|
|||
installedAppsList: AppsListQuery["apps"]["edges"];
|
||||
customAppsList: AppsListQuery["apps"]["edges"];
|
||||
appsInProgressList?: AppsInstallationsQuery;
|
||||
loadingAppsInProgress: boolean;
|
||||
getCustomAppHref: (id: string) => string;
|
||||
onInstalledAppRemove: (id: string) => void;
|
||||
onCustomAppRemove: (id: string) => void;
|
||||
|
@ -27,7 +26,6 @@ const AppsListPage: React.FC<AppsListPageProps> = ({
|
|||
appsInProgressList,
|
||||
customAppsList,
|
||||
installedAppsList,
|
||||
loadingAppsInProgress,
|
||||
getCustomAppHref,
|
||||
onInstalledAppRemove,
|
||||
onCustomAppRemove,
|
||||
|
@ -58,7 +56,6 @@ const AppsListPage: React.FC<AppsListPageProps> = ({
|
|||
<CardSpacer />
|
||||
<AppsInProgress
|
||||
appsList={appsInProgress}
|
||||
disabled={loadingAppsInProgress}
|
||||
onAppInstallRetry={onAppInstallRetry}
|
||||
onRemove={onAppInProgressRemove}
|
||||
/>
|
||||
|
|
|
@ -32,9 +32,6 @@ export interface InstalledAppsProps extends ListProps {
|
|||
const InstalledApps: React.FC<InstalledAppsProps> = ({
|
||||
appsList,
|
||||
onRemove,
|
||||
settings,
|
||||
disabled,
|
||||
onUpdateListSettings,
|
||||
...props
|
||||
}) => {
|
||||
const intl = useIntl();
|
||||
|
|
|
@ -81,7 +81,6 @@ export const AppsList: React.FC<AppsListProps> = ({ params }) => {
|
|||
|
||||
const {
|
||||
data: appsInProgressData,
|
||||
loading: loadingAppsInProgress,
|
||||
refetch: appsInProgressRefetch,
|
||||
} = useAppsInstallationsQuery({
|
||||
displayLoader: false,
|
||||
|
@ -331,7 +330,6 @@ export const AppsList: React.FC<AppsListProps> = ({ params }) => {
|
|||
installedAppsList={installedApps}
|
||||
customAppsList={customApps}
|
||||
appsInProgressList={appsInProgressData}
|
||||
loadingAppsInProgress={loadingAppsInProgress}
|
||||
disabled={loading || customAppsLoading}
|
||||
settings={settings}
|
||||
onUpdateListSettings={updateListSettings}
|
||||
|
|
|
@ -59,11 +59,8 @@ export const ChannelCreateView = ({}) => {
|
|||
|
||||
const handleSubmit = async ({
|
||||
shippingZonesIdsToAdd,
|
||||
shippingZonesIdsToRemove,
|
||||
warehousesIdsToAdd,
|
||||
warehousesIdsToRemove,
|
||||
warehousesToDisplay,
|
||||
shippingZonesToDisplay,
|
||||
currencyCode,
|
||||
allocationStrategy,
|
||||
...rest
|
||||
|
|
|
@ -4,7 +4,6 @@ import React from "react";
|
|||
interface CardTitleProps {
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
height?: "default" | "const";
|
||||
title: string | React.ReactNode;
|
||||
subtitle?: string | React.ReactNode;
|
||||
toolbar?: React.ReactNode;
|
||||
|
@ -15,11 +14,9 @@ interface CardTitleProps {
|
|||
const CardTitle: React.FC<CardTitleProps> = ({
|
||||
className,
|
||||
children,
|
||||
height,
|
||||
title,
|
||||
subtitle,
|
||||
toolbar,
|
||||
onClick,
|
||||
...rest
|
||||
}) => (
|
||||
<CardHeader
|
||||
|
|
|
@ -55,7 +55,7 @@ export const ColorPicker: React.FC<ColorPickerProps> = ({
|
|||
);
|
||||
const [hue, setHue] = useState<number>(convert.hex.hsv(hex)[0]);
|
||||
|
||||
const [_, s, v] = convert.hex.hsv(hex);
|
||||
const [, s, v] = convert.hex.hsv(hex);
|
||||
const [r, g, b] = convert.hex.rgb(hex);
|
||||
const isValidColor = hex.match(/^(?:[0-9a-fA-F]{3}){1,2}$/);
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ const RichTextEditor: React.FC<RichTextEditorProps> = ({
|
|||
helperText,
|
||||
editorRef,
|
||||
onInitialize,
|
||||
onReady,
|
||||
...props
|
||||
}) => {
|
||||
const classes = useStyles({});
|
||||
|
|
|
@ -19,7 +19,8 @@ interface TableButtonWrapper {
|
|||
*/
|
||||
export const TableButtonWrapper = <T extends HTMLElement>({
|
||||
children,
|
||||
}: TableButtonWrapper) => {
|
||||
}: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
TableButtonWrapper) => {
|
||||
const onClick = (e: React.MouseEvent<T>) => {
|
||||
if (!children.props.href) {
|
||||
// <TableRowLink> is a <a> that wraps each <tr>
|
||||
|
|
|
@ -74,7 +74,6 @@ const TableCellHeader = React.forwardRef<unknown, TableCellHeaderProps>(
|
|||
textAlign,
|
||||
disabled = false,
|
||||
onClick,
|
||||
title,
|
||||
...rest
|
||||
} = props;
|
||||
|
||||
|
|
|
@ -104,7 +104,6 @@ const CustomerAddress: React.FC<CustomerAddressProps> = props => {
|
|||
<Skeleton />
|
||||
)
|
||||
}
|
||||
height="const"
|
||||
toolbar={
|
||||
<CardMenu
|
||||
disabled={disabled}
|
||||
|
|
|
@ -93,6 +93,7 @@ const GiftCardsListTableHeader: React.FC<GiftCardsListTableHeaderProps> = ({
|
|||
}),
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const { title, ...headerTooltipItemProps } = headerTooltipItem;
|
||||
|
||||
return (
|
||||
|
|
|
@ -26,6 +26,7 @@ interface AddressEditCommonProps {
|
|||
}
|
||||
|
||||
export const stringifyAddress = (address: Partial<AddressFragment>): string => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const { id, ...addressWithoutId } = address;
|
||||
return Object.values(flatten(addressWithoutId)).join(" ");
|
||||
};
|
||||
|
|
|
@ -278,6 +278,7 @@ export function mergeRepeatedOrderLines(
|
|||
export function addressToAddressInput<T>(
|
||||
address: T & AddressFragment,
|
||||
): AddressInput {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const { id, __typename, ...rest } = address;
|
||||
return {
|
||||
...rest,
|
||||
|
|
|
@ -60,7 +60,6 @@ export interface ProductListPageProps
|
|||
currencySymbol: string;
|
||||
gridAttributes: RelayToFlat<GridAttributesQuery["grid"]>;
|
||||
limits: RefreshLimitsQuery["shop"]["limits"];
|
||||
totalGridAttributes: number;
|
||||
products: RelayToFlat<ProductListQuery["products"]>;
|
||||
onAdd: () => void;
|
||||
onExport: () => void;
|
||||
|
@ -101,7 +100,6 @@ export const ProductListPage: React.FC<ProductListPageProps> = props => {
|
|||
loading,
|
||||
settings,
|
||||
tabs,
|
||||
totalGridAttributes,
|
||||
onAdd,
|
||||
onAll,
|
||||
onColumnQueryChange,
|
||||
|
|
|
@ -387,12 +387,6 @@ export const ProductList: React.FC<ProductListProps> = ({ params }) => {
|
|||
defaultSettings={defaultListSettings[ListViews.PRODUCT_LIST]}
|
||||
filterOpts={filterOpts}
|
||||
gridAttributes={mapEdgesToItems(gridAttributes?.data?.grid) || []}
|
||||
totalGridAttributes={maybe(
|
||||
() =>
|
||||
availableInGridAttributesOpts.result.data.availableInGrid
|
||||
.totalCount,
|
||||
0,
|
||||
)}
|
||||
settings={settings}
|
||||
loading={
|
||||
availableInGridAttributesOpts.result.loading || gridAttributes.loading
|
||||
|
|
|
@ -77,7 +77,6 @@ const ShippingZoneRates: React.FC<ShippingZoneRatesProps> = props => {
|
|||
return (
|
||||
<Card>
|
||||
<CardTitle
|
||||
height="const"
|
||||
title={
|
||||
variant === "price"
|
||||
? intl.formatMessage({
|
||||
|
|
|
@ -46,7 +46,6 @@ export interface ShippingZoneRatesPageProps
|
|||
allChannelsCount?: number;
|
||||
shippingChannels: ChannelShippingData[];
|
||||
disabled: boolean;
|
||||
havePostalCodesChanged?: boolean;
|
||||
rate: ShippingZoneQuery["shippingZone"]["shippingMethods"][0];
|
||||
channelErrors: ShippingChannelsErrorFragment[];
|
||||
errors: ShippingErrorFragment[];
|
||||
|
@ -75,7 +74,6 @@ export const ShippingZoneRatesPage: React.FC<ShippingZoneRatesPageProps> = ({
|
|||
channelErrors,
|
||||
disabled,
|
||||
errors,
|
||||
havePostalCodesChanged,
|
||||
backHref,
|
||||
onDelete,
|
||||
onSubmit,
|
||||
|
|
|
@ -70,7 +70,6 @@ const ShippingZonesList: React.FC<ShippingZonesListProps> = props => {
|
|||
return (
|
||||
<Card>
|
||||
<CardTitle
|
||||
height="const"
|
||||
title={intl.formatMessage({
|
||||
id: "h5r9+x",
|
||||
defaultMessage: "Shipping By Zone",
|
||||
|
|
|
@ -378,7 +378,6 @@ export const RateUpdate: React.FC<RateUpdateProps> = ({
|
|||
unassignProductOpts?.status === "loading" ||
|
||||
assignProductOpts?.status === "loading"
|
||||
}
|
||||
havePostalCodesChanged={state.havePostalCodesChanged}
|
||||
saveButtonBarState={updateShippingRateOpts.status}
|
||||
onDelete={() => openModal("remove")}
|
||||
backHref={shippingZoneUrl(id)}
|
||||
|
|
|
@ -53,7 +53,6 @@ const props: ProductListPageProps = {
|
|||
...pageListProps.default.settings,
|
||||
columns: ["availability", "productType", "price"],
|
||||
},
|
||||
totalGridAttributes: attributes.length,
|
||||
};
|
||||
|
||||
storiesOf("Views / Products / Product list", module)
|
||||
|
|
|
@ -3,8 +3,6 @@ const path = require("path");
|
|||
const CheckerPlugin = require("fork-ts-checker-webpack-plugin");
|
||||
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
|
||||
|
||||
const resolve = resolvePath => path.resolve(__dirname, resolvePath);
|
||||
|
||||
module.exports = ({ config }) => {
|
||||
config.module.rules.push({
|
||||
exclude: /node_modules/,
|
||||
|
|
Loading…
Reference in a new issue