ESLint config to be used in some of our projects, that includes recommended rules of the following plugins:


License
MIT
Install
npm install @ailo/eslint-config@5.4.6

Documentation

Introduction

ESLint config to be used in some of our projects, that includes recommended rules of the following plugins:

  • eslint-config-airbnb / eslint-config-airbnb-base / eslint-config-airbnb-typescript
  • eslint-plugin-react
  • eslint-plugin-react-hooks
  • eslint-plugin-jsx-a11y
  • eslint-config-prettier
  • eslint-import-resolver-typescript
  • eslint-plugin-import
  • eslint-plugin-jest
  • eslint-plugin-promise
  • eslint-plugin-unicorn

With some slight modifications to some of the defaults on our side.

Usage

  1. Setup eslint as you would normally do.

  2. yarn add -D @ailo/eslint-config eslint @typescript-eslint/parser prettier

  3. Extend the config as in the following example:

    Node.js service:

    // .eslintrc.js
    module.exports = {
      parser: "@typescript-eslint/parser",
      parserOptions: {
        project: ["./tsconfig.json"],
      },
      extends: [require.resolve("@ailo/eslint-config/configs/ts-node")],
    };

    Node.js service without TS:

    // .eslintrc.js
    module.exports = {
      parser: "babel-eslint",
      extends: [require.resolve("@ailo/eslint-config/configs/node")],
    };

    Front-end React app:

    // .eslintrc.js
    module.exports = {
      parser: "@typescript-eslint/parser",
      parserOptions: {
        project: ["./tsconfig.json"],
      },
      extends: [require.resolve("@ailo/eslint-config/configs/ts-react")],
    };

    Cypress:

    // .eslintrc.js
    module.exports = {
      parser: "@typescript-eslint/parser",
      parserOptions: {
        project: ["./tsconfig.json"],
      },
      extends: [require.resolve("@ailo/eslint-config/configs/ts-cypress")],
    };

    Replace ts-node with other name of another config file if your environment differs.

Adding it to existing codebase

If your codebase is large and introducing this config makes eslint yell with hundreds of errors, you might find following advices to be useful:

Releasing

yarn release