Coder Social home page Coder Social logo

Bug: eslint ignores property is not taken into account, and it displays <ESLint was configured to run ... However, that TSConfig does not / none of those TSConfigs include this file> about typescript-eslint HOT 10 CLOSED

HatemMn avatar HatemMn commented on June 12, 2024
Bug: eslint ignores property is not taken into account, and it displays

from typescript-eslint.

Comments (10)

bradzacher avatar bradzacher commented on June 12, 2024 1

https://eslint.org/docs/latest/use/configure/configuration-files#globally-ignoring-files-with-ignores

If you want to COMPLETELY ignore a file - you need to use an object with just ignores.
Otherwise ignores only skips the files from the specific config object

Which is why your "no typescript eslint" branch works - because you have ignores in an object by itself.

from typescript-eslint.

bradzacher avatar bradzacher commented on June 12, 2024 1

While I honestly still do not understand the sentence

Otherwise ignores only skips the files from the specific config object

The flat config is an array of objects.
The final config for a file is calculated by merging the array of objects into a single object.
Which objects are used for a given file depends on the files and ignores patterns.
If you add ignore to an object and the file doesn't match - then eslint will skip that config for that file.

If you have an object that just has ignores then it is a special case which declares a global ignore list.

Please have a read through the docs for more information
https://eslint.org/docs/latest/use/configure/configuration-files#configuration-objects

from typescript-eslint.

JoshuaKGoldberg avatar JoshuaKGoldberg commented on June 12, 2024

This fixes it for me:

-    ignores: ["app/myFirstApp/nestedProject/"],
+    ignores: ["app/myFirstApp/nestedProject/src/fileIdoNotWantToLint.ts"],

My hunch is there needs to be * and/or **s somewhere. If that's not right, I think your issue would be with ESLint core - perhaps a docs clarification/correction to be made somewhere? typescript-eslint doesn't do anything different with ignores. tseslint.config doesn't modify them.

Additionally, we're planning on switching the recommendation from project to useProjectService (today, EXPERIMENTAL_useProjectService) in our upcoming v8 major. Which also fixes the issue.

Closing as not on our end, but if you can pinpoint a bug in our source, we'd be happy to fix it. Thanks!

from typescript-eslint.

HatemMn avatar HatemMn commented on June 12, 2024

@JoshuaKGoldberg Thank you very much for answering so quickly !

Are you sure the pattern you provided fixes the problem for you ? I have already tried it, it does not work and instead of that error I simply get the project to lint my file as if I did not ask for it to not be linted :

  1:69  error  'e' is defined but never used                            @typescript-eslint/no-unused-vars
  2:7   error  'custom_event' is never reassigned. Use 'const' instead  prefer-const

✖ 2 problems (2 errors, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

Those errors were left there on purpose, by the way.

This error only happened to me when I have started using the tslint configuration - so don't you think the issue if from it ? If no, who should I report it to ?

from typescript-eslint.

JoshuaKGoldberg avatar JoshuaKGoldberg commented on June 12, 2024

What I mean by "fixing" it is that you no longer get the big ESLint was configured to run ... complaint. That complaint comes from this project, typescript-eslint.

We (typescript-eslint) act as "just" a set of extensions on top of ESLint. If you're having issues with ESLint's ignores then that'd be the ESLint project, not us.

tslint

Sorry to nitpick you, but because a lot of people get confused by this: "tslint" refers to an old linter that was deprecated a few years back. https://typescript-eslint.io/troubleshooting/tslint. We try to avoid that name because a lot of folks have a hard time understanding the difference between it and typescript-eslint. Just a heads up. 🙂

from typescript-eslint.

HatemMn avatar HatemMn commented on June 12, 2024

Thank you @JoshuaKGoldberg for the clear response, and sorry if my questions seemed repetitive as this my first time with eslint on a repository !

In order to make to make sure if the problem arises from ESLint or from typescript-eslint, I simply deleted typescript-eslint from my packages and reproduced the same project and everything was fine and worked like their documentation stated. You can checkout the new branch I made to try this out or simply read the config file.

Due to this, I would maintain that it's not core Eslint that is causing this problem. What do you think ?

from typescript-eslint.

JoshuaKGoldberg avatar JoshuaKGoldberg commented on June 12, 2024

Interesting! Thanks for trying that out. npx @eslint/config-inspector might be useful too?

Putting this back in triage.

from typescript-eslint.

HatemMn avatar HatemMn commented on June 12, 2024

Thank you for considering this and for npx @eslint/config-inspector idea, I did not know about it. I will use it to investigate the problem with you guys

from typescript-eslint.

HatemMn avatar HatemMn commented on June 12, 2024

I have tried this solution on my main repository, and it worked !

While I honestly still do not understand the sentence

Otherwise ignores only skips the files from the specific config object

the solution you have provided solves the problem, thank you very much guys ! the documentation was quite confusing. If you have time you can mention it in the FAQ for future reference :) I do admit however that the problem is eslint related indeed

from typescript-eslint.

JoshuaKGoldberg avatar JoshuaKGoldberg commented on June 12, 2024

A good docs suggestion for ESLint core. 🙂

from typescript-eslint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.