question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

disable rules for certain file paths or extensions

See original GitHub issue

I’m using Cypress and Jest with the ESLint plugins for both, and the Jest plugin is complaining about consistent-test-it and expect-expect inside the .spec.js files which are Cypress tests (Mocha syntax).

Being able to specify the file extension to lint would allow these rules to live together in one config.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
SimenBcommented, Apr 2, 2019

You can specify plugins, but not extends, in overrides (I think? If not, just specify all the plugins in the root - unless you activate rules, they don’t really do anything)

You should either:

  • manually compose the config in a js config file (you can do require('eslint-plugin-jest').configs.recommended and use that however you want)
  • use multiple config files (with some root: true in them)
  • wait for the resolution of https://github.com/eslint/rfcs/pull/9 or any alternative like it

I don’t think it makes sense for us to figure out how to do our own filtering of rules on top of eslint’s current mechanics for it. So I’ll close, but feel free to continue the discussion. As mentioned above, a PR with instructions on how to do it is welcome if you think whatever solution you come up with should be shared 😃

2reactions
macklinucommented, Apr 2, 2019

I am curious about this too, having run into a similar issue in a personal project, but I have not yet explored using ESLint’s overrides option. Have you tried this out yet? I would encourage you to play around with that configuration, and if you are able to find a solution, we could definitely add that helpful information to the README (only enabling eslint-plugin-jest for certain files using a shared config). Please let us know what your findings are! 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Turning off eslint rule for a specific file - Stack Overflow
1) Disabling "All rules" · You can go with 1.2 and add /* eslint-disable */ on top of the files, one by one....
Read more >
How to disable ESLint for some lines, files or folders
In this tutorial, you'll learn how to turn off ESLint for certain directories ... To disable not all, but only some specific ESLint...
Read more >
Ignoring Code - ESLint - Pluggable JavaScript Linter
You can tell ESLint to ignore specific files and directories using ignorePatterns in your config files. ignorePatterns patterns follow the same rules as...
Read more >
eslint-plugin-import/extensions.md at main - GitHub
ESLint plugin with rules that help validate proper imports. ... Some file resolve algorithms allow you to omit the file extension within the...
Read more >
Configure and validate exclusions based on extension, name ...
Using PowerShell to add or remove exclusions for files based on the extension, location, or file name requires using a combination of three ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found