eslint.config.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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-hooks/incompatible-library': 'off',
  28. 'react-refresh/only-export-components': [
  29. 'warn',
  30. { allowConstantExport: true },
  31. ],
  32. 'no-console': 'error',
  33. 'no-unused-vars': 'off',
  34. '@typescript-eslint/no-unused-vars': [
  35. 'error',
  36. {
  37. args: 'all',
  38. argsIgnorePattern: '^_',
  39. caughtErrors: 'all',
  40. caughtErrorsIgnorePattern: '^_',
  41. destructuredArrayIgnorePattern: '^_',
  42. varsIgnorePattern: '^_',
  43. ignoreRestSiblings: true,
  44. },
  45. ],
  46. '@typescript-eslint/consistent-type-imports': [
  47. 'error',
  48. {
  49. prefer: 'type-imports',
  50. fixStyle: 'inline-type-imports',
  51. disallowTypeAnnotations: false,
  52. },
  53. ],
  54. 'no-duplicate-imports': 'error',
  55. },
  56. },
  57. {
  58. files: ['src/routes/**/*.{ts,tsx}'],
  59. plugins: {
  60. 'react-refresh': reactRefresh,
  61. },
  62. rules: {
  63. 'react-refresh/only-export-components': 'off',
  64. },
  65. }
  66. )