Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eslint glob (**) is not considering all directories recursively

I am using OSX, in my package.json file I have the script entry:

"lint": "eslint ./src/**/*.js"

However, when I run npm lint only the 1st level of directories are being considered for linting, eg. ./src/dir/* not ./src/dir/nested_dir/*.

I was under the impression that ** glob indicated recursive search?

Does anyone know how I can make this behave as expected?

like image 448
jfunk Avatar asked Jan 13 '19 03:01

jfunk


2 Answers

Some Googling turned up this thread on Github:

Before (not working): "lint": "eslint ./src/**/*.js"

After (working): "lint": "eslint './src/**/*.js'"

like image 87
jfunk Avatar answered Nov 06 '22 20:11

jfunk


Try this instead:

"lint": "eslint src --ext .js"

Or for more than one extension:

"lint": "eslint src --ext .js,.jsx,.ts,.tsx"

See more info on eslint's docs

like image 13
Udi Avatar answered Nov 06 '22 19:11

Udi