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 const array issue #2785

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

ES6 const array issue #2785

alecpl opened this issue Dec 27, 2019 · 1 comment

Comments

@alecpl
Copy link

alecpl commented Dec 27, 2019

Following javascript code

const routes = [
    {
        path: '/',
        redirect: { name: 'login' }
    },
    {
        path: '/dashboard',
        name: 'dashboard',
        component: DashboardComponent,
    }
]

const router = new VueRouter({
        mode: 'history',
        routes
})

is considered invalid in a few places. phpdbf converts it to

const routes = [
    {
        path: '/',
        redirect: { name: 'login' }
    },
    {
        path: '/dashboard',
        name: 'dashboard',
        component: DashboardComponent,
    }
    ]

    const router = new VueRouter({
        mode: 'history',
        routes
    })

Which is imo wrong.

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