[keyword-spacing] override this before: false with greater than #14712
Description
Tell us about your environment
- ESLint Version: 7.27.0
- Node Version: 14.17.0
What parser (default, @babel/eslint-parser
, @typescript-eslint/parser
, etc.) are you using?
@typescript-eslint/parser
but also tested with only using eslint and the problem still exists.
Please show your full configuration:
Configuration
{
"rules": {
'keyword-spacing': 'off',
'@typescript-eslint/keyword-spacing': [
'error',
{
"overrides": {
"this": { "before": null },
"new": { "before": null }
}
}
],
}
}
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
(note that when you change the >
into a <
the lint error goes away.
if (this.refundAmount > this.maximumRefund) { // the same thing with a less than works fine
I wasn't sure what to expect from this configuration of the rule. I had to set "this" and "new" to before: false, because I don't want a space between casting angle brackets <Thing>this.blah
or <Thing>new Blah()
.
And I was happy when it seemed to work in almost all cases. Obviously I'm using this.blah
in thousands of places, very commonly with spaces in front, and almost all of them work. The only exception is the "greater than" symbol, used for comparisons. Less than (and everything else) seems to work fine.
So given it only gives an error with the exact combination > this
I feel like it's a bug.
What did you expect to happen?
No errors
What actually happened? Please copy-paste the actual, raw output from ESLint.
283:41 error Unexpected space(s) before "this" @typescript-eslint/keyword-spacing
Steps to reproduce this issue:
- (see demo above)
Metadata
Assignees
Labels
Type
Projects
Status
Complete