find-glob
Regular find
has inconsistent support for extended regex syntax.
This replacement uses glob
package syntax and will work consistently anywhere your Node works.
find-glob '**/*.js'
find-glob -0 '**/*.js' '**/*.json' '!node_modules/**' | xargs -0 eclint
find-glob --contain 'TODO' --fail-on-empty '**/*.js'
Options
-0
enables a null byte separator, to be used with -0
in xargs
.
--contain '^http:'
will filter only the files that contain the passed regular expression, which is run in multi-line mode by default, so ^
and $
refer to a line begin and line end.
--fail-on-empty
will return an error code if no files have been found.