.eslintrc.js 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* global module */
  2. module.exports = {
  3. env: {
  4. browser: true,
  5. es2021: true,
  6. },
  7. extends: "eslint:recommended",
  8. parserOptions: {
  9. ecmaVersion: "latest",
  10. },
  11. rules: {
  12. "arrow-spacing": "error",
  13. "block-spacing": "error",
  14. "brace-style": "error",
  15. "comma-dangle": ["error", "only-multiline"],
  16. "comma-spacing": "error",
  17. "comma-style": ["error", "last"],
  18. "curly": ["error", "multi-line", "consistent"],
  19. "eol-last": "error",
  20. "func-call-spacing": "error",
  21. "function-call-argument-newline": ["error", "consistent"],
  22. "function-paren-newline": ["error", "consistent"],
  23. "indent": ["error", 4],
  24. "key-spacing": "error",
  25. "keyword-spacing": "error",
  26. "linebreak-style": ["error", "unix"],
  27. "no-extra-semi": "error",
  28. "no-mixed-spaces-and-tabs": "error",
  29. "no-multi-spaces": "error",
  30. "no-redeclare": ["error", {builtinGlobals: false}],
  31. "no-trailing-spaces": "error",
  32. "no-unused-vars": "off",
  33. "no-whitespace-before-property": "error",
  34. "object-curly-newline": ["error", {consistent: true, multiline: true}],
  35. "object-curly-spacing": ["error", "never"],
  36. "operator-linebreak": ["error", "after"],
  37. "quote-props": ["error", "consistent-as-needed"],
  38. "semi": ["error", "always"],
  39. "semi-spacing": "error",
  40. "semi-style": ["error", "last"],
  41. "space-before-blocks": "error",
  42. "space-before-function-paren": ["error", "never"],
  43. "space-in-parens": ["error", "never"],
  44. "space-infix-ops": "error",
  45. "space-unary-ops": "error",
  46. "switch-colon-spacing": "error",
  47. "template-curly-spacing": ["error", "never"],
  48. "unicode-bom": "error",
  49. },
  50. globals: {
  51. //script.js
  52. gradioApp: "readonly",
  53. executeCallbacks: "readonly",
  54. onAfterUiUpdate: "readonly",
  55. onOptionsChanged: "readonly",
  56. onUiLoaded: "readonly",
  57. onUiUpdate: "readonly",
  58. uiCurrentTab: "writable",
  59. uiElementInSight: "readonly",
  60. uiElementIsVisible: "readonly",
  61. //ui.js
  62. opts: "writable",
  63. all_gallery_buttons: "readonly",
  64. selected_gallery_button: "readonly",
  65. selected_gallery_index: "readonly",
  66. switch_to_txt2img: "readonly",
  67. switch_to_img2img_tab: "readonly",
  68. switch_to_img2img: "readonly",
  69. switch_to_sketch: "readonly",
  70. switch_to_inpaint: "readonly",
  71. switch_to_inpaint_sketch: "readonly",
  72. switch_to_extras: "readonly",
  73. get_tab_index: "readonly",
  74. create_submit_args: "readonly",
  75. restart_reload: "readonly",
  76. updateInput: "readonly",
  77. onEdit: "readonly",
  78. //extraNetworks.js
  79. requestGet: "readonly",
  80. popup: "readonly",
  81. // profilerVisualization.js
  82. createVisualizationTable: "readonly",
  83. // from python
  84. localization: "readonly",
  85. // progrssbar.js
  86. randomId: "readonly",
  87. requestProgress: "readonly",
  88. // imageviewer.js
  89. modalPrevImage: "readonly",
  90. modalNextImage: "readonly",
  91. // localStorage.js
  92. localSet: "readonly",
  93. localGet: "readonly",
  94. localRemove: "readonly",
  95. // resizeHandle.js
  96. setupResizeHandle: "writable"
  97. }
  98. };