Awesome
eslint-config
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:
@moxy/eslint-config-babel
- If you are going to use Babel to transpile source code.@moxy/eslint-config-jest
- If you are going to use Jest to develop tests.@moxy/eslint-config-react
- If you are going to use React.@moxy/eslint-config-react-web-a11y
- If you want to detect accessibility issues in web projects based on React.@moxy/eslint-config-vue
- If you are going to use Vue.@moxy/eslint-config-react-native
- If you are going to use React Native.@moxy/eslint-config-react-native-a11y
- If you want to detect accessibility issues in React Native apps.
Typical configs
<details> <summary>Standard JavaScript project</summary>{
"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.
{
"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.
{
"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.
{
"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"
]
}
</details>
Older versions
If you want to read the changelog of an older version, please check here.