You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.4 KiB

11 months ago
  1. import globals from "./server/node_modules/globals/index.js"
  2. import eslintRecommended from "./server/node_modules/@eslint/js/src/index.js"
  3. import eslintConfigPrettier from "./server/node_modules/eslint-config-prettier/index.js"
  4. import prettier from "./server/node_modules/eslint-plugin-prettier/eslint-plugin-prettier.js"
  5. import react from "./server/node_modules/eslint-plugin-react/index.js"
  6. import reactRefresh from "./server/node_modules/eslint-plugin-react-refresh/index.js"
  7. import reactHooks from "./server/node_modules/eslint-plugin-react-hooks/index.js"
  8. import ftFlow from "./server/node_modules/eslint-plugin-ft-flow/dist/index.js"
  9. import hermesParser from "./server/node_modules/hermes-eslint/dist/index.js"
  10. const reactRecommended = react.configs.recommended
  11. const jsxRuntime = react.configs["jsx-runtime"]
  12. export default [
  13. eslintRecommended.configs.recommended,
  14. eslintConfigPrettier,
  15. {
  16. ignores: ["**/*.test.js"],
  17. languageOptions: {
  18. parser: hermesParser,
  19. parserOptions: {
  20. ecmaFeatures: { jsx: true }
  21. },
  22. ecmaVersion: 2020,
  23. sourceType: "module",
  24. globals: {
  25. ...globals.browser,
  26. ...globals.es2020,
  27. ...globals.node
  28. }
  29. },
  30. linterOptions: { reportUnusedDisableDirectives: true },
  31. settings: { react: { version: "18.2" } },
  32. plugins: {
  33. ftFlow,
  34. react,
  35. "jsx-runtime": jsxRuntime,
  36. "react-hooks": reactHooks,
  37. prettier
  38. },
  39. rules: {
  40. ...reactRecommended.rules,
  41. ...reactHooks.configs.recommended.rules,
  42. ...ftFlow.recommended,
  43. "no-unused-vars": "warn",
  44. "no-undef": "warn",
  45. "no-empty": "warn",
  46. "no-extra-boolean-cast": "warn",
  47. "prettier/prettier": "warn"
  48. }
  49. },
  50. {
  51. files: ["frontend/src/**/*.js"],
  52. plugins: {
  53. ftFlow,
  54. prettier
  55. },
  56. rules: {
  57. "prettier/prettier": "warn"
  58. }
  59. },
  60. {
  61. files: [
  62. "server/endpoints/**/*.js",
  63. "server/models/**/*.js",
  64. "server/swagger/**/*.js",
  65. "server/utils/**/*.js",
  66. "server/index.js"
  67. ],
  68. rules: {
  69. "no-undef": "warn"
  70. }
  71. },
  72. {
  73. files: ["frontend/src/**/*.jsx"],
  74. plugins: {
  75. ftFlow,
  76. react,
  77. "jsx-runtime": jsxRuntime,
  78. "react-hooks": reactHooks,
  79. "react-refresh": reactRefresh,
  80. prettier
  81. },
  82. rules: {
  83. ...jsxRuntime.rules,
  84. "react/prop-types": "off", // FIXME
  85. "react-refresh/only-export-components": "warn"
  86. }
  87. }
  88. ]