<?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>Forem: Andreas Nicolaou</title>
    <description>The latest articles on Forem by Andreas Nicolaou (@andreas_nicolaou_b3b60f17).</description>
    <link>https://forem.com/andreas_nicolaou_b3b60f17</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%2F2811237%2F1f64019b-17d9-45a2-9643-af52ab0b9e22.png</url>
      <title>Forem: Andreas Nicolaou</title>
      <link>https://forem.com/andreas_nicolaou_b3b60f17</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/andreas_nicolaou_b3b60f17"/>
    <language>en</language>
    <item>
      <title>Say Goodbye to Try-Catch Blocks Forever!</title>
      <dc:creator>Andreas Nicolaou</dc:creator>
      <pubDate>Sun, 17 Aug 2025 20:50:11 +0000</pubDate>
      <link>https://forem.com/andreas_nicolaou_b3b60f17/say-goodbye-to-try-catch-blocks-forever-1em4</link>
      <guid>https://forem.com/andreas_nicolaou_b3b60f17/say-goodbye-to-try-catch-blocks-forever-1em4</guid>
      <description>&lt;p&gt;Error handling is a necessary but often frustrating part of JavaScript development. Wrapping functions in try…catch blocks clutters your code, making it harder to read and maintain.&lt;/p&gt;

&lt;p&gt;Wouldn’t it be great if you could automate error handling while keeping your code clean and functional?&lt;/p&gt;

&lt;p&gt;That’s exactly what &lt;a class="mentioned-user" href="https://dev.to/andreasnicolaou"&gt;@andreasnicolaou&lt;/a&gt;/safe does.&lt;/p&gt;

&lt;p&gt;This lightweight library automatically wraps your functions and promises in a safe execution environment, ensuring errors are caught without the need for repetitive try…catch blocks.&lt;/p&gt;

&lt;p&gt;Why Use &lt;a href="https://www.npmjs.com/package/@andreasnicolaou/safe" rel="noopener noreferrer"&gt;@andreasnicolaou/safe&lt;/a&gt;?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No more try…catch spam — Keep your code clean and readable.&lt;/li&gt;
&lt;li&gt;Works with both synchronous &amp;amp; asynchronous functions — No need to handle errors separately.&lt;/li&gt;
&lt;li&gt;Customizable error logging — Integrate with logging tools like Sentry.&lt;/li&gt;
&lt;li&gt;Functional programming friendly — Compose operations without error-handling clutter.&lt;/li&gt;
&lt;li&gt;TypeScript optimized — Enjoy full type inference and guards.&lt;/li&gt;
&lt;li&gt;Framework-agnostic — Works seamlessly with React, Node.js, Deno, and more&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;To install &lt;a href="https://www.npmjs.com/package/@andreasnicolaou/safe" rel="noopener noreferrer"&gt;@andreasnicolaou/safe&lt;/a&gt;, simply run:&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install @andreasnicolaou/safe
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;For full usage details and API documentation, visit the official npm page:&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
      &lt;div class="c-embed__body flex items-center justify-between"&gt;
        &lt;a href="https://www.npmjs.com/package/@andreasnicolaou/safe" rel="noopener noreferrer" class="c-link fw-bold flex items-center"&gt;
          &lt;span class="mr-2"&gt;npmjs.com&lt;/span&gt;
          

        &lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>typescript</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Stop using CSS Class Selectors in Jasmine Tests: Here's a Better Way</title>
      <dc:creator>Andreas Nicolaou</dc:creator>
      <pubDate>Sun, 17 Aug 2025 20:46:58 +0000</pubDate>
      <link>https://forem.com/andreas_nicolaou_b3b60f17/stop-using-css-class-selectors-in-jasmine-tests-heres-a-better-way-37jd</link>
      <guid>https://forem.com/andreas_nicolaou_b3b60f17/stop-using-css-class-selectors-in-jasmine-tests-heres-a-better-way-37jd</guid>
      <description>&lt;p&gt;When writing end-to-end or integration tests, how we select elements matters. A lot.&lt;/p&gt;

&lt;p&gt;If you've ever updated a class name in a component and had half your test suite crumble like a stale cookie, you've experienced first-hand why CSS classes aren't the most stable way to identify elements in tests.&lt;/p&gt;

&lt;p&gt;That's exactly why I built &lt;strong&gt;&lt;a href="https://www.npmjs.com/package/@andreasnicolaou/eslint-plugin-no-classes-by-css" rel="noopener noreferrer"&gt;@andreasnicolaou/eslint-plugin-no-classes-by-css&lt;/a&gt;&lt;/strong&gt; an ESLint plugin designed to enforce better testing practices by preventing the use of CSS class selectors in By.css() calls.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://www.npmjs.com/package/@andreasnicolaou/eslint-plugin-no-classes-by-css" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/@andreasnicolaou/eslint-plugin-no-classes-by-css&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let me walk you through the why, the what, and the how.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Avoid CSS Classes in Tests?&lt;/strong&gt;&lt;br&gt;
In Jasmine (and Protractor) tests, a common pattern for locating elements is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;element(By.css('.login-button'));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Looks fine, right? Until your designer decides to rename &lt;strong&gt;.login-button&lt;/strong&gt; to &lt;strong&gt;.btn-primary&lt;/strong&gt;, and now your test is broken-not because the app changed functionally, but because the &lt;strong&gt;&lt;em&gt;selector changed superficially&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Using class selectors tightly couples your test code to styling decisions. This is fragile and leads to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Brittle tests that fail on non-functional changes&lt;/li&gt;
&lt;li&gt;Hard-to-maintain test suites&lt;/li&gt;
&lt;li&gt;Poor separation of concerns&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;IDs or tag-based selectors tend to be &lt;strong&gt;more semantically meaningful&lt;/strong&gt; and &lt;strong&gt;less likely to change arbitrarily&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Plugin&lt;/strong&gt;: &lt;em&gt;&lt;a class="mentioned-user" href="https://dev.to/andreasnicolaou"&gt;@andreasnicolaou&lt;/a&gt;/eslint-plugin-no-classes-by-css&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This ESLint plugin enforces a simple rule: &lt;strong&gt;Don't use CSS class selectors in By.css()&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It flags the following:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// ❌ Not allowed
element(By.css('.my-class'));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;But allows these if configured:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// ✅ Allowed (with allowIds)
element(By.css('#submit-button'));
// ✅ Allowed (with allowTags)
element(By.css('button'));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Getting Started&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;1. Install the plugin&lt;/strong&gt;&lt;br&gt;
Depending on how ESLint is set up in your project:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# If ESLint is installed globally
npm install -g @andreasnicolaou/eslint-plugin-no-classes-by-css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Or locally in your devDependencies
npm install -D @andreasnicolaou/eslint-plugin-no-classes-by-css
@andreasnicolaou/eslint-plugin-no-classes-by-css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
      &lt;div class="c-embed__body flex items-center justify-between"&gt;
        &lt;a href="https://www.npmjs.com/package/@andreasnicolaou/eslint-plugin-no-classes-by-css" rel="noopener noreferrer" class="c-link fw-bold flex items-center"&gt;
          &lt;span class="mr-2"&gt;npmjs.com&lt;/span&gt;
          

        &lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Configure .eslintrc&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "plugins": [
    "@andreasnicolaou/no-classes-by-css"
  ],
  "rules": {
    "@andreasnicolaou/no-classes-by-css/no-classes-by-css": [
      "error",
      {
        "allowIds": true,
        "allowTags": true
      }
    ]
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Configuration Options&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;allowIds&lt;/code&gt;: (default: &lt;code&gt;false&lt;/code&gt;)&lt;br&gt;
 Allow ID selectors like &lt;code&gt;By.css('#user-id')&lt;/code&gt;&lt;br&gt;
&lt;code&gt;allowTags&lt;/code&gt;: (default: &lt;code&gt;false&lt;/code&gt;)&lt;br&gt;
 Allow tag selectors like &lt;code&gt;By.css('input')&lt;/code&gt;&lt;br&gt;
&lt;code&gt;disallowClasses&lt;/code&gt;: Always &lt;code&gt;true&lt;/code&gt;&lt;br&gt;
 Disallows selectors like &lt;code&gt;By.css('.username-field')&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-World Example&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Bad 👎&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const loginButton = element(By.css('.login-btn'));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Better 👍&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const loginButton = element(By.css('#login'));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Even Better&lt;/em&gt;&lt;br&gt;
Use a dedicated test ID or data attribute with a custom selector strategy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Autofix?&lt;/strong&gt;&lt;br&gt;
Not yet. The plugin currently &lt;strong&gt;does not support autofix&lt;/strong&gt;, since rewriting selectors correctly often requires human context.&lt;/p&gt;

&lt;p&gt;But it will warn you, and that's a great first step toward cleaner tests.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Tests should be &lt;strong&gt;resilient&lt;/strong&gt; and &lt;strong&gt;easy to maintain&lt;/strong&gt;. By avoiding class-based selectors, you're building test suites that are more stable, more semantic, and less prone to breaking from visual or stylistic changes.&lt;br&gt;
If this sounds like a headache you've dealt with before, give &lt;a href="https://dev.to@andreasnicolaou/eslint-plugin-no-classes-by-css"&gt;@andreasnicolaou/eslint-plugin-no-classes-by-css&lt;/a&gt; a spin. Drop it into your config, commit to better practices, and spend less time debugging fragile selectors.&lt;br&gt;
Let's write tests that can stand the test of time.&lt;/p&gt;

&lt;p&gt;Thanks for reading! If you found this helpful, share it with your team - or better yet, drop a star on the GitHub repo. ✨&lt;/p&gt;

</description>
      <category>angular</category>
      <category>eslint</category>
      <category>jasmine</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Toastify: The Lightweight, No-Dependency Toast Notification Library for Your Web Apps</title>
      <dc:creator>Andreas Nicolaou</dc:creator>
      <pubDate>Sun, 17 Aug 2025 19:37:15 +0000</pubDate>
      <link>https://forem.com/andreas_nicolaou_b3b60f17/toastify-the-lightweight-no-dependency-toast-notification-library-for-your-web-apps-3ggo</link>
      <guid>https://forem.com/andreas_nicolaou_b3b60f17/toastify-the-lightweight-no-dependency-toast-notification-library-for-your-web-apps-3ggo</guid>
      <description>&lt;p&gt;When building modern web applications, user notifications are essential for enhancing UX. Whether it’s success messages, errors, or general information, toast notifications offer a seamless way to communicate with users. However, many notification libraries come with unnecessary bloat, dependencies, or limited customization options.&lt;/p&gt;

&lt;p&gt;Enter Toastify, a fast, lightweight, and fully customizable toast notification library designed to provide clean and efficient alerts with zero dependencies.&lt;/p&gt;

&lt;p&gt;In this article, we’ll explore why Toastify is the perfect choice for developers who want simple yet powerful toast notifications in their projects.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;No Dependencies&lt;/li&gt;
&lt;li&gt;Fully Customizable&lt;/li&gt;
&lt;li&gt;Flexiple API
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install @andreasnicolaou/toastify
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Live demo: &lt;a href="https://andreasnicolaou.github.io/toastify/" rel="noopener noreferrer"&gt;View here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you like what you see drop a ⭐️ here: &lt;a href="https://github.com/andreasnicolaou/toastify" rel="noopener noreferrer"&gt;Git Repo&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>angular</category>
      <category>vue</category>
      <category>react</category>
    </item>
    <item>
      <title>Looking for a client-side expression language compatible with Symfony Expression Language?</title>
      <dc:creator>Andreas Nicolaou</dc:creator>
      <pubDate>Mon, 03 Feb 2025 19:36:01 +0000</pubDate>
      <link>https://forem.com/andreas_nicolaou_b3b60f17/typescript-symfony-expression-language-21ag</link>
      <guid>https://forem.com/andreas_nicolaou_b3b60f17/typescript-symfony-expression-language-21ag</guid>
      <description>&lt;p&gt;A TypeScript implementation of the popular Symfony Expression Language! This library allows you to evaluate complex expressions client-side, fully mirroring the functionality of the PHP version.&lt;/p&gt;

&lt;p&gt;Use it to create dynamic and flexible expression-based logic on the frontend while keeping it in sync with your Symfony/PHP backend.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Features&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Full Symfony Compatibility — Works just like Symfony’s Expression Language.&lt;/li&gt;
&lt;li&gt;Rich Syntax — Supports numbers, strings, operators, functions, and object/array access.&lt;/li&gt;
&lt;li&gt;Custom Functions — Extend functionality by registering your own functions.&lt;/li&gt;
&lt;li&gt;TypeScript Support — Fully typed, making it seamless to use in TS projects.&lt;/li&gt;
&lt;li&gt;Client-Side Execution — Evaluate expressions directly in the browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Installation&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install @andreasnicolaou/typescript-expression-language
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;For full usage details and API documentation, visit the official npm page:&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://www.npmjs.com/package/@andreasnicolaou/typescript-expression-language" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic-production.npmjs.com%2F338e4905a2684ca96e08c7780fc68412.png" height="420" class="m-0" width="800"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://www.npmjs.com/package/@andreasnicolaou/typescript-expression-language" rel="noopener noreferrer" class="c-link"&gt;
          @andreasnicolaou/typescript-expression-language - npm
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          TypeScript implementation of symfony/expression-language. Latest version: 1.3.0, last published: 11 days ago. Start using &lt;a class="mentioned-user" href="https://dev.to/andreasnicolaou"&gt;@andreasnicolaou&lt;/a&gt;/typescript-expression-language in your project by running `npm i &lt;a class="mentioned-user" href="https://dev.to/andreasnicolaou"&gt;@andreasnicolaou&lt;/a&gt;/typescript-expression-language`. There are no other projects in the npm registry using &lt;a class="mentioned-user" href="https://dev.to/andreasnicolaou"&gt;@andreasnicolaou&lt;/a&gt;/typescript-expression-language.
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic-production.npmjs.com%2Fb0f1a8318363185cc2ea6a40ac23eeb2.png" width="32" height="32"&gt;
        npmjs.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;&lt;a href="https://andreasnicolaou.github.io/typescript-expression-language/" rel="noopener noreferrer"&gt;Demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Use This Library?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Eliminate Duplicate Logic — Write expressions once and use them both client-side and server-side.&lt;/li&gt;
&lt;li&gt;Consistent Behavior — Ensure frontend and backend calculations match perfectly.&lt;/li&gt;
&lt;li&gt;Lightweight &amp;amp; Fast — Optimized for speed, with minimal dependencies.&lt;/li&gt;
&lt;li&gt;Safe (no eval, uses AST)&lt;/li&gt;
&lt;li&gt;You can add custom functions &amp;amp; operators&lt;/li&gt;
&lt;li&gt;Great for UI features, use in feature flags, search filters, validation rules, dashboards, etc&lt;/li&gt;
&lt;li&gt;Dynamic rules without code changes, let users/admins define filters, formulas, or conditions in text.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Get Started Today!&lt;br&gt;
This library is open-source and actively maintained! If you find it useful, consider giving it a ⭐️ on GitHub: &lt;a href="https://github.com/andreasnicolaou/typescript-expression-language" rel="noopener noreferrer"&gt;expression-language&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Install via npm at: &lt;a href="https://www.npmjs.com/package/@andreasnicolaou/typescript-expression-language?activeTab=readme" rel="noopener noreferrer"&gt;expression-language&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>php</category>
      <category>angular</category>
      <category>react</category>
    </item>
  </channel>
</rss>
