@domenic/eslint-config
Version:
Domenic Denicola's base ESLint config
328 lines (325 loc) • 11 kB
JavaScript
export default [{
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": "off",
"no-class-assign": "error",
"no-compare-neg-zero": "error",
"no-cond-assign": ["error", "except-parens"],
"no-const-assign": "error",
"no-constant-binary-expression": "error",
"no-constant-condition": ["error", { checkLoops: false }],
"no-constructor-return": "error",
"no-control-regex": "off",
"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": "off",
"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": "off",
"no-unsafe-negation": "error",
"no-unsafe-optional-chaining": [
"error",
{ disallowArithmeticOperators: true },
],
"no-unused-private-class-members": "error",
"no-unused-vars": "error",
"no-use-before-define": ["error", { functions: false }],
"no-useless-backreference": "error",
"require-atomic-updates": "off", // over-trigger-happy
"use-isnan": ["error", { enforceForIndexOf: true }],
"valid-typeof": "error",
// Suggestions
"accessor-pairs": "error",
"arrow-body-style": "off",
"block-scoped-var": "off",
"camelcase": ["error", { properties: "always" }],
"capitalized-comments": "off",
"class-methods-use-this": "off",
"complexity": "off",
"consistent-return": "error",
"consistent-this": "off",
"curly": ["error", "all"],
"default-case-last": "error",
"default-case": "off",
"default-param-last": "error",
"dot-notation": "error",
"eqeqeq": "error",
"func-name-matching": ["error"],
"func-names": "off",
"func-style": ["error", "declaration"],
"grouped-accessor-pairs": ["error", "getBeforeSet"],
"guard-for-in": "off",
"id-denylist": "off",
"id-length": "off",
"id-match": "off",
"init-declarations": "off",
"logical-assignment-operators": "error",
"max-classes-per-file": "off",
"max-depth": "off",
"max-lines-per-function": "off",
"max-lines": "off",
"max-nested-callbacks": "off",
"max-params": "off",
"max-statements": "off",
"multiline-comment-style": ["error", "separate-lines"],
"new-cap": "error",
"no-alert": "error",
"no-array-constructor": "error",
"no-bitwise": "off",
"no-caller": "error",
"no-case-declarations": "error",
"no-confusing-arrow": "off",
"no-console": "error",
"no-continue": "off",
"no-delete-var": "error",
"no-div-regex": "off",
"no-else-return": "error",
"no-empty-function": "off",
"no-empty-static-block": "off",
"no-empty": "error",
"no-eq-null": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-boolean-cast": "error",
"no-extra-label": "error",
"no-extra-semi": "error",
"no-floating-decimal": "error",
"no-global-assign": "error",
"no-implicit-coercion": "error",
"no-implicit-globals": "error",
"no-implied-eval": "error",
"no-inline-comments": "off",
"no-invalid-this": "error",
"no-iterator": "error",
"no-label-var": "error",
"no-labels": ["error", { allowLoop: true }],
"no-lone-blocks": "error",
"no-lonely-if": "error",
"no-loop-func": "error",
"no-magic-numbers": "off",
"no-mixed-operators": [
"error",
{
groups: [
["&", "|", "^", "~", "<<", ">>", ">>>"],
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
["&&", "||"],
["in", "instanceof"],
],
},
],
"no-multi-assign": "off",
"no-multi-str": "error",
"no-negated-condition": "off",
"no-nested-ternary": "error",
"no-new-func": "error",
"no-new-object": "error",
"no-new-wrappers": "error",
"no-new": "error",
"no-nonoctal-decimal-escape": "error",
"no-octal-escape": "error",
"no-octal": "error",
"no-param-reassign": "off",
"no-plusplus": "off",
"no-proto": "error",
"no-redeclare": "error",
"no-regex-spaces": "error",
"no-restricted-exports": "off",
"no-restricted-globals": "off",
"no-restricted-imports": "off",
"no-restricted-properties": "off",
"no-restricted-syntax": "off",
"no-return-assign": ["error", "except-parens"],
"no-return-await": "error",
"no-script-url": "off",
"no-sequences": "error",
"no-shadow-restricted-names": "error",
"no-shadow": "error",
"no-ternary": "off",
"no-throw-literal": "error",
"no-undef-init": "error",
"no-undefined": "off",
"no-underscore-dangle": "off",
"no-unneeded-ternary": "error",
"no-unused-expressions": "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-warning-comments": "off",
"no-with": "error",
"object-shorthand": "error",
"one-var-declaration-per-line": ["error", "initializations"],
"one-var": ["error", { initialized: "never", uninitialized: "always" }],
"operator-assignment": ["error", "always"],
"prefer-arrow-callback": "error",
"prefer-const": [
"error",
{ ignoreReadBeforeAssign: true, destructuring: "all" },
],
"prefer-destructuring": [
"error",
{
VariableDeclarator: { array: false, object: true },
AssignmentExpression: { array: false, object: false },
},
{ enforceForRenamedProperties: false },
],
"prefer-exponentiation-operator": "error",
"prefer-named-capture-group": "off",
"prefer-numeric-literals": "error",
"prefer-object-has-own": "error",
"prefer-object-spread": "error",
"prefer-promise-reject-errors": "error",
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-template": "error",
"quote-props": ["error", "consistent-as-needed"],
"radix": ["error", "as-needed"],
"require-await": "error",
"require-unicode-regexp": "error",
"require-yield": "error",
"sort-imports": "off",
"sort-keys": "off",
"sort-vars": "off",
"spaced-comment": ["error", "always"],
"strict": ["error", "global"],
"symbol-description": "error",
"vars-on-top": "off",
"yoda": ["error", "never", { exceptRange: true }],
// Layout & Formatting
"array-bracket-newline": ["error", { multiline: true }],
"array-bracket-spacing": ["error", "never"],
"array-element-newline": ["error", "consistent"],
"arrow-parens": ["error", "as-needed"],
"arrow-spacing": "error",
"block-spacing": ["error", "always"],
"brace-style": ["error", "1tbs", { allowSingleLine: false }],
"comma-dangle": ["error", "never"],
"comma-spacing": "error",
"comma-style": ["error", "last"],
"computed-property-spacing": ["error", "never"],
"dot-location": ["error", "property"],
"eol-last": "error",
"func-call-spacing": ["error", "never"],
"function-call-argument-newline": ["error", "consistent"],
"function-paren-newline": ["error", "multiline-arguments"],
"generator-star-spacing": ["error", "after"],
"implicit-arrow-linebreak": "error",
"indent": [
"error",
2,
{
SwitchCase: 1,
CallExpression: { arguments: "first" },
FunctionExpression: { parameters: "first" },
ignoredNodes: ["ConditionalExpression"],
},
],
"jsx-quotes": "off",
"key-spacing": [
"error",
{ beforeColon: false, afterColon: true, mode: "strict" },
],
"keyword-spacing": ["error", { before: true, after: true }],
"line-comment-position": "off",
"linebreak-style": ["error", "unix"],
"lines-around-comment": "off",
"lines-between-class-members": "off",
"max-len": ["error", 120, { ignoreUrls: true }],
"max-statements-per-line": ["error", { max: 1 }],
"multiline-ternary": ["error", "always-multiline"],
"new-parens": "error",
"newline-per-chained-call": "off",
"no-extra-parens": [
"error",
"all",
{
conditionalAssign: false,
returnAssign: false,
nestedBinaryExpressions: false,
enforceForNewInMemberExpressions: false,
},
],
"no-mixed-spaces-and-tabs": "error",
"no-multi-spaces": "error",
"no-multiple-empty-lines": "error",
"no-tabs": "error",
"no-trailing-spaces": "error",
"no-whitespace-before-property": "error",
"nonblock-statement-body-position": "error",
"object-curly-newline": ["error", { consistent: true }],
"object-curly-spacing": ["error", "always"],
"object-property-newline": "off",
"operator-linebreak": ["error", "after"],
"padded-blocks": ["error", "never"],
"padding-line-between-statements": "off",
"quotes": [
"error",
"double",
{ avoidEscape: true, allowTemplateLiterals: true },
],
"rest-spread-spacing": "error",
"semi-spacing": "error",
"semi-style": "error",
"semi": ["error", "always"],
"space-before-blocks": ["error", "always"],
"space-before-function-paren": [
"error",
{ anonymous: "always", named: "never" },
],
"space-in-parens": ["error", "never"],
"space-infix-ops": "error",
"space-unary-ops": ["error", { words: true, nonwords: false }],
"switch-colon-spacing": "error",
"template-curly-spacing": ["error", "never"],
"template-tag-spacing": "error",
"unicode-bom": "error",
"wrap-iife": ["error", "inside"],
"wrap-regex": "off",
"yield-star-spacing": ["error", "after"],
},
}];