diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 21ca7c5..04989aa 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,28 +1,78 @@ module.exports = { - 'env': { - 'es2021': true, - 'node': true, + env: { + es2021: true, + node: true, }, - "extends": "eslint:recommended", - 'overrides': [ + extends: 'eslint:recommended', + overrides: [ { - 'env': { - 'node': true, + env: { + node: true, }, - 'files': [ + files: [ '.eslintrc.{js,cjs}', ], - 'parserOptions': { - 'sourceType': 'script', + parserOptions: { + sourceType: 'script', }, }, ], - 'parserOptions': { - 'ecmaVersion': 'latest', - 'sourceType': 'module', + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', }, - 'rules': { - 'semi': 'error', - 'no-unused-vars': ["error", { "argsIgnorePattern": "^_" }], + plugins: [ + '@stylistic/js', + ], + // https://eslint.org/docs/latest/rules/ + // https://eslint.style/packages/js + rules: { + 'no-unused-vars': ['error', { argsIgnorePattern: '^_' }], + '@stylistic/js/array-bracket-newline': ['error', 'consistent'], + '@stylistic/js/array-bracket-spacing': 'error', + '@stylistic/js/array-element-newline': ['error', 'consistent'], + '@stylistic/js/arrow-parens': ['error', 'as-needed'], + '@stylistic/js/arrow-spacing': 'error', + '@stylistic/js/block-spacing': 'error', + '@stylistic/js/brace-style': 'error', + '@stylistic/js/comma-dangle': ['error', 'always-multiline'], + '@stylistic/js/comma-spacing': 'error', + '@stylistic/js/comma-style': 'error', + '@stylistic/js/eol-last': 'error', + '@stylistic/js/func-call-spacing': 'error', + '@stylistic/js/function-paren-newline': ['error', 'consistent'], + '@stylistic/js/implicit-arrow-linebreak': 'error', + '@stylistic/js/indent': ['error', 2], + '@stylistic/js/key-spacing': 'error', + '@stylistic/js/keyword-spacing': 'error', + '@stylistic/js/linebreak-style': 'error', + '@stylistic/js/no-extra-parens': 'error', + '@stylistic/js/no-extra-semi': 'error', + '@stylistic/js/no-mixed-spaces-and-tabs': 'error', + '@stylistic/js/no-multi-spaces': 'error', + '@stylistic/js/no-multiple-empty-lines': 'error', + '@stylistic/js/no-tabs': 'error', + '@stylistic/js/no-trailing-spaces': 'error', + '@stylistic/js/no-whitespace-before-property': 'error', + '@stylistic/js/nonblock-statement-body-position': 'error', + '@stylistic/js/object-curly-newline': 'error', + '@stylistic/js/object-curly-spacing': ['error', 'always'], + '@stylistic/js/object-property-newline': ['error', { allowAllPropertiesOnSameLine: true }], + '@stylistic/js/quote-props': ['error', 'as-needed'], + '@stylistic/js/quotes': ['error', 'single'], + '@stylistic/js/rest-spread-spacing': 'error', + '@stylistic/js/semi': 'error', + '@stylistic/js/semi-spacing': 'error', + '@stylistic/js/semi-style': 'error', + '@stylistic/js/space-before-blocks': 'error', + '@stylistic/js/space-before-function-paren': ['error', { anonymous: 'never', named: 'never', asyncArrow: 'always' }], + '@stylistic/js/space-in-parens': 'error', + '@stylistic/js/space-infix-ops': 'error', + '@stylistic/js/space-unary-ops': 'error', + '@stylistic/js/spaced-comment': 'error', + '@stylistic/js/switch-colon-spacing': 'error', + '@stylistic/js/template-curly-spacing': 'error', + '@stylistic/js/template-tag-spacing': 'error', + '@stylistic/js/wrap-regex': 'error', }, }; diff --git a/package-lock.json b/package-lock.json index ec60dff..4736f13 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "puppeteer-extra-plugin-stealth": "^2.11.2" }, "devDependencies": { + "@stylistic/eslint-plugin-js": "^1.0.1", "eslint": "^8.53.0" } }, @@ -196,6 +197,21 @@ "@otplib/plugin-thirty-two": "^12.0.1" } }, + "node_modules/@stylistic/eslint-plugin-js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin-js/-/eslint-plugin-js-1.0.1.tgz", + "integrity": "sha512-SfJlEnmBowaWx9GyN/7vQ/7jQP2wVQe5CcaoVL6V5nmCWl9Q+VSeJPSBOjB7XOYSYL1HoEQsvA+8Hy7Zt2XrnA==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "acorn": "^8.11.2", + "escape-string-regexp": "^4.0.0", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esutils": "^2.0.3", + "graphemer": "^1.4.0" + } + }, "node_modules/@types/debug": { "version": "4.1.8", "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.8.tgz", @@ -1733,6 +1749,21 @@ "@otplib/plugin-thirty-two": "^12.0.1" } }, + "@stylistic/eslint-plugin-js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin-js/-/eslint-plugin-js-1.0.1.tgz", + "integrity": "sha512-SfJlEnmBowaWx9GyN/7vQ/7jQP2wVQe5CcaoVL6V5nmCWl9Q+VSeJPSBOjB7XOYSYL1HoEQsvA+8Hy7Zt2XrnA==", + "dev": true, + "requires": { + "@eslint-community/eslint-utils": "^4.4.0", + "acorn": "^8.11.2", + "escape-string-regexp": "^4.0.0", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esutils": "^2.0.3", + "graphemer": "^1.4.0" + } + }, "@types/debug": { "version": "4.1.8", "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.8.tgz", diff --git a/package.json b/package.json index 189e38e..fe2b52b 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "author": "Ralf Vogler", "license": "AGPL-3.0-only", "devDependencies": { + "@stylistic/eslint-plugin-js": "^1.0.1", "eslint": "^8.53.0" } }