1

I have two files which are siblings.

  • index.js
  • index.test.js

First is for source, second is the unit tests for first file.

I have a lot of eslint rules to check my sources. And I use some plugins to enhance thoses checks. Especially security-plugin.

It makes sense to check security into source code, but i don't mind for tests files. How can i disable into tests files only security rules?

I already have tried those but it's not working:

/* eslint-disable security */
/* eslint-disable security/* */

Any idea is welcomed. I just want to keep source and test files as siblings

MathKimRobin
  • 1,268
  • 3
  • 21
  • 52
  • You can use [`overrides`](https://stackoverflow.com/questions/34764287/turning-off-eslint-rule-for-a-specific-file/65069069#65069069) to ignore rules for your `xxx.test.js` files, but AFAIK you can't ignore a whole plugin and need to disable all the rules specifically. – S.Visser Feb 01 '22 at 16:11
  • It seems that you're true sadly – MathKimRobin Feb 16 '22 at 06:57

1 Answers1

0

Have a found a trick. I just run eslint twice. One time for "normal" sources with tests excluded, and a second time with another configuration file without security plugin declared inside only for tests. Not the smartest way but does the job.

MathKimRobin
  • 1,268
  • 3
  • 21
  • 52