Facebook's Create React App (CRA) recently introduced a new feature allowing users to customize the base ESLint rules.
Recognizing that some cases may require further customization, it is now possible to extend the base ESLint config by setting the EXTEND_ESLINT environment variable to true. Setting Up Your Editor
An example is provided without specific details like filename or what "shared-config" refers to.
{
"eslintConfig": {
"extends": ["react-app", "shared-config"],
"rules": {
"additional-rule": "warn"
},
"overrides": [
{
"files": ["**/*.ts?(x)"],
"rules": {
"additional-typescript-only-rule": "warn"
}
}
]
}
}
The feature can be enabled by adding an environment variable.
EXTEND_ESLINT=true
However, the documentation page does not provide information on how to utilize this feature - see Advanced configuration.
I tried adding their example code to my build in a file named .eslintrc.json
, but encountered a build error:
"Error: ESLint configuration in .eslintrc.json is invalid: - Unexpected top-level property "eslintConfig"."
Has anyone successfully implemented this? Do I need to export a module from the file?