diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2024-02-10 23:12:01 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-11 04:12:01 +0000 |
commit | 765f1ede668f70e3af7717bf4d5f05dbf009c7f8 (patch) | |
tree | e73f481c93f8bbaa42f7c8216190fb1cb4621301 /.eslintrc.json | |
parent | 805cf9cb3ea744a6d7c0a5da27fc9ef4e6f08626 (diff) |
Eslint rule updates (#665)
* Padding newline rules
* Update rules
* Update rules
* Update rules
* Updates
* Update object quotes
* Merge similar ts and js rules
* Change export spacing rules
* Move typescript-eslint rules
* Spacing
* Actually save and commit changes
Diffstat (limited to '.eslintrc.json')
-rw-r--r-- | .eslintrc.json | 143 |
1 files changed, 99 insertions, 44 deletions
diff --git a/.eslintrc.json b/.eslintrc.json index 5b6ebd05..32bbdaec 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,8 +3,7 @@ "extends": [ "eslint:recommended", "plugin:jsonc/recommended-with-json", - "plugin:eslint-comments/recommended", - "plugin:@typescript-eslint/recommended" + "plugin:eslint-comments/recommended" ], "parser": "@typescript-eslint/parser", "parserOptions": { @@ -76,34 +75,84 @@ "prefer-const": ["error", {"destructuring": "all"}], "require-atomic-updates": "off", + "@stylistic/array-bracket-newline": ["error", "consistent"], "@stylistic/array-bracket-spacing": ["error", "never"], + "@stylistic/array-element-newline": ["error", "consistent"], "@stylistic/arrow-parens": ["error", "always"], "@stylistic/arrow-spacing": ["error", {"before": true, "after": true}], "@stylistic/block-spacing": ["error", "always"], "@stylistic/brace-style": ["error", "1tbs", {"allowSingleLine": true}], "@stylistic/comma-dangle": ["error", "never"], "@stylistic/comma-spacing": ["error", {"before": false, "after": true}], + "@stylistic/comma-style": ["error", "last"], "@stylistic/computed-property-spacing": ["error", "never"], + "@stylistic/dot-location": ["error", "property"], "@stylistic/eol-last": ["error", "always"], "@stylistic/func-call-spacing": ["error", "never"], + "@stylistic/function-call-argument-newline": ["error", "consistent"], + "@stylistic/function-call-spacing": ["error", "never"], "@stylistic/function-paren-newline": ["error", "multiline-arguments"], "@stylistic/generator-star-spacing": ["error", "before"], + "@stylistic/implicit-arrow-linebreak": ["error", "beside"], "@stylistic/indent": ["error", 4, {"SwitchCase": 1, "MemberExpression": 1, "flatTernaryExpressions": true, "ignoredNodes": ["ConditionalExpression"]}], + "@stylistic/indent-binary-ops": ["error", 0], "@stylistic/key-spacing": ["error", {"beforeColon": false, "afterColon": true, "mode": "strict"}], "@stylistic/keyword-spacing": ["error", {"before": true, "after": true}], + "@stylistic/linebreak-style": ["error", "unix"], + "@stylistic/lines-around-comment": "off", + "@stylistic/lines-between-class-members": ["error", "always", {"exceptAfterSingleLine": true}], + "@stylistic/max-len": "off", + "@stylistic/max-statements-per-line": ["error", {"max": 2}], + "@stylistic/member-delimiter-style": [ + "error", + { + "multiline": {"delimiter": "semi", "requireLast": true}, + "singleline": {"delimiter": "comma", "requireLast": false}, + "multilineDetection": "brackets" + } + ], + "@stylistic/multiline-ternary": ["error", "always-multiline"], "@stylistic/new-parens": "error", + "@stylistic/newline-per-chained-call": ["error", {"ignoreChainWithDepth": 3}], + "@stylistic/no-confusing-arrow": "error", + "@stylistic/no-extra-parens": "off", + "@stylistic/no-extra-semi": "error", + "@stylistic/no-floating-decimal": "error", + "@stylistic/no-mixed-operators": ["error", {"allowSamePrecedence": true, "groups": [["&&", "||"]]}], + "@stylistic/no-mixed-spaces-and-tabs": "error", "@stylistic/no-multi-spaces": "error", - "@stylistic/no-multiple-empty-lines": ["error", {"max": 2}], + "@stylistic/no-multiple-empty-lines": ["error", {"max": 2, "maxEOF": 0, "maxBOF": 0}], + "@stylistic/no-tabs": "error", "@stylistic/no-trailing-spaces": "error", "@stylistic/no-whitespace-before-property": "error", + "@stylistic/nonblock-statement-body-position": ["error", "beside"], "@stylistic/object-curly-newline": "error", "@stylistic/object-curly-spacing": ["error", "never"], + "@stylistic/object-property-newline": ["error", {"allowAllPropertiesOnSameLine": true}], + "@stylistic/one-var-declaration-per-line": ["error", "initializations"], + "@stylistic/operator-linebreak": ["error", "after"], "@stylistic/padded-blocks": ["error", "never"], - "@stylistic/quote-props": ["error", "consistent"], + "@stylistic/padding-line-between-statements": [ + "error", + {"blankLine": "always", "prev": "*", "next": "import"}, + {"blankLine": "always", "prev": "import", "next": "*"}, + {"blankLine": "always", "prev": "*", "next": "export"}, + {"blankLine": "always", "prev": "import", "next": "let"}, + {"blankLine": "always", "prev": "import", "next": "const"}, + {"blankLine": "always", "prev": "export", "next": "let"}, + {"blankLine": "always", "prev": "export", "next": "const"}, + {"blankLine": "always", "prev": "export", "next": "export"}, + {"blankLine": "always", "prev": "export", "next": "type"}, + {"blankLine": "always", "prev": "type", "next": "export"}, + {"blankLine": "always", "prev": "type", "next": "type"}, + {"blankLine": "never", "prev": "import", "next": "import"} + ], + "@stylistic/quote-props": ["error", "consistent-as-needed", {"numbers": true}], "@stylistic/quotes": ["error", "single", "avoid-escape"], "@stylistic/rest-spread-spacing": ["error", "never"], "@stylistic/semi": "error", "@stylistic/semi-spacing": ["error", {"before": false, "after": true}], + "@stylistic/semi-style": ["error", "last"], "@stylistic/space-before-blocks": ["error", "always"], "@stylistic/space-before-function-paren": ["error", {"anonymous": "never", "named": "never", "asyncArrow": "always"}], "@stylistic/space-in-parens": ["error", "never"], @@ -113,7 +162,21 @@ "@stylistic/switch-colon-spacing": ["error", {"after": true, "before": false}], "@stylistic/template-curly-spacing": ["error", "never"], "@stylistic/template-tag-spacing": ["error", "never"], + "@stylistic/type-annotation-spacing": [ + "error", + { + "before": false, + "after": true, + "overrides": { + "arrow": {"before": true, "after": true} + } + } + ], + "@stylistic/type-generic-spacing": "error", + "@stylistic/type-named-tuple-spacing": "error", "@stylistic/wrap-iife": ["error", "inside"], + "@stylistic/wrap-regex": "off", + "@stylistic/yield-star-spacing": ["error", {"before": true, "after": false}], "no-unsanitized/method": "error", "no-unsanitized/property": "error", @@ -184,29 +247,44 @@ "eslint-comments/no-unused-disable": "error", - "unused-imports/no-unused-imports": "error", - - "@typescript-eslint/ban-ts-comment": ["error", {"ts-expect-error": {"descriptionFormat": "^ - .+$"}}], - "@typescript-eslint/ban-types": ["error", {"types": {"object": true}, "extendDefaults": true}], - "@typescript-eslint/consistent-type-exports": "off", - "@typescript-eslint/no-explicit-any": "error", - "@typescript-eslint/no-shadow": ["error", {"builtinGlobals": false}], - "@typescript-eslint/no-this-alias": "error", - "@typescript-eslint/no-unused-vars": "off", - "@typescript-eslint/no-var-requires": "off" + "unused-imports/no-unused-imports": "error" }, "overrides": [ { "files": [ + "*.js", "*.ts" ], + "extends": [ + "plugin:@typescript-eslint/recommended-type-checked" + ], "rules": { - "no-undef": "off", - - "@typescript-eslint/no-unused-vars": ["error", {"vars": "local", "args": "after-used", "argsIgnorePattern": "^_", "caughtErrors": "none"}], + "@typescript-eslint/no-floating-promises": "off", + "@typescript-eslint/no-misused-promises": "off", + "@typescript-eslint/no-redundant-type-constituents": "off", + "@typescript-eslint/no-unsafe-argument": "off", + "@typescript-eslint/no-unsafe-assignment": "off", + "@typescript-eslint/no-unsafe-call": "off", + "@typescript-eslint/no-unsafe-enum-comparison": "off", + "@typescript-eslint/no-unsafe-member-access": "off", + "@typescript-eslint/no-unsafe-return": "off", + "@typescript-eslint/require-await": "off", + "@typescript-eslint/restrict-template-expressions": "off", + "@typescript-eslint/ban-ts-comment": ["error", {"ts-expect-error": {"descriptionFormat": "^ - .+$"}}], + "@typescript-eslint/ban-types": ["error", {"types": {"object": true}, "extendDefaults": true}], + "@typescript-eslint/no-explicit-any": "error", + "@typescript-eslint/no-shadow": ["error", {"builtinGlobals": false}], + "@typescript-eslint/no-this-alias": "error", + "@typescript-eslint/no-unused-vars": ["error", {"vars": "local", "args": "after-used", "argsIgnorePattern": "^_", "caughtErrors": "none"}] + } + }, + { + "files": [ + "*.ts" + ], + "rules": { "@stylistic/block-spacing": "off", - "@stylistic/brace-style": ["error", "1tbs", {"allowSingleLine": true}], "@stylistic/comma-dangle": [ "error", { @@ -220,32 +298,9 @@ "tuples": "always-multiline" } ], - "@stylistic/comma-spacing": ["error", {"before": false, "after": true}], - "@stylistic/function-call-spacing": ["error", "never"], - "@stylistic/indent": ["error", 4], - "@stylistic/key-spacing": ["error", {"beforeColon": false, "afterColon": true, "mode": "strict"}], - "@stylistic/keyword-spacing": ["error", {"before": true, "after": true}], - "@stylistic/lines-around-comment": "off", - "@stylistic/lines-between-class-members": ["error", "always"], - "@stylistic/member-delimiter-style": [ - "error", - { - "multiline": {"delimiter": "semi", "requireLast": true}, - "singleline": {"delimiter": "comma", "requireLast": false}, - "multilineDetection": "brackets" - } - ], - "@stylistic/no-multiple-empty-lines": ["error", {"max": 1, "maxEOF": 0}], - "@stylistic/no-extra-parens": ["error", "all"], - "@stylistic/no-extra-semi": "error", - "@stylistic/object-curly-spacing": ["error", "never"], - "@stylistic/padding-line-between-statements": "off", - "@stylistic/quotes": ["error", "single", "avoid-escape"], - "@stylistic/semi": "error", - "@stylistic/space-before-blocks": ["error", "always"], - "@stylistic/space-before-function-paren": ["error", {"anonymous": "never", "named": "never", "asyncArrow": "always"}], - "@stylistic/space-infix-ops": "error", - "@stylistic/type-annotation-spacing": "error" + "@stylistic/indent-binary-ops": "off", + "@stylistic/no-multiple-empty-lines": ["error", {"max": 1, "maxEOF": 0, "maxBOF": 0}], + "@stylistic/no-extra-parens": ["error", "all"] } }, { |