eslint.config.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import globals from 'globals'
  2. import js from '@eslint/js'
  3. import pluginQuery from '@tanstack/eslint-plugin-query'
  4. import reactHooks from 'eslint-plugin-react-hooks'
  5. import reactRefresh from 'eslint-plugin-react-refresh'
  6. import { defineConfig } from 'eslint/config'
  7. import tseslint from 'typescript-eslint'
  8. export default defineConfig(
  9. { ignores: ['dist', 'src/components/ui'] },
  10. {
  11. extends: [
  12. js.configs.recommended,
  13. ...tseslint.configs.recommended,
  14. ...pluginQuery.configs['flat/recommended'],
  15. ],
  16. files: ['**/*.{ts,tsx}'],
  17. languageOptions: {
  18. ecmaVersion: 2020,
  19. globals: globals.browser,
  20. },
  21. plugins: {
  22. 'react-hooks': reactHooks,
  23. 'react-refresh': reactRefresh,
  24. },
  25. rules: {
  26. ...reactHooks.configs.recommended.rules,
  27. 'react-refresh/only-export-components': [
  28. 'warn',
  29. { allowConstantExport: true },
  30. ],
  31. 'no-console': 'error',
  32. 'no-unused-vars': 'off',
  33. '@typescript-eslint/no-unused-vars': [
  34. 'error',
  35. {
  36. args: 'all',
  37. argsIgnorePattern: '^_',
  38. caughtErrors: 'all',
  39. caughtErrorsIgnorePattern: '^_',
  40. destructuredArrayIgnorePattern: '^_',
  41. varsIgnorePattern: '^_',
  42. ignoreRestSiblings: true,
  43. },
  44. ],
  45. // Enforce type-only imports for TypeScript types
  46. '@typescript-eslint/consistent-type-imports': [
  47. 'error',
  48. {
  49. prefer: 'type-imports',
  50. fixStyle: 'inline-type-imports',
  51. disallowTypeAnnotations: false,
  52. },
  53. ],
  54. // Prevent duplicate imports from the same module
  55. 'no-duplicate-imports': 'error',
  56. },
  57. }
  58. )