Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6 function syntax issue #2784

Closed
alecpl opened this issue Dec 27, 2019 · 1 comment
Closed

ES6 function syntax issue #2784

alecpl opened this issue Dec 27, 2019 · 1 comment

Comments

@alecpl
Copy link

alecpl commented Dec 27, 2019

For following javascript code:

window.axios.interceptors.response.use(
    response => {
        // Do nothing
        return response
    },
    error => {
        var error_msg

        if (error.response && error.response.status == 422) {
            // cut
        }
    }
)

there's two issues:

  1. It complains about indentation of the comment line to be 8 instead of expected 4 spaces. phpdbf can fix it this way, but obviously it's not what should happen.
  2. It complains about the same regarding var error_msg line, but this case is different, phpdbf is not able to fix it. Also note that it does not complain about indentation of the if statement below.

Used phpcs 3.5.3. PHP 7.4. Rules: PSR1 + PSR12.

@gsherwood
Copy link
Member

PHP_CodeSniffer does not support modern JS syntax. All JS functionality will be removed in version 4 and no bugs will be fixed in version 3. I strongly suggest switching to a dedicated JS linting tool like eslint.

The version 4 roadmap can be found here: https://github.com/squizlabs/PHP_CodeSniffer/milestone/11

The specific issue for this is here: #2448

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants