eslint-plugin-filename-rules
eslint-plugin-filename-rules copied to clipboard
Custom error/warning message?
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}'
}
]
}
}
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.