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 and ignored by default on linting #16602

Closed
1 task
EvyiLdaRkmaN opened this issue Nov 30, 2022 · 5 comments
Closed
1 task

Warning for ignored files and ignored by default on linting #16602

EvyiLdaRkmaN opened this issue Nov 30, 2022 · 5 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly repro:needed
Projects

Comments

@EvyiLdaRkmaN
Copy link

Environment

Node version: v18.12.1
npm version: 8.19.2
Local ESLint version: 8.28.0
Global ESLint version: 8.28.0
Operating System: windows 11

What parser are you using?

@typescript-eslint/parser

What did you do?

Configuration
{
    "env": {
        "browser": true,
        "es2021": true
    },
    "extends": [
        "plugin:react/recommended",
        "airbnb",
        "prettier",
        "plugin:@typescript-eslint/recommended"
    ],
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
        "ecmaFeatures": {
            "jsx": true
        },
        "ecmaVersion": "latest",
        "sourceType": "module",
        "project": ["./tsconfig.json"]
    },
    "plugins": [
        "react",
        "@typescript-eslint"
    ],
    "ignorePatterns": ["!.*"],
    "rules": {
       // ...
    }
}

eslintignore
node_modules
build
public
src/assets

#files
*.json
*.md
*.css
*.config.*
*.html
.*

too many warnings when committing using husky

package.json

"lint-staged": {
    "**/*": ["prettier --write --ignore-unknown", "eslint"]
  },
// vite template code, using: npm create vite@latest pce-front -- --template react-ts

What did you expect to happen?

I only expected the errors, since it is supposed that to avoid the mentioned warnings, I followed their recommendations and more

What actually happened?

C:\Users\ameri\Documents\GitHub\pce-front\.eslintignore
  0:0  warning  File ignored by default.  Use a negated ignore pattern (like "--ignore-pattern '!<relative/path/to/filename>'") to override

C:\Users\ameri\Documents\GitHub\pce-front\.eslintrc.json
  0:0  warning  File ignored by default.  Use a negated ignore pattern (like "--ignore-pattern '!<relative/path/to/filename>'") to override

C:\Users\ameri\Documents\GitHub\pce-front\.gitignore
  0:0  warning  File ignored by default.  Use a negated ignore pattern (like "--ignore-pattern '!<relative/path/to/filename>'") to override

C:\Users\ameri\Documents\GitHub\pce-front\.husky\pre-commit
  0:0  warning  File ignored by default.  Use a negated ignore pattern (like "--ignore-pattern '!<relative/path/to/filename>'") to override

C:\Users\ameri\Documents\GitHub\pce-front\.prettierignore
  0:0  warning  File ignored by default.  Use a negated ignore pattern (like "--ignore-pattern '!<relative/path/to/filename>'") to override

C:\Users\ameri\Documents\GitHub\pce-front\.prettierrc.json
  0:0  warning  File ignored by default.  Use a negated ignore pattern (like "--ignore-pattern '!<relative/path/to/filename>'") to override

C:\Users\ameri\Documents\GitHub\pce-front\index.html
  0:0  warning  File ignored because of a matching ignore pattern. Use "--no-ignore" to override

C:\Users\ameri\Documents\GitHub\pce-front\package-lock.json
  0:0  warning  File ignored because of a matching ignore pattern. Use "--no-ignore" to override

C:\Users\ameri\Documents\GitHub\pce-front\package.json
  0:0  warning  File ignored because of a matching ignore pattern. Use "--no-ignore" to override

C:\Users\ameri\Documents\GitHub\pce-front\public\vite.svg
  0:0  warning  File ignored because of a matching ignore pattern. Use "--no-ignore" to override

C:\Users\ameri\Documents\GitHub\pce-front\src\App.css
  0:0  warning  File ignored because of a matching ignore pattern. Use "--no-ignore" to override

C:\Users\ameri\Documents\GitHub\pce-front\src\assets\react.svg
  0:0  warning  File ignored because of a matching ignore pattern. Use "--no-ignore" to override

C:\Users\ameri\Documents\GitHub\pce-front\src\index.css
  0:0  warning  File ignored because of a matching ignore pattern. Use "--no-ignore" to override

C:\Users\ameri\Documents\GitHub\pce-front\tsconfig.json
  0:0  warning  File ignored because of a matching ignore pattern. Use "--no-ignore" to override

C:\Users\ameri\Documents\GitHub\pce-front\tsconfig.node.json
  0:0  warning  File ignored because of a matching ignore pattern. Use "--no-ignore" to override

C:\Users\ameri\Documents\GitHub\pce-front\vite.config.ts
  0:0  warning  File ignored because of a matching ignore pattern. Use "--no-ignore" to override

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

No response

@EvyiLdaRkmaN EvyiLdaRkmaN added bug ESLint is working incorrectly repro:needed labels Nov 30, 2022
@eslint-github-bot eslint-github-bot bot added this to Needs Triage in Triage Nov 30, 2022
@mdjermanovic mdjermanovic moved this from Needs Triage to Triaging in Triage Dec 1, 2022
@mdjermanovic
Copy link
Member

Hi @EvyiLdaRkmaN, thanks for the issue!

Can you please clarify what actually happened and what did you expect to happen? In particular:

  • Was the commit successful?
  • Do you expect not to see any warnings when the commit is successful, or do you expect to see warnings when there are any but not those about ignored files?

@EvyiLdaRkmaN
Copy link
Author

Hi @mdjermanovic.
I didn't expect so many warnings from files I'm specifically ignoring or even from config files, like .eslintignore, .eslintrc.json, .gitignore, and more.

* Was the commit successful?

yes, commit successful. Even though I don't know if it's right to ignore so many warnings

@nzakas
Copy link
Member

nzakas commented Dec 2, 2022

There are two problems here:

  1. You are explicitly ignoring those files in eslintignore, which is what’s causing the warnings. You should remove everything under “#files” in eslintignore.
  2. You should only run eslint with lint-staged on *.js files. Right now you are running on every file no matter the extension.

If you make those two changes the earnings will go away.

@EvyiLdaRkmaN
Copy link
Author

Ok @nzakas .
therefore the following configuration would be correct?

.eslintignore

node_modules
build
public

#files
*.config.*

.package.json

"lint-staged": {
    "**/*": "prettier --write --ignore-unknown",
    "*.{ts,tsx}": "eslint"
  },

This seems to no longer give warnings

@nzakas
Copy link
Member

nzakas commented Dec 8, 2022

Yup, that's exactly it. 👍

@nzakas nzakas closed this as not planned Won't fix, can't repro, duplicate, stale Dec 8, 2022
Triage automation moved this from Triaging to Complete Dec 8, 2022
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Jun 7, 2023
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jun 7, 2023
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 bug ESLint is working incorrectly repro:needed
Projects
Archived in project
Triage
Complete
Development

No branches or pull requests

3 participants