<?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: Claudio F.</title>
    <description>The latest articles on DEV Community by Claudio F. (@cfofiu).</description>
    <link>https://dev.to/cfofiu</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%2F289550%2Fa21ba714-cfc9-41da-8d7d-f959d57d42d3.jpeg</url>
      <title>DEV Community: Claudio F.</title>
      <link>https://dev.to/cfofiu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cfofiu"/>
    <language>en</language>
    <item>
      <title>Our Journey to Prettier and ESLint: How We Adopted These Tools to Improve Our Code Quality</title>
      <dc:creator>Claudio F.</dc:creator>
      <pubDate>Thu, 31 Mar 2022 18:26:43 +0000</pubDate>
      <link>https://dev.to/cfofiu/our-journey-to-prettier-and-eslint-how-we-adopted-these-tools-to-improve-our-code-quality-nfg</link>
      <guid>https://dev.to/cfofiu/our-journey-to-prettier-and-eslint-how-we-adopted-these-tools-to-improve-our-code-quality-nfg</guid>
      <description>&lt;p&gt;At &lt;a href="http://monogram.io"&gt;Monogram&lt;/a&gt;, we've always strived to produce quality code. Alongside &lt;a href="https://www.typescriptlang.org"&gt;TypeScript&lt;/a&gt; we believe that &lt;a href="https://prettier.io"&gt;Prettier&lt;/a&gt; and &lt;a href="https://eslint.org"&gt;ESLint&lt;/a&gt; help us do just that by enforcing our coding standards across all of our repositories, and by giving us instant feedback on potential errors. Adopting these tools has been a great journey so far, and we've seen vast improvements in the quality and consistency of our code. We welcome your feedback on prettier and eslint – please share with us how you're using them in your own work!&lt;/p&gt;

&lt;p&gt;We're excited to announce that we've released two npm packages that make it easy for you to adopt Prettier and ESLint in your own work. The first package, &lt;a href="https://www.npmjs.com/package/@monogram/prettier-config"&gt;&lt;code&gt;monogram-prettier&lt;/code&gt;&lt;/a&gt;, is a wrapper around prettier that makes it easy to use with all of your projects. The second package, &lt;a href="https://www.npmjs.com/package/@monogram/eslint-config"&gt;&lt;code&gt;monogram-eslint&lt;/code&gt;&lt;/a&gt;, is a wrapper around eslint that makes it easy to use with all of your projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prettier
&lt;/h2&gt;

&lt;p&gt;There are a lot of debates over code style within different teams. It can be frustrating trying to keep everyone happy. By adopting Prettier, you can automatically format your code so that everyone is on the same page - and stop wasting time arguing over style choices! Prettier is an extension for many popular code editors that will automatically format your code according to a set of rules. This means that you can just write your code and not worry about the formatting - Prettier will take care of it for you. Many teams have adopted Prettier as their standard for code formatting, and it's definitely worth considering for your team as well!&lt;/p&gt;

&lt;p&gt;&lt;code&gt;monogram-prettier&lt;/code&gt; installs in your package.json and it provides our own pre-defined prettier rules all you have to do is add install it and add it to your package.json.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install
&lt;/h3&gt;

&lt;p&gt;Install the package via &lt;code&gt;npm&lt;/code&gt; or &lt;code&gt;yarn&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn add &lt;span class="nt"&gt;--dev&lt;/span&gt; @monogram/prettier-config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Add it to your &lt;code&gt;package.json&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;You must add it to your package.json for the rules to take effect.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"prettier"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"@monogram/prettier-config"&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Extend it
&lt;/h3&gt;

&lt;p&gt;A &lt;code&gt;.prettierrc.js&lt;/code&gt; file is not needed, but if you'd like to extend it and add your own settings feel free to use it like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;.prettierrc.js&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;module.exports&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="err"&gt;...require('@github/prettier-config')&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="err"&gt;tabWidth:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="err"&gt;useTabs:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="err"&gt;overrides:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="err"&gt;files:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;'*.scss'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="err"&gt;options:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
       &lt;/span&gt;&lt;span class="err"&gt;singleQuote:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
       &lt;/span&gt;&lt;span class="err"&gt;tabWidth:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
       &lt;/span&gt;&lt;span class="err"&gt;useTabs:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
       &lt;/span&gt;&lt;span class="err"&gt;printWidth:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;160&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  ESLint
&lt;/h2&gt;

&lt;p&gt;ESLint is a tool for linting JavaScript code. It can be used to enforce your team's coding standards, or to help you write better code. ESLint uses a rules-based approach to linting, which allows you to configure it however you want. This means that you can customize it to fit your team's needs, and make sure that everything is compliant with industry best practices. Whether you're just starting out with code quality assurance or you're a seasoned pro, ESLint is a tool that can help you write better code.&lt;/p&gt;

&lt;p&gt;The package that we've put together is called &lt;code&gt;monogram-eslint&lt;/code&gt;, it installs in your project and it provides our own pre-defined ESLint rules.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install
&lt;/h3&gt;

&lt;p&gt;In order to install it you must run it via &lt;code&gt;npx&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx @monogram/eslint-config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both packages are open source and available on GitHub. We would love to hear from you about how you're using them and feel free to contribute via PRs. Please reach out to us on &lt;a href="https://twitter.com/cfofiu"&gt;Twitter&lt;/a&gt; or &lt;a href="https://github.com/monogramdesign"&gt;GitHub&lt;/a&gt;. Thanks for helping us make our code quality even better!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>lint</category>
      <category>prettier</category>
    </item>
    <item>
      <title>How to Store a Long, Multi-line Private Key in an Environment Variable</title>
      <dc:creator>Claudio F.</dc:creator>
      <pubDate>Thu, 29 Oct 2020 02:48:57 +0000</pubDate>
      <link>https://dev.to/cfofiu/how-to-store-a-long-private-key-in-vercel-s-environment-variables-46f5</link>
      <guid>https://dev.to/cfofiu/how-to-store-a-long-private-key-in-vercel-s-environment-variables-46f5</guid>
      <description>&lt;p&gt;Most of the time you store simple, straight forward private keys for your deployments, but sometimes your project requires some complex ones like this one below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCt95m8QfrcIR+o
0a7S1hTtcbt7NhEJLiVELktu1XsFSitazhwvrRuVGn1c+cqgQbmAp7x/xoaYcLfY
tAaKR9v1xNEIBEwA/h1k+TFl7xJqH6Q07LBVYR0kVWiXgUHo6XWhlJEy4PCC5Yqo
eV2ZsA4Jjsh8c0cWTEFX9cCCT8cRIOfMeR/TcAeF/bPEOnmrbJJLV+5ivJUCHpio
[...]
tQeRV0IfFdnW8V3y6XI+xFYBOkx7D4BGFF8fUNr0iYMCWvICu2cJlWqi6Qmlk+LJ
br9Sl3Y2c1bXQbsW2ZKQJTANKBxeY1i9Au1pdCUCgYEAzbqB5omxKXcXx/0ZI/ao
cIJ9hQ6S18JIniG7DFyyUzqHansnqD1Qqxefl1fFLcuWktUivfbr7v5FoWUjwKLQ
JOJOVI3DZCsOumPrpEpjRa4cCQEjNPqYHL4voIR5IHRr+4iKSVrXUcmhdyqxjonG
11Avbqh479wA4VYksAF9AM4=
-----END PRIVATE KEY-----
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When your project is ready to launch, but you're getting stuck in a few minor, silly errors like &lt;code&gt;Failed to parse private key: Error: Invalid PEM formatted message&lt;/code&gt;, you know that the problem is how the environment variable is stored, but have tried a lot of things to try to get it to work.&lt;/p&gt;

&lt;p&gt;Well... hoping to save someone some time, I've ran across this pretty elegant solution in GitHub.&lt;/p&gt;

&lt;p&gt;Store your multi-line Private Key like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FIREBASE_PRIVATE_KEY='{"privateKey":"-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQE...-----END PRIVATE KEY-----"}'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and use it in the code as following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { privateKey } = JSON.parse(process.env.FIREBASE_PRIVATE_KEY)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Peace!&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>googlecloud</category>
      <category>azure</category>
      <category>firebase</category>
    </item>
  </channel>
</rss>
