Skip to content

A sharable ESLint config file that enforces Hack Reactor's style guide

Notifications You must be signed in to change notification settings

reactorcore/eslint-config-hackreactor

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

Enforcing Hack Reactor's Style Guide

This is an installable ESLint configuration file that enforces Hack Reactor's style guide.

ESLint is a tool for identifying and reporting on patterns found in JavaScript code, with the goal of making code more consistent and avoiding bugs. It's an invaluable tool when working with other engineers.

System Requirements

A working version of Node.js

Installation

Install ESLint globally by running the following command in your terminal:

npm install -g eslint

Install the Hack Reactor style guide configuration:

npm install -g reactorcore/eslint-config-hackreactor

Enforce the style guide in a project

Create an .eslintrc.js file in the root directory of your repository:

module.exports = {
  extends: 'hackreactor',
  rules: {
    // Rules here will override the 'hackreactor' configuration
    // http://eslint.org/docs/rules/
  }
};

Now, you can run ESLint from the command line:

eslint [options] [file|dir|glob]*

For example:

eslint someFile.js someOtherFile.js
eslint client/**

If you don't see any output, your files have passed all the linting rules. In addition to the command line interface, ESLint can be integrated into various build systems like Gulp, Grunt, or a pre-commit hook.

Enforce the style guide in Sublime Text

By downloading and configuring a couple of plugins for Sublime Text, you can receive live feedback about your code's syntax and style, much like spelling errors in a word document. This is a very useful practice to build muscle memory around good style habits.

Install SublimeLinter

The easiest way to download plugins for Sublime Text is through Package Control. With Package Control, you can install SublimeLinter and its ESLint plugin from the Command Palette (cmd + shift + p):

  • Package Control: Install Package -> SublimeLinter
  • Package Control: Install Package -> SublimeLinter-contrib-eslint

Configure SublimeLinter

Without any configuration, SublimeLinter will only enforce rules from a .eslintrc file. If no .eslintrc file exists among the open files, SublimeLinter will fall back to the default behavior the eslint command, and only enforce syntax errors.

You can configure SublimeLinter to enforce the Hack Reactor style guide on files/projects without an .eslintrc file.

Navigate to Preferences -> Package Settings -> SublimeLinter -> Settings - User and update the linters section to the following:

"eslint": {
  "@disable": false,
  "args": [
    "--config",
    "hackreactor"
  ],
  "excludes": []
}

About

A sharable ESLint config file that enforces Hack Reactor's style guide

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%