Skip to content

Jelmerro's eslint config

License

Notifications You must be signed in to change notification settings

Jelmerro/eslint-config

Repository files navigation

eslint-config

Jelmerro's eslint config

This is my personal eslint config that I aim to use for all my projects in the future. It contains a very large number of rules that are enabled, many with custom config. It also combines different plugins into one easy to install repository. The main components are:

The config is currently updated to eslint 9 and supports eslint.config.js. Since the config depends on eslint, you only need to install the config, not eslint itself. This has the advantage that the config will always use a compatible eslint version.

ESM

  • npm i -D jelmerro/eslint-config
  • Add the following to eslint.config.js:
import eslintConfig from "eslint-config"
export default {
    ...eslintConfig,
    "languageOptions": {
        ...eslintConfig.languageOptions,
        "sourceType": "module"
    },
    "rules": {
        ...eslintConfig.rules,
        // add custom rules here
    }
}

In case you do not want to customize any rules, just remove the entire "rules" key. You are free to customize this, the above snippet simply serves as an example.

CommonJS

  • npm i -D jelmerro/eslint-config
  • Add the following to eslint.config.js:
"use strict"

module.exports = require("eslint-config")

In case you want to customize the rules, you can split the require and export.

"use strict"

const eslintConfig = require("eslint-config")
module.exports = {
    ...eslintConfig,
    "rules": {
        ...eslintConfig.rules,
        // add custom rules here
    }
}

Rationale

This config was created over many years of trial and error. I have been using my own custom config since 2018 and it has grown in size a lot since. As such, it seemed about time to standardize my config for all projects. This was the main reason for making this repository/project after all these years. It also helps removing a lot of unrelated eslint config/code from projects. With this project it is just a couple of config lines to use my standard eslint config.