eslint.config.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. }
  39. }
  40. },
  41. {
  42. // Front end
  43. files: [
  44. "index.js",
  45. "initgui.js",
  46. "src/**/*.js",
  47. "packages/**/*.js",
  48. ],
  49. ignores: [
  50. "packages/backend/**/*.js",
  51. ],
  52. languageOptions: {
  53. globals: {
  54. ...globals.browser,
  55. ...globals.commonjs,
  56. "puter": true,
  57. "i18n": true,
  58. "html_encode": true,
  59. "html_decode": true,
  60. "isMobile": true,
  61. // Class Registry
  62. "logger": true,
  63. "def": true,
  64. "use": true,
  65. // Libraries
  66. "saveAs": true, // FileSaver
  67. "iro": true, // iro.js color picker
  68. "$": true, // jQuery
  69. "jQuery": true, // jQuery
  70. "JSZip": true, // JSZip
  71. "_": true, // lodash
  72. "QRCode": true, // qrcode
  73. "io": true, // socket.io
  74. "timeago": true, // timeago
  75. "SelectionArea": true, // viselect
  76. }
  77. }
  78. },
  79. {
  80. // Tests
  81. files: [
  82. "**/test/**/*.js",
  83. ],
  84. languageOptions: {
  85. globals: {
  86. ...globals.mocha,
  87. }
  88. }
  89. },
  90. {
  91. // Phoenix
  92. files: [
  93. "packages/phoenix/**/*.js",
  94. ],
  95. languageOptions: {
  96. globals: {
  97. ...globals.node,
  98. }
  99. }
  100. },
  101. {
  102. // Global rule settings
  103. rules: {
  104. "no-prototype-builtins": "off", // Complains about any use of hasOwnProperty()
  105. "no-unused-vars": "off", // Temporary, we just have a lot of these
  106. "no-debugger": "warn",
  107. "no-async-promise-executor": "off", // We do this quite often and it's fine
  108. }
  109. },
  110. ];