From 6bfa91f7adf0e65e6d210c040d347b13ace9389d Mon Sep 17 00:00:00 2001 From: Paul Pestov <10750176+paulpestov@users.noreply.github.com> Date: Fri, 19 Jul 2024 13:53:25 +0200 Subject: [PATCH] refactor: add linting fixes --- .eslintrc | 20 + .eslintrc.cjs | 50 - .stylelintrc | 20 + cypress.config.cjs | 1 + examples/gfl-local.html | 2 - examples/style.css | 5 +- package-lock.json | 2361 ++++++++--------- package.json | 27 +- src/App.vue | 17 +- src/components/ContentView.vue | 15 +- src/components/ImageView.vue | 19 +- src/components/Loading.vue | 14 - src/components/LoadingSpinner.vue | 39 + .../{Notification.vue => MessageBox.vue} | 5 +- src/components/TreeView.vue | 63 +- src/components/annotations/AnnotationIcon.vue | 4 - .../annotations/AnnotationsList.vue | 15 +- .../annotations/AnnotationsView.vue | 8 +- src/components/base/BaseButton.vue | 25 +- src/components/base/BaseCheckbox.vue | 18 +- src/components/base/BaseDialog.vue | 19 +- src/components/base/BaseDropdown.vue | 5 +- src/components/base/BaseIcon.vue | 2 +- src/components/header/DarkModeToggle.vue | 2 +- src/components/header/GlobalHeader.vue | 22 +- .../{Language.vue => LanguageSwitch.vue} | 0 .../header/{Navbar.vue => NavBar.vue} | 4 +- src/components/header/PanelsToggle.vue | 23 +- src/components/header/SoftwareInfo.vue | 44 +- src/components/header/TitleBar.vue | 22 +- .../header/{Tools.vue => ToolBar.vue} | 6 +- src/components/metadata/Actor.vue | 14 +- .../metadata/CollectionMetadata.vue | 29 +- src/components/metadata/ItemMetadata.vue | 18 +- src/components/metadata/ManifestMetadata.vue | 25 +- src/components/metadata/MetadataItem.vue | 23 +- src/components/metadata/MetadataValue.vue | 19 - src/components/panels/Panel.vue | 139 +- src/components/panels/PanelsWrapper.vue | 2 +- .../panels/actions/PanelImageAction.vue | 5 +- .../panels/actions/PanelToggleAction.vue | 11 +- .../panels/actions/PanelZoomAction.vue | 6 +- src/css/_global.scss | 8 +- src/css/_scrollbar.scss | 1 - src/css/_tooltip.scss | 2 +- src/css/preflight.scss | 13 +- src/services/bookmark.js | 2 +- src/stores/contents.ts | 220 +- src/types.d.ts | 10 +- src/utils/annotations.js | 2 + src/utils/icons/index.js | 1 - tests/mocks/ahiqar/content/ahiqar.css | 12 +- 52 files changed, 1700 insertions(+), 1739 deletions(-) create mode 100644 .eslintrc delete mode 100644 .eslintrc.cjs create mode 100644 .stylelintrc delete mode 100644 src/components/Loading.vue create mode 100644 src/components/LoadingSpinner.vue rename src/components/{Notification.vue => MessageBox.vue} (92%) rename src/components/header/{Language.vue => LanguageSwitch.vue} (100%) rename src/components/header/{Navbar.vue => NavBar.vue} (100%) rename src/components/header/{Tools.vue => ToolBar.vue} (81%) diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 00000000..b72b9895 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,20 @@ +{ + "root": true, + "plugins": [ + "@typescript-eslint" + ], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:vue/vue3-recommended" + ], + "parser": "vue-eslint-parser", + "parserOptions": { + "parser": "@typescript-eslint/parser" + }, + "rules": { + "no-undef": "off", + "vue/multi-word-component-names": "off", + "vue/no-v-html": "off" + } +} diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index f67fb027..00000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,50 +0,0 @@ -module.exports = { - root: true, - - env: { - browser: true, - }, - - extends: [ - 'airbnb-base', - 'plugin:vue/vue3-essential', - '@vue/eslint-config-typescript' - ], - globals: { - ga: true, // Google Analytics - cordova: true, - __statics: true, - process: true, - Capacitor: true, - chrome: true, - }, - - // add your custom rules here - rules: { - 'no-param-reassign': 'off', - 'import/first': 'off', - 'import/named': 'error', - 'import/namespace': 'error', - 'import/default': 'error', - 'import/export': 'error', - 'import/extensions': 'off', - 'import/no-unresolved': 'off', - 'import/no-extraneous-dependencies': 'off', - 'import/prefer-default-export': 'off', - 'import/no-mutable-exports': 'off', - 'prefer-promise-reject-errors': 'off', - 'no-use-before-define': 'off', - 'no-return-assign': 'off', - 'vue/multi-word-component-names': 'off', - 'no-promise-executor-return': 'off', - 'vue/no-deprecated-slot-attribute': 'off', - 'no-throw-literal': 'off', - 'class-methods-use-this': 'off', - - // allow debugger during development only - 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', - 'max-len': 0, - 'allow-parens': 'off', - 'no-plusplus': ['error', { allowForLoopAfterthoughts: true }], - }, -}; diff --git a/.stylelintrc b/.stylelintrc new file mode 100644 index 00000000..20a117c1 --- /dev/null +++ b/.stylelintrc @@ -0,0 +1,20 @@ +{ + "extends": ["stylelint-config-standard"], + "overrides": [ + { + "files": ["*.scss", "**/*.scss"], + "extends": ["stylelint-config-standard-scss"] + }, + { + "files": ["*.vue", "**/*.vue"], + "extends": [ + "stylelint-config-standard-scss", + "stylelint-config-standard-vue/scss" + ] + } + ], + "rules": { + "at-rule-no-unknown": null, + "no-descending-specificity": null + } +} diff --git a/cypress.config.cjs b/cypress.config.cjs index 5757b74c..13c1e355 100644 --- a/cypress.config.cjs +++ b/cypress.config.cjs @@ -4,6 +4,7 @@ module.exports = defineConfig({ viewportWidth: 1400, viewportHeight: 800, experimentalSourceRewriting: true, + chromeWebSecurity: false, screenshotsFolder: 'tests/cypress/screenshots', downloadsFolder: 'tests/cypress/downloads', fixturesFolder: 'tests/cypress/fixtures', diff --git a/examples/gfl-local.html b/examples/gfl-local.html index a5bcd7a9..ec4adf50 100644 --- a/examples/gfl-local.html +++ b/examples/gfl-local.html @@ -21,9 +21,7 @@
- - diff --git a/src/components/LoadingSpinner.vue b/src/components/LoadingSpinner.vue new file mode 100644 index 00000000..a4f05644 --- /dev/null +++ b/src/components/LoadingSpinner.vue @@ -0,0 +1,39 @@ + + + + + diff --git a/src/components/Notification.vue b/src/components/MessageBox.vue similarity index 92% rename from src/components/Notification.vue rename to src/components/MessageBox.vue index ef5d3a73..a691d6fc 100644 --- a/src/components/Notification.vue +++ b/src/components/MessageBox.vue @@ -8,7 +8,10 @@ /> {{ title || message }} -