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
First line of .eslintignore doesn't seem to get read #8044
Comments
We have an open issue #6759 which talks about In the meantime, your best bet is to either run ESLint from the directory where |
Also: Could you please include the contents of your |
The issue isn't that .eslintignore isn't working, it's that the first line isn't read. For instance, I have the following structure
Using this .eslintignore file:
only the files in the thing folder (Test2.js) are ignored. Using this .eslintignore file:
all files (Test.js and Test2.js) get ignored. It looks like the first line simply isn't read. |
Have you tried using `/Scripts/Test.js` (lowercase .js extension)?
…On Feb 8, 2017 12:49 PM, "sgjoy1" ***@***.***> wrote:
The issue isn't that .eslintignore isn't working, it's that the first line
isn't read. For instance, I have the following structure
Scripts
|_Test.js
|_thing
|_Test2.js
Using this .eslintignore file:
/Scripts/Test.Js
/Scripts/thing/Test2.js
only the files in the thing folder (Test2.js) are ignored.
Using this .eslintignore file:
#skip
/Scripts/Test.Js
/Scripts/thing/Test2.js
all files (Test.js and Test2.js) get ignored. It looks like the first line
simply isn't read.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#8044 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AARWeh5but3ZiJwU047XWgzLnTAXdrbdks5rag4AgaJpZM4L7F_5>
.
|
Sorry, that was a typo. they are lowercase. |
@sgjoy1 can you create a repo with a simplified reproducible example? |
I've added a repo here (https://github.com/sgjoy1/eslintignoreLineReadIssue). You'll need to fill in some of the blanks on the command to run, but you'll eventually see 2 errors. If you open the .eslintignore file and add a comment for the first line, you'll get 1 error. |
There is a weird character in your .eslintignore file which is causing the first line not to match.
Also, you shouldn't use comments in json files, they are not valid. You should use |
I'm guessing it's a BOM. I'll try to remove it and see if that solves the issue. Thanks for your help! As for the comment, the documentation says JSON and YAML support comments (http://eslint.org/docs/2.0.0/user-guide/configuring#comments-in-configuration-files). Perhaps that's incorrect? |
It looks like the BOM was the problem. Thanks for your help. |
Closing this issue as it looks like the question has been answered. Please feel free to visit us in the ESLint Gitter if you have any other issues! |
Hi @sgjoy1, we use a particular library for reading ESLint configuration files which goes beyond the JSON standard and allows comments, but this only applies to ESLint configuration files. In general, comments are invalid in standard JSON. |
Hi @platinumazure, I agree with not adding comments to JSON files, but figured @alberto was referencing my .eslintrc.json file since the .eslintignore file is plain text. I see now that he didn't specify which JSON file had comments, so it's possible I have an odd setup somewhere, or it's just confusion between expected behavior and the special library that EsLint is using for .eslintrc.json files. |
Sorry about the confusion. You can use comments in .eslintrc.json files and eslint will deal with them without problems, but I would personally avoid it since other programs (e.g. editors, json validators) won't necessarily work with them. |
I'm using node.exe to run eslint.js on the command line. I'm feeding in my own .eslintrc file and all of the rules are being respected; however, my .eslintignore file didn't seem to be working. I believe I'm using the default parser.
My command looks a little like:
My .eslintignore is in the same working directory as the process, but it only had one line in it. Running the command produced the same result as if I hadn't ignored the file. If I add another line to my .eslintignore file, my result is the same, except anything that produced an error for the second ignore rule is now gone. I've added a comment on the first line and both rules are respected. It looks like something isn't fully reading the .eslintignore file, but it's not a huge issue now that I know what's happening.
EsLint Version: 3.14.1
Node Version: 7.4.0
npm Version: 4.0.5
.eslintrc file:
The text was updated successfully, but these errors were encountered: