Skip to content

Add support for functional custom messages #4117

@amk221

Description

@amk221

What is the problem you're trying to solve?

I would like to inform developers better when their code fails linting.

Currently, I can provide a custom message but:

  1. This loses the ability to reference the value that caused the failure. For example:
    • Before: Unexpected hex color "#fff"
    • After Unexpected hex color. Please refer to the brand colours in the Styleguide


  2. The blacklisted values are a great way to prevent developers from adding rules you would otherwise not want. However, it's not possible to do this:
    'declaration-property-value-blacklist': {
       'font-weight': ['500', { message: 'Please use the semi-bold mixin instead' }]
    },
    
    ...you can only add 1 catch-all message for all invalid property values.


What solution would you like to see?

  1. It would be great to be able to swap-in values ${hex}
    or, at least prefix/suffix the original error to the custom message.

  2. It would be nice if the custom messages were acknowledged for each invalid property

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedis likely non-trival and help is wantedstatus: ready to implementis ready to be worked on by someone

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions