eslint-plugin-node
eslint-plugin-node copied to clipboard
[Feature request] Expose context.settings for shareable configs
We have a shareable config file that we use across multiple projects with good default configuration. However, sometimes there are rules which require adding some custom per-project configuration on top of the base one. I would like if it was possible to use shared settings in eslint-config-* to extend certain configurations without having to create a custom plugin just for shared configs. So we don't have to re-write the conplete configuration of a rule (which also won't benefit from any update in the shared config).
For example:
"simple-import-sort/imports": [
"error",
{
"groups": [
// Side effect imports.
[
"^\\u0000"
],
// Packages.
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
[
"^@?\\w"
],
// Absolute imports and other imports such as Vue-style `@/foo`.
// Anything not matched in another group.
[
"^"
],
// Relative imports.
// Anything that starts with a dot, src/, or our custom paths
[
"^@my-project", // <-- project specific setting
"^(\\.|src/)"
]
]
}
],
// ...
"no-autofix/@angular-eslint/template/i18n": [
"error",
{
"boundTextAllowedPattern": "(MyProject|EN|FR)", // <-- cusom for this project
"ignoreTags": [
// eslint-config-*
"meta",
"link",
"title",
"mat-icon"
],
"ignoreAttributes": [
// Plugin's base configuration
"charset",
"class",
"color",
"colspan",
"fill",
"formControlName",
"height",
"href",
"id",
"lang",
"ngClass",
"ngProjectAs",
"routerLink",
"src",
"stroke",
"stroke-width",
"style",
"svgIcon",
"tabindex",
"target",
"type",
"viewBox",
"width",
"xmlns",
// eslint-config-*
"role",
"mat-form-field[appearance]",
"mat-form-field[floatLabel]",
"matTooltipPosition",
"input[autocomplete]",
"input[accept]",
"name",
"panelClass",
"cdkColumnDef",
"ngx-mat-select-search[name]",
// cusom for this project
"app-spinner[mode]"
]
}
]
// ... and more
Which could be shortened to (and support updated):
"settings": {
"my-shareable-config": {
"ts-paths": ["@my-project"],
"i18n": {
"ignoreTags": [],
"ignoreAttributes": [
"app-spinner[mode]"
]
}
}
}
I think I'd be fine using some sort of workaround solution if this is not to be supported.