Repository: TheOdinProject/odin-bot-v2
Pull request #516 (2024-03-18 07:57:14)

Bump prettier from 3.0.3 to 3.2.5
Bumps [prettier](https://github.com/prettier/prettier) from 3.0.3 to 3.2.5.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/prettier/prettier/releases">prettier's releases</a>.</em></p>
<blockquote>
<h2>3.2.5</h2>
<p>🔗 <a href="https://github.com/prettier/prettier/blob/main/CHANGELOG.md#325">Changelog</a></p>
<h2>3.2.4</h2>
<ul>
<li>Fix <code>.eslintrc.json</code> format <a href="https://redirect.github.com/prettier/prettier/issues/15947">#15947</a></li>
</ul>
<p>🔗 <a href="https://github.com/prettier/prettier/blob/main/CHANGELOG.md#324">Changelog</a></p>
<h2>3.2.3</h2>
<ul>
<li>Format <code>tsconfig.json</code> file with <code>jsonc</code> parser <a href="https://redirect.github.com/prettier/prettier/issues/15927">#15927</a></li>
</ul>
<p>🔗 <a href="https://github.com/prettier/prettier/blob/main/CHANGELOG.md#323">Changelog</a></p>
<h2>3.2.2</h2>
<p>🔗 <a href="https://github.com/prettier/prettier/blob/main/CHANGELOG.md#322">Changelog</a></p>
<h2>3.2.1</h2>
<p>🔗 <a href="https://github.com/prettier/prettier/blob/main/CHANGELOG.md#321">Changelog</a></p>
<h2>3.2.0</h2>
<p><a href="https://github.com/prettier/prettier/compare/3.1.1...3.2.0">diff</a></p>
<p>🔗 <a href="https://prettier.io/blog/2024/01/12/3.2.0.html">Release note</a></p>
<h2>3.1.1</h2>
<p>🔗 <a href="https://github.com/prettier/prettier/blob/main/CHANGELOG.md#311">Changelog</a></p>
<h2>3.1.0</h2>
<p><a href="https://github.com/prettier/prettier/compare/3.0.3...3.1.0">diff</a></p>
<p>🔗 <a href="https://prettier.io/blog/2023/11/13/3.1.0.html">Release note</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/prettier/prettier/blob/main/CHANGELOG.md">prettier's changelog</a>.</em></p>
<blockquote>
<h1>3.2.5</h1>
<p><a href="https://github.com/prettier/prettier/compare/3.2.4...3.2.5">diff</a></p>
<h4>Support Angular inline styles as single template literal (<a href="https://redirect.github.com/prettier/prettier/pull/15968">#15968</a> by <a href="https://github.com/sosukesuzuki"><code>@​sosukesuzuki</code></a>)</h4>
<p><a href="https://blog.angular.io/introducing-angular-v17-4d7033312e4b">Angular v17</a> supports single string inline styles.</p>
<!-- raw HTML omitted -->
<pre lang="ts"><code>// Input
@Component({
  template: `&lt;div&gt;...&lt;/div&gt;`,
  styles: `h1 { color: blue; }`,
})
export class AppComponent {}
<p>// Prettier 3.2.4
<a href="https://github.com/Component"><code>@​Component</code></a>({
template: <code>&amp;lt;div&amp;gt;...&amp;lt;/div&amp;gt;</code>,
styles: <code>h1 { color: blue; }</code>,
})
export class AppComponent {}</p>
<p>// Prettier 3.2.5
<a href="https://github.com/Component"><code>@​Component</code></a>({
template: <code>&amp;lt;div&amp;gt;...&amp;lt;/div&amp;gt;</code>,
styles: <code>h1 { color: blue; }</code>,
})
export class AppComponent {}</p>
<p></code></pre></p>
<h4>Unexpected embedded formatting for Angular template (<a href="https://redirect.github.com/prettier/prettier/pull/15969">#15969</a> by <a href="https://github.com/JounQin"><code>@​JounQin</code></a>)</h4>
<p>Computed template should not be considered as Angular component template</p>
<!-- raw HTML omitted -->
<pre lang="ts"><code>// Input
const template = &quot;foobar&quot;;
<p><a href="https://github.com/Component"><code>@​Component</code></a>({
[template]: <code>&amp;lt;h1&amp;gt;{{       hello }}&amp;lt;/h1&amp;gt;</code>,
})
export class AppComponent {}
&lt;/tr&gt;&lt;/table&gt;
</code></pre></p>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/prettier/prettier/commit/7142cf354cce2558f41574f44b967baf11d5b603"><code>7142cf3</code></a> Release 3.2.5</li>
<li><a href="https://github.com/prettier/prettier/commit/8cbee2e217baad7acf4cb3947834e8c1b41ed647"><code>8cbee2e</code></a> chore(deps): update glimmer to v0.88.1 (<a href="https://redirect.github.com/prettier/prettier/issues/15991">#15991</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/45baee061cb982d9dd298fefa74f4c195a3e0709"><code>45baee0</code></a> chore(deps): update dependency magic-string to v0.30.6 (<a href="https://redirect.github.com/prettier/prettier/issues/16022">#16022</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/9fb32a1a6b10bfb6dae317492f10e5e42956cf23"><code>9fb32a1</code></a> Minor refactor to property print (<a href="https://redirect.github.com/prettier/prettier/issues/15924">#15924</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/08f19401e48ccfeddff4300827da4c8677cb2b79"><code>08f1940</code></a> Update install script for husky v9 (<a href="https://redirect.github.com/prettier/prettier/issues/16000">#16000</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/6d0b1d2a935d47e0517721a0d5e62eb79e972b0c"><code>6d0b1d2</code></a> Update yarn to v4.1.0 (<a href="https://redirect.github.com/prettier/prettier/issues/16021">#16021</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/c8ba8dbca18858a7962184bbb3898502b9ec7cfb"><code>c8ba8db</code></a> chore(deps): update dependency <code>@​angular/compiler</code> to v17.1.2 (<a href="https://redirect.github.com/prettier/prettier/issues/16018">#16018</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/e2250ec6881222a1bb46ef55403067a259d8c7a3"><code>e2250ec</code></a> chore(deps): update typescript-eslint to v6.20.0 (<a href="https://redirect.github.com/prettier/prettier/issues/16015">#16015</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/02865f6cc77858b3a4cbaf7d4e2e72a4e88fe175"><code>02865f6</code></a> chore(deps): update dependency npm-run-all2 to v6.1.2 (<a href="https://redirect.github.com/prettier/prettier/issues/16017">#16017</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/014ee5d47445ae79233291d5b4846b28bedf3601"><code>014ee5d</code></a> chore(deps): update dependency hermes-parser to v0.19.0 (<a href="https://redirect.github.com/prettier/prettier/issues/16014">#16014</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/prettier/prettier/compare/3.0.3...3.2.5">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=prettier&package-manager=npm_and_yarn&previous-version=3.0.3&new-version=3.2.5)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/package-lock.json b/package-lock.json
index 8d7125a..c1aa949 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10,13 +10,13 @@
       "license": "ISC",
       "dependencies": {
         "@discordjs/rest": "^2.2.0",
-        "axios": "^1.6.7",
+        "axios": "^1.6.8",
         "discord-api-types": "^0.37.73",
         "discord.js": "^14.14.1",
         "dotenv": "^16.4.5",
         "glob": "^10.3.10",
         "ioredis": "^5.3.2",
-        "prettier": "^3.0.3"
+        "prettier": "^3.2.5"
       },
       "devDependencies": {
         "@babel/eslint-parser": "^7.23.10",
@@ -3191,11 +3191,11 @@
       }
     },
     "node_modules/axios": {
-      "version": "1.6.7",
-      "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.7.tgz",
-      "integrity": "sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==",
+      "version": "1.6.8",
+      "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz",
+      "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==",
       "dependencies": {
-        "follow-redirects": "^1.15.4",
+        "follow-redirects": "^1.15.6",
         "form-data": "^4.0.0",
         "proxy-from-env": "^1.1.0"
       }
@@ -4767,9 +4767,9 @@
       "dev": true
     },
     "node_modules/follow-redirects": {
-      "version": "1.15.4",
-      "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz",
-      "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==",
+      "version": "1.15.6",
+      "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
+      "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
       "funding": [
         {
           "type": "individual",
@@ -7319,9 +7319,9 @@
       }
     },
     "node_modules/prettier": {
-      "version": "3.0.3",
-      "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz",
-      "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==",
+      "version": "3.2.5",
+      "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz",
+      "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==",
       "bin": {
         "prettier": "bin/prettier.cjs"
       },
@@ -10949,11 +10949,11 @@
       "dev": true
     },
     "axios": {
-      "version": "1.6.7",
-      "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.7.tgz",
-      "integrity": "sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==",
+      "version": "1.6.8",
+      "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz",
+      "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==",
       "requires": {
-        "follow-redirects": "^1.15.4",
+        "follow-redirects": "^1.15.6",
         "form-data": "^4.0.0",
         "proxy-from-env": "^1.1.0"
       },
@@ -12106,9 +12106,9 @@
       "dev": true
     },
     "follow-redirects": {
-      "version": "1.15.4",
-      "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz",
-      "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw=="
+      "version": "1.15.6",
+      "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
+      "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA=="
     },
     "for-each": {
       "version": "0.3.3",
@@ -13927,9 +13927,9 @@
       "dev": true
     },
     "prettier": {
-      "version": "3.0.3",
-      "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz",
-      "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg=="
+      "version": "3.2.5",
+      "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz",
+      "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A=="
     },
     "pretty-format": {
       "version": "29.6.1",
diff --git a/package.json b/package.json
index 0949593..eaa1c48 100644
--- a/package.json
+++ b/package.json
@@ -13,13 +13,13 @@
   "license": "ISC",
   "dependencies": {
     "@discordjs/rest": "^2.2.0",
-    "axios": "^1.6.7",
+    "axios": "^1.6.8",
     "discord-api-types": "^0.37.73",
     "discord.js": "^14.14.1",
     "dotenv": "^16.4.5",
     "glob": "^10.3.10",
     "ioredis": "^5.3.2",
-    "prettier": "^3.0.3"
+    "prettier": "^3.2.5"
   },
   "devDependencies": {
     "@babel/eslint-parser": "^7.23.10",
diff --git a/services/update-faq/update-faq.service.js b/services/update-faq/update-faq.service.js
index 7efe461..7dcca51 100644
--- a/services/update-faq/update-faq.service.js
+++ b/services/update-faq/update-faq.service.js
@@ -46,29 +46,28 @@ class UpdateFAQsService {
     prev.forEach((message) => message.delete());
   }
 
-  static segments(string, length, delimiter, doNotPrependDelimiter) {
+  static segments(string, length, delimiter, prependDelimiter = true) {
     const segmentedString = string.split(delimiter)
     const segments = []
     let currentSection = ""
 
     for (let i = 0; i < segmentedString.length; i += 1) {
-      let segment = segmentedString[i]
+      const segment = prependDelimiter ? delimiter + segmentedString[i] : segmentedString[i];
 
-      if (!doNotPrependDelimiter) {
-        segment = delimiter + segmentedString[i]
-      }
       if (segmentedString[i] === '') {
         // eslint-disable-next-line no-continue
-        continue
+        continue;
       }
+
       if ((currentSection.length + segment.length) >= length) {
-          segments.push(currentSection)
-          currentSection = segment
+        segments.push(currentSection);
+        currentSection = segment;
       } else {
-        currentSection += segment
+        currentSection += segment;
       }
     }
-    segments.push(currentSection)
+
+    segments.push(currentSection);
     return segments;
   }
 }


Test patch:
diff --git a/services/update-faq/update-faq.service.test.js b/services/update-faq/update-faq.service.test.js
index 0494750..9a9429b 100644
--- a/services/update-faq/update-faq.service.test.js
+++ b/services/update-faq/update-faq.service.test.js
@@ -49,7 +49,7 @@ describe('UpdateFAQsService', () => {
         const string = '### The Odin Project.### Your Career in Web Development starts here';
         const delimiter = '###'
         const length = 25;
-        const result = UpdateFAQsService.segments(string, length, delimiter, true);
+        const result = UpdateFAQsService.segments(string, length, delimiter, false);
         expect(result).toEqual([' The Odin Project.', ' Your Career in Web Development starts here']);
       })
     })
@@ -69,7 +69,7 @@ describe('UpdateFAQsService', () => {
         const string = 'The Odin Project. Your Career in Web Development starts here';
         const delimiter = '###'
         const length = 75;
-        const result = UpdateFAQsService.segments(string, length, delimiter, true);
+        const result = UpdateFAQsService.segments(string, length, delimiter, false);
         expect(result).toEqual(['The Odin Project. Your Career in Web Development starts here']);
       })
     })