Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I suppress the "No files matching the pattern" message in ESLint?

In my CI setup, I have a test that runs eslint against all JS files. If no JS files exist, it's currently throwing an error. I'd prefer if it'd succeeded when no JS files exist. Is this possible?

$ eslint "./src/assets/scripts/**/*.js"  Oops! Something went wrong! :(  ESLint: 5.7.0. No files matching the pattern "./src/assets/scripts/**/*.js" were found. Please check for typing mistakes in the pattern.  ERROR: Job failed: exit code 1 
like image 698
JacobTheDev Avatar asked Feb 05 '19 21:02

JacobTheDev


2 Answers

What worked for me was changing single quotes to escaped double quotes

So from:

"lint": "eslint '**/*.{ts,tsx}'" 

To:

"lint": "eslint \"**/*.{ts,tsx}\"" 

The reason is because it depends on the console you are using - possibly the operation system (that's why it can work for you while it's not working for others and via versa) Source: https://dev.to/gruckion/comment/b65c

like image 59
Sebastian Voráč Avatar answered Nov 05 '22 19:11

Sebastian Voráč


The --no-error-on-unmatched-pattern flag was added in v6.8.0 of ESLint.

https://eslint.org/docs/user-guide/command-line-interface#no-error-on-unmatched-pattern

like image 29
ncraley Avatar answered Nov 05 '22 18:11

ncraley