<?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: Daniel Bernardino</title>
    <description>The latest articles on DEV Community by Daniel Bernardino (@daniel__bernardino).</description>
    <link>https://dev.to/daniel__bernardino</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%2F957488%2F4d9316b8-b2ad-4a17-9a74-40559289be01.jpeg</url>
      <title>DEV Community: Daniel Bernardino</title>
      <link>https://dev.to/daniel__bernardino</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/daniel__bernardino"/>
    <language>en</language>
    <item>
      <title>Good configs for Typescript</title>
      <dc:creator>Daniel Bernardino</dc:creator>
      <pubDate>Tue, 24 Jan 2023 15:10:48 +0000</pubDate>
      <link>https://dev.to/daniel__bernardino/good-configs-for-typescript-1nhf</link>
      <guid>https://dev.to/daniel__bernardino/good-configs-for-typescript-1nhf</guid>
      <description>&lt;p&gt;I'm not a professional in this technology, but I understood the importance that a setup has in our applications. I'll show my back-end setup and I hope you like it.&lt;/p&gt;

&lt;p&gt;For didactic purposes, I'm going to install some dependencies that don't necessarily have to do with one another. Imagine that it is your application will not deviate much from this pattern.&lt;/p&gt;

&lt;p&gt;Thinking about making this article applicable, and you don't have to look for the configurations in the middle of the explanations I'll leave it as a step-by-step, and at the end, explain everything, feel free to read it as you wish.&lt;/p&gt;






&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm init -y
&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;npm i cors dotenv express pg morgan
&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;npm i -D nodemon typescript ts-node
&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;npm i -D @types/express @types/node @types/cors @types/pg
&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;npx tsc --init
&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;./tsconfig.json

{
  "compilerOptions": {
    "target": "es2021",
    "module": "commonjs",
    "rootDir": "./src",
    "esModuleInterop": true,
    "outDir": "./dist",
    "moduleResolution": "node",
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "skipLibCheck": true,
    "allowSyntheticDefaultImports": true
  }
}
&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;// commit
chore: add basic configs and ts config
&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;./package.json

"script": {
  "start:dev": "nodemon --watch 'src/' --exec 'ts-node src/server.ts' -e ts",
  // ...
},
&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;// commit
chore: add ts-node and nodemon setup
&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;npm i -D eslint prettier eslint-config-prettier


npm init @eslint/config
&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;.eslintignore

node_modules
/*.js
&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;.eslintrc.json

{
  "env": {
    "browser": true,
    "es2020": true,
    "node": true
  },
  "extends": [
    "plugin:@typescript-eslint/recommended"
  ],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaVersion": "latest",
    "sourceType": "module",
        "project": ["./tsconfig.json"],
  },
  "plugins": ["@typescript-eslint"],
  "rules": {
    "space-before-function-paren": "off",
    "@typescript-eslint/no-empty-interface": "off"
  }
}
&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;.prettierrc.json

{
  "semi": false,
  "singleQuote": true,
  "tabWidth": 2,
  "trailingComma": "all",
  "printWidth": 120
}
&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;//commit
chore: add eslint and prettier setup
&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;npm i -D husky lint-staged git-commit-msg-linter
&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;.package.json

"scripts": {
  "husky": "husky install",
  //...
}
&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;.lintstagedrc.json

{
  "*.ts": [
    "npx eslint 'src/**' --fix",
    "npx prettier --check 'src/**'"
  ]
}
&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;npm run husky

npx husky add .husky/pre-commit "npx lint-staged"

npx husky add .husky/commit-msg ".git/hooks/commit-msg \$1"
&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;// commit
chore: add husky and lint-staged setup
&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;npm i -D tsconfig-paths tsc-alias
&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;.package.json

"script": {
  "build": "tsc &amp;amp;&amp;amp; tsc-alias",
  "start:dev": "nodemon --watch 'src/' --exec 'ts-node -r tsconfig-paths/register src/server.ts' -e ts",
  //...
}
&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;./tsconfig.json
{
  "compilerOptions: {
    // ...

    "paths": {
      "@/*": ["*"]
    },
    "baseUrl": "./src"
  }
}
&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;// commit

chore: add tsconfig-paths to script dev and tsc-alias setup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  First of all
&lt;/h2&gt;

&lt;p&gt;Start your application and install the basic dependencies, checking if their respective types exist, if in doubt, try installing it with &lt;code&gt;@types/&amp;lt;name-lib&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;All ready, basic dependencies of a back-end application using Express, Typescript and postgreSQL.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now we need to initialize the Typescript, remembering that it is a tool that will 'modify' your file, adding a layer of processes and typing that will not go to production.&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;tsconfig.json&lt;/code&gt; file will be created, where you can add and configure your Typescript.&lt;/p&gt;

&lt;p&gt;All properties have some value, and I recommend that you research or even test the change that each of them may have in your project, but the ones described in the step-by-step were the ones that best suited my style of code.&lt;/p&gt;

&lt;p&gt;Some interesting ones to mention:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;"allowSyntheticDefaultImports"&lt;/code&gt;: this way will be able to do default imports, like &lt;code&gt;import express from 'express'&lt;/code&gt;;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;"skipLibCheck"&lt;/code&gt;: this can save time during compilation at the expense of type-system accuracy.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  IT'S IS IMPORTANT
&lt;/h2&gt;

&lt;p&gt;I see many junior developers who don't understand scripts and how they work, this is worrying, because they are an details of your application that needs to make sense with its context.&lt;/p&gt;

&lt;p&gt;Let's understand our script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"start:dev": "nodemon --watch 'src/' --exec 'ts-node -r tsconfig-paths/register resrc/server.ts' -e ts"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Uses nodemon to monitor changes to files inside the "src/" folder&lt;/li&gt;
&lt;li&gt;Run ts-node to record the tsconfig path, and run the server.ts file inside the "src/server.ts" folder&lt;/li&gt;
&lt;li&gt;Uses the .ts extension for TypeScript files.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Explaining a little better:&lt;br&gt;
I want this application to have the 'start:dev' command in which to run the nodemon lib and watch (--watch) just the "src/" folder and then run the 'ts-node -r tsconfig-paths/register resrc' command /server.ts', in this command I want to run ts-node to build my application and start it with my main file 'server.ts'&lt;/p&gt;
&lt;h2&gt;
  
  
  Continuing,
&lt;/h2&gt;

&lt;p&gt;I'm not going to explain the &lt;strong&gt;configuration of eslint and prettier&lt;/strong&gt;, it's something personal, and normally in a company everything is already configured for you, but study to better understand how you can do it your way.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;gits hooks&lt;/strong&gt; are very valid for N reasons, but the configuration I left is specific to code standardization it if you work with a team, having a standardized code is very important. Of course, issues like programming logic are not so simple to standardize, but this &lt;strong&gt;configuration will help with formatting and semantic commits&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Lastly,
&lt;/h2&gt;

&lt;p&gt;We have path mappings, beautiful and smelling it's solve the paths like '../../../../../BlaEntity/index.ts'.&lt;/p&gt;

&lt;p&gt;I will demonstrate following the example above:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.tsconfig.json

"paths": {
   "@Bla/*": ["/domain/entities/flo/flu/BlaEntity/*"]
},
"baseUrl": "./src"


./another-file

import { BlaEntity } from '@Bla/index.ts'

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's a silly example, but feel free to define the nomenclature you want, then just assign its value with the path you determine.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Thank you for reading, I will try to make better and smaller articles, but I confess that I get carried away writing &amp;lt;3&lt;/strong&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>ESLint in 2022, from a beginner's point of view ;)</title>
      <dc:creator>Daniel Bernardino</dc:creator>
      <pubDate>Sat, 29 Oct 2022 14:32:49 +0000</pubDate>
      <link>https://dev.to/daniel__bernardino/eslint-in-2022-from-a-beginners-point-of-view--4b2a</link>
      <guid>https://dev.to/daniel__bernardino/eslint-in-2022-from-a-beginners-point-of-view--4b2a</guid>
      <description>&lt;p&gt;&lt;em&gt;Hey, there. In quick work, it's important to say that I'm a beginner dev and this is my first post, and maybe I have a little "naive" view of Linters. In that case, I hope for your help in the comments. Let's get to the point.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;If you know a little about package managers, any installation will be easy, look in the &lt;a href="https://eslint.org/docs/latest/user-guide/getting-started"&gt;eslint&lt;/a&gt; documentation.&lt;/p&gt;

&lt;p&gt;Anyway, I'll leave below the list of commands for you to do this, but try the documentation, because it can update, well, anytime.&lt;/p&gt;

&lt;h3&gt;
  
  
  First of all,
&lt;/h3&gt;

&lt;p&gt;We are in a situation where, in your code editor &lt;em&gt;(I'm using vscode)&lt;/em&gt;, you don't have &lt;strong&gt;any extensions or settings already changed&lt;/strong&gt; by you to use linters. Please pay attention to this.&lt;/p&gt;

&lt;p&gt;And you need to start your project, It could be an &lt;code&gt;npm init&lt;/code&gt;, it could be &lt;code&gt;npm init -y&lt;/code&gt;, it could be a &lt;code&gt;create-react-app&lt;/code&gt;, &lt;code&gt;vite&lt;/code&gt;, it doesn't matter so much.&lt;/p&gt;

&lt;p&gt;Start it however you feel comfortable.&lt;/p&gt;

&lt;h3&gt;
  
  
  Now yes, install eslint
&lt;/h3&gt;



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

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will already create a &lt;code&gt;.eslintrc&lt;/code&gt; folder (where you configure eslint) and will ask you some questions. You're free to answer each one because it depends on your type of project and your desire as well.&lt;/p&gt;

&lt;p&gt;I choose these options:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;? How would you like to use ESLint? … 
  To check syntax only
  To check syntax and find problems
▸ To check syntax, find problems, and enforce code style
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Choosing a code style already gives you a set of rules that a lot of people use, in all cases, it's good to use.&lt;/p&gt;

&lt;p&gt;Next question.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;? What type of modules does your project use? … 
▸ JavaScript modules (import/export)
  CommonJS (require/exports)
  None of these
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Understand this part as the way you import and export things. requise are already going out of fashion, so to speak, usually, your choice will be the first option.&lt;/p&gt;

&lt;p&gt;Next.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;? Which framework does your project use? … 
▸ React
  Vue.js
  None of these

? Does your project use TypeScript? ‣ No / Yes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I'm using React and in this project, there's no need to apply Typescript&lt;/p&gt;

&lt;p&gt;We're just starting!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;? Where does your code run? …  (Press &amp;lt;space&amp;gt; to select, &amp;lt;a&amp;gt; to toggle all, &amp;lt;i&amp;gt; to invert selection)
✔ Browser
✔ Node
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Normally you will leave both options checked, but feel free to choose where your code will run.&lt;/p&gt;

&lt;p&gt;Next!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;? How would you like to define a style for your project? … 
▸ Use a popular style guide
  Answer questions about your style

? Which style guide do you want to follow? … 
▸ Airbnb: https://github.com/airbnb/javascript
  Standard: https://github.com/standard/standard
  Google: https://github.com/google/eslint-config-google
  XO: https://github.com/xojs/eslint-config-xo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I chose Airbnb to demo and it's also the one I use the most, but feel free to inquire about other famous style guides&lt;/p&gt;

&lt;p&gt;More one!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;? What format do you want your config file to be in? … 
  JavaScript
  YAML
▸ JSON
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I like to use JSON format because normally the other settings, by default, come in JSON. The difference between them is very little.&lt;/p&gt;

&lt;p&gt;Next question!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;? Would you like to install them now? ‣ No / Yes

? Which package manager do you want to use? … 
▸ npm
  yarn
  pnpm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I don't know what happens if you don't install it now, you might have to do it all over again, but anyway, if we started all this to install, let's go all the way. I use NPM as a package manager.&lt;/p&gt;

&lt;p&gt;Finally, it's over... just kidding, &lt;/p&gt;

&lt;p&gt;This is the part we do in the terminal, now you can open your file, and I'll use the &lt;code&gt;code .&lt;/code&gt; command to open my code editor.&lt;/p&gt;

&lt;h3&gt;
  
  
  In your code editor,
&lt;/h3&gt;

&lt;p&gt;Now, you have installed your first linter. Congratulations!!!&lt;br&gt;
Let's take a look at your editor, it'll look like this:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--K8vHrb0---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8hbiqkq9espdsuc288kt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--K8vHrb0---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8hbiqkq9espdsuc288kt.png" alt="config-eslint-opened" width="880" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The most important parts you need to understand in eslint settings are &lt;strong&gt;extends&lt;/strong&gt;, &lt;strong&gt;plugins&lt;/strong&gt;, and &lt;strong&gt;rules&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Extends:
&lt;/h2&gt;

&lt;p&gt;Roughly speaking, Extends are files full of rules already configured. Downloading one you like and adding it to the array, it's ready to use.&lt;/p&gt;

&lt;p&gt;Nothing prevents you from installing several extends, but there is an important detail that will define the conflicts that your file may have.&lt;/p&gt;

&lt;p&gt;If you add your extends outside the array, they might conflict, because that means you're applying the two entire extends to your file. &lt;/p&gt;

&lt;p&gt;Your code editor will warn you that this is impossible to do, semantic errors of an object. That's why you should put it &lt;strong&gt;inside an array&lt;/strong&gt; if you're using &lt;strong&gt;more than one extension&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1kGL6nHx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ovhocllkqtwkk42vk4nu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1kGL6nHx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ovhocllkqtwkk42vk4nu.png" alt="object-array-extends" width="880" height="255"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Inside an array, your extends will inherit the characteristics of the previous extends.&lt;/p&gt;

&lt;p&gt;For example, looking at the image above, I can say that if there is an equal rule between the two extensions, the Airbnb rule will prevail.&lt;/p&gt;

&lt;p&gt;If I added another extends and it also had conflict then this one would take priority.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The order of priority is descending: from the last item in the array, to the first.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Plugins:
&lt;/h2&gt;

&lt;p&gt;Plugins are different, they are like a file that you install and leave in your project. It won't do anything until you give the command.&lt;/p&gt;

&lt;p&gt;It will make your rules available for you to use.&lt;/p&gt;

&lt;p&gt;The extends apply them the moment you add them, the plugins, even adding, don't apply your rules, just make them available for you to use.&lt;/p&gt;
&lt;h2&gt;
  
  
  Rules:
&lt;/h2&gt;

&lt;p&gt;Now I'm going to create an &lt;code&gt;index.js&lt;/code&gt; and make my first React component, let's see if our linter is working. To do this I will go to the terminal and put an &lt;code&gt;npx eslint .&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;const MyComponent = () =&amp;gt; {
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;h1&amp;gt;Hello, dev.to&amp;lt;/h1&amp;gt;
      &amp;lt;p&amp;gt;Please like this post!!!&amp;lt;/p&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}

export default MyComponent;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fMHRLTVb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g3fxkn4zn34ehgoyihmi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fMHRLTVb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g3fxkn4zn34ehgoyihmi.png" alt="first-errors-in-terminal" width="880" height="186"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wow, I thought that everything was ready, it seems that there are a lot of mistakes here and some very important ones.&lt;/p&gt;

&lt;p&gt;In my case, my first mistake is to use React, without even installing it in my application, what a big mistake. But there are also some minor bugs like the lack of semicolons.&lt;/p&gt;

&lt;p&gt;My Airbnb extends is telling me all these errors, I can change it if I want by changing the rule value. The basic values ​​that exist are: &lt;strong&gt;error&lt;/strong&gt;, &lt;strong&gt;warn&lt;/strong&gt;, &lt;strong&gt;off&lt;/strong&gt;;&lt;/p&gt;

&lt;p&gt;The rule can be considered an error, a warning, or it can be disabled.&lt;/p&gt;

&lt;p&gt;Let's disable the semicolon problem and also the newline that was reported by eslint;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--E3xzYbjG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sm13b7k638oskd0mhutc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--E3xzYbjG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sm13b7k638oskd0mhutc.png" alt="changed-rules-in-config" width="718" height="444"&gt;&lt;/a&gt;&lt;br&gt;
Notice that at least now those silly errors are no longer being warned.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9sU3J_W0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qv1r8pa7vo1czsb0zt9q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9sU3J_W0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qv1r8pa7vo1czsb0zt9q.png" alt="second-erros-in-terminal" width="880" height="151"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that's how rules work, you can write rule changes however you want, even applying an extends or plugin. We have other errors being shown but will be explained later.&lt;/p&gt;
&lt;h2&gt;
  
  
  Last but not least
&lt;/h2&gt;

&lt;p&gt;Now you understand how your linter extends work, how you can use plugins, and also how to see your errors.&lt;/p&gt;

&lt;p&gt;But let's make it easier. &lt;/p&gt;

&lt;p&gt;As I am using vscode, I will install the ESLint Extension, click on the configuration option, and click on add to Workspace recommendation. Doing so will create a folder called &lt;code&gt;.vscode&lt;/code&gt; with a file inside about the extension you just recommended.&lt;/p&gt;

&lt;p&gt;This means that every time someone downloads your project, vscode will recommend that they install this extension. It's practical, isn't it?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eLvtaFd0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eitzszz1143t1mff0tak.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eLvtaFd0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eitzszz1143t1mff0tak.png" alt="eslint-extension-vscode" width="880" height="617"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now your errors will be indicated by vscode itself, there is no need to run the command &lt;code&gt;npx eslint .&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Bonus
&lt;/h2&gt;

&lt;p&gt;ESlint also gives you the option to fix these errors, if you noticed the terminal errors, it suggests that we use the &lt;code&gt;--fix&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;To do this you need to have your files saved and run the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx eslint . --fix
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The simplest errors will format themselves, but some will persist and you must pay attention to them.&lt;/p&gt;

&lt;h3&gt;
  
  
  Formatting when saving
&lt;/h3&gt;

&lt;p&gt;Remember when vscode created a &lt;code&gt;.vscode&lt;/code&gt; folder?&lt;/p&gt;

&lt;p&gt;We can use this same folder to define the vscode settings in the project.&lt;/p&gt;

&lt;p&gt;This means that these settings won't change other projects and if someone downloads it, they won't need to change any settings in their code editor.&lt;/p&gt;

&lt;p&gt;Create a file called &lt;code&gt;settings.json&lt;/code&gt; and add the following code to it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will be telling your vscode:&lt;br&gt;
&lt;strong&gt;When you save a file, use eslint to format errors;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this case, you will be using your ESLint, not only as a Linter but as a Formatter.&lt;/p&gt;

&lt;p&gt;I'll leave this topic of formatters for another post. But it is important that you understand the processes I mentioned and how you have the freedom to use them however you want.&lt;/p&gt;

&lt;p&gt;That was it for today, I hope you enjoyed reading and that you tried to practice.&lt;/p&gt;

&lt;p&gt;See you later.&lt;/p&gt;

</description>
      <category>prettier</category>
      <category>tutorial</category>
      <category>productivity</category>
      <category>eslint</category>
    </item>
  </channel>
</rss>
