squizlabs / PHP_CodeSniffer

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
BSD 3-Clause "New" or "Revised" License
10.66k stars 1.48k forks source link

JavaScript: Indentation after object parameter #3928

Closed szepeviktor closed 10 months ago

szepeviktor commented 10 months ago

Describe the bug

PSR12: Indentation after object parameter. When the second parameter of React.createElement is removed there is no error.

Code sample

function doit()
{
    window.wc.wcBlocksRegistry.registerPaymentMethod({
        label: React.createElement('img', {
            foo: 'bar'
        }),
        content: 'text'
    });
}

To reproduce

Steps to reproduce the behavior:

 7 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
   |       |     (Generic.WhiteSpace.ScopeIndent.IncorrectExact)

Expected behavior

No errors.

Versions (please complete the following information)

Operating System Debian stretch
PHP version 7.4
PHP_CodeSniffer version 3.7.2
Standard PSR-12
Install type composer

Please confirm:

jrfnl commented 10 months ago

Thanks for reporting this. Javascript support will be removed in PHPCS 4.0, so this is unlikely to get fixed. There are other, JS specific, code styling tools available nowadays. I suggest you use those.

szepeviktor commented 10 months ago

You made me very glad that PHPCS will be a PHP-only tool.