eslint.config.js 2.6 KB

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