JavaScript Auto Linting in VSCode

Get rid of ugly JS Code while developing!

XOR
XOR
May 12 · 2 min read
Photo by Caspar Camille Rubin on Unsplash

Writing code and keeping on eye on code formatting is kind of tremendous job.

This writing will help JavaScript developer to focus on writhing and thinking logic not on styling while developing software.


Note: Recommended to have eslint installed on your VSCode.

Setup

Now create your .eslintrc file

Tell them why you need lint?

Now this will create something like this in your project

.eslintrc.js

Manual Linting

Linting in Action in my App.js File

Now hit cmd+shift+P and it will open this

Hit Fix all Auto-Fixable problem

Now my file looks like this. Much Better.

my App.js File

Auto Linting

Now I want this to be done when i hit CTRL + S

Paste below in setting.json

File > Preferences > Settings > Workplace then Code Actions On Save

Now ESLint is ready for action. Just write and save Code. Linting will be done right away.


Thanks for reading. 🍻

JavaScript In Plain English

New articles every day.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store