eslint configuration for the de-tooling team
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.circleci
test
.gitignore
README.md
common.js
index.js
package-lock.json
package.json
react.js
test.js

README.md

eslint-config-de-tooling

This is an ESLint configuration which aims to ensure all de-tooling applications' source code is consistent in style.

This plugin extends airbnb's base config along with extra rules provided by eslint-plugin-unicorn.

Usage

Install this package together with your application:

npm install --save-dev @financial-times/eslint-config-de-tooling

It's recommended to avoid global installs where possible, as eslint in particular can be volatile with dependency locations.

Extend the config using an eslint config file. For example in an .eslintrc.js file:

{
    "extends": [
        "@financial-times/de-tooling"
    ],
    "rules": {
        // Override any settings from the "parent" extended configuration
    }
}

Mocha config

A mocha config is provided which can be used to extend the base config:

{
    "extends": [
        "@financial-times/de-tooling",
        "@financial-times/de-tooling/test"
    ],
    "rules": {
        // Override any settings from the "parent" extended configuration
    }
}

This config adds mocha and sinon globals and additional rules for mocha based tests.

React/JSX config

A jsx config is provided which replaces the base config, based on the full airbnb config:

{
    "extends": [
        "@financial-times/de-tooling/react"
    ],
    "rules": {
        // Override any settings from the "parent" extended configuration
    }
}

Dependencies

This package requires certain dependencies as peerDependencies. This is a decision consistent with eslint (see https://github.com/eslint/eslint/issues/2518, https://github.com/eslint/eslint/issues/3458). This means they should be installed wherever this package is consumed, with matching version ranges:

It's possible to automatically install these by adapting the steps from eslint-config-airbnb-base, e.g. for Linux/OSX:

(
  export PKG=@financial-times/eslint-config-de-tooling;
  npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "$PKG@latest"
)