What happened?
When running ESLint through Qlty Cloud or the Qlty GitHub integration, linting fails with:
Oops! Something went wrong! :(
ESLint: 7.32.0
Error: Error while loading rule 'jest/no-deprecated-functions': Unable to detect Jest version - please ensure jest package is installed, or otherwise set version explicitly
Occurred while linting /home/runner/work/porta/spec/javascripts/utilities/json-utils.spec.ts
at detectJestVersion (/home/runner/.qlty/cache/tools/eslint/7.32.0-4b976551fc3b/node_modules/eslint-plugin-jest/lib/rules/utils/detectJestVersion.js:22:9)
at create (/home/runner/.qlty/cache/tools/eslint/7.32.0-4b976551fc3b/node_modules/eslint-plugin-jest/lib/rules/no-deprecated-functions.js:34:283)
at Object.create (/home/runner/.qlty/cache/tools/eslint/7.32.0-4b976551fc3b/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js:41:20)
at createRuleListeners (/home/runner/.qlty/cache/tools/eslint/7.32.0-4b976551fc3b/node_modules/eslint/lib/linter/linter.js:765:21)
at /home/runner/.qlty/cache/tools/eslint/7.32.0-4b976551fc3b/node_modules/eslint/lib/linter/linter.js:937:31
at Array.forEach (<anonymous>)
at runRules (/home/runner/.qlty/cache/tools/eslint/7.32.0-4b976551fc3b/node_modules/eslint/lib/linter/linter.js:882:34)
at Linter._verifyWithoutProcessors (/home/runner/.qlty/cache/tools/eslint/7.32.0-4b976551fc3b/node_modules/eslint/lib/linter/linter.js:1181:31)
at Linter._verifyWithConfigArray (/home/runner/.qlty/cache/tools/eslint/7.32.0-4b976551fc3b/node_modules/eslint/lib/linter/linter.js:1280:21)
at Linter.verify (/home/runner/.qlty/cache/tools/eslint/7.32.0-4b976551fc3b/node_modules/eslint/lib/linter/linter.js:1235:25)
Please see https://github.com/3scale/porta/blob/fa8c58782bf7f5d8c556e115d04216097e3461f7/spec/javascripts/.eslintrc#L7-L10 to see a real-world example how this is a problem.
This doesn't happen when running eslint locally from within the project directory, because eslint-plugin-jest plugin successfully detects the current installed jest version.
Apparently Qlty runs eslint from outside the project dir so eslint-plugin-jest auto-detection fails.
I believe Qlty github integration should run plugins (or at least eslint) from within the project dir to avoid this issue.
Currently a workaround exists to set jest version manually inside .eslintrc.js
settings: {
jest: {
version: 29 // or your actual Jest major version
}
}
But this is obviously suboptimal as with upgrades this will become out of sync and this will frustrate the developers, who surely already forgot about this.
What did you expect to happen?
eslint-plugin-jest to detecte jest version automatically as designed; or at least qlty to allow a configuration option to do so
Can you reproduce the problem?
Yes, consistently
CLI Version
github integration
Relevant log output
log pasted in description
What happened?
When running ESLint through Qlty Cloud or the Qlty GitHub integration, linting fails with:
Please see https://github.com/3scale/porta/blob/fa8c58782bf7f5d8c556e115d04216097e3461f7/spec/javascripts/.eslintrc#L7-L10 to see a real-world example how this is a problem.
This doesn't happen when running eslint locally from within the project directory, because
eslint-plugin-jestplugin successfully detects the current installedjestversion.Apparently Qlty runs
eslintfrom outside the project dir soeslint-plugin-jestauto-detection fails.I believe Qlty github integration should run plugins (or at least
eslint) from within the project dir to avoid this issue.Currently a workaround exists to set
jestversion manually inside.eslintrc.jsBut this is obviously suboptimal as with upgrades this will become out of sync and this will frustrate the developers, who surely already forgot about this.
What did you expect to happen?
eslint-plugin-jestto detecte jest version automatically as designed; or at least qlty to allow a configuration option to do soCan you reproduce the problem?
Yes, consistently
CLI Version
github integration
Relevant log output
log pasted in description