From ce58e1bc60e76d69846c441d9518be78c9e24936 Mon Sep 17 00:00:00 2001 From: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com> Date: Fri, 6 Dec 2024 09:32:27 +0100 Subject: [PATCH] Replace deprecated ESLint config by flat config (incl. replacing airbnb plugin) --- .eslintrc.json | 14 -------------- eslint.config.mjs | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 14 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 0f47e60..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "airbnb-base", - "globals": { - "Module": true, - "Log": true, - "MM": true - }, - "rules": { - "comma-dangle": "off", - "object-shorthand": "off", - "func-names": "off", - "space-before-function-paren": "off" - } -} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..fcbd88a --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,40 @@ +import eslintPluginJs from '@eslint/js'; +import eslintPluginStylistic from '@stylistic/eslint-plugin'; +import globals from 'globals'; + +const config = [ + { + files: ['**/*.js', '**/*.mjs'], + }, + { + languageOptions: { + globals: { + ...globals.browser, + ...globals.node, + Log: 'readonly', + MM: 'readonly', + Module: 'readonly', + }, + }, + plugins: { + ...eslintPluginStylistic.configs['all-flat'].plugins, + }, + rules: { + ...eslintPluginJs.configs.recommended.rules, + ...eslintPluginStylistic.configs['all-flat'].rules, + '@stylistic/array-element-newline': 'off', + '@stylistic/brace-style': ['error', '1tbs', {allowSingleLine: true}], + '@stylistic/comma-dangle': ['error', 'only-multiline'], + '@stylistic/dot-location': ['error', 'property'], + '@stylistic/function-call-argument-newline': 'off', + '@stylistic/indent': ['error', 2], + '@stylistic/padded-blocks': 'off', + '@stylistic/quote-props': ['error', 'consistent-as-needed'], + '@stylistic/quotes': ['error', 'single'], + '@stylistic/multiline-comment-style': 'off', + '@stylistic/multiline-ternary': 'off', + }, + } +]; + +export default config;