From 41f9cbffe6a2bfed242b4cb5255eb80e642b0e24 Mon Sep 17 00:00:00 2001 From: anapnoe <124302297+anapnoe@users.noreply.github.com> Date: Fri, 20 Sep 2024 13:12:17 +0300 Subject: [PATCH] update Eslint --- .eslintignore | 4 -- .eslintrc.js | 98 ------------------------------------------------ eslint.config.js | 94 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 4 files changed, 95 insertions(+), 103 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc.js create mode 100644 eslint.config.js diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 1cfd9487674..00000000000 --- a/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -extensions -extensions-disabled -repositories -venv \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 2e7258f6b13..00000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,98 +0,0 @@ -/* global module */ -module.exports = { - env: { - browser: true, - es2021: true, - }, - extends: "eslint:recommended", - parserOptions: { - ecmaVersion: "latest", - }, - rules: { - "arrow-spacing": "error", - "block-spacing": "error", - "brace-style": "error", - "comma-dangle": ["error", "only-multiline"], - "comma-spacing": "error", - "comma-style": ["error", "last"], - "curly": ["error", "multi-line", "consistent"], - "eol-last": "error", - "func-call-spacing": "error", - "function-call-argument-newline": ["error", "consistent"], - "function-paren-newline": ["error", "consistent"], - "indent": ["error", 4], - "key-spacing": "error", - "keyword-spacing": "error", - "linebreak-style": ["error", "unix"], - "no-extra-semi": "error", - "no-mixed-spaces-and-tabs": "error", - "no-multi-spaces": "error", - "no-redeclare": ["error", {builtinGlobals: false}], - "no-trailing-spaces": "error", - "no-unused-vars": "off", - "no-whitespace-before-property": "error", - "object-curly-newline": ["error", {consistent: true, multiline: true}], - "object-curly-spacing": ["error", "never"], - "operator-linebreak": ["error", "after"], - "quote-props": ["error", "consistent-as-needed"], - "semi": ["error", "always"], - "semi-spacing": "error", - "semi-style": ["error", "last"], - "space-before-blocks": "error", - "space-before-function-paren": ["error", "never"], - "space-in-parens": ["error", "never"], - "space-infix-ops": "error", - "space-unary-ops": "error", - "switch-colon-spacing": "error", - "template-curly-spacing": ["error", "never"], - "unicode-bom": "error", - }, - globals: { - //script.js - gradioApp: "readonly", - executeCallbacks: "readonly", - onAfterUiUpdate: "readonly", - onOptionsChanged: "readonly", - onUiLoaded: "readonly", - onUiUpdate: "readonly", - uiCurrentTab: "writable", - uiElementInSight: "readonly", - uiElementIsVisible: "readonly", - //ui.js - opts: "writable", - all_gallery_buttons: "readonly", - selected_gallery_button: "readonly", - selected_gallery_index: "readonly", - switch_to_txt2img: "readonly", - switch_to_img2img_tab: "readonly", - switch_to_img2img: "readonly", - switch_to_sketch: "readonly", - switch_to_inpaint: "readonly", - switch_to_inpaint_sketch: "readonly", - switch_to_extras: "readonly", - get_tab_index: "readonly", - create_submit_args: "readonly", - restart_reload: "readonly", - updateInput: "readonly", - onEdit: "readonly", - //extraNetworks.js - requestGet: "readonly", - popup: "readonly", - // profilerVisualization.js - createVisualizationTable: "readonly", - // from python - localization: "readonly", - // progrssbar.js - randomId: "readonly", - requestProgress: "readonly", - // imageviewer.js - modalPrevImage: "readonly", - modalNextImage: "readonly", - // localStorage.js - localSet: "readonly", - localGet: "readonly", - localRemove: "readonly", - // resizeHandle.js - setupResizeHandle: "writable" - } -}; diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000000..9de8690352d --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,94 @@ +/* global module */ +module.exports = { + ignores: [ + "extensions", + "extensions-disabled", + "repositories", + "venv" + ], + languageOptions: { + globals: { + gradioApp: "readonly", + executeCallbacks: "readonly", + onAfterUiUpdate: "readonly", + onOptionsChanged: "readonly", + onUiLoaded: "readonly", + onUiUpdate: "readonly", + uiCurrentTab: "writable", + uiElementInSight: "readonly", + uiElementIsVisible: "readonly", + opts: "writable", + all_gallery_buttons: "readonly", + selected_gallery_button: "readonly", + selected_gallery_index: "readonly", + switch_to_txt2img: "readonly", + switch_to_img2img_tab: "readonly", + switch_to_img2img: "readonly", + switch_to_sketch: "readonly", + switch_to_inpaint: "readonly", + switch_to_inpaint_sketch: "readonly", + switch_to_extras: "readonly", + get_tab_index: "readonly", + create_submit_args: "readonly", + restart_reload: "readonly", + updateInput: "readonly", + onEdit: "readonly", + requestGet: "readonly", + popup: "readonly", + createVisualizationTable: "readonly", + localization: "readonly", + randomId: "readonly", + requestProgress: "readonly", + modalPrevImage: "readonly", + modalNextImage: "readonly", + localSet: "readonly", + localGet: "readonly", + localRemove: "readonly", + setupResizeHandle: "writable" + }, + parserOptions: { + ecmaVersion: "latest", + }, + }, + rules: { + "arrow-spacing": "error", + "block-spacing": "error", + "brace-style": "error", + "comma-dangle": ["error", "only-multiline"], + "comma-spacing": "error", + "comma-style": ["error", "last"], + "curly": ["error", "multi-line", "consistent"], + "eol-last": "error", + "func-call-spacing": "error", + "function-call-argument-newline": ["error", "consistent"], + "function-paren-newline": ["error", "consistent"], + "indent": ["error", 4], + "key-spacing": "error", + "keyword-spacing": "error", + "linebreak-style": ["error", "unix"], + "no-extra-semi": "error", + "no-mixed-spaces-and-tabs": "error", + "no-multi-spaces": "error", + "no-redeclare": ["error", {builtinGlobals: false}], + "no-trailing-spaces": "error", + "no-unused-vars": "off", + "no-whitespace-before-property": "error", + "object-curly-newline": ["error", {consistent: true, multiline: true}], + "object-curly-spacing": ["error", "never"], + "operator-linebreak": ["error", "after"], + "quote-props": ["error", "consistent-as-needed"], + "semi": ["error", "always"], + "semi-spacing": "error", + "semi-style": ["error", "last"], + "space-before-blocks": "error", + "space-before-function-paren": ["error", "never"], + "space-in-parens": "error", + "space-infix-ops": "error", + "space-unary-ops": "error", + "switch-colon-spacing": "error", + "template-curly-spacing": ["error", "never"], + "unicode-bom": "error", + }, + // Add any additional configurations you need directly here, + // or extend from other configurations (if needed) +}; diff --git a/package.json b/package.json index c0ba406787d..bd71a5a18f7 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "stable-diffusion-webui", "version": "0.0.0", "devDependencies": { - "eslint": "^8.40.0" + "eslint": "^8.57.1" }, "scripts": { "lint": "eslint .",