Skip to content

5im0n/eslint-config-pouloum

Repository files navigation

eslint-config-pouloum

npm GitHub license peerDependency Status Travis Code Climate

A set of configurable ESLint configurations for meticulous people. Inspire by Meetic configuration

Installation

You have to install ESLint first and the configuration package

$ npm install --save-dev eslint eslint-config-pouloum

Install it globally if you want to use this configuration from command-line.

$ npm i -g eslint eslint-config-pouloum

If you use ESLint v2.X please install the last configuration that suits the previous major version

$ npm i -g eslint eslint-config-pouloum@2.2.0

Usage

This set of configs is meant to be extended on a per-project basis as necessary using ESLint's shareable configs.

  • Add the extends attribute to your .eslintrc
{
  "extends": "pouloum"
}
  • Or to the eslintConfig field of the package.json of your project
{
  "name": "your-project-name",
  "eslintConfig": {
    "extends": "pouloum"
  }
}

  • You can also use it from command line
$ eslint -c pouloum *.js

Override

If the default configurations does not suit you, you can easily override it. Consult the ESLint documentation for more information about extending configuration files.

{
  "extends": "pouloum",
  // Override rule comes heres
  "rules": {
    "no-magic-numbers": 0
  }
}

Available configurations

This package includes the following configurations:

Standalone

ES6 (default)

If your project is written in ECMAScript-6, you can extend with the ES6 subset of configuration.

  • extends the ES5 configuration
  • set sourceType to module
  • add rules related to ES6 (arrowFunctions, classes...)
  • enable all ecmaFeatures expect jsx
  • overrides some rules (no-underscore-dangle...)
{
  "extends": [
    "pouloum/configurations/es6"
  ]
}

ES5

This is a collection of rules regarding possible errors, best practices, strict mode, variables and stylistic issues.

This configuration enforces neither env nor globals settings. You may have to set individually on your project

{
  "extends": "pouloum"
}

Extended

Extended configurations can't be used on its own.

Browser

  • add the browser environment
  • overrides some rules (no-console...)
{
  "extends": [
    "pouloum",
    "pouloum/configurations/browser"
  ]
}

Server

  • adds rules related to Node.js (no-mixed-requires, no-process-exit...)
  • add the node environment
  • overrides some rules (no-console, ...)
{
  "extends": [
    "pouloum/configurations/es6",
    "pouloum/configurations/server"
  ]
}

Angular

This configuration is base on the ESLint angular plugin therefore you have to install it before using this configuration:

$ npm install --save-dev eslint-plugin-angular
  • collection of rules regarding possible errors, best practices, naming, deprecated features, conventions and wrappers
  • extends the browser configuration
{
  "extends": [
    "pouloum",
    "pouloum/configurations/angular"
  ]
}

License

The MIT License (MIT)