eslint.config.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import js from "@eslint/js";
  2. import globals from "globals";
  3. import react from "eslint-plugin-react";
  4. import reactHooks from "eslint-plugin-react-hooks";
  5. import reactRefresh from "eslint-plugin-react-refresh";
  6. import preferArrow from "eslint-plugin-prefer-arrow";
  7. import importPlugin from "eslint-plugin-import";
  8. export default [
  9. { ignores: ["dist"] },
  10. {
  11. files: ["**/*.{js,jsx}"],
  12. languageOptions: {
  13. ecmaVersion: 2020,
  14. globals: globals.browser,
  15. parserOptions: {
  16. ecmaVersion: "latest",
  17. ecmaFeatures: { jsx: true },
  18. sourceType: "module",
  19. },
  20. },
  21. settings: { react: { version: "18.3" } },
  22. plugins: {
  23. react,
  24. "react-hooks": reactHooks,
  25. "react-refresh": reactRefresh,
  26. "prefer-arrow": preferArrow,
  27. import: importPlugin,
  28. },
  29. rules: {
  30. ...js.configs.recommended.rules,
  31. ...react.configs.recommended.rules,
  32. ...react.configs["jsx-runtime"].rules,
  33. ...reactHooks.configs.recommended.rules,
  34. "react/jsx-no-target-blank": "off",
  35. "react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
  36. "react/prop-types": "off",
  37. "prefer-arrow/prefer-arrow-functions": [
  38. "error",
  39. {
  40. classPropertiesAllowed: false,
  41. disallowPrototype: true,
  42. singleReturnOnly: false,
  43. },
  44. ],
  45. "prefer-arrow-callback": "error",
  46. "import/order": [
  47. "error",
  48. {
  49. groups: [["builtin", "external"], ["internal"], ["sibling", "parent"]],
  50. "newlines-between": "always",
  51. },
  52. ],
  53. },
  54. },
  55. ];