Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Enforce "no unused locals" policy in TypeScript
Patryk Zawadzkiea6f3eb268db
diff --git a/saleor/static/dashboard-next/AppRoot.tsx b/saleor/static/dashboard-next/AppRoot.tsxindex 69564f6ec2..9819383720 100644--- a/saleor/static/dashboard-next/AppRoot.tsx+++ b/saleor/static/dashboard-next/AppRoot.tsx@@ -18,7 +18,6 @@ import SVG from "react-inlinesvg";import * as saleorLogo from "../images/logo.svg";import { UserContext } from "./auth";-import Container from "./components/Container";import MenuToggle from "./components/MenuToggle";import Navigator from "./components/Navigator";import Toggle from "./components/Toggle";diff --git a/saleor/static/dashboard-next/auth/AuthProvider.tsx b/saleor/static/dashboard-next/auth/AuthProvider.tsxindex 038e6f2fec..d9327027ba 100644--- a/saleor/static/dashboard-next/auth/AuthProvider.tsx+++ b/saleor/static/dashboard-next/auth/AuthProvider.tsx@@ -93,10 +93,9 @@ class AuthProvider extends React.Component<};render() {- const { children, tokenAuth, tokenVerify } = this.props;+ const { children } = this.props;const { user } = this.state;const isAuthenticated = !!user;- const loading = tokenAuth.loading || tokenVerify.loading;return (<UserContext.Providervalue={{ user, login: this.login, logout: this.logout }}diff --git a/saleor/static/dashboard-next/auth/mutations.ts b/saleor/static/dashboard-next/auth/mutations.tsindex d892f6e985..65ae12367c 100644--- a/saleor/static/dashboard-next/auth/mutations.ts+++ b/saleor/static/dashboard-next/auth/mutations.ts@@ -1,6 +1,4 @@import gql from "graphql-tag";-import * as React from "react";-import { Mutation, MutationProps } from "react-apollo";import { TypedMutation } from "../mutations";diff --git a/saleor/static/dashboard-next/categories/mutations.ts b/saleor/static/dashboard-next/categories/mutations.tsindex 24be2ad9df..57364b40bf 100644--- a/saleor/static/dashboard-next/categories/mutations.ts+++ b/saleor/static/dashboard-next/categories/mutations.ts@@ -1,6 +1,4 @@import gql from "graphql-tag";-import * as React from "react";-import { Mutation, MutationProps } from "react-apollo";import {CategoryCreateMutation,diff --git a/saleor/static/dashboard-next/categories/views/CategoryCreate.tsx b/saleor/static/dashboard-next/categories/views/CategoryCreate.tsxindex d4d7d675ba..e6cd192a8e 100644--- a/saleor/static/dashboard-next/categories/views/CategoryCreate.tsx+++ b/saleor/static/dashboard-next/categories/views/CategoryCreate.tsx@@ -7,7 +7,6 @@ import i18n from "../../i18n";import CategoryEditPage from "../components/CategoryEditPage";import { categoryShowUrl } from "../index";import {- categoryCreateMutation,TypedCategoryCreateMutation} from "../mutations";diff --git a/saleor/static/dashboard-next/categories/views/CategoryDetails.tsx b/saleor/static/dashboard-next/categories/views/CategoryDetails.tsxindex 30d85642bb..358fdf9928 100644--- a/saleor/static/dashboard-next/categories/views/CategoryDetails.tsx+++ b/saleor/static/dashboard-next/categories/views/CategoryDetails.tsx@@ -14,7 +14,6 @@ import {import { productAddUrl, productUrl } from "../../products";import { categoryAddUrl, categoryEditUrl, categoryShowUrl } from "../index";import {- categoryDeleteMutation,TypedCategoryDeleteMutation} from "../mutations";import {diff --git a/saleor/static/dashboard-next/categories/views/CategoryUpdate.tsx b/saleor/static/dashboard-next/categories/views/CategoryUpdate.tsxindex f5b6fa725a..5cf761f1ed 100644--- a/saleor/static/dashboard-next/categories/views/CategoryUpdate.tsx+++ b/saleor/static/dashboard-next/categories/views/CategoryUpdate.tsx@@ -1,5 +1,4 @@import * as React from "react";-import { Redirect } from "react-router-dom";import ErrorMessageCard from "../../components/ErrorMessageCard";import Messages from "../../components/messages";@@ -9,7 +8,6 @@ import i18n from "../../i18n";import CategoryEditPage from "../components/CategoryEditPage";import { categoryShowUrl } from "../index";import {- categoryUpdateMutation,TypedCategoryUpdateMutation} from "../mutations";import { categoryDetailsQuery, TypedCategoryDetailsQuery } from "../queries";diff --git a/saleor/static/dashboard-next/components/DateFormatter/DateFormatter.tsx b/saleor/static/dashboard-next/components/DateFormatter/DateFormatter.tsxindex af59a284d0..eb2a1721ad 100644--- a/saleor/static/dashboard-next/components/DateFormatter/DateFormatter.tsx+++ b/saleor/static/dashboard-next/components/DateFormatter/DateFormatter.tsx@@ -1,9 +1,7 @@import { withStyles } from "@material-ui/core/styles";import Tooltip from "@material-ui/core/Tooltip";import Typography, { TypographyProps } from "@material-ui/core/Typography";-import * as moment from "moment";import * as React from "react";-import ReactMoment from "react-moment";import { LocaleConsumer } from "../Locale";import { Consumer } from "./DateContext";diff --git a/saleor/static/dashboard-next/components/SeoForm/SeoForm.tsx b/saleor/static/dashboard-next/components/SeoForm/SeoForm.tsxindex f8a1674e17..9a7838b3fc 100644--- a/saleor/static/dashboard-next/components/SeoForm/SeoForm.tsx+++ b/saleor/static/dashboard-next/components/SeoForm/SeoForm.tsx@@ -9,7 +9,6 @@ import * as React from "react";import i18n from "../../i18n";import CardTitle from "../CardTitle";import FormSpacer from "../FormSpacer";-import Skeleton from "../Skeleton";import Toggle from "../Toggle";interface SeoFormProps {diff --git a/saleor/static/dashboard-next/pages/components/PageListPage/PageListPage.tsx b/saleor/static/dashboard-next/pages/components/PageListPage/PageListPage.tsxindex e21d48256e..8524ca6cb8 100644--- a/saleor/static/dashboard-next/pages/components/PageListPage/PageListPage.tsx+++ b/saleor/static/dashboard-next/pages/components/PageListPage/PageListPage.tsx@@ -1,5 +1,4 @@import IconButton from "@material-ui/core/IconButton";-import { withStyles } from "@material-ui/core/styles";import AddIcon from "@material-ui/icons/Add";import * as React from "react";diff --git a/saleor/static/dashboard-next/pages/mutations.ts b/saleor/static/dashboard-next/pages/mutations.tsindex c71dbcf2d3..f4f256cbd3 100644--- a/saleor/static/dashboard-next/pages/mutations.ts+++ b/saleor/static/dashboard-next/pages/mutations.ts@@ -1,5 +1,4 @@import gql from "graphql-tag";-import { Mutation, MutationProps } from "react-apollo";import { TypedMutation } from "../mutations";diff --git a/saleor/static/dashboard-next/pages/views/PageCreate.tsx b/saleor/static/dashboard-next/pages/views/PageCreate.tsxindex 8f4ecda25e..275f9b3bf2 100644--- a/saleor/static/dashboard-next/pages/views/PageCreate.tsx+++ b/saleor/static/dashboard-next/pages/views/PageCreate.tsx@@ -5,7 +5,7 @@ import { pageListUrl } from "..";import { NavigatorLink } from "../../components/Navigator";import i18n from "../../i18n";import PageDetailsPage from "../../pages/components/PageDetailsPage";-import { pageCreateMutation, TypedPageCreateMutation } from "../mutations";+import { TypedPageCreateMutation } from "../mutations";interface PageCreateFormProps {id: string;diff --git a/saleor/static/dashboard-next/pages/views/PageDetails.tsx b/saleor/static/dashboard-next/pages/views/PageDetails.tsxindex 4f3196243d..1c15814da6 100644--- a/saleor/static/dashboard-next/pages/views/PageDetails.tsx+++ b/saleor/static/dashboard-next/pages/views/PageDetails.tsx@@ -7,8 +7,6 @@ import { NavigatorLink } from "../../components/Navigator";import i18n from "../../i18n";import PageDetailsPage from "../components/PageDetailsPage";import {- pageDeleteMutation,- pageUpdateMutation,TypedPageDeleteMutation,TypedPageUpdateMutation} from "../mutations";diff --git a/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx b/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsxindex 3fa0645b47..28f339a3ea 100644--- a/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx+++ b/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx@@ -124,14 +124,6 @@ const ProductVariantCreatePage = decorate<ProductVariantCreatePageProps>(key={product ? JSON.stringify(product) : "noproduct"}>{({ change, data, errors, hasChanged, submit }) => {- const images = data.images- ? data.images.map(- id =>- product.images.edges- .map(edge => edge.node)- .filter(image => image.id === id)[0]- )- : undefined;return (<><div className={classes.root}>diff --git a/saleor/static/dashboard-next/products/components/ProductVariantDeleteDialog/ProductVariantDeleteDialog.tsx b/saleor/static/dashboard-next/products/components/ProductVariantDeleteDialog/ProductVariantDeleteDialog.tsxindex 6cbb81708a..5f005c1405 100644--- a/saleor/static/dashboard-next/products/components/ProductVariantDeleteDialog/ProductVariantDeleteDialog.tsx+++ b/saleor/static/dashboard-next/products/components/ProductVariantDeleteDialog/ProductVariantDeleteDialog.tsx@@ -1,5 +1,5 @@import Button from "@material-ui/core/Button";-import Dialog, { DialogProps } from "@material-ui/core/Dialog";+import Dialog from "@material-ui/core/Dialog";import DialogActions from "@material-ui/core/DialogActions";import DialogContent from "@material-ui/core/DialogContent";import DialogContentText from "@material-ui/core/DialogContentText";@@ -28,7 +28,7 @@ export interface ProductVariantDeleteDialogProps {const ProductVariantDeleteDialog = decorate<ProductVariantDeleteDialogProps>(props => {- const { children, classes, name, open, onConfirm, onClose } = props;+ const { classes, name, open, onConfirm, onClose } = props;return (<Dialog open={open}><DialogTitle>diff --git a/saleor/static/dashboard-next/products/components/ProductVariantImageSelectDialog/ProductVariantImageSelectDialog.tsx b/saleor/static/dashboard-next/products/components/ProductVariantImageSelectDialog/ProductVariantImageSelectDialog.tsxindex 974f7f68f3..4bacbc5fe4 100644--- a/saleor/static/dashboard-next/products/components/ProductVariantImageSelectDialog/ProductVariantImageSelectDialog.tsx+++ b/saleor/static/dashboard-next/products/components/ProductVariantImageSelectDialog/ProductVariantImageSelectDialog.tsx@@ -3,7 +3,7 @@ import Dialog from "@material-ui/core/Dialog";import DialogActions from "@material-ui/core/DialogActions";import DialogContent from "@material-ui/core/DialogContent";import DialogTitle from "@material-ui/core/DialogTitle";-import { withStyles, WithStyles } from "@material-ui/core/styles";+import { withStyles } from "@material-ui/core/styles";import * as React from "react";import { ProductImageType } from "../..";diff --git a/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx b/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsxindex 549107b94d..97d20f7d5c 100644--- a/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx+++ b/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx@@ -15,7 +15,6 @@ import SaveButtonBar, {SaveButtonBarState} from "../../../components/SaveButtonBar";import Toggle from "../../../components/Toggle";-import i18n from "../../../i18n";import ProductVariantAttributes from "../ProductVariantAttributes";import ProductVariantDeleteDialog from "../ProductVariantDeleteDialog";import ProductVariantImages from "../ProductVariantImages";diff --git a/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx b/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsxindex 5367c33c1e..cb431135d2 100644--- a/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx+++ b/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx@@ -36,13 +36,6 @@ interface ProductVariantsProps {}const decorate = withStyles(theme => {- const dot = {- borderRadius: "100%",- display: "inline-block",- height: theme.spacing.unit,- marginRight: theme.spacing.unit,- width: theme.spacing.unit- };return {denseTable: {"& td, & th": {@@ -66,7 +59,6 @@ export const ProductVariants = decorate<ProductVariantsProps>(classes,variants,fallbackPrice,- onAttributesEdit,onRowClick,onVariantAdd}) => (diff --git a/saleor/static/dashboard-next/products/mutations.ts b/saleor/static/dashboard-next/products/mutations.tsindex cb5a4dc1cd..bc9d71d0d3 100644--- a/saleor/static/dashboard-next/products/mutations.ts+++ b/saleor/static/dashboard-next/products/mutations.ts@@ -5,7 +5,6 @@ import {ProductCreateMutationVariables,ProductDeleteMutation,ProductDeleteMutationVariables,- ProductDetailsQuery,ProductImageCreateMutation,ProductImageCreateMutationVariables,ProductImageDeleteMutation,@@ -31,7 +30,6 @@ import { TypedMutation } from "../mutations";import {fragmentProduct,- fragmentProductImage,fragmentVariant} from "./queries";diff --git a/saleor/static/dashboard-next/products/views/ProductList.tsx b/saleor/static/dashboard-next/products/views/ProductList.tsxindex aca4f8c07a..62ecfeb2f0 100644--- a/saleor/static/dashboard-next/products/views/ProductList.tsx+++ b/saleor/static/dashboard-next/products/views/ProductList.tsx@@ -1,6 +1,5 @@import * as React from "react";-import { withStyles } from "@material-ui/core/styles";import { productAddUrl, productListUrl, productUrl } from "..";import ErrorMessageCard from "../../components/ErrorMessageCard";import Navigator from "../../components/Navigator";diff --git a/saleor/static/dashboard-next/products/views/ProductVariantCreate.tsx b/saleor/static/dashboard-next/products/views/ProductVariantCreate.tsxindex a032a2385b..08ab4491fb 100644--- a/saleor/static/dashboard-next/products/views/ProductVariantCreate.tsx+++ b/saleor/static/dashboard-next/products/views/ProductVariantCreate.tsx@@ -46,8 +46,6 @@ export const ProductVariant: React.StatelessComponent<ProductUpdateProps> = ({);}- const handleError = () =>- pushMessage({ text: i18n.t("Something went wrong") });const handleCreateSuccess = (data: VariantCreateMutation) => {if (data.productVariantCreate.errors &&diff --git a/tsconfig.json b/tsconfig.jsonindex 54b8959bd9..85ad0824b9 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -3,7 +3,8 @@"jsx": "react","lib": ["es2017", "dom", "esnext"],"sourceMap": true,- "target": "es5"+ "target": "es5",+ "noUnusedLocals": true},"include": ["webpack.d.ts"]}diff --git a/tslint.json b/tslint.jsonindex d41c786ad8..726ce403ff 100644--- a/tslint.json+++ b/tslint.json@@ -9,7 +9,6 @@"no-console": [true, "log"],"no-implicit-dependencies": [true, "dev"],"no-shadowed-variable": false,- "no-submodule-imports": [true, "@material-ui"],- "no-unused-variable": true+ "no-submodule-imports": [true, "@material-ui"]}}