UNPKG

@yolocat/eslint-config

Version:

My ESLint configuration

271 lines (267 loc) 11.4 kB
module.exports = { plugins: [ "@stylistic" ], rules: { // Possible Problems "array-callback-return": "error", "constructor-super": "error", "for-direction": "error", "getter-return": "error", "no-async-promise-executor": "error", "no-await-in-loop": "error", "no-class-assign": "error", "no-compare-neg-zero": "error", "no-cond-assign": "error", "no-const-assign": "error", "no-constant-binary-expression": "error", "no-constant-condition": "error", "no-constructor-return": "error", "no-control-regex": "error", "no-debugger": "error", "no-dupe-args": "error", "no-dupe-class-members": "error", "no-dupe-else-if": "error", "no-dupe-keys": "error", "no-duplicate-case": "error", "no-duplicate-imports": "error", "no-empty-character-class": "error", "no-empty-pattern": "error", "no-ex-assign": "error", "no-fallthrough": "error", "no-func-assign": "error", "no-import-assign": "error", "no-inner-declarations": "error", "no-invalid-regexp": "error", "no-irregular-whitespace": "error", "no-loss-of-precision": "error", "no-misleading-character-class": "error", "no-new-native-nonconstructor": "error", "no-new-symbol": "error", "no-obj-calls": "error", "no-promise-executor-return": "error", "no-prototype-builtins": "error", "no-self-assign": "error", "no-self-compare": "error", "no-setter-return": "error", "no-sparse-arrays": "error", "no-template-curly-in-string": "error", "no-this-before-super": "error", "no-undef": "error", "no-unexpected-multiline": "error", "no-unmodified-loop-condition": "error", "no-unreachable": "error", "no-unreachable-loop": "error", "no-unsafe-finally": "error", "no-unsafe-negation": "error", "no-unsafe-optional-chaining": "error", "no-unused-private-class-members": "error", "no-unused-vars": "warn", "no-use-before-define": "error", "no-useless-backreference": "error", "require-atomic-updates": "error", "use-isnan": "error", "valid-typeof": "error", // Suggestions "arrow-body-style": ["error", "as-needed"], "block-scoped-var": "error", "capitalized-comments": ["error", "never"], "class-methods-use-this": "error", "consistent-return": "error", "consistent-this": ["error", "self"], "curly": ["error", "multi-line", "consistent"], "default-case": "error", "default-case-last": "error", "default-param-last": "error", "dot-notation": "error", "eqeqeq": "error", "func-name-matching": "error", "func-names": ["error", "as-needed"], "func-style": ["error", "declaration", { "allowArrowFunctions": true }], "grouped-accessor-pairs": "error", "guard-for-in": "error", "id-length": ["error", { "min": 2, "exceptions": ["_"] }], "init-declarations": ["error", "always"], "logical-assignment-operators": ["error", "always"], "multiline-comment-style": ["error", "separate-lines"], "new-cap": "error", "no-alert": "error", "no-array-constructor": "error", "no-bitwise": "warn", "no-caller": "error", "no-case-declarations": "error", "no-console": "warn", "no-delete-var": "error", "no-else-return": "error", "no-empty": "error", "no-eval": "error", "no-extend-native": "error", "no-extra-bind": "error", "no-extra-boolean-cast": "error", "no-extra-label": "error", "no-global-assign": "error", "no-implicit-coercion": "error", "no-implied-eval": "error", "no-invalid-this": "error", "no-iterator": "error", "no-label-var": "error", "no-lone-blocks": "error", "no-multi-assign": "error", "no-multi-str": "error", "no-negated-condition": "error", "no-nested-ternary": "error", "no-new": "error", "no-new-func": "error", "no-new-wrappers": "error", "no-nonoctal-decimal-escape": "error", "no-object-constructor": "error", "no-octal": "error", "no-octal-escape": "error", "no-param-reassign": "error", "no-proto": "error", "no-redeclare": "error", "no-regex-spaces": "error", "no-return-assign": "error", "no-script-url": "error", "no-sequences": "error", "no-shadow": "error", "no-shadow-restricted-names": "error", "no-throw-literal": "error", "no-undef-init": "error", "no-undefined": "error", "no-underscore-dangle": "error", "no-unused-labels": "error", "no-useless-call": "error", "no-useless-catch": "error", "no-useless-computed-key": "error", "no-useless-concat": "error", "no-useless-constructor": "error", "no-useless-escape": "error", "no-useless-rename": "error", "no-useless-return": "error", "no-var": "error", "no-void": "error", "no-with": "error", "object-shorthand": ["error", "always"], "operator-assignment": ["error", "always"], "prefer-arrow-callback": ["error", { "allowNamedFunctions": false }], "prefer-const": "error", "prefer-destructuring": "error", "prefer-exponentiation-operator": "error", "prefer-named-capture-group": "error", "prefer-numeric-literals": "error", "prefer-object-has-own": "error", "prefer-object-spread": "error", "prefer-promise-reject-errors": "error", "prefer-regex-literals": "error", "prefer-rest-params": "error", "prefer-spread": "error", "prefer-template": "error", "radix": "error", "require-unicode-regexp": "error", "require-yield": "error", "strict": "error", "symbol-description": "error", // Layout & Formatting "yoda": ["error", "never"], // ESLint Stylistic "@stylistic/array-bracket-newline": ["error", { "multiline": true }], "@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"], "@stylistic/comma-dangle": ["error", "always-multiline"], "@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/function-call-argument-newline": ["error", "consistent"], "@stylistic/function-call-spacing": ["error", "never"], "@stylistic/function-paren-newline": ["error", "multiline"], "@stylistic/generator-star-spacing": ["error", { "before": false, "after": true }], "@stylistic/implicit-arrow-linebreak": ["error", "beside"], "@stylistic/indent": ["error", "tab"], "@stylistic/indent-binary-ops": ["error", "tab"], "@stylistic/jsx-closing-bracket-location": ["error", "tag-aligned"], "@stylistic/jsx-closing-tag-location": "error", "@stylistic/jsx-curly-brace-presence": ["error", { "props": "never", "children": "always" }], "@stylistic/jsx-curly-newline": ["error", { "multiline": "require", "singleline": "forbid" }], "@stylistic/jsx-curly-spacing": ["error", { "when": "never", "children": { "when": "always" } }], "@stylistic/jsx-equals-spacing": ["error", "never"], "@stylistic/jsx-first-prop-new-line": ["error", "multiline"], "@stylistic/jsx-function-call-newline": ["error", "multiline"], "@stylistic/jsx-indent": ["error", "tab", { "indentLogicalExpressions": true }], "@stylistic/jsx-indent-props": ["error", "tab"], "@stylistic/jsx-newline": ["error", { "prevent": true }], "@stylistic/jsx-one-expression-per-line": ["error", { "allow": "single-child" }], "@stylistic/jsx-pascal-case": "error", "@stylistic/jsx-props-no-multi-spaces": "error", "@stylistic/jsx-quotes": ["error", "prefer-double"], "@stylistic/jsx-self-closing-comp": ["error", { "component": true, "html": true }], "@stylistic/jsx-tag-spacing": ["error", { "closingSlash": "never", "beforeSelfClosing": "always", "afterOpening": "never" }], "@stylistic/jsx-wrap-multilines": ["error", { "declaration": "parens-new-line", "assignment": "parens-new-line", "return": "parens-new-line", "arrow": "parens-new-line", "condition": "parens-new-line", "logical": "parens-new-line", "prop": "parens-new-line", "propertyValue": "parens-new-line" }], "@stylistic/key-spacing": ["error", { "beforeColon": false, "afterColon": true, "mode": "strict" }], "@stylistic/keyword-spacing": ["error", { "before": true, "after": true, "overrides": { "if": { "after": false }, "for": { "after": false }, "while": { "after": false }, "switch": { "after": false }, "catch": { "after": false } } }], "@stylistic/linebreak-style": ["error", "unix"], "@stylistic/lines-between-class-members": ["error", "always"], "@stylistic/max-len": ["error", { "code": 120, "tabWidth": 4, "ignoreUrls": true, "ignoreComments": true, "ignoreTrailingComments": true, "ignoreStrings": true, "ignoreTemplateLiterals": true, "ignoreRegExpLiterals": true }], "@stylistic/max-statements-per-line": ["error", { "max": 2 }], "@stylistic/member-delimiter-style": ["error", { "multiline": { "delimiter": "semi", "requireLast": true }, "singleline": { "delimiter": "semi", "requireLast": true } }], "@stylistic/multiline-ternary": ["error", "always-multiline"], "@stylistic/no-confusing-arrow": "error", "@stylistic/no-extra-parens": ["error", "all", { "nestedBinaryExpressions": false }], "@stylistic/no-extra-semi": "error", "@stylistic/no-floating-decimal": "error", "@stylistic/no-mixed-operators": "error", "@stylistic/no-mixed-spaces-and-tabs": "error", "@stylistic/no-multi-spaces": "error", "@stylistic/no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 1 }], "@stylistic/no-tabs": ["error", { "allowIndentationTabs": true }], "@stylistic/no-trailing-spaces": "error", "@stylistic/no-whitespace-before-property": "error", "@stylistic/nonblock-statement-body-position": ["error", "beside"], "@stylistic/object-curly-newline": ["error", { "multiline": true, "consistent": true }], "@stylistic/object-curly-spacing": ["error", "always"], "@stylistic/object-property-newline": ["error", { "allowAllPropertiesOnSameLine": false }], "@stylistic/operator-linebreak": ["error", "before"], "@stylistic/padded-blocks": ["error", { "blocks": "never", "classes": "always", "switches": "never" }], "@stylistic/quote-props": ["error", "as-needed"], "@stylistic/quotes": ["error", "double", { "avoidEscape": false, "allowTemplateLiterals": true }], "@stylistic/rest-spread-spacing": ["error", "never"], "@stylistic/semi": ["error", "always"], "@stylistic/semi-spacing": "error", "@stylistic/semi-style": ["error", "last"], "@stylistic/space-before-blocks": ["error", "always"], "@stylistic/space-before-function-paren": ["error", "never"], "@stylistic/space-in-parens": ["error", "never"], "@stylistic/space-infix-ops": "error", "@stylistic/space-unary-ops": ["error", { "words": true, "nonwords": false }], "@stylistic/spaced-comment": ["error", "always"], "@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 }], "@stylistic/type-generic-spacing": "error", "@stylistic/type-named-tuple-spacing": "error", "@stylistic/wrap-iife": ["error", "inside"], "@stylistic/yield-star-spacing": ["error", "after"] } }