eslint-stylistic / eslint-stylistic

Monorepo for ESLint Stylistic plugins and configs
https://eslint.style
MIT License
1.2k stars 84 forks source link

`@stylistic/type-annotation-spacing`: Confused by parentheses #441

Open ej612 opened 1 week ago

ej612 commented 1 week ago

Validations

Describe the bug

Hi there!

This is my eslint config:

'@stylistic/type-annotation-spacing': ['error', {
    overrides: {
        colon: {
            before: false,
            after: true
        }
    }
}]

And this is my code:

/**
 * Missing space between colon & return type is detected
 * -> GOOD
 */
function error_is_reported_ok():void {
    //
}

An error is displayed as expected: image

If I wrap the return type in parentheses, like so:

/**
 * If return type is wrapped in parentheses,
 * missing space after colon is not detected
 * -> BAD
 */
function error_is_not_reported_not_ok():(void) {
    //
}

No violation is detected anymore. Is this intended behavior? I would expect the rule to report a violation, parentheses or not.

Thanks a lot in advance!

Reproduction

https://stackblitz.com/edit/github-dgu1fv-ymqf1g

Contributes