Eslint Config Custom

@natu/eslint-config-custom

💻 Custom ESlint configuration

ESlint (opens in a new tab) and Prettier (opens in a new tab) are tools that analyzes your code and helps you to keep it clean, consistent, and error-free. This package is used as one source of truth for default ESlint configuration.

This package includes:

  • ESlint configuration in eslint-next.js file,
  • ordering imports schema in order-imports.js file.

It can be extended if needed for particular package or app purposes. Extended config will inherit all the traits of this package's configuration (ex. rules, plugins, and language options) and add or modify some of the options.

🤓 Usage

To use this package in other package or app you need to import it as dev dependency in its individual package.json file:

[your-workspace]/package.json
"devDependencies": {
    "eslint-config-custom": "*",
}

Then include it in its individual .eslintrc file as the extended config:

[your-workspace]/.eslintrc.js
module.exports = {
  parserOptions: {
    tsconfigRootDir: __dirname,
    project: './tsconfig.json',
  },
  extends: ['eslint-config-custom/eslint-next.js'],
};

Add global custom rules

If you need to extend global options this ESlint configuration, this is also the place to do so.

Example:

packages/eslint-config-custom/.eslint-next.js
module.exports = {
  // ...
  rules: {
    // ... other rules
    'your-rule-name': 0, // <- your custom global rule
  },
  // ...
};

Add custom rules for specific workspace

You can customize the rules by overriding existing ones or adding new options specific to a particular workspace.

Example:

[your-workspace]/.eslintrc.js
module.exports = {
  parserOptions: {
    tsconfigRootDir: __dirname,
    project: './tsconfig.json',
  },
  extends: ['eslint-config-custom/eslint-next.js'],
  rules: {
    'your-rule-name': 0, // <- your custom rule for specyfic workspace
  },
};