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