Skip to content

ESLint configs used in Leocode's projects.

License

Notifications You must be signed in to change notification settings

leocode/eslint-config

Repository files navigation

LEOCODE's ESLint config

Installation

  1. Install all peer dependencies. You can use your favourite tool or just type:
For React:

yarn add --dev eslint@8 @typescript-eslint/eslint-plugin@5 @typescript-eslint/parser@5 [email protected] [email protected] typescript@4

For Node:

yarn add --dev eslint@8 @typescript-eslint/eslint-plugin@5 @typescript-eslint/parser@5 typescript@4
  1. Install package with configuration:
yarn add --dev @leocode/eslint-config

Usage

For node put this in .eslintrc.js file:

module.exports = {
  extends: ['@leocode/eslint-config/node'],
};

For React put this in .eslintrc.js file:

module.exports = {
  extends: ['@leocode/eslint-config/react'],
};

Known issues

If ESLint doesn't work by default in your editor (it cannot find tsconfig.json file), you may need to specify in .eslintrc.js:

module.exports = {
  extends: ['@leocode/eslint-config/node'],
  parserOptions: {
    tsconfigRootDir: __dirname, // or any other directory relative to `.eslintrc.js` file
  },
};

License

MIT