#
Advanced composition
If the default by project type configurations doesn't fits your needs, rather than writing your own configuration from scratch, you can compose a new one from the underlying configuration pieces of @workleap/eslint-plugin
.
#
Available pieces
#
Compose a configuration
Each configuration piece can be extended individually, or in combination with other pieces, to compose your own custom ESLint configuration.
#
Single piece
To extend the configuration with a single piece:
.eslintrc.json
{
"$schema": "https://json.schemastore.org/eslintrc",
"root": true,
"extends": "plugin:@workleap/typescript",
"rules": {
...
}
}
#
Multiple pieces
To extend the configuration with multiple pieces:
.eslintrc.json
{
"$schema": "https://json.schemastore.org/eslintrc",
"root": true,
"extends": ["plugin:@workleap/core", "plugin:@workleap/typescript"],
"rules": {
...
}
}
#
Lint additional files
The configuration pieces already targets which file extensions their linting rules will be applied to. If you wish to lint additional file extensions for a given piece you can add an ESLint override block:
.eslintrc.json
{
"$schema": "https://json.schemastore.org/eslintrc",
"root": true,
"extends": ["plugin:@workleap/react"],
"overrides": [
{
"files": ["*.js", "*.jsx"],
"extends": "plugin:@workleap/react"
}
]
}