Skip to content

MOXY eslint configuration to be used across several JavaScript projects

License

Notifications You must be signed in to change notification settings

moxystudio/eslint-config

Repository files navigation

eslint-config

Build Status Coverage Status

MOXY's set of ESLint configuration packages to be used across several JavaScript projects.

How it works

This repository contains two sets of ESLint configurations to be used in JavaScript projects:

  • the base configuration, which defines the common ESLint rules, the ECMAScript version and the module system.
  • the enhancers, which contain specific settings for different frameworks, like React or Vue.

By using one or more of these packages, you can enforce the desired code styles for each type of project.

For more information on how to use each package and their specific configurations, please read the package's README by following the links below. You may also check the examples listed in Typical Configs to see how the packages may be combined for the most common scenarios.

Base config

The base config is published as @moxy/eslint-config-base, check out its README to know how to use it.

Enhancer configs

There are several enhancer packages, which are intended to be used in conjunction with the base configuration:

Typical configs

Standard JavaScript project
{
    "root": true,
    "env": {
        "browser": true
    },
    "extends": [
        "@moxy/eslint-config-base/esm",
        "@moxy/eslint-config-babel",
        "@moxy/eslint-config-jest"
    ]
}

ℹ️ If your project is isomorphic / universal, you may want to enable the node environment as well.

React web project
{
    "root": true,
    "env": {
        "browser": true
    },
    "extends": [
        "@moxy/eslint-config-base/esm",
        "@moxy/eslint-config-babel",
        "@moxy/eslint-config-react",
        "@moxy/eslint-config-react-web-a11y",
        "@moxy/eslint-config-jest"
    ]
}

ℹ️ If your project is Isomorphic / Universal, you may want to enable the node environment as well.

Node.js project
{
    "root": true,
    "env": {
        "node": true
    },
    "extends": [
        "@moxy/eslint-config-base/cjs/es2019",
        "@moxy/eslint-config-jest"
    ]
}

⚠️ In the above example, we choose the es2019 version instead of the latest ECMAScript version because there's no Babel compilation and we are restricted to what the Node.js runtime supports. Please check node.green and select the most appropriate ECMAScript version based on the Node.js version you are targeting.

React Native apps
{
    "root": true,
    "extends": [
        "@moxy/eslint-config-base/esm",
        "@moxy/eslint-config-babel",
        "@moxy/eslint-config-react",
        "@moxy/eslint-config-react-native",
        "@moxy/eslint-config-react-native-a11y",
        "@moxy/eslint-config-jest"
    ]
}

Older versions

If you want to read the changelog of an older version, please check here.

License

MIT License