<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bassel Al-Sayed</title>
    <description>The latest articles on DEV Community by Bassel Al-Sayed (@basselalsayed).</description>
    <link>https://dev.to/basselalsayed</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3190657%2F2394e4ff-eff8-432a-a698-e5be1bcfaa4d.png</url>
      <title>DEV Community: Bassel Al-Sayed</title>
      <link>https://dev.to/basselalsayed</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/basselalsayed"/>
    <language>en</language>
    <item>
      <title>Should you replace prettier? Maybe</title>
      <dc:creator>Bassel Al-Sayed</dc:creator>
      <pubDate>Thu, 22 May 2025 09:12:29 +0000</pubDate>
      <link>https://dev.to/basselalsayed/should-you-stop-using-prettier-maybe-93d</link>
      <guid>https://dev.to/basselalsayed/should-you-stop-using-prettier-maybe-93d</guid>
      <description>&lt;p&gt;For years, I've been &lt;a href="https://prettier.io/" rel="noopener noreferrer"&gt;prettier&lt;/a&gt;'s biggest fan... Introducing it to every codebase at a new role, instantly adding it to any new repository, installing additional plugins such as &lt;a href="https://github.com/tailwindlabs/prettier-plugin-tailwindcss" rel="noopener noreferrer"&gt;tailwind&lt;/a&gt; or &lt;a href="https://github.com/prettier/plugin-xml" rel="noopener noreferrer"&gt;xml&lt;/a&gt; and of course, ensuring the "Format on save" option is switched on.&lt;/p&gt;

&lt;p&gt;But recently while building &lt;a href="https://dev.to/basselalsayed/rediscovering-react-visualise-algorithms-in-the-browser-18lo"&gt;algovi&lt;/a&gt; I encountered some turbulence for the first time with my first love of formatting. &lt;/p&gt;

&lt;p&gt;The source of this frustration? Multiple operators.&lt;/p&gt;

&lt;p&gt;Consider the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;d&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To understand it, you need to recall operator precedence. &lt;/p&gt;

&lt;p&gt;Perhaps most developers would prefer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;d&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Is it uglier? Depends who's answering. However, most of us would agree it's more readable. &lt;/p&gt;

&lt;p&gt;Alas, when it comes time to format, the parentheses are nowhere to be found.&lt;/p&gt;

&lt;p&gt;This example may be trivial, but it's easy to see how this problem can get worse. &lt;/p&gt;

&lt;h3&gt;
  
  
  The solution?
&lt;/h3&gt;

&lt;p&gt;I don't have a good one...yet. &lt;/p&gt;

&lt;p&gt;My first thought was to use &lt;a href="https://eslint.org/docs/latest/rules/no-mixed-operators" rel="noopener noreferrer"&gt;no-mixed-operators&lt;/a&gt;, which can be setup to enforce parentheses on any operator you like.&lt;/p&gt;

&lt;p&gt;However, after setting it up. I noticed my prettier eslint rule was still complaining (yes I did make sure the rule sat after my prettier rules). After some digging I found this comically long &lt;a href="https://github.com/prettier/prettier/issues/187" rel="noopener noreferrer"&gt;issue&lt;/a&gt; where some developers resolved to stop using prettier entirely. &lt;/p&gt;

&lt;p&gt;Why? &lt;/p&gt;

&lt;p&gt;The only way to get prettier to play nice with this rule is extraction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mult&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;d&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;mult&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's not terrible. Potentially it's actually preferable for longer equations. For my use cases though, it breaks the flow of the equation. Sometimes, wrapping segments in parentheses communicates intent without polluting the namespace with throwaway variables.&lt;/p&gt;

&lt;h3&gt;
  
  
  Potential solutions
&lt;/h3&gt;

&lt;p&gt;The only realistic solutions for my use case I found are to replace prettier for js/ts altogether, leaving it to format css, markdown etc. which I'm not eager to do.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://eslint.style/" rel="noopener noreferrer"&gt;@stylistic/eslint&lt;/a&gt; can be configured to pretty much replicate prettier's behaviour, but I'm an all or nothing guy. If I'm going to add an extensive plugin I'd like to use it properly, replacing my react and typescript rules with it as they recommend. I will probably get round to this when I have the time, updating my &lt;a href="https://github.com/basselalsayed/eslint-config-bsas" rel="noopener noreferrer"&gt;core eslint config&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://biomejs.dev/" rel="noopener noreferrer"&gt;biome&lt;/a&gt; is a replacement for both ESlint and prettier. It's a pretty cool project but I've already spent considerable time setting up my ESlint so this is not a realistic option.&lt;/p&gt;

&lt;h3&gt;
  
  
  In defence of prettier
&lt;/h3&gt;

&lt;p&gt;If you have a more complex equation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="nx"&gt;d&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;f&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;g&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;h&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;k&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;l&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Prettier will format it closer to what I am suggesting above:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
      &lt;span class="p"&gt;(((&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="nx"&gt;d&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;f&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;g&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;h&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;k&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;l&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a case for extraction though. Because similarly to ternaries, there are diminishing marginal returns on parenthesis.&lt;/p&gt;

&lt;h3&gt;
  
  
  Closing thoughts
&lt;/h3&gt;

&lt;p&gt;Prettier has been an essential tool for me for years. &lt;/p&gt;

&lt;p&gt;However, this experience has brought me to the conclusion that code formatters should aid readability, not rigidly enforce minimalism at the cost of comprehension. Until Prettier allows an option to respect extra parentheses for clarity, we are stuck choosing between formatter compliance and readable math. Does a formatter deserve to have this much power?&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Rediscovering React: Visualise algorithms in the browser!</title>
      <dc:creator>Bassel Al-Sayed</dc:creator>
      <pubDate>Wed, 21 May 2025 10:58:31 +0000</pubDate>
      <link>https://dev.to/basselalsayed/rediscovering-react-visualise-algorithms-in-the-browser-18lo</link>
      <guid>https://dev.to/basselalsayed/rediscovering-react-visualise-algorithms-in-the-browser-18lo</guid>
      <description>&lt;p&gt;Recently, I took on a side project that’s been both a technical refresher and a creative outlet: a pathfinding visualizer built with React.&lt;/p&gt;

&lt;p&gt;The motivation was simple. I missed building things for the sake of building. Recently in my career, I’ve been more focused on svelte and flutter and I wanted to reconnect with my react foundation. With no time pressure or stakeholder demands, I gave myself the space to explore, iterate, and have fun.&lt;/p&gt;

&lt;p&gt;The project itself is a visual tool that lets users see how different pathfinding algorithms work in real time. Think Dijkstra’s, A* etc. &lt;/p&gt;

&lt;p&gt;It was a great way to sharpen my JavaScript fundamentals, play with some awesome libraries, revisit hook abstraction and folder architecture, and even brush up on algorithmic thinking.&lt;/p&gt;

&lt;p&gt;More than just a technical exercise, this project reminded me why I love software development and particularly frontend: the immediate feedback of building, breaking, and fixing —and the satisfaction of watching an idea come to life on screen.&lt;/p&gt;

&lt;p&gt;If you’re curious, you can &lt;a href="https://algovi.netlify.app" rel="noopener noreferrer"&gt;check it out&lt;/a&gt; or have a look at the code &lt;a href="https://github.com/basselalsayed/algo-visualiser-v2" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ Due to some CSS hacks I used with linear gradients, it does not render correctly on firefox. Tested on chromium and safari &lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>webdev</category>
      <category>typescript</category>
      <category>react</category>
      <category>algorithms</category>
    </item>
  </channel>
</rss>
