eslint-plugin-filename-rules icon indicating copy to clipboard operation
eslint-plugin-filename-rules copied to clipboard

Custom error/warning message?

Open areknow opened this issue 3 years ago • 1 comments

Is it possible to pass in a custom error message? Maybe something like this:

{
    files: ['foo/bar/*.ts'],
    rules: {
        'filename-rules/match': [
            'error',
            {
                regex: /(.*?)\.(get\.ts|post\.ts)$/,
                message: 'Files extensions must follow the convention of: {.get.ts, .post.ts}'
            }
        ]
    }
}

areknow avatar Dec 15 '21 16:12 areknow

I've created at PR here to accomplish this: https://github.com/dolsem/eslint-plugin-filename-rules/pull/12

Here, you could specify the message as a third argument:

...
'filename-rules/match': [2, /^([a-z]+-)*[a-z]+(?:\..*)?$/], 'Custom message',
...

Didn't want to mess up anyone's use of this library by changing the structure of the rules input.

brandonbrown5 avatar Nov 28 '22 21:11 brandonbrown5