eslint.config.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import eslint from "@eslint/js";
  2. import tseslint from "typescript-eslint";
  3. import globals from "globals";
  4. export default tseslint.config(
  5. // Global ignores
  6. {
  7. ignores: ["build/", "node_modules/", "coverage/"],
  8. },
  9. // Base config for all files
  10. eslint.configs.recommended,
  11. ...tseslint.configs.recommended,
  12. // TypeScript files config
  13. {
  14. files: ["src/**/*.ts"],
  15. languageOptions: {
  16. ecmaVersion: 2022,
  17. sourceType: "module",
  18. globals: {
  19. ...globals.node,
  20. ...globals.es2022,
  21. },
  22. },
  23. rules: {
  24. "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
  25. "@typescript-eslint/explicit-function-return-type": "off",
  26. "@typescript-eslint/no-explicit-any": "warn",
  27. },
  28. },
  29. // Relaxed rules for test files
  30. {
  31. files: ["src/**/*.test.ts"],
  32. rules: {
  33. // Allow any in test mocks and assertions
  34. "@typescript-eslint/no-explicit-any": "off",
  35. // Allow non-null assertions in tests
  36. "@typescript-eslint/no-non-null-assertion": "off",
  37. },
  38. }
  39. );