How do I prevent Jest from trying to execute my .eslintrc.js as a test file?

Viewed 56

I'm trying to set up a new project which uses both ESLint and Jest. I also want to use eslint-plugin-jest, to get Jest-specific linting rules. I don't want those rules to apply to non-test files, though.

Usually, the way I'd accomplish something like this is to create a root .eslintrc.js in the root of the project and a folder-specific .eslintrc.js in the folder needing special rules. This appears to work fine for ESLint, but Jest tries to execute __tests__/.eslintrc.js as a test file and complains that it doesn't have any tests.

How can I tell Jest to ignore my ESLint configuration file?

Project structure:

  • .eslintrc.js
  • package.json
  • jest.config.js
  • lib/
    • index.js
  • __tests__/
    • .eslintrc.js
    • index.test.js
0 Answers
Related