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.

Read More

Easier Excerpts 1.5.0

Just shy of two years ago (almost to the day, even), I first released Easier Excerpts for WordPress. It was, and still is, one of those plugins that I built for myself and ultimately decided to release for others to use.

It’s small and serves a very small improvement to the excerpt field in the post editor, but it’s something that I still use every day.

But over time, WordPress changes and improves, one’s ability to write code and build their tools changes. And that’s a lot of what went into this particular version.

Read More

Developing Plugins and Themes Against WordPress Trunk

When developing plugins or themes for WordPress, one of the strategies that I often recommend is doing so against trunk (or the current snapshot of the code) of WordPress.

For those who are more experienced developers, you’re already on the up-and-up on the lingo and the caveats that come with doing this. But if you’re someone who is looking for ways to better their development practices, then perhaps this will help.

Remember that because WordPress is open source software, you can view the source code on the web at anytime.

Developing Against WordPress Trunk: trunk

Not only that, but you can download it to your local computer and work with it, as well. This will require certain pieces of software, and I’ll get into that momentarily; however, the ultimate purpose of this post is to talk about:

  • how to work with the current snapshot of code with WordPress,
  • how and why it may be beneficial to use this codebase when working on projects for others.

As stated above, there are caveats for doing this, and sometimes it’s a good idea to use the latest stable version of the codebase. And I’ll address that later in the article, as well.

Read More

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.

Read More

Scheduled Post Shortcut 1.5.0

I first released Scheduled Post Shortcut for WordPress almost two years ago (officially, it’ll be two years ago this June but who’s counting, right? 🙂).

It’s one of those really simple plugins that works well for those who schedule content far out and want to easily see how many posts are in their backlog, but not much else.

Scheduled Post Shortcut 1.5.0

In short, it’s a plugin designed for people who blog regularly and frequently.

Anyway, I had a notice on the project page in the WordPress Plugin Repository that the plugin had not been tested against the lastest version of WordPress.

So while making sure it was compatible against WordPress 4.9.4, I also brought it up to date with some other standards.

Read More