From 84ec8d3464903cfa8259ff622bff2b19b5c47132 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 7 Mar 2024 19:37:34 +0100 Subject: [PATCH] refactor(ui): cleanup eslint configuration MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- pnpm-lock.yaml | 11 +++++++++++ ui/web/.eslintrc.cjs | 16 ++++++---------- ui/web/package.json | 1 + .../components/actions/AddChargingStations.vue | 2 ++ .../components/actions/SetSupervisionUrl.vue | 1 + .../components/actions/StartTransaction.vue | 1 + ui/web/src/components/buttons/ToggleButton.vue | 1 + .../charging-stations/CSConnector.vue | 3 ++- .../components/charging-stations/CSData.vue | 7 ++++--- ui/web/src/composables/UIClient.ts | 4 +++- ui/web/src/main.ts | 10 ++++++---- ui/web/src/router/index.ts | 5 +++-- ui/web/src/views/ChargingStationsView.vue | 18 ++++++++++-------- ui/web/start.js | 1 + ui/web/tests/unit/CSTable.spec.ts | 3 ++- ui/web/vite.config.ts | 5 +++-- ui/web/vitest.config.ts | 4 +++- 17 files changed, 60 insertions(+), 33 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d8bee504..26aed9cc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -266,6 +266,9 @@ importers: eslint-plugin-import: specifier: ^2.29.1 version: 2.29.1(@typescript-eslint/parser@7.1.1)(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0) + eslint-plugin-simple-import-sort: + specifier: ^12.0.0 + version: 12.0.0(eslint@8.57.0) eslint-plugin-vue: specifier: ^9.22.0 version: 9.22.0(eslint@8.57.0) @@ -5366,6 +5369,14 @@ packages: eslint: 8.57.0 dev: true + /eslint-plugin-simple-import-sort@12.0.0(eslint@8.57.0): + resolution: {integrity: sha512-8o0dVEdAkYap0Cn5kNeklaKcT1nUsa3LITWEuFk3nJifOoD+5JQGoyDUW2W/iPWwBsNBJpyJS9y4je/BgxLcyQ==} + peerDependencies: + eslint: '>=5.0.0' + dependencies: + eslint: 8.57.0 + dev: true + /eslint-plugin-tsdoc@0.2.17: resolution: {integrity: sha512-xRmVi7Zx44lOBuYqG8vzTXuL6IdGOeF9nHX17bjJ8+VE6fsxpdGem0/SBTmAwgYMKYB1WBkqRJVQ+n8GK041pA==} dependencies: diff --git a/ui/web/.eslintrc.cjs b/ui/web/.eslintrc.cjs index 128bff5f..55c077bd 100644 --- a/ui/web/.eslintrc.cjs +++ b/ui/web/.eslintrc.cjs @@ -9,11 +9,12 @@ module.exports = defineConfig({ node: true }, - plugins: ['import'], + plugins: ['simple-import-sort', 'import'], extends: [ 'eslint:recommended', 'plugin:import/recommended', + 'plugin:import/typescript', 'plugin:vue/vue3-recommended', '@vue/eslint-config-typescript/recommended', '@vue/eslint-config-prettier' @@ -28,20 +29,15 @@ module.exports = defineConfig({ }, parserOptions: { + sourceType: 'module', ecmaVersion: 'latest' }, rules: { 'no-console': env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-debugger': env.NODE_ENV === 'production' ? 'warn' : 'off', - 'vue/require-v-for-key': 'off', - 'vue/multi-word-component-names': 'off', - 'sort-imports': [ - 'error', - { - ignoreDeclarationSort: true - } - ], - 'import/order': 'error' + 'simple-import-sort/imports': 'error', + 'simple-import-sort/exports': 'error', + 'vue/multi-word-component-names': 'off' } }) diff --git a/ui/web/package.json b/ui/web/package.json index ce4a83a8..c5bd79c5 100644 --- a/ui/web/package.json +++ b/ui/web/package.json @@ -52,6 +52,7 @@ "eslint-define-config": "^2.1.0", "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.29.1", + "eslint-plugin-simple-import-sort": "^12.0.0", "eslint-plugin-vue": "^9.22.0", "jsdom": "^24.0.0", "prettier": "^3.2.5", diff --git a/ui/web/src/components/actions/AddChargingStations.vue b/ui/web/src/components/actions/AddChargingStations.vue index 6e3c2932..a95cba2b 100644 --- a/ui/web/src/components/actions/AddChargingStations.vue +++ b/ui/web/src/components/actions/AddChargingStations.vue @@ -6,6 +6,7 @@ @@ -95,6 +96,7 @@