I'm trying to fix eslint
warnings in my code and I get a lot of these. The problem is that the files in question are not jest tests but cypress
tests. The tests are valid because cypress
expect
is not the same as jest
expect
.
Is there a way to either ignore the cypress
directory for jest/valid-expect
warnings ? or if that fails just ignore the directory for any jest
validation ? There's no jest
tests in that directory.
Asked
Active
Viewed 6,599 times
11

xyious
- 1,065
- 4
- 13
- 29
-
Possible duplicate of https://stackoverflow.com/questions/42250257/disable-eslint-rules-for-folder – CRayen Oct 02 '18 at 12:15
-
more of a duplicate of this: https://stackoverflow.com/questions/41316551/eslint-ignore-specific-rule-for-a-specific-directory – xyious Oct 02 '18 at 15:45
-
1None of these links really solve the problem tho. We should be able to specify to use the correct `expect` – Anthony May 16 '22 at 22:23
2 Answers
6
This answer provides most of the information needed (thanks CRayen for pointing me to another question (which was a duplicate of another)).
Basically you can put a .eslintrc file into any subfolder in which you want to override rules. Then you need to add a section like the one in the answer:
"overrides": [{
"files": [ "*.spec.js" ],
"rules": {
"no-unused-expressions": 0
}
}]
where you explicitly turn off the rules you don't want to be used to check the files listed by setting them to 0.

xyious
- 1,065
- 4
- 13
- 29
-
4This hides the error, but it's not a good answer. Not sure why you would get even 8 votes. We should be able to still have eslint and differentiate the different `expect` – Anthony May 16 '22 at 22:25