.eslintrc.js 1004 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* eslint-env node */
  2. /* eslint import/no-nodejs-modules:0 */
  3. const process = require('process');
  4. const isRelaxed = !!process.env.SENTRY_ESLINT_RELAXED;
  5. const isCi = !!process.env.CI;
  6. // Strict ruleset that runs on pre-commit and in local environments
  7. const ADDITIONAL_HOOKS_TO_CHECK_DEPS_FOR =
  8. '(useEffectAfterFirstRender|useMemoWithPrevious)';
  9. const strictRulesNotCi = {
  10. 'react-hooks/exhaustive-deps': [
  11. 'error',
  12. {additionalHooks: ADDITIONAL_HOOKS_TO_CHECK_DEPS_FOR},
  13. ],
  14. };
  15. module.exports = {
  16. extends: [isRelaxed ? 'sentry-app' : 'sentry-app/strict'],
  17. globals: {
  18. require: false,
  19. expect: false,
  20. sinon: false,
  21. MockApiClient: true,
  22. TestStubs: true,
  23. tick: true,
  24. jest: true,
  25. },
  26. rules: {
  27. 'react-hooks/exhaustive-deps': [
  28. 'warn',
  29. {additionalHooks: ADDITIONAL_HOOKS_TO_CHECK_DEPS_FOR},
  30. ],
  31. ...(!isRelaxed && !isCi ? strictRulesNotCi : {}),
  32. },
  33. overrides: [
  34. {
  35. files: ['*.ts', '*.tsx'],
  36. rules: {},
  37. },
  38. ],
  39. };