From 65e330043d66a5782c80f3edfd6cdfaa531a2bb8 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 2 Jan 2026 14:16:18 +0200 Subject: [PATCH 1/4] Refactor Sum component and update App to use it; enhance editor settings in .prettierrc; upgrade @mate-academy/scripts to version 2.1.3 --- .prettierrc | 23 ++++++++++++++--------- package-lock.json | 9 +++++---- package.json | 2 +- src/App.jsx | 12 ++++++++---- src/components/Sum/Sum.jsx | 8 +++++++- 5 files changed, 35 insertions(+), 19 deletions(-) diff --git a/.prettierrc b/.prettierrc index 49b905d69..b8b790153 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,11 +1,16 @@ { - "arrowParens": "avoid", - "singleQuote": true, - "tabWidth": 2, - "trailingComma": "all", - "jsxSingleQuote": false, - "printWidth": 80, - "semi": true, - "bracketSpacing": true, - "bracketSameLine": false + "files.autoSave": "afterDelay", + "files.autoSaveDelay": 500, + "editor.fontSize": 15, + "editor.tabSize": 2, + "editor.renderWhitespace": "boundary", + "editor.detectIndentation": false, + + "editor.codeActionsOnSave": { + "source.fixAll": "always", + "source.fixAll.eslint": "always" + }, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnType": true, + "editor.formatOnSave": true } diff --git a/package-lock.json b/package-lock.json index ffe91f1e2..53b982878 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ }, "devDependencies": { "@cypress/react18": "^2.0.1", - "@mate-academy/scripts": "^1.8.5", + "@mate-academy/scripts": "^2.1.3", "@mate-academy/stylelint-config": "*", "@vitejs/plugin-react": "^4.3.1", "cypress": "^13.13.0", @@ -763,10 +763,11 @@ } }, "node_modules/@mate-academy/scripts": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/@mate-academy/scripts/-/scripts-1.8.5.tgz", - "integrity": "sha512-mHRY2FkuoYCf5U0ahIukkaRo5LSZsxrTSgMJheFoyf3VXsTvfM9OfWcZIDIDB521kdPrScHHnRp+JRNjCfUO5A==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@mate-academy/scripts/-/scripts-2.1.3.tgz", + "integrity": "sha512-a07wHTj/1QUK2Aac5zHad+sGw4rIvcNl5lJmJpAD7OxeSbnCdyI6RXUHwXhjF5MaVo9YHrJ0xVahyERS2IIyBQ==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/rest": "^17.11.2", "@types/get-port": "^4.2.0", diff --git a/package.json b/package.json index 863c49669..f41ce178d 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ }, "devDependencies": { "@cypress/react18": "^2.0.1", - "@mate-academy/scripts": "^1.8.5", + "@mate-academy/scripts": "^2.1.3", "@mate-academy/stylelint-config": "*", "@vitejs/plugin-react": "^4.3.1", "cypress": "^13.13.0", diff --git a/src/App.jsx b/src/App.jsx index dc51f769d..6ad6a136b 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,5 +1,6 @@ -import React from 'react'; -import './App.scss'; +import React from "react"; +import "./App.scss"; +import { Sum } from "./components/Sum/Sum"; export const App = () => ( <> @@ -8,7 +9,10 @@ export const App = () => (

Sum of 10 and 0 is 10

Sum of 0 and 5 is 5

Sum of 0 and 0 is 0

- {/* Replace paragraphs with Sum componets */} - {/* And remove commented lines :) */} + + + + + ); diff --git a/src/components/Sum/Sum.jsx b/src/components/Sum/Sum.jsx index 381aa0422..432ac2eef 100644 --- a/src/components/Sum/Sum.jsx +++ b/src/components/Sum/Sum.jsx @@ -1 +1,7 @@ -// export const Sum = () => (); +export const Sum = ({ a = 0, b = 0 }) => { + return ( +

+ Sum of {a} and {b} is {a + b} +

+ ); +}; From e6f44fe94fac479433a6a6425df1cf91bda31559 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 2 Jan 2026 18:17:24 +0200 Subject: [PATCH 2/4] Refactor Sum component to simplify rendering; update App to use new prop structure --- src/App.jsx | 6 +++--- src/components/Sum/Sum.jsx | 6 +----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 6ad6a136b..186ffd4df 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -11,8 +11,8 @@ export const App = () => (

Sum of 0 and 0 is 0

- - - + + + ); diff --git a/src/components/Sum/Sum.jsx b/src/components/Sum/Sum.jsx index 432ac2eef..6ba3457e2 100644 --- a/src/components/Sum/Sum.jsx +++ b/src/components/Sum/Sum.jsx @@ -1,7 +1,3 @@ export const Sum = ({ a = 0, b = 0 }) => { - return ( -

- Sum of {a} and {b} is {a + b} -

- ); + return

{`Sum of ${a} and ${b} is ${a + b}`}.

; }; From e19076cea1929f55a07b4ba58eb867e6b2752b1c Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 2 Jan 2026 18:18:50 +0200 Subject: [PATCH 3/4] Fix punctuation in Sum component output --- src/components/Sum/Sum.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Sum/Sum.jsx b/src/components/Sum/Sum.jsx index 6ba3457e2..9853f9183 100644 --- a/src/components/Sum/Sum.jsx +++ b/src/components/Sum/Sum.jsx @@ -1,3 +1,3 @@ export const Sum = ({ a = 0, b = 0 }) => { - return

{`Sum of ${a} and ${b} is ${a + b}`}.

; + return

{`Sum of ${a} and ${b} is ${a + b}`}

; }; From 6957349e02adfc77a8d74d16c2e7b1a25fb56d43 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 2 Jan 2026 18:26:31 +0200 Subject: [PATCH 4/4] Remove hardcoded sum output paragraphs from App component --- src/App.jsx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 186ffd4df..859f6da2d 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -4,11 +4,6 @@ import { Sum } from "./components/Sum/Sum"; export const App = () => ( <> -

Sum of 2 and 3 is 5

-

Sum of -5 and 5 is 0

-

Sum of 10 and 0 is 10

-

Sum of 0 and 5 is 5

-

Sum of 0 and 0 is 0