Skip to content
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

Warning for ignored files on linting #5623

Closed
abhisekp opened this issue Mar 19, 2016 · 17 comments
Closed

Warning for ignored files on linting #5623

abhisekp opened this issue Mar 19, 2016 · 17 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion

Comments

@abhisekp
Copy link

What version of ESLint are you using?
eslint 2.4.0

What parser (default, Babel-ESLint, etc.) are you using?
babel-eslint 6.0.0-beta.6

Please show your full configuration:

.eslintrc.json

{
    "root": true,
    "extends": "airbnb/base",
    "rules": {
        "indent": [
            2,
            2
        ],
        "quotes": [
            0, "double"
        ],
        "linebreak-style": [
            2, "unix"
        ],
        "semi": [
            2, "always"
        ],
        "no-unused-vars": [
            1, {
                "vars": "all",
                "args": "none"
            }
        ],
        "no-var": [1],
        "no-fallthrough": [1]
    },
    "env": {
        "es6": true,
        "node": true
    },
    "ecmaFeatures": {
        "modules": true
    },
    "globals": {
        "logger": true,
        "log4js": true
    },
    "parser": "babel-eslint"
}

.eslintignore

*.min.js
build/

What did you do? Please include the actual source code causing the issue.
eslint **/*.js

What did you expect to happen?
Not to show my ignored files WARNING while linting.

What actually happened? Please include the actual, raw output from ESLint.

MyProjects/NodeApp/md-urls  create-lib-WIP ✗                           0m ↑⚑  ⍉
▶ npm run lint

> md-urls@0.0.3 lint /home/abhisekp/MyProjects/NodeApp/md-urls
> eslint **/*.js


/home/abhisekp/MyProjects/NodeApp/md-urls/bin/cli.js
  5:13  warning  'program' is defined but never used  no-unused-vars

/home/abhisekp/MyProjects/NodeApp/md-urls/build/CONTRIBUTING.js
  0:0  warning  File ignored because of a matching ignore pattern. Use --no-ignore to override

/home/abhisekp/MyProjects/NodeApp/md-urls/build/app.js
  0:0  warning  File ignored because of a matching ignore pattern. Use --no-ignore to override

/home/abhisekp/MyProjects/NodeApp/md-urls/build/index.js
  0:0  warning  File ignored because of a matching ignore pattern. Use --no-ignore to override

/home/abhisekp/MyProjects/NodeApp/md-urls/lib/app.js
  1:5  warning  'x' is defined but never used  no-unused-vars

✖ 5 problems (0 errors, 5 warnings)
@platinumazure
Copy link
Member

Workaround (only practical if you have no rules configured as warnings): Use --quiet option to suppress warnings and only print errors.

@abhisekp
Copy link
Author

@platinumazure i've rules configured as warning and i need those warnings.

@platinumazure
Copy link
Member

I understand- it's a note for others who find this issue 😄
On Mar 19, 2016 5:12 PM, "Abhisek Pattnaik" notifications@github.com
wrote:

@platinumazure https://github.com/platinumazure i've rules configured
as warning and i need those warnings.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#5623 (comment)

@alberto
Copy link
Member

alberto commented Mar 20, 2016

I think it is working as expected, because of the way you are calling eslint. If you use eslint . instead, the warnings should go away.

@abhisekp
Copy link
Author

@alberto absolutely. Thanks.
But why should it gimme warning for ignored files/directories?

@alberto
Copy link
Member

alberto commented Mar 20, 2016

Because there is a discrepancy between the files you are asking to lint in the command line and your ignored files. I'm actually not sure what should take precedence, but this is something we are discussing in another thread, so I'm closing this one.

@alberto alberto closed this as completed Mar 20, 2016
@JaKXz
Copy link

JaKXz commented Apr 13, 2016

@alberto sorry to continue a closed thread, but I don't really follow the similarities in #4828 -

I'd prefer not to have to use the --quiet flag to suppress ALL warnings when I've specifically listed files in my .eslintignore that I want eslint to ignore. Is there a good reason for this behaviour that I'm missing? The docs say it's because eslint is unsure about the files that I want to ignore from linting, but, if I've specified it explicitly in an ignore file I don't see that as an issue. It's like if git warned me about ignoring files in my .gitignore every time I wanted to commit.

@alberto
Copy link
Member

alberto commented Apr 14, 2016

Yes, by using eslint **/*.js (without quotes) you are explicitly including all files and asking eslint to lint them. eslint is trying to be helpful telling you that it is not linting some of the files you asked him because they are ignored.

Try using eslint . instead.

@JaKXz
Copy link

JaKXz commented Apr 14, 2016

Thanks! That makes sense.

@jhliberty
Copy link

Can we add a rule to not display a warning when an ignored file is linted? It's really frustrating to save an ignored file and see warnings thrown.

screenshot

@joaoreynolds
Copy link

^ I agree. I don't see any value in having this warning to begin with since the point of gitignore is to ignore files that fall within the group of files you're linting.

@jchristin
Copy link

@alberto What's the point of an ignore file if it's not to contradict what you express in the config file?

@johnomalley
Copy link

Yeah I just complained to JetBrains about this issue... the only workaround to prevent this issue from firing in IDEA/WebStorm is to turn off ESLint integration. Please reconsider this... it's a really dumb idea to 'warn' the user that the system is working as designed.

@brandonsturgeon
Copy link

I'd also like to support another consideration for this issue. If I've explicitly ignored a file in .eslintignore, I don't need to hear about it anymore.

@Alexsey
Copy link

Alexsey commented Jun 8, 2017

@johnomalley could you please link your issue in WebStorm issue tracker? So any one how find this thread may +1 it or just track the progress

@johnomalley
Copy link

johnomalley commented Jun 8, 2017

https://youtrack.jetbrains.com/issue/WEB-27100

Looks like they fixed it.

@jitendravyas
Copy link

@alberto I'm using grunt plugin https://github.com/sindresorhus/grunt-eslint

Don't know how to use eslint . Can you please help?

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion
Projects
None yet
Development

No branches or pull requests