ESLINT_CONFIGURATION
Requires that a workspace package has ESLint installed and configured correctlyConformance is available on Enterprise plans
ESLint is a tool to statically analyze code to find and report problems. ESLint is required to be enabled for every workspace package in a monorepo so that all code in the monorepo is checked for these problems. Additionally, repositories can enforce that particular ESLint plugins are installed and that specific rules are treated as errors.
This rule requires that:
- An ESLint config exists in the current workspace.
- A script to run ESLint exists in
package.json
in the current workspace. reportUnusedDisableDirectives
is set totrue
, which detects and can autofix unused ESLint disable comments.root
is set totrue
, which ensures that workspaces don't inherit unintended rules and configuration from ESLint configuration files in parent directories.
A Conformance error occurred in test "ESLINT_CONFIGURATION".
ESLint configuration must specify `reportUnusedDisableDirectives` to be `true`
To find out more information and how to fix this error, visit
/docs/workflow-collaboration/conformance/rules/ESLINT_CONFIGURATION.
If this violation should be ignored, add the following entry to
/apps/dashboard/.allowlists/ESLINT_CONFIGURATION.allowlist.json and get approval from the appropriate person.
{
"testName": "ESLINT_CONFIGURATION",
"reason": "TODO: Add reason why this violation is allowed to be ignored.",
"location": {
"workspace": "dashboard"
}
}
See the ESLint docs for more information on how to configure ESLint, including plugins and rules.
The recommended approach for configuring ESLint in a monorepo is to have a shared ESLint config in an internal package. See the Turbo docs on ESLint to get started.
Once your monorepo has a shared ESLint config, you can add a .eslintrc.cjs
file to the root folder of your workspace with the contents:
module.exports = {
root: true,
extends: ['eslint-config-custom/base'],
};
You should also add "eslint-config-custom": "workspace:*"
to your
devDependencies
.
Was this helpful?