NinjaShadow91 / MVWA

A deliberately vulnerable e-commerce web application built with modern technologies, designed to help web developers and security enthusiasts learn about common web application vulnerabilities in a legal and realistic environment.
GNU General Public License v3.0
0 stars 0 forks source link

Failed to build with npm `10.2.2` #1

Closed aegilops closed 12 months ago

aegilops commented 1 year ago

This failed to build for me.

It gave this TypeScript error, using npm 10.2.2.

% npm run build  

> mvwa@0.1.0 build
> next build

info  - Loaded env from .../MVWA/.env.local
info  - SWC minify release candidate enabled. https://nextjs.link/swcmin

...

info  - Linting and checking validity of types ...Failed to compile.

./src/pages/index.page.tsx:100:12
Type error: Type '{}' is missing the following properties from type '{ navigation: any; searchQueryP: string | undefined; }': navigation, searchQueryP

   98 |           aria-label="Top"
   99 |         >
> 100 |           <Navbar></Navbar>
      |            ^
  101 |         </div>
  102 | 
  103 |         {/* Hero section */}

> Build error occurred

There were also numerous type warnings from ESLint:

./src/components/Footer/index.tsx
34:25  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
37:19  Warning: 'data' is defined but never used.  @typescript-eslint/no-unused-vars

./src/components/Modal/index.tsx
8:24  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
9:26  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
10:23  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
27:6  Warning: React Hook useEffect has a missing dependency: 'cleanupFunc'. Either include it or remove the dependency array. If 'cleanupFunc' changes too often, find the parent component that defines it and wrap that definition in useCallback.  react-hooks/exhaustive-deps

./src/components/Navbar/index.tsx
23:15  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
47:19  Warning: Do not use `<img>` element. Use `<Image />` from `next/image` instead. See: https://nextjs.org/docs/messages/no-img-element  @next/next/no-img-element
116:27  Warning: Do not use `<img>` element. Use `<Image />` from `next/image` instead. See: https://nextjs.org/docs/messages/no-img-element  @next/next/no-img-element
142:31  Warning: 'active' is defined but never used.  @typescript-eslint/no-unused-vars
243:23  Warning: Do not use `<img>` element. Use `<Image />` from `next/image` instead. See: https://nextjs.org/docs/messages/no-img-element  @next/next/no-img-element

./src/components/Uppy/index.tsx
4:10  Warning: 'Form' is defined but never used.  @typescript-eslint/no-unused-vars
11:8  Warning: 'TrpcApi' is defined but never used.  @typescript-eslint/no-unused-vars
63:45  Warning: 'file' is defined but never used.  @typescript-eslint/no-unused-vars
69:38  Warning: Forbidden non-null assertion.  @typescript-eslint/no-non-null-assertion
84:6  Warning: React Hook React.useMemo has missing dependencies: 'props.endpoint' and 'trpcMediaTokens'. Either include them or remove the dependency array.  react-hooks/exhaustive-deps

./src/pages/_app.page.tsx
30:12  Warning: 'ctx' is defined but never used.  @typescript-eslint/no-unused-vars

./src/pages/api/auth/[...nextauth].api.ts
37:28  Warning: 'account' is defined but never used.  @typescript-eslint/no-unused-vars
37:37  Warning: 'profile' is defined but never used.  @typescript-eslint/no-unused-vars
37:46  Warning: 'email' is defined but never used.  @typescript-eslint/no-unused-vars
37:53  Warning: 'credentials' is defined but never used.  @typescript-eslint/no-unused-vars
40:11  Warning: Forbidden non-null assertion.  @typescript-eslint/no-non-null-assertion
41:11  Warning: Forbidden non-null assertion.  @typescript-eslint/no-non-null-assertion
76:11  Warning: Forbidden non-null assertion.  @typescript-eslint/no-non-null-assertion
77:11  Warning: Forbidden non-null assertion.  @typescript-eslint/no-non-null-assertion
90:11  Warning: Forbidden non-null assertion.  @typescript-eslint/no-non-null-assertion
91:11  Warning: Forbidden non-null assertion.  @typescript-eslint/no-non-null-assertion
109:18  Warning: Forbidden non-null assertion.  @typescript-eslint/no-non-null-assertion

./src/pages/api/auth/providerDetails.ts
33:36  Warning: 'req' is defined but never used.  @typescript-eslint/no-unused-vars

./src/pages/api/trpc/[trpc].api.ts
3:3  Warning: 'PrismaClientInitializationError' is defined but never used.  @typescript-eslint/no-unused-vars
4:3  Warning: 'PrismaClientRustPanicError' is defined but never used.  @typescript-eslint/no-unused-vars
7:10  Warning: 'ZodError' is defined but never used.  @typescript-eslint/no-unused-vars

./src/pages/auth/forgot-password.page.tsx
95:6  Warning: React Hook useEffect has missing dependencies: 'confirmPassword', 'email', 'inputConfirmNewPasswordError', 'inputEmailError', 'inputNewPasswordError', 'password', 'token', 'trpcSubmitPasswordReset', and 'useCase'. Either include them or remove the dependency array.  react-hooks/exhaustive-deps
340:70  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any

./src/pages/auth/signin.page.tsx
30:6  Warning: React Hook useEffect has a missing dependency: 'providers'. Either include it or remove the dependency array. If 'setOAuthProviderNumber' needs the current value of 'providers', you can also switch to useReducer instead of useState and read 'providers' in the reducer.  react-hooks/exhaustive-deps
78:58  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
79:64  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
294:38  Warning: Forbidden non-null assertion.  @typescript-eslint/no-non-null-assertion
338:62  Warning: 'context' is defined but never used.  @typescript-eslint/no-unused-vars

./src/pages/auth/signout.page.tsx
14:6  Warning: React Hook useEffect has a missing dependency: 'session.status'. Either include it or remove the dependency array.  react-hooks/exhaustive-deps

./src/pages/auth/signup.page.tsx
39:6  Warning: React Hook useEffect has a missing dependency: 'providers'. Either include it or remove the dependency array. If 'setOAuthProviderNumber' needs the current value of 'providers', you can also switch to useReducer instead of useState and read 'providers' in the reducer.  react-hooks/exhaustive-deps
43:58  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
44:64  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
46:56  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
47:54  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
371:38  Warning: Forbidden non-null assertion.  @typescript-eslint/no-non-null-assertion
415:62  Warning: 'context' is defined but never used.  @typescript-eslint/no-unused-vars

./src/pages/index.page.tsx
2:10  Warning: 'signIn' is defined but never used.  @typescript-eslint/no-unused-vars
3:10  Warning: 'useEffect' is defined but never used.  @typescript-eslint/no-unused-vars
52:9  Warning: 'session' is assigned a value but never used.  @typescript-eslint/no-unused-vars
166:37  Warning: Forbidden non-null assertion.  @typescript-eslint/no-non-null-assertion

./src/pages/product/[id].page.tsx
4:10  Warning: 'ReactElement' is defined but never used.  @typescript-eslint/no-unused-vars
7:3  Warning: 'Dialog' is defined but never used.  @typescript-eslint/no-unused-vars
8:3  Warning: 'Disclosure' is defined but never used.  @typescript-eslint/no-unused-vars
9:3  Warning: 'Popover' is defined but never used.  @typescript-eslint/no-unused-vars
10:3  Warning: 'RadioGroup' is defined but never used.  @typescript-eslint/no-unused-vars
12:3  Warning: 'Transition' is defined but never used.  @typescript-eslint/no-unused-vars
22:3  Warning: 'getProductDescriptionSecure' is defined but never used.  @typescript-eslint/no-unused-vars
48:20  Warning: 'setQuantity' is assigned a value but never used.  @typescript-eslint/no-unused-vars
50:42  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
51:64  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
54:42  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
55:54  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
195:19  Warning: 'data' is defined but never used.  @typescript-eslint/no-unused-vars
202:17  Warning: 'error' is defined but never used.  @typescript-eslint/no-unused-vars
229:21  Warning: 'data' is defined but never used.  @typescript-eslint/no-unused-vars

./src/pages/search/index.page.tsx
1:10  Warning: 'Product' is defined but never used.  @typescript-eslint/no-unused-vars
13:44  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any

./src/pages/seller/addproduct.page.tsx
5:21  Warning: 'useMemo' is defined but never used.  @typescript-eslint/no-unused-vars
9:8  Warning: 'Tus' is defined but never used.  @typescript-eslint/no-unused-vars
21:10  Warning: 'tokens' is assigned a value but never used.  @typescript-eslint/no-unused-vars
21:18  Warning: 'setTokens' is assigned a value but never used.  @typescript-eslint/no-unused-vars
22:10  Warning: 'tokenError' is assigned a value but never used.  @typescript-eslint/no-unused-vars
22:22  Warning: 'setTokenError' is assigned a value but never used.  @typescript-eslint/no-unused-vars
47:34  Warning: Forbidden non-null assertion.  @typescript-eslint/no-non-null-assertion

./src/pages/seller/index.page.tsx
6:10  Warning: 'useEffect' is defined but never used.  @typescript-eslint/no-unused-vars
6:21  Warning: 'useRef' is defined but never used.  @typescript-eslint/no-unused-vars
12:9  Warning: 'user' is assigned a value but never used.  @typescript-eslint/no-unused-vars
13:40  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any

./src/pages/seller/store.page.tsx
7:3  Warning: 'getProductEditLink' is defined but never used.  @typescript-eslint/no-unused-vars
12:21  Warning: 'useRef' is defined but never used.  @typescript-eslint/no-unused-vars
20:38  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
21:44  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any

./src/pages/user/cart.page.tsx
18:10  Warning: 'classNames' is defined but never used.  @typescript-eslint/no-unused-vars
27:46  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
28:36  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
29:44  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
30:66  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
31:64  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
34:10  Warning: 'status' is assigned a value but never used.  @typescript-eslint/no-unused-vars
36:14  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any

./src/pages/user/manage.page.tsx
3:10  Warning: 'useEffect' is defined but never used.  @typescript-eslint/no-unused-vars
7:10  Warning: 'classNames' is defined but never used.  @typescript-eslint/no-unused-vars
7:33  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
15:10  Warning: 'profile' is assigned a value but never used.  @typescript-eslint/no-unused-vars
15:42  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
16:46  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
17:10  Warning: 'notificationProfile' is assigned a value but never used.  @typescript-eslint/no-unused-vars
17:66  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
43:21  Warning: 'data' is defined but never used.  @typescript-eslint/no-unused-vars
67:23  Warning: 'data' is defined but never used.  @typescript-eslint/no-unused-vars
87:23  Warning: 'data' is defined but never used.  @typescript-eslint/no-unused-vars

./src/pages/user/orders.page.tsx
2:3  Warning: 'CheckIcon' is defined but never used.  @typescript-eslint/no-unused-vars
3:3  Warning: 'ClockIcon' is defined but never used.  @typescript-eslint/no-unused-vars
4:3  Warning: 'QuestionMarkCircleIcon' is defined but never used.  @typescript-eslint/no-unused-vars
5:16  Warning: 'XMarkIconMini' is defined but never used.  @typescript-eslint/no-unused-vars
11:10  Warning: 'getOrderLink' is defined but never used.  @typescript-eslint/no-unused-vars
14:10  Warning: 'classNames' is defined but never used.  @typescript-eslint/no-unused-vars
19:9  Warning: 'router' is assigned a value but never used.  @typescript-eslint/no-unused-vars
22:48  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
23:40  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
24:44  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
26:14  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any

./src/pages/utils/utils.tsx
1:8  Warning: 'Image' is defined but never used.  @typescript-eslint/no-unused-vars
2:24  Warning: 'useEffect' is defined but never used.  @typescript-eslint/no-unused-vars
23:10  Warning: Forbidden non-null assertion.  @typescript-eslint/no-non-null-assertion
30:10  Warning: 'url' is assigned a value but never used.  @typescript-eslint/no-unused-vars
52:5  Warning: Do not use `<img>` element. Use `<Image />` from `next/image` instead. See: https://nextjs.org/docs/messages/no-img-element  @next/next/no-img-element

./src/server/db/test.ts
917:48  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any

./src/server/router/cart/Cart.ts
1:10  Warning: 'Orders' is defined but never used.  @typescript-eslint/no-unused-vars
1:33  Warning: 'ProductInventory' is defined but never used.  @typescript-eslint/no-unused-vars
262:28  Warning: 'input' is defined but never used.  @typescript-eslint/no-unused-vars
321:47  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any

./src/server/router/cart/WishList.ts
33:56  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any

./src/server/router/context.ts
17:24  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
44:21  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
45:15  Warning: 'headerDate' is assigned a value but never used.  @typescript-eslint/no-unused-vars
64:30  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
83:10  Warning: 'logRefererSecure' is defined but never used.  @typescript-eslint/no-unused-vars
89:21  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
90:15  Warning: 'headerDate' is assigned a value but never used.  @typescript-eslint/no-unused-vars
109:30  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any

./src/server/router/editor/FeaturedPosts.ts
5:7  Warning: 'EditorPostRouter' is assigned a value but never used.  @typescript-eslint/no-unused-vars

./src/server/router/index.ts
27:10  Warning: 'insertData' is defined but never used.  @typescript-eslint/no-unused-vars

./src/server/router/order/Order.ts
126:30  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any

./src/server/router/personalisation/BasedOnPreviousOrders.ts
8:28  Warning: 'input' is defined but never used.  @typescript-eslint/no-unused-vars

./src/server/router/product/Search.ts
37:17  Warning: 'priceRangeMax' is assigned a value but never used.  @typescript-eslint/no-unused-vars
38:17  Warning: 'priceRangeMin' is assigned a value but never used.  @typescript-eslint/no-unused-vars

./src/server/router/review/ProductReview.ts
13:28  Warning: 'input' is defined but never used.  @typescript-eslint/no-unused-vars

./src/server/router/review/StoreReview.ts
28:28  Warning: 'input' is defined but never used.  @typescript-eslint/no-unused-vars

./src/server/router/store/Seller.ts
63:23  Warning: 'input' is defined but never used.  @typescript-eslint/no-unused-vars

./src/server/router/user/UserAddress.ts
8:28  Warning: 'input' is defined but never used.  @typescript-eslint/no-unused-vars

./src/server/router/user/UserContact.ts
8:28  Warning: 'input' is defined but never used.  @typescript-eslint/no-unused-vars

./src/server/router/user/UserNotification.ts
8:28  Warning: 'input' is defined but never used.  @typescript-eslint/no-unused-vars
42:23  Warning: 'ctx' is defined but never used.  @typescript-eslint/no-unused-vars
42:28  Warning: 'input' is defined but never used.  @typescript-eslint/no-unused-vars

./src/server/router/util.ts
756:3  Warning: 'error' is defined but never used.  @typescript-eslint/no-unused-vars
758:3  Warning: 'callbackId' is defined but never used.  @typescript-eslint/no-unused-vars

info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
NinjaShadow91 commented 1 year ago

Hi Paul Hodgkinson,

Regarding the TypeScript error you've encountered, this is indeed a known issue. As the project is no longer actively developed, there are a few quirks like this one. MVWA was designed with certain functionalities and features in mind, and these type errors, while present, do not typically interfere with the main operations of the project. The recommended way to use MVWA is in development mode. This mode bypasses these build errors and allows you to explore the project's features. While I understand that running into build issues can be a bit of a hurdle, the project in its current state is best utilised in this way. That being said, contributions to the project are always welcome. If you or anyone else is interested in addressing these issues, it would be greatly appreciated. Any improvements or updates can help make MVWA more robust and user-friendly for everyone.

Now for the particular error with the Navbar component is because of not passing the required arguments. Although it's a straightforward fix, it appears in multiple places. A quick solution could be to modify the Navbar component to accept 'any' type as an argument.

As for the ESLint warnings, they are predominantly present in the frontend code. This is partly due to constrained development time and the complex nature of the type definitions for objects returned by the server. In many cases, I opted to use 'any' to avoid extensive type definitions.

Thanks again for reaching out and for your understanding.

Best, Pulkit Chahar