<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kapolcs Nagy on Medium]]></title>
        <description><![CDATA[Stories by Kapolcs Nagy on Medium]]></description>
        <link>https://medium.com/@KapolcsN?source=rss-1a828a0a1f28------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*YPIPFqwRNauvXtqWobjVAg.jpeg</url>
            <title>Stories by Kapolcs Nagy on Medium</title>
            <link>https://medium.com/@KapolcsN?source=rss-1a828a0a1f28------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 00:35:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@KapolcsN/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to setup ESLint, Prettier, and Babel for your React project]]></title>
            <link>https://medium.com/c-hive/how-to-setup-eslint-prettier-and-babel-for-your-react-project-1f5e15a56b7b?source=rss-1a828a0a1f28------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f5e15a56b7b</guid>
            <category><![CDATA[eslint]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[prettier]]></category>
            <category><![CDATA[babel]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Kapolcs Nagy]]></dc:creator>
            <pubDate>Tue, 17 Dec 2019 15:04:51 GMT</pubDate>
            <atom:updated>2019-12-23T23:42:39.229Z</atom:updated>
            <content:encoded><![CDATA[<p>Building high-quality apps these days is hard.</p><p>That’s why nowadays, there are many tools that allow us to write quality code and make sure our apps don’t break. You may think of testing tools like <a href="https://jestjs.io/">Jest</a> at first, but before even writing a test, you can prevent many head-scratching situations.</p><p>In this article, we will overview the process, how I set up these tools for a React project. First of all, you need to install Prettier.</p><h3>Prettier</h3><p>For using this tool you need to install Prettier:</p><pre>npm install -D prettier</pre><p>Now you have Prettier installed and from now with a little config, your code will be always consistent. I’m sure many of you were work on projects where some files have tabs, some spaces, or have a trailing comma and others don’t…</p><p>Prettier is a project which takes all the conversation out of context and it standardizes to a predefined style. So everyone will be on the same format.</p><p>I actually, really don’t care about how is my code looks like as long as it’s well-formatted and consistent. The great thing Prettier does this for us.</p><h4>Configurate Prettier</h4><p>You can run from the command line as an npm script:</p><pre>&quot;scripts&quot;: {<br>    &quot;format&quot;: &quot;prettier \&quot;src/**/*.{js,html}\&quot; --write&quot;,clicks&#39;))<br>}</pre><p>Or install the <a href="https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode">plugin</a> and just add to your vscode config this two lines (without my comments):</p><pre>“editor.formatOnSave”: true, <em>// enable a formatter to format on save</em><br>“prettier.requireConfig”: true,    <em>// prettier only run if installed</em></pre><p>And create a file in the project root directory named <em>.prettierrc</em> with an empty object {} in it (it means you will use the default settings).</p><p>And that’s it Prettier is installed in your project. And now if you press ctr+s Prettier will run so you can focus more on your code.</p><p>Now we need another tool called linter. It is different from Prettier because Prettier is very mechanical, like how is this file formatted, or where should I put return, etc. but it doesn’t care about what the code actually does. This is the linter’s task.</p><h3>Bare minimum ESLint config</h3><p>Now install ESLint which is a code linter:</p><pre>npm install -D eslint eslint-config-prettier</pre><p>We need the <em>eslint-config-prettier</em> package too, because there is an overlap between Prettier and ESLint, and we need to tell ESLint to leave the mechanical part to Prettier.</p><p>Create .eslintrc.json config file in the project root:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/688f591978abca236cbb901e828af6dc/href">https://medium.com/media/688f591978abca236cbb901e828af6dc/href</a></iframe><p>(I leave a comment every line ends where I think need some guidance.)</p><p>The most important part is the <a href="https://eslint.org/docs/rules/"><em>eslint:recommended</em></a> which is the bare minimum. Everything in <em>eslint:recommended</em> what is recommended for everyone to run all the time. We can use other rule sets such as <a href="https://www.npmjs.com/package/eslint-config-airbnb"><em>airbnb</em></a>, but it will force us to write code in a specific way, so that is more opinionated.</p><p>If you want to see ESLint hints on hover, just install this <a href="https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint">vscode eslint plugin</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ckWxE4b3zxi1bgZoJFFxOw.jpeg" /></figure><h3>ESLint, Babel config for almost every React project</h3><p>The previous was the basic standard setup for ESLint, but we need to go further to make sure ESLint understands React correctly. For that, we need to install a few other tools:</p><pre>npm i -D babel-eslint eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react</pre><p><em>babel-eslint</em>: the babel compiler out the box doesn’t understand React super well, that’s why we install this plugin</p><p><em>eslint-plugin-import</em>: give new rules for importing, and exporting things, just to have a good habit about that kind of stuff</p><p><em>eslint-plugin-jsx-a11y</em>: this will help with no brainer things for accessibility (like don’t make div clickable, etc.)</p><p><em>eslint-plugin-react</em>: help us some additional React rules we need</p><p>And change the .eslintrc.json to the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b05d722db0b6ed0056d28fb91ba951ae/href">https://medium.com/media/b05d722db0b6ed0056d28fb91ba951ae/href</a></iframe><p>At this point, we could tell this is the ESLint config for almost every React project needs. And don’t forget, the most important you don’t question anything what is in <em>eslint:recommended </em>because everything it said pretty standard rules in JS community.</p><p><a href="https://github.com/nkapolcs/eslint-config-for-react">nkapolcs/eslint-config-for-react</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f5e15a56b7b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/c-hive/how-to-setup-eslint-prettier-and-babel-for-your-react-project-1f5e15a56b7b">How to setup ESLint, Prettier, and Babel for your React project</a> was originally published in <a href="https://medium.com/c-hive">C-Hive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>