You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a user of @code-pushup/eslint-plugin, I would like to easily configure my own custom groups of ESLint rules with weights I give them. I would like to configure this using the ESLint rule IDs I'm already familiar with (e.g. @typescript-eslint/naming-convention), instead of the slugified audits which often include an options hash (e.g. typescript-eslint-naming-convention-bff213ed8affa645).
Rules will be referenced by their plugin-scoped ESLint rule ID, just like it in a regular ESLint config. The eslintPlugin function will take care of transforming it to a Code PushUp group with matching audits. Audits will be matched regardless of if the rule has additional options or not.
For simplicity, the user would be able to specify an array of rule ID references, which assigns weight: 1 for each audit. But if the user doesn't want a uniform distribution, they could use an object instead which maps rules to their weights.
We can further simplify configuration by supporting * wildcards in the rule ID. This syntax would allow a user to group all rules from a specific ESLint plugin together with one reference (e.g. @angular-eslint/* or rxjs-x/*). A wildcard reference will be resolved as if each rule was specified individually, with the same weight applied to all matching audits.
User story
As a user of
@code-pushup/eslint-plugin
, I would like to easily configure my own custom groups of ESLint rules with weights I give them. I would like to configure this using the ESLint rule IDs I'm already familiar with (e.g.@typescript-eslint/naming-convention
), instead of the slugified audits which often include an options hash (e.g.typescript-eslint-naming-convention-bff213ed8affa645
).Inspiration
code-pushup/ng-demo
Proposal
The
eslintPlugin
would accept a new options object defined as follows:Rules will be referenced by their plugin-scoped ESLint rule ID, just like it in a regular ESLint config. The
eslintPlugin
function will take care of transforming it to a Code PushUp group with matching audits. Audits will be matched regardless of if the rule has additional options or not.For simplicity, the user would be able to specify an array of rule ID references, which assigns
weight: 1
for each audit. But if the user doesn't want a uniform distribution, they could use an object instead which maps rules to their weights.We can further simplify configuration by supporting
*
wildcards in the rule ID. This syntax would allow a user to group all rules from a specific ESLint plugin together with one reference (e.g.@angular-eslint/*
orrxjs-x/*
). A wildcard reference will be resolved as if each rule was specified individually, with the same weight applied to all matching audits.Example
This user configuration:
would create the following groups:
which can then be used to create categories:
Acceptance criteria
eslintPlugin
supports optionalgroups
*
in rule ID reference acts as wildcard to match many rule IDs with same prefix and/or suffixThe text was updated successfully, but these errors were encountered: