Welcome to the wonderful world of linters and code formatters

Hi there! My name is Natanael Sinisalo. I’m the guy behind this whole WPastronaut website and also the one who is typing these words you’re currently reading. Happy to see you here and excited to help you out with this course.

Let’s get straight started, shall we? 🙂

2019 was the year when developers (at least in the JavaScript community) realized the power and the luxury of using tools to format code automatically for you.

Having Code formatters around isn’t that new thing actually. There has been many code formatters for different programming languages around for years at this point. Even some IDEs (such as PhpStorm) has been having a built-in code formatter for a long time. Yet they only started to get really widespread use after Prettier took the JavaScript community by a storm.

I think there are are multiple reasons on why it took so long to people start using code formatters:

  1. It was really time consuming to configure them to make the output please every individuals pre-existing preferences and habits
  2. The edge cases where code just formats weirdly can be so frustrating that you’d rather disable them
  3. Eventually refusing to use them after disabling them

Prettier changed all that. It’s an opinionated code formatter that you can pretty much install and forget. And it works really well.

When I first started to use Prettier for my JavaScript files I wasn’t quite sure if I liked it or not. I had my own preferences for formatting code for so many years and the output of Prettier was quite different from what I was used to.

After a few days of using Prettier I didn’t only accept that it was now in charge of formatting my code, but I was really hooked for not having to format my JavaScript/SCSS manually. It also changed the way I write code. Now I can just write my code in one line and Prettier handles everything for me automatically.

So I started my journey to create a setup that would format most of my WordPress related code automatically and tries to fix any errors spotted by linters while at it.

An overview of this course

In this Intro section you’ll going to learn more about linters and code formatters, so instead of just randomly installing something on your computer you’ll understand better how they work and the reasoning behind the tools we’re going to use. That also makes it easier for you to debug this setup in the future when problems arise.

In The base setup section I’ll help you to install and configure all the necessary tools.

Lastly there are multiple sections on how to configure different code editors to use the tools installed in The basic setup. Just go through the section(s) relevant to your preferred code editor(s).

After going through this course you should be having a working linter and code formatting setup that can also be used in a team of multiple developers.

That’s pretty much about this introduction. I hope you enjoy this course and please leave a comment (there is a comment section under each lesson) if you have any questions or you spot any errors. I’m here to help you.