From e8392e65591b99f52c89cbec4554c87b19bde335 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 25 Jul 2021 20:54:38 +0200 Subject: Organized Eslint stuff --- .eslintrc.json | 175 ----------------------------- package.json | 7 -- packages/client/.eslintrc.json | 41 +++++++ packages/client/package.json | 7 ++ packages/eslint-config-base/.eslintrc.json | 10 ++ packages/eslint-config-base/index.js | 139 +++++++++++++++++++++++ packages/eslint-config-base/package.json | 8 ++ packages/server/.eslintrc.json | 17 +++ packages/server/package.json | 6 + test/.eslintrc.json | 17 +++ yarn.lock | 11 +- 11 files changed, 253 insertions(+), 185 deletions(-) delete mode 100644 .eslintrc.json create mode 100644 packages/client/.eslintrc.json create mode 100644 packages/eslint-config-base/.eslintrc.json create mode 100644 packages/eslint-config-base/index.js create mode 100644 packages/eslint-config-base/package.json create mode 100644 packages/server/.eslintrc.json create mode 100644 test/.eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index ce3a490..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,175 +0,0 @@ -{ - "root": true, - "env": { - "commonjs": true, - "es2021": true, - "node": true - }, - "extends": [ - "standard", - "plugin:@typescript-eslint/recommended", - "plugin:vue/vue3-strongly-recommended", - "@vue/standard", - "@vue/typescript" - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 12 - }, - "plugins": [ "@typescript-eslint" ], - "ignorePatterns": [ - "/node_modules" - ], - "rules": { - "no-console": "off", - "no-debugger": "off", - "array-bracket-spacing": [ - "error", - "always" - ], - "array-bracket-newline": [ "warn", "consistent" ], - "array-element-newline": "off", - "arrow-body-style": "off", - "arrow-parens": [ - "error", - "as-needed" - ], - "arrow-spacing": [ - "error", - { - "after": true, - "before": true - } - ], - "brace-style": [ "error", "stroustrup", { "allowSingleLine": false } ], - "camelcase": "off", - "capitalized-comments": [ - "error", - "always" - ], - "comma-spacing": [ - "error", - { - "after": true, - "before": false - } - ], - "comma-style": [ - "error", - "last" - ], - "comma-dangle": [ "error", "never" ], - "computed-property-spacing": [ - "error", - "never" - ], - "curly": [ "error", "all" ], - "dot-notation": "off", - "eol-last": [ - "error", - "never" - ], - "eqeqeq": "error", - "func-names": "off", - "func-style": [ "error", "declaration" ], - "id-length": "off", - "implicit-arrow-linebreak": [ - "error", - "beside" - ], - "indent": [ "warn", "tab" ], - "keyword-spacing": [ "error", { - "before": false, - "overrides": { - "from": { "before": true }, - "for": { "after": false }, - "if": { "after": false }, - "throw": { "after": false }, - "while": { "after": false } - } - } ], - "linebreak-style": [ - "error", - "unix" - ], - "line-comment-position": ["error", { "position": "above" }], - "max-len": "off", - "max-lines": [ "error", 600 ], - "max-params": [ "error", 6 ], - "max-statements": "off", - "multiline-comment-style": [ "error", "bare-block" ], - "no-await-in-loop": "off", - "no-control-regex": "off", - "no-else-return": [ - "error", - { - "allowElseIf": true - } - ], - "no-extra-parens": "off", - "no-magic-numbers": "off", - "no-tabs": "off", - "no-ternary": "off", - "no-underscore-dangle": [ "error", { "allowAfterThis": true } ], - "no-var": "error", - "object-curly-spacing": [ - "error", - "always" - ], - "object-shorthand": "off", - "one-var": "off", - "padded-blocks": "off", - "prefer-arrow-callback": "off", - "prefer-const": "off", - "prefer-destructuring": "off", - "prefer-template": "off", - "quote-props": [ "error", "as-needed" ], - "quotes": [ "error", "double" ], - "semi": [ "error", "always" ], - "semi-style": [ - "error", - "last" - ], - "sort-keys": "off", - "space-before-function-paren": [ "error", "never" ], - "space-in-parens": [ - "error", - "never" - ], - "spaced-comment": [ - "error", - "always" - ], - "strict": [ - "error", - "never" - ], - "template-curly-spacing": [ - "error", - "never" - ], - "unicode-bom": [ - "error", - "never" - ], - "yoda": [ - "error", - "never" - ], - "vue/max-attributes-per-line": [ "warn", { - "singleline": { - "max": 2, - "allowFirstLine": true - }, - "multiline": { - "max": 2, - "allowFirstLine": false - } - } ], - "vue/html-closing-bracket-newline": [ "error", { - "singleline": "never", - "multiline": "never" - } ], - "vue/html-indent": [ "error", "tab" ] - } -} \ No newline at end of file diff --git a/package.json b/package.json index 0539fa6..32ff023 100644 --- a/package.json +++ b/package.json @@ -17,18 +17,11 @@ "devDependencies": { "@types/fs-extra": "^9.0.12", "@types/jest": "^26.0.23", - "client": "^1.0.0", "concurrently": "^6.2.0", "dotenv": "^10.0.0", "eslint": "^7.31.0", - "eslint-config-standard": "^16.0.3", - "eslint-plugin-import": "^2.23.4", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^5.1.0", - "eslint-plugin-vue": "^7.14.0", "fs-extra": "^10.0.0", "jest": "^27.0.6", - "server": "^1.0.0", "ts-jest": "^27.0.3", "typescript": "^4.3.5" } diff --git a/packages/client/.eslintrc.json b/packages/client/.eslintrc.json new file mode 100644 index 0000000..d60df09 --- /dev/null +++ b/packages/client/.eslintrc.json @@ -0,0 +1,41 @@ +{ + "env": { + "node": true + }, + "parser": "vue-eslint-parser", + "parserOptions": { + "parser": "@typescript-eslint/parser" + }, + "extends": [ + "plugin:vue/vue3-strongly-recommended", + "@vue/standard", + "@vue/typescript", + "base" + ], + "overrides": [ + { + "files": ["*.ts"], + "extends": [ + "plugin:@typescript-eslint/recommended" + ] + } + ], + "rules": { + "vue/max-attributes-per-line": [ "warn", { + "singleline": { + "max": 2, + "allowFirstLine": true + }, + "multiline": { + "max": 2, + "allowFirstLine": false + } + } ], + "vue/html-closing-bracket-newline": [ "error", { + "singleline": "never", + "multiline": "never" + } ], + "vue/html-indent": [ "error", "tab" ], + "typescript-eslint/no-var-requires": "off" + } +} \ No newline at end of file diff --git a/packages/client/package.json b/packages/client/package.json index 65496d4..a82dafd 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -32,10 +32,17 @@ "@vue/compiler-sfc": "^3.0.0", "@vue/eslint-config-standard": "^6.0.0", "@vue/eslint-config-typescript": "^7.0.0", + "eslint": "^7.31.0", + "eslint-config-base": "^1.0.0", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^4.2.1", + "eslint-plugin-vue": "^7.14.0", "sass": "^1.26.5", "sass-loader": "^12.1.0", "shared_types": "^1.0.0", "typescript": "^4.3.5", + "vue-eslint-parser": "^7.9.0", "webpack": "^5.46.0" }, "license": "MIT" diff --git a/packages/eslint-config-base/.eslintrc.json b/packages/eslint-config-base/.eslintrc.json new file mode 100644 index 0000000..d79f15b --- /dev/null +++ b/packages/eslint-config-base/.eslintrc.json @@ -0,0 +1,10 @@ +{ + "env": { + "es2021": true, + "node": true + }, + "parserOptions": { + "ecmaVersion": 12 + }, + "extends": "./index.js" +} diff --git a/packages/eslint-config-base/index.js b/packages/eslint-config-base/index.js new file mode 100644 index 0000000..bcd5f24 --- /dev/null +++ b/packages/eslint-config-base/index.js @@ -0,0 +1,139 @@ +module.exports = { + rules: { + "no-console": "off", + "no-debugger": "off", + "array-bracket-spacing": [ + "error", + "always" + ], + "array-bracket-newline": [ "warn", "consistent" ], + "array-element-newline": "off", + "arrow-body-style": "off", + "arrow-parens": [ + "error", + "as-needed" + ], + "arrow-spacing": [ + "error", + { + after: true, + before: true + } + ], + "brace-style": [ "error", "stroustrup", { allowSingleLine: false } ], + camelcase: "off", + "capitalized-comments": [ + "error", + "always" + ], + "comma-spacing": [ + "error", + { + after: true, + before: false + } + ], + "comma-style": [ + "error", + "last" + ], + "comma-dangle": [ "error", "never" ], + "computed-property-spacing": [ + "error", + "never" + ], + curly: [ "error", "all" ], + "dot-notation": "off", + "eol-last": [ + "error", + "never" + ], + eqeqeq: "error", + "func-names": "off", + "func-style": [ "error", "declaration" ], + "id-length": "off", + "implicit-arrow-linebreak": [ + "error", + "beside" + ], + indent: [ "warn", "tab" ], + "keyword-spacing": [ "error", { + before: false, + overrides: { + from: { before: true }, + for: { after: false }, + if: { after: false }, + throw: { after: false }, + while: { after: false } + } + } ], + "linebreak-style": [ + "error", + "unix" + ], + "line-comment-position": [ "error", { position: "above" } ], + "max-len": "off", + "max-lines": [ "error", 600 ], + "max-params": [ "error", 6 ], + "max-statements": "off", + "multiline-comment-style": [ "error", "bare-block" ], + "no-await-in-loop": "off", + "no-control-regex": "off", + "no-else-return": [ + "error", + { + allowElseIf: true + } + ], + "no-extra-parens": "off", + "no-magic-numbers": "off", + "no-tabs": "off", + "no-ternary": "off", + "no-underscore-dangle": [ "error", { allowAfterThis: true } ], + "no-var": "error", + "object-curly-spacing": [ + "error", + "always" + ], + "object-shorthand": "off", + "one-var": "off", + "padded-blocks": "off", + "prefer-arrow-callback": "off", + "prefer-const": "off", + "prefer-destructuring": "off", + "prefer-template": "off", + "quote-props": [ "error", "as-needed" ], + quotes: [ "error", "double" ], + semi: [ "error", "always" ], + "semi-style": [ + "error", + "last" + ], + "sort-keys": "off", + "space-before-function-paren": [ "error", "never" ], + "space-in-parens": [ + "error", + "never" + ], + "spaced-comment": [ + "error", + "always" + ], + strict: [ + "error", + "never" + ], + "template-curly-spacing": [ + "error", + "never" + ], + "unicode-bom": [ + "error", + "never" + ], + yoda: [ + "error", + "never" + ] + } +}; \ No newline at end of file diff --git a/packages/eslint-config-base/package.json b/packages/eslint-config-base/package.json new file mode 100644 index 0000000..51c3fcc --- /dev/null +++ b/packages/eslint-config-base/package.json @@ -0,0 +1,8 @@ +{ + "name": "eslint-config-base", + "version": "1.0.0", + "main": "index.js", + "author": "HampusMat", + "license": "MIT", + "private": true +} diff --git a/packages/server/.eslintrc.json b/packages/server/.eslintrc.json new file mode 100644 index 0000000..6d17384 --- /dev/null +++ b/packages/server/.eslintrc.json @@ -0,0 +1,17 @@ +{ + "env": { + "commonjs": true, + "es2021": true, + "node": true + }, + "extends": [ + "standard", + "plugin:@typescript-eslint/recommended", + "base" + ], + "parserOptions": { + "ecmaVersion": 12, + "parser": "@typescript-eslint/parser" + }, + "plugins": [ "@typescript-eslint" ] +} \ No newline at end of file diff --git a/packages/server/package.json b/packages/server/package.json index f5ff6e1..06ce863 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -24,6 +24,12 @@ "@types/whatwg-url": "^8.2.0", "@typescript-eslint/eslint-plugin": "^4.26.0", "@typescript-eslint/parser": "^4.26.0", + "eslint": "^7.31.0", + "eslint-config-base": " ^1.0.0", + "eslint-config-standard": "^16.0.3", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^5.1.0", "nodemon": "^2.0.12", "shared_types": "^1.0.0", "ts-node": "^10.1.0", diff --git a/test/.eslintrc.json b/test/.eslintrc.json new file mode 100644 index 0000000..6d17384 --- /dev/null +++ b/test/.eslintrc.json @@ -0,0 +1,17 @@ +{ + "env": { + "commonjs": true, + "es2021": true, + "node": true + }, + "extends": [ + "standard", + "plugin:@typescript-eslint/recommended", + "base" + ], + "parserOptions": { + "ecmaVersion": 12, + "parser": "@typescript-eslint/parser" + }, + "plugins": [ "@typescript-eslint" ] +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 660643c..10112be 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4508,6 +4508,11 @@ eslint-plugin-node@^11.1.0: resolve "^1.10.1" semver "^6.1.0" +eslint-plugin-promise@^4.2.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-4.3.1.tgz#61485df2a359e03149fdafc0a68b0e030ad2ac45" + integrity sha512-bY2sGqyptzFBDLh/GMbAxfdJC+b0f23ME63FOE4+Jao0oZ3E1LEwFtWJX/1pGMJLiTtrSSern2CRM/g+dfc0eQ== + eslint-plugin-promise@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-5.1.0.tgz#fb2188fb734e4557993733b41aa1a688f46c6f24" @@ -7838,9 +7843,9 @@ object-copy@^0.1.0: kind-of "^3.0.3" object-inspect@^1.10.3: - version "1.10.3" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.10.3.tgz#c2aa7d2d09f50c99375704f7a0adf24c5782d369" - integrity sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw== + version "1.11.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.11.0.tgz#9dceb146cedd4148a0d9e51ab88d34cf509922b1" + integrity sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg== object-is@^1.0.1: version "1.1.5" -- cgit v1.2.3-18-g5258