Software, Development, and WordPress

Tag: Visual Studio Code (Page 1 of 3)

Setting Up PHP CodeSniffer Per Project

A few years ago, I wrote a post about Setting Up PHP CodeSniffer in Visual Studio Code (and I’ve recently updated it, too).

But it’s been four years since that post was originally written and, in that time, a lot can change in terms of how we write code.

Four years is roughly an Internet Age, isn’t it?

Anyway, the basic points of that article still stand, but if you’re working on a variety of projects and some of them require different configurations, settings, and standards, then the way you go about installing and configuring PHP CodeSniffer may be different than how you configure it on a system-level.

So if you’re in that position, here’s how you can configure PHP CodeSniffer on a per project basis using Visual Studio Code.

Continue reading

Code Quality Per Language Settings in Visual Studio Code

In previous posts, I’ve talked a bit about Visual Studio Code, and though I’ve tried a variety of other editors, I keep coming back to this particular IDE.

An IDE For WordPresss Development: Visual Studio Code

Over time, it’s matured quite a bit, continues to do so, and allows plenty of customization especially for those of us working in PHP, Sass, JavaScript, and, more generally speaking, WordPress.

If you use any linters, though, you’ll find that one of the things each will talk about is the amount of whitespace that should exist before a given line of code.

So if you’re using Visual Studio Code, these are the extensions and the settings I recommend for making sure your code is up to par with whatever code quality tools you’re using.

Continue reading

How To Set Up JavaScript linting in Visual Studio Code

I’m obviously a big fan of using coding standards whenever you’re writing server-side code (regardless of it being WordPress, PSR2, or whatever else – as long as you’re using something, I think it’s a good thing).

But when it comes to writing client-side code, namely JavaScript for this post, we don’t see it discussed as much though I think of it as being as equally important. Same goes for CSS, Sass, or LESS, but that’s content for another post.

For recent projects, we’ve been using Airbnb JavaScript Style guide for our projects. I’m a fan and think it helps to write clean, readable JavaScript (that looks as if it’s been written by the same person – the ultimate goal of coding standards, right?).

JavaScript linting in Visual Studio Code: Airbnb Styleguide

In this post, I’ll walk through the process of getting it setup in Visual Studio Code.

Continue reading

Installing PHPUnit in Visual Studio Code

Once you’ve got the PHP Coding Standards set up in Visual Studio Code, I think it’s also important to make sure that you have PHPUnit installed so that you get in the practice of writing testable code.

If you wait to start doing this until after you’ve started a project, you’re far less likely to start doing it. I’m saying this both from experience and from working with other developers.

So before I start covering how to handle front-end linting and things like that, I want to walk through the process of setting up PHPUnit. If you’ve not yet read how we’re managing packages or how we’re using Visual Studio Code, I recommend catching up by reading the following articles:

  1. A WordPress Development Environment (Using a Package Manager)
  2. An IDE for WordPress Development
  3. Working with User Settings in Visual Studio Code

Once you’re caught up, head back to this post.

Continue reading

Using PHP Coding Standards in Visual Studio Code

So we’ve got the basics set up in Visual Studio Code set up, but we don’t have any practical tools installed to help us with more of the professional side of writing code.

Of course, “professional” can be defined based on the company, team, or environment in which you’re working. For this series, I’ve opted to go with WordPress as the foundation. But that still leaves things such as:

  • coding standards,
  • JavaScript linting,
  • package management,
  • And so on.

And throughout the series, I’m going to cover everything listed above. But to do so, I’m going to cover each component one-by-one.

Today’s post is going to focus on the PHP coding standards. I’ve written plenty of material regarding the WordPress Coding Standards, but in the last year or more, I’ve begun to work more with PSR, and so that’s what will be covered in this post.

As a side note, know that much of what is covered can be translated to the WordPress Coding Standards should you so choose, and it’s going to be clear as to where you’d make the changes.

With that said, let’s get started.

Continue reading

« Older posts

© 2021 Tom McFarlin

Theme by Anders NorenUp ↑