Search code examples
javascriptnode.jsglobeslint

Eslint glob does not work without extensions


I am running my Eslint through npm like so:

"eslint": "eslint resources/assets/js/**/*"

This does not work though, I have to manually specify an extension.

"eslint": "eslint resources/assets/js/**/*.js"

In that case it does work. I have .vue and .js files though so that is a bit of a problem.

I would love to be able to do something like this:

"eslint": "eslint resources/assets/js/**/*.{js, vue}"

But I don't think something like that exists yet for ESlint.

If this behavior normal and what could I do to still check my .vue and .js files?


Solution

  • You need to remove the space between the js and vue file extensions:

    "eslint": "eslint resources/assets/js/**/*.{js,vue}"
    

    Alternatively, I am pretty sure you could also use:

    "eslint": "eslint resources/assets/js/**/*.(js|vue)"