eslint.config.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. import js from "@eslint/js";
  2. import globals from "globals";
  3. export default [
  4. js.configs.recommended,
  5. {
  6. // Global ignores
  7. ignores: [
  8. "**/*.min.js",
  9. "**/src/lib/**",
  10. "**/dist/",
  11. "packages/backend/src/public/assets/**",
  12. ],
  13. },
  14. {
  15. // Top-level and tools use Node
  16. files: [
  17. "tools/**/*.js",
  18. ],
  19. languageOptions: {
  20. globals: {
  21. ...globals.node,
  22. }
  23. }
  24. },
  25. {
  26. // Back end
  27. files: [
  28. "packages/backend/**/*.js",
  29. "dev-server.js",
  30. "utils.js",
  31. ],
  32. languageOptions: {
  33. globals: {
  34. ...globals.node,
  35. "kv": true,
  36. "def": true,
  37. "use": true,
  38. "ll":true,
  39. }
  40. }
  41. },
  42. {
  43. // Front end
  44. files: [
  45. "index.js",
  46. "initgui.js",
  47. "src/**/*.js",
  48. "packages/**/*.js",
  49. ],
  50. ignores: [
  51. "packages/backend/**/*.js",
  52. ],
  53. languageOptions: {
  54. globals: {
  55. ...globals.browser,
  56. ...globals.commonjs,
  57. "puter": true,
  58. "i18n": true,
  59. "html_encode": true,
  60. "html_decode": true,
  61. "isMobile": true,
  62. // Class Registry
  63. "logger": true,
  64. "def": true,
  65. "use": true,
  66. // Libraries
  67. "saveAs": true, // FileSaver
  68. "iro": true, // iro.js color picker
  69. "$": true, // jQuery
  70. "jQuery": true, // jQuery
  71. "JSZip": true, // JSZip
  72. "_": true, // lodash
  73. "QRCode": true, // qrcode
  74. "io": true, // socket.io
  75. "timeago": true, // timeago
  76. "SelectionArea": true, // viselect
  77. // Puter GUI Globals
  78. "set_menu_item_prop": true,
  79. "determine_active_container_parent": true,
  80. "privacy_aware_path": true,
  81. }
  82. }
  83. },
  84. {
  85. // Tests
  86. files: [
  87. "**/test/**/*.js",
  88. ],
  89. languageOptions: {
  90. globals: {
  91. ...globals.mocha,
  92. }
  93. }
  94. },
  95. {
  96. // Phoenix
  97. files: [
  98. "packages/phoenix/**/*.js",
  99. ],
  100. languageOptions: {
  101. globals: {
  102. ...globals.node,
  103. }
  104. }
  105. },
  106. {
  107. // Global rule settings
  108. rules: {
  109. "no-prototype-builtins": "off", // Complains about any use of hasOwnProperty()
  110. "no-unused-vars": "off", // Temporary, we just have a lot of these
  111. "no-debugger": "warn",
  112. "no-async-promise-executor": "off", // We do this quite often and it's fine
  113. }
  114. },
  115. ];