Pup

v2.x

ExtrasESLint

In order to help keep code formatting consistent, Pup utilizes the ESLint library. This tool is designed to run via your IDE/text editor or the command line. "Linting" occurs by evaluating your project's source code against a set of rules that suggest how your code should be written.

While there's on "one true" set of rules, Pup prefers to use the popular AirBnB JavaScript Style Guide. It's a well-maintained set of rules used by a major company which ensures that your own code will be well-aligned with a large subset of the development community.

Pup also utilizes the Prettier code formatter. While not a linter, Prettier works in conjunction with ESLint by automatically formatting the syntax (how the actual code is written) to automatically map to an opinionated standard.

In addition to these two tools, Pup also includes a handful of "plugins" for ESLint which add rules particular to some of the technology used in Pup like Meteor, React, Jest, and TestCafe.

Linting is a broad topic. What's most important to understand is that it's designed to help you not hurt you. It's goal is to ensure that your code stays consistent throughout your project. As your project grows in size, this becomes more and more valuable.

When you're working with Pup, it's highly recommended that you install the ESLint plugin for your IDE/text editor of choice. For example, this VSCode package in conjunction with this VSCode package are used during the development of Pup.

If you'd like to customize any of the rules, Pup stores this in the package.json file stored at the root of the project. The rules are located within the eslintConfig object in this file.

Husky

To aid in the process of linting your code beyond your text editor, Pup includes a pre-commit hook (a command that's run before your code is finally committed via the Git version control system) via the library Husky. This ensures that no code is committed to your project with linting errors present.

This can be tedious but it guarantees that the quality of your code always remains consistent (a good thing!).

If you'd like to configure Husky or disable it, you can locate its settings in the package.json file at the root of the project in the husky object.