Reference audits (or groups) which you wish to include in custom categories (use npx code-pushup print-config
to list audits and groups).
Assign weights based on what influence each ESLint rule should have on the overall category score (assign weight 0 to only include as extra info, without influencing category score).
Note that categories can combine multiple plugins.
export default {
categories: [
{
slug: 'code-style',
title: 'Code style',
refs: [
{
type: 'audit',
plugin: 'eslint',
slug: 'no-var',
weight: 1,
},
{
type: 'audit',
plugin: 'eslint',
slug: 'prefer-const',
weight: 1,
},
{
type: 'audit',
plugin: 'eslint',
slug: 'react-hooks-rules-of-hooks',
weight: 2,
},
],
},
{
slug: 'performance',
title: 'Performance',
refs: [
{
type: 'audit',
plugin: 'eslint',
slug: 'react-jsx-key',
weight: 0,
},
],
},
],
};
Referencing individual audits provides a lot of granularity, but it can be difficult to maintain such a configuration when there is a high amount of lint rules. A simpler way is to reference many related audits at once using groups. E.g. you can distinguish rules which have declared a type of problem
, suggestion
, or layout
:
export default {
categories: [
{
slug: 'bug-prevention',
title: 'Bug prevention',
refs: [
{
type: 'group',
plugin: 'eslint',
slug: 'problems',
weight: 100,
},
],
},
{
slug: 'code-style',
title: 'Code style',
refs: [
{
type: 'group',
plugin: 'eslint',
slug: 'suggestions',
weight: 75,
},
{
type: 'group',
plugin: 'eslint',
slug: 'formatting',
weight: 25,
},
],
},
],
};