<?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: Sam</title>
    <description>The latest articles on Forem by Sam (@info5am).</description>
    <link>https://forem.com/info5am</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%2F216277%2Fe5149fc8-7a6e-4b25-95b9-a06d748dcc4e.png</url>
      <title>Forem: Sam</title>
      <link>https://forem.com/info5am</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/info5am"/>
    <language>en</language>
    <item>
      <title>Setting Up Python Virtual Environments</title>
      <dc:creator>Sam</dc:creator>
      <pubDate>Sat, 22 Aug 2020 13:08:08 +0000</pubDate>
      <link>https://forem.com/info5am/setting-up-python-virtual-environments-2j99</link>
      <guid>https://forem.com/info5am/setting-up-python-virtual-environments-2j99</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmpar8g3weo6jqsyz5doe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmpar8g3weo6jqsyz5doe.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;venv&lt;/strong&gt; is a package shipped with Python 3, which you can run using python3 -m venv (although for some reason some distros separate it out into a separate distro package, such as python3-venv on Ubuntu/Debian). It serves the same purpose as &lt;em&gt;virtualenv&lt;/em&gt;, but only has a subset of its features &lt;a href="https://virtualenv.pypa.io/en/latest/" rel="noopener noreferrer"&gt;see a comparison here&lt;/a&gt;. — &lt;a href="https://stackoverflow.com/questions/41573587/what-is-the-difference-between-venv-pyvenv-pyenv-virtualenv-virtualenvwrappe" rel="noopener noreferrer"&gt;source&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What is the benefit of using wrapping your code into a virtual environment?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;it isolates the project-related libraries and it doesn’t access the globally installed libraries.
We can think of it as if the project would live on its own island, isolated from the rest of the world, having its own little things going on 🌴&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Creating aliases
&lt;/h2&gt;

&lt;p&gt;Before we move on, let’s create some aliases for convenience of use.&lt;br&gt;
If you type &lt;code&gt;which python&lt;/code&gt; in terminal, it will print out the path for the python executable, which should be something like this &lt;code&gt;/usr/local/bin/python3&lt;/code&gt;.&lt;br&gt;
Then, open &lt;code&gt;~/.bashprofile&lt;/code&gt; you can type &lt;code&gt;cat ~/.bashprofile&lt;/code&gt; to open it directly in terminal or use any other way suitable for you. And add there the following line:&lt;br&gt;
&lt;code&gt;alias python=”/usr/local/bin/python3”&lt;/code&gt;&lt;br&gt;
Basically, we created an alias &lt;strong&gt;python&lt;/strong&gt; for &lt;strong&gt;python3&lt;/strong&gt;, and what it will do is each time you will be using python command it will be referring to &lt;strong&gt;python3&lt;/strong&gt;, which I find neat. And, of course, you can skip this step if you want to.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a virtual environment
&lt;/h2&gt;

&lt;p&gt;Creation of virtual environments is done by executing the command &lt;code&gt;venv&lt;/code&gt;:&lt;br&gt;
In my case, I already had some script saved in folder in Desktop, so I wanted to sort wrap it in the venv.&lt;br&gt;
&lt;code&gt;➜ script git:(master) python -m venv  /Users/user/Desktop/script&lt;/code&gt;&lt;br&gt;
In the example above I refer to the script using the &lt;em&gt;absolute path&lt;/em&gt;, however the &lt;em&gt;relative path&lt;/em&gt; like &lt;code&gt;~/Desktop/script&lt;/code&gt; should also work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Activating the virtual environment
&lt;/h2&gt;

&lt;p&gt;To activate virtual environment type the following command:&lt;br&gt;
&lt;code&gt;➜ script git:(master) ✗ source  /Users/user/Desktop/script/bin/activate&lt;/code&gt;&lt;br&gt;
And let’s say we have a &lt;code&gt;requirements.txt&lt;/code&gt; file, which specifies all the dependencies required to successfully running the python project, now all those dependencies/libraries will be installed and accessible only within this virtual environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Note
&lt;/h3&gt;

&lt;p&gt;If you exit the terminal, next time you want to run your project you will need to source &lt;code&gt;~/.bashprofile&lt;/code&gt; &lt;strong&gt;AND&lt;/strong&gt; re-enable the virtual environment (using activate command from above).&lt;br&gt;
&lt;em&gt;That’s all Folks!&lt;/em&gt; ☕&lt;/p&gt;

</description>
      <category>python</category>
      <category>venv</category>
      <category>bash</category>
    </item>
    <item>
      <title>Prisma + GraphQL. Project Setup Pt1</title>
      <dc:creator>Sam</dc:creator>
      <pubDate>Wed, 15 Jan 2020 21:58:43 +0000</pubDate>
      <link>https://forem.com/info5am/prisma-graphql-project-setup-pt1-5g6p</link>
      <guid>https://forem.com/info5am/prisma-graphql-project-setup-pt1-5g6p</guid>
      <description>&lt;p&gt;So, I started to work on my personal portfolio as an aspiring Junior Frontend developer before I switched my career to Security Analyst :D&lt;/p&gt;

&lt;p&gt;At my previous job we were building an internal testing tool (top secret stuff), and the stack we used was pretty trendy on the frontend side, it was React with Typescript and other friends.&lt;/p&gt;

&lt;p&gt;So, I wanted to develop my skillset further, and on top of that learn a bit of backend, while building a personal project for my portfolio.&lt;/p&gt;

&lt;p&gt;I would probably do something with NodeJS, Express, MongoDB and React-Typescript, since I actually wasn’t sure about the backend, and at the same time I didn’t want to go that deep into it rather just having fun while building my precious UI.&lt;/p&gt;

&lt;p&gt;But then my colleague told me to look into Prisma and GraphQL… and I was sold!&lt;/p&gt;

&lt;p&gt;GraphQL is sexy. See why &lt;a href="https://www.howtographql.com/basics/1-graphql-is-the-better-rest/" rel="noopener noreferrer"&gt;"GraphQL is the better REST"&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Stack
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Backend
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.prisma.io/docs/understand-prisma/prisma-introduction-what-why-how-j9ff/" rel="noopener noreferrer"&gt;Prisma v 1.34&lt;/a&gt; — an open source library, that sort of sits on top of your database and provides a full-featured GraphQL API that you can use to interact with the database.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.apollographql.com/docs/apollo-server/" rel="noopener noreferrer"&gt;Apollo Server v2&lt;/a&gt; — implements a GraphQL server and can be queried from ApolloClient.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nodejs.org/en/" rel="noopener noreferrer"&gt;Node.js v8.9.4 or later&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;PostgreSQL&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Frontend
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://create-react-app.dev/docs/getting-started/" rel="noopener noreferrer"&gt;React v16.8&lt;/a&gt; — in particular Create-React-App will serve as a great template for starters.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.apollographql.com/docs/react/" rel="noopener noreferrer"&gt;ApolloClient v2.6&lt;/a&gt; — will be responsible for requesting and caching your data, as well as updating your UI&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Initial Setup
&lt;/h2&gt;

&lt;p&gt;While I was deciding on how to approach the backend, I had already cloned &lt;em&gt;create-react-app&lt;/em&gt; and installed nodejs. Fairly easy, so I won’t focus on it here.&lt;/p&gt;

&lt;p&gt;However, for beginners, I think it is worth mentioning the folder structure.&lt;/p&gt;

&lt;p&gt;So, inside &lt;em&gt;my-app&lt;/em&gt; folder, you will have two other folders: &lt;em&gt;backend&lt;/em&gt; and &lt;em&gt;frontend&lt;/em&gt;. Each of them has their respective &lt;code&gt;package.json&lt;/code&gt; files, which have their scripts to start the server-side with node and the frontend.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F534%2F1%2AKWT45XfD8Ydkg6nMFIlTWw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F534%2F1%2AKWT45XfD8Ydkg6nMFIlTWw.png" alt="backend folder structure"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Prisma Setup
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Install the Prisma CLI
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g prisma
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Set up Prisma using Docker, in order to use Prisma locally. For this, you will create a Docker Compose file that configures Prisma and specifies the database it can connect to, in my case its a brand new Postgres db.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch docker-compose.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Paste the contents of the file below into your docker-compose.yml file.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;To launch Prisma and the connected database:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker-compose up -d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And now Prisma is connected to your local database and runs on &lt;code&gt;&lt;a href="http://localhost:4466" rel="noopener noreferrer"&gt;http://localhost:4466&lt;/a&gt;&lt;/code&gt;, which was specified in the configuration file above.&lt;/p&gt;

&lt;p&gt;You might want to access Prisma admin panel &lt;code&gt;&lt;a href="http://localhost:4466/_admin" rel="noopener noreferrer"&gt;http://localhost:4466/_admin&lt;/a&gt;&lt;/code&gt; to gain more detailed view of the responses when querying your database. You can also delete records from your database there.&lt;/p&gt;

&lt;p&gt;To find out how you can secure your Prisma server, see &lt;a href="https://www.prisma.io/docs/prisma-server/authentication-and-security-kke4/" rel="noopener noreferrer"&gt;this&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Configure your Prisma API
&lt;/h2&gt;

&lt;p&gt;To bootstrap the configuration files for your Prisma client run the following command, where &lt;code&gt;endpoint&lt;/code&gt; needs to match the URL of a running Prisma server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;prisma init --endpoint http://localhost:4466
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create the minimal setup required to deploy the Prisma datamodel: &lt;code&gt;prisma.yml&lt;/code&gt; and &lt;code&gt;datamodel.prisma&lt;/code&gt;. And it will allow you to finally deploy the Prisma API.&lt;/p&gt;

&lt;p&gt;Few things before deploying.&lt;/p&gt;

&lt;p&gt;Add the following lines to the end of your &lt;code&gt;prisma.yml&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;generate:
  - generator: graphql-schema
  output: ./generated/prisma.graphql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will generate our GraphQL schema which we will be referring to when building &lt;em&gt;queries&lt;/em&gt; and &lt;em&gt;mutations&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Now let’s deploy using the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;prisma deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point you can consider your Prisma set up done. 🎉🎉🎉&lt;/p&gt;

&lt;p&gt;In the next part, I will set up both Apollo Client and Server, as well as write my first queries and mutations.&lt;/p&gt;

</description>
      <category>prisma</category>
      <category>graphql</category>
      <category>apollo</category>
      <category>react</category>
    </item>
    <item>
      <title>TSLint -&gt; ESLint/CRA/Typescript/Prettier</title>
      <dc:creator>Sam</dc:creator>
      <pubDate>Wed, 21 Aug 2019 21:34:23 +0000</pubDate>
      <link>https://forem.com/info5am/tslint-eslint-cra-typescript-prettier-2h40</link>
      <guid>https://forem.com/info5am/tslint-eslint-cra-typescript-prettier-2h40</guid>
      <description>&lt;p&gt;If you have read my previous article and added TSLint support to your React App, at some point you will have to migrate to ESLint for the reason that TSLint is going to be deprecated (which I also mentioned in “Set Up TSLint and Prettier in VS Code for React App with Typescript”).&lt;/p&gt;

&lt;p&gt;Below I describe the steps for successful migration, along with providing file configurations to make it easier for you to jump right into using ESLint in your React App with Typescript. Enjoy!&lt;/p&gt;

&lt;h2&gt;
  
  
  package.json
&lt;/h2&gt;

&lt;p&gt;Your &lt;em&gt;package.json&lt;/em&gt; should contain at least the versions below:&lt;br&gt;
&lt;code&gt;&lt;a href="mailto:typescript@3.4.5"&gt;typescript@3.4.5&lt;/a&gt;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;react-scripts@^3.0.1&lt;/code&gt;&lt;br&gt;
&lt;code&gt;react@^16.8.6&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  script
&lt;/h3&gt;

&lt;p&gt;in your package.json specify the script:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;“lint:ts”: “eslint --ext=jsx,ts,tsx src”&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  remove everything related to TSLint (if you have any)
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;yarn remove @typescript-eslint/eslint-plugin-tslint tslint tslint-config-prettier tslint-react&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  install ESLint
&lt;/h2&gt;

&lt;p&gt;⚠️ ESLint is coming with Create-React-App, so you can skip this step.&lt;/p&gt;

&lt;p&gt;You can install ESLint using yarn or npm:&lt;br&gt;
&lt;code&gt;npm install eslint --save-dev&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn add eslint --dev&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Set up a configuration file (.eslintrc)
&lt;/h2&gt;

&lt;p&gt;You should then set up a configuration file:&lt;br&gt;
&lt;code&gt;$ ./node_modules/.bin/eslint --init&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You will have to go through prompt and choose what will go into the auto-generated &lt;strong&gt;.eslintrc.js&lt;/strong&gt; file.&lt;/p&gt;

&lt;p&gt;for more details check this link: &lt;a href="https://eslint.org/docs/user-guide/configuring?source=post_page-----4befb4918ba8----------------------"&gt;Configuring ESLint&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Of course, you will still have to customize this file if you want to have typescript, react and prettier support.&lt;/p&gt;
&lt;h2&gt;
  
  
  .eslintrc.js
&lt;/h2&gt;

&lt;p&gt;So, this is pretty much the main config file. It contains the information about which configs, plugins for linting you are using. You can tweak the recommended rules from here as well.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  .eslintignore
&lt;/h2&gt;

&lt;p&gt;If you don’t want to lint certain files, then at the root level of your application’s folder structure you can add a .eslintignore file, where you can list any files that should be ignored.&lt;br&gt;
For example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;src/serviceWorker.ts&lt;/code&gt;&lt;br&gt;
&lt;code&gt;src/tests/&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  eslint with React
&lt;/h2&gt;

&lt;p&gt;And to support React-related rules you can install eslint-plugin-react, you can find the list of all rules &lt;a href="https://www.npmjs.com/package/eslint-plugin-react?source=post_page-----4befb4918ba8----------------------"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;install the plugin:
&lt;code&gt;npm install eslint-plugin-react --save-dev&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;yarn add eslint-plugin-react --dev&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the presets to get reasonable defaults:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;"extends": [&lt;br&gt;
  "eslint:recommended",&lt;br&gt;
  "plugin:react/recommended"&lt;br&gt;
]&lt;/p&gt;

&lt;p&gt;On top of that you can add a plugin to lint react hooks:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.npmjs.com/package/eslint-plugin-react-hooks?source=post_page-----4befb4918ba8----------------------"&gt;eslint-plugin-react-hooks&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;install:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;npm install eslint-plugin-react-hooks --save-dev&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn add eslint-plugin-react-hooks --dev&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;enable your react-hooks plugin in &lt;em&gt;.eslintrc.js&lt;/em&gt;:&lt;br&gt;
&lt;code&gt;"plugins": ["@typescript-eslint", &lt;strong&gt;"react-hooks"&lt;/strong&gt;]&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;the rules that it activates:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;"rules": {&lt;br&gt;
  // ...&lt;br&gt;
  "react-hooks/rules-of-hooks": "error",&lt;br&gt;
  "react-hooks/exhaustive-deps": "warn"&lt;br&gt;
}&lt;/p&gt;
&lt;h2&gt;
  
  
  setting up ESLint to work with TypeScript
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/typescript-eslint/typescript-eslint?source=post_page-----4befb4918ba8----------------------#why-does-this-project-exist"&gt;Why typescript-eslint?&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that you already have eslint and you would like to extends its capabilities to typescript, install the following to the dev dependencies:&lt;br&gt;
&lt;code&gt;yarn add @typescript-eslint/parser @typescript-eslint/eslint-plugin --dev&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm i @typescript-eslint/parser @typescript-eslint/eslint-plugin --save-dev&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.npmjs.com/package/@typescript-eslint/parser?source=post_page-----4befb4918ba8----------------------"&gt;@typescript-eslint/parser&lt;/a&gt;: eslint-specific parser that understands typescript AST format&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/typescript-eslint/typescript-eslint?source=post_page-----4befb4918ba8----------------------#how-do-i-configure-my-project-to-use-typescript-eslint"&gt;How do I configure my project to use typescript-eslint?&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.npmjs.com/package/@typescript-eslint/eslint-plugin?source=post_page-----4befb4918ba8----------------------"&gt;@typescript-eslint/eslint-plugin&lt;/a&gt;: provides a good dose of typescript-specific eslint rules&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  tsconfig.json
&lt;/h2&gt;

&lt;p&gt;This file contains essential typescript rules like &lt;em&gt;noImplicitAny&lt;/em&gt;, etc.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  prettier
&lt;/h2&gt;

&lt;p&gt;Now that you have your eslint-typescript symbiosis you might want to enforce the auto-fixing of code formatting.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn add prettier eslint-config-prettier eslint-plugin-prettier --dev&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;prettier&lt;/strong&gt;: the core prettier library&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/prettier/eslint-config-prettier?source=post_page-----4befb4918ba8----------------------"&gt;eslint-config-prettier&lt;/a&gt;: disables eslint rules that might conflict with prettier&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;in your &lt;em&gt;.eslintrc.js&lt;/em&gt;:&lt;br&gt;
{&lt;br&gt;
  “extends”: [“plugin:prettier/recommended”]&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;This will enable &lt;strong&gt;eslint-plugin-prettier&lt;/strong&gt;, set &lt;strong&gt;prettier/prettier&lt;/strong&gt; rule to &lt;strong&gt;“error”&lt;/strong&gt;, and extend the &lt;strong&gt;eslint-config-prettier&lt;/strong&gt; configuration.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.npmjs.com/package/eslint-plugin-prettier?source=post_page-----4befb4918ba8----------------------"&gt;eslint-plugin-prettier&lt;/a&gt;: runs prettier as an eslint rule&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I specified my prettier rules inside .eslintrc.js file above and it works for me to have all the different sorts of rules in one place. However, it is also possible to have them in a separate .prettierrc file if you’d like.&lt;br&gt;
The whole list of prettier’s code formatting options can be found &lt;a href="https://prettier.io/docs/en/options.html?source=post_page-----4befb4918ba8----------------------"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, in my .eslitrc.js file on line 17 I have commented out “plugin:prettier/recommended”, which fully enables prettier plugin, and remember that it is very opinionated, and might conflict with your eslint rules.&lt;/p&gt;
&lt;h2&gt;
  
  
  prettier and VSCode
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;download and install vscode prettier extension from &lt;a href="https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode&amp;amp;source=post_page-----4befb4918ba8----------------------"&gt;here&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;open VSCode, hit ‘⇧⌘P’ to open the Command Palette… and type in ‘Preferences: Open Settings (JSON)’ and enable eslint auto-fixing like below on line 25–36:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;To fix your lint errors run this command:&lt;br&gt;
&lt;code&gt;npm run lint:ts --fix&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn run lint:ts --fix&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That’s all Folks! ☕️&lt;/p&gt;

</description>
      <category>eslint</category>
      <category>react</category>
      <category>typescript</category>
      <category>prettier</category>
    </item>
  </channel>
</rss>
