Skip to content
This repository has been archived by the owner on Aug 3, 2018. It is now read-only.

trussle/eslint-config-trussle

Repository files navigation

ESLint Configuration for Trussle

npm version

This repository collects a bunch of standard ESLint files for Trussle repositories.

Usage

Add the package to your devDependencies:

npm install --save-dev eslint-config-trussle

Next, create a file .eslintrc.js in the root directory of your project pointing to the coding standard:

module.exports = {
  extends: "trussle",

  // You will need to set up an environment:
  // see http://eslint.org/docs/user-guide/configuring#specifying-environments
  // for more information.
  env: {
    // node: true,
    // mocha: true,
    // browser: true,
    // jasmine: true,
  }
};

ESLint allows nested configuration, allowing you to choose different configurations for your tests, server-side and client-side code. Check out their website for documentation.

Migrating Older Code

For older (ES5) code, try the following:

  • Install eslint-config-trussle.
  • Fix any indentation issues you have with some editor-fu.
  • Run the auto-fixer with eslint --fix .
  • Fix the rest of the violations manually, either by fixing the issue or adding a special rule to your project.

Changing the Rules

  • Have a good reason for changing the rule, and write it as a comment near the rule in .eslint.js.
  • Bump the version number:
    • 0.0.0 => 1.0.1 for rule configuration changes.
    • 0.0.x => 0.1.x for added or removed rules.
    • 0.x.x => 1.x.x for major changes (new ESLint version, etc.).
  • Commit, push, and update the package in the project you're working on.