From f36d5f1883fd07e402bcece00967ec17cc178e71 Mon Sep 17 00:00:00 2001 From: HGlab <54232526+HGlab01@users.noreply.github.com> Date: Wed, 21 Aug 2024 13:54:23 +0200 Subject: [PATCH] Eslint9 --- .eslintrc.json | 29 -------------------- .github/workflows/test-and-release.yml | 1 - .vscode/extensions.json | 3 ++- eslint.config.mjs | 37 ++++++++++++++++++++++++++ jsonExplorer.js | 2 +- 5 files changed, 40 insertions(+), 32 deletions(-) delete mode 100644 .eslintrc.json create mode 100644 eslint.config.mjs diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index bba65d8..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "env": { - "node": true, - "es6": true - }, - "extends": [ - "eslint:recommended" - ], - "parserOptions": { - "ecmaVersion": 2018 - - }, - "rules": { - "no-console": "off", - "no-var": "error", - "quotes": [ - "error", - "single", - { - "avoidEscape": true, - "allowTemplateLiterals": true - } - ], - "semi": [ - "error", - "always" - ] - } -} diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml index 1b3ecd7..4303fe1 100644 --- a/.github/workflows/test-and-release.yml +++ b/.github/workflows/test-and-release.yml @@ -15,7 +15,6 @@ on: jobs: build: - runs-on: ubuntu-latest strategy: diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 897af65..a7f9c3b 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,5 +1,6 @@ { "recommendations": [ - "dbaeumer.vscode-eslint" + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode" ] } \ No newline at end of file diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..ff2b236 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,37 @@ +import globals from 'globals'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import js from '@eslint/js'; +import { FlatCompat } from '@eslint/eslintrc'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all +}); + +export default [...compat.extends('eslint:recommended'), { + languageOptions: { + globals: { + ...globals.node, + ...globals.mocha + }, + ecmaVersion: 2023, + sourceType: 'module' + }, + rules: { + indent: ['warn', 4, { + SwitchCase: 1 + }], + 'no-console': 'off', + 'no-trailing-spaces': 'error', + quotes: ['error', 'single', { + avoidEscape: true, + allowTemplateLiterals: true + }], + semi: ['error', 'always'], + 'comma-dangle': ['error', 'only-multiline'] + }, +}]; \ No newline at end of file diff --git a/jsonExplorer.js b/jsonExplorer.js index 493ca66..93d1301 100644 --- a/jsonExplorer.js +++ b/jsonExplorer.js @@ -141,7 +141,7 @@ function traverseJson(jObject, parent = null, replaceName = false, replaceID = f /** * Analysis modify element in stateAttr.js and executes command * @param {string} method defines the method to be executed (e.g. round()) - * @param {string | number} value value to be executed + * @param {string | number} value value to be executed */ function modify(method, value) { adapter.log.silly(`Function modify with method "${method}" and value "${value}"`);