Skip to content

werkzeugkiste/eslint-config

Repository files navigation

@werkzeugkiste/eslint-config

A shared ESLint config for @werkzeugkiste. Rules are carefully selected to be as restrictive as necessary but no more. This config aims to reduce bugs and cause as much consistency as possible in a codebase while keeping the code readable even for not-so-experienced developers.

Installation

Get started by running this command in the root of your project:

yarn add --dev eslint @werkzeugkiste/eslint-config
npm install --save-dev eslint @werkzeugkiste/eslint-config

Afterwards install all peerDependencies into your project:

npx install-peerdeps --dev @werkzeugkiste/eslint-config

Usage

If you want to use this config as base in any of your projects you need to create a .eslintrc.json file that extends this config. If you do not have an ESLint config yet, the easiest way is to do that automatically by running the following command in the root folder of your project (where your package.json is):

# create .eslintrc.json config file:
npx @werkzeugkiste/eslint-config

This command creates a new .eslintrc.json file for you and adds linting for JavaScript, React/JSX, Node and TypeScript.

If you already have an ESLint config or if you prefer the manual way, add the following content to your config file:

{
  "extends": ["@werkzeugkiste"]
}

Optionally you can also add linting for React/JSX:

{
  "extends": ["@werkzeugkiste", "@werkzeugkiste/eslint-config/react"]
}

Add linting for Node.js:

{
  "extends": ["@werkzeugkiste", "@werkzeugkiste/eslint-config/node"]
}

If you want to use TypeScript, that's fine:

{
  "extends": ["@werkzeugkiste", "@werkzeugkiste/eslint-config/typescript"]
}

Or use them all at once:

{
  "extends": [
    "@werkzeugkiste",
    "@werkzeugkiste/eslint-config/react",
    "@werkzeugkiste/eslint-config/node",
    "@werkzeugkiste/eslint-config/typescript"
  ]
}

For more information see: http://eslint.org/docs/user-guide/configuring