With a node.js project, I've added eslint-plugin-security and it is giving a lot of warnings for code in my test/spec files (using mochajs). Since the test code won't be running in production, these don't seem as useful as they do in the project's actual code. (A lot of Generic Object Injection Sink warnings )
Is there a way to have the security plugin ignore certain files other than putting /* eslint-disable */ at the top of every spec file?
There is three way to ignore files or folders:
1. Creating a
.eslintignoreon your project root folder with the thing you want to ignore:**/*.js2. Using eslint cli & the
--ignore-pathto specify another file where your ignore rules will be located3. Using your package.json
Official Documentation
On my side, I had issue with Intellij IDEA where eslint was checking files in a folder only dedicated to Typescript (+tslint) which was a pain, so I've picked solution 3.