.eslintrc.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* eslint-env node */
  2. const detectDeprecations = !!process.env.SENTRY_DETECT_DEPRECATIONS;
  3. module.exports = {
  4. root: true,
  5. extends: detectDeprecations
  6. ? ['sentry-app/strict', 'plugin:deprecation/recommended']
  7. : ['sentry-app/strict'],
  8. parserOptions: detectDeprecations
  9. ? {
  10. project: './tsconfig.json',
  11. }
  12. : {},
  13. globals: {
  14. require: false,
  15. expect: false,
  16. MockApiClient: true,
  17. tick: true,
  18. jest: true,
  19. },
  20. rules: {
  21. 'react-hooks/exhaustive-deps': [
  22. 'error',
  23. {additionalHooks: '(useEffectAfterFirstRender|useMemoWithPrevious)'},
  24. ],
  25. // TODO(@anonrig): Remove this from eslint-sentry-config
  26. 'space-infix-ops': 'off',
  27. 'object-shorthand': 'off',
  28. 'object-curly-spacing': 'off',
  29. 'import/no-amd': 'off',
  30. 'no-danger-with-children': 'off',
  31. 'no-fallthrough': 'off',
  32. 'no-obj-calls': 'off',
  33. 'array-bracket-spacing': 'off',
  34. 'computed-property-spacing': 'off',
  35. 'react/no-danger-with-children': 'off',
  36. 'jest/no-disabled-tests': 'off',
  37. },
  38. // JSON file formatting is handled by Biome. ESLint should not be linting
  39. // and formatting these files.
  40. ignorePatterns: ['*.json'],
  41. overrides: [
  42. {
  43. files: ['static/**/*.spec.{ts,js}', 'tests/js/**/*.{ts,js}'],
  44. extends: ['plugin:testing-library/react', 'sentry-app/strict'],
  45. rules: {
  46. // TODO(@anonrig): Remove this from eslint-sentry-config
  47. 'space-infix-ops': 'off',
  48. 'object-shorthand': 'off',
  49. 'object-curly-spacing': 'off',
  50. 'import/no-amd': 'off',
  51. 'no-danger-with-children': 'off',
  52. 'no-fallthrough': 'off',
  53. 'no-obj-calls': 'off',
  54. 'array-bracket-spacing': 'off',
  55. 'computed-property-spacing': 'off',
  56. 'react/no-danger-with-children': 'off',
  57. 'jest/no-disabled-tests': 'off',
  58. },
  59. },
  60. {
  61. // We specify rules explicitly for the sdk-loader here so we do not have
  62. // eslint ignore comments included in the source file, which is consumed
  63. // by users.
  64. files: ['**/js-sdk-loader.ts'],
  65. rules: {
  66. 'no-console': 'off',
  67. },
  68. },
  69. ],
  70. };