Skip to content

AuroraDigital/eslint-config-aurora

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eslint-config-aurora

JavaScript Style Guide

Standard JavaScript, but with opinionated changes.

Changed rules

Rule Old New Why
space-before-function-paren ['error', 'always'] ['error', {'anonymous': 'always', 'named': 'never', 'asyncArrow': 'always' }] Spacing before named function parenthesis is just unusual.

Changes the function parenthesis spacing rule to disallow spaces for named functions but continue to require them for anonymous and asyncArrow functions.

function name(arg) { ... } // ✓ ok now, previously forced a space

Rule Old New Why
comma-dangle ['error', 'never'] ['warn', 'always-multiline'] Trailing commas allow for quicker additions to lists from cold starts.

Changes the dangling comma rule to be a warning instead of an error and expect them on the last element or property which is on a different line of comma separated values.

var obj = {
  message: 'hello', // ✓ ok now, previously an error
}

Usage

Simple

The easiest way to get started, built upon standardx.

Install:

yarn add --dev eslint-config-aurora standardx

or

npm install --save-dev eslint-config-aurora standardx

Create or edit eslintrc.json:

{
  "extends": "aurora"
}

Flexible

The more powerful way to get started, allows for custom configurations.

Install:

yarn add --dev \
  eslint-config-aurora \
  eslint-config-standard \
  eslint-plugin-import \
  eslint-plugin-node \
  eslint-plugin-promise \
  eslint-plugin-standard

or

npm install --save-dev \
  eslint-config-aurora \
  eslint-config-standard \
  eslint-plugin-import \
  eslint-plugin-node \
  eslint-plugin-promise \
  eslint-plugin-standard

Create or edit eslintrc.json:

{
  "extends": ["standard", "aurora"]
}

Note: "aurora" must come after "standard" in order to override the rules of eslint-config-standard.

ESLint + Prettier

This ESLint config is designed to work alongside our shareable Prettier config: @auroradigital/prettier-config.