eslintrc: Rework to extend eslint:recommended.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-05-26 18:58:32 -07:00 committed by Tim Abbott
parent 62fcf98b6f
commit e18d49ca30
1 changed files with 16 additions and 102 deletions

View File

@ -3,6 +3,9 @@
"node": true, "node": true,
"es6": true "es6": true
}, },
"extends": [
"eslint:recommended"
],
"parserOptions": { "parserOptions": {
"ecmaVersion": 2019, "ecmaVersion": 2019,
"warnOnUnsupportedTypeScriptVersion": false, "warnOnUnsupportedTypeScriptVersion": false,
@ -17,7 +20,6 @@
"arrow-spacing": [ "error", { "before": true, "after": true } ], "arrow-spacing": [ "error", { "before": true, "after": true } ],
"block-scoped-var": "error", "block-scoped-var": "error",
"brace-style": [ "error", "1tbs", { "allowSingleLine": true } ], "brace-style": [ "error", "1tbs", { "allowSingleLine": true } ],
"camelcase": "off",
"comma-dangle": [ "error", "comma-dangle": [ "error",
{ {
"arrays": "always-multiline", "arrays": "always-multiline",
@ -33,123 +35,73 @@
"after": true "after": true
} }
], ],
"complexity": [ "off", 4 ],
"curly": "error", "curly": "error",
"dot-notation": [ "error", { "allowKeywords": true } ], "dot-notation": "error",
"empty-returns/main": "error", "empty-returns/main": "error",
"eol-last": [ "error", "always" ], "eol-last": "error",
"eqeqeq": "error", "eqeqeq": "error",
"func-style": [ "off", "expression" ],
"guard-for-in": "error", "guard-for-in": "error",
"indent": ["error", 4, { "indent": ["error", 4, {
"ArrayExpression": "first", "ArrayExpression": "first",
"ObjectExpression": "first", "ObjectExpression": "first",
"SwitchCase": 0,
"CallExpression": {"arguments": "first"}, "CallExpression": {"arguments": "first"},
"FunctionExpression": {"parameters": "first"}, "FunctionExpression": {"parameters": "first"},
"FunctionDeclaration": {"parameters": "first"} "FunctionDeclaration": {"parameters": "first"}
}], }],
"key-spacing": [ "error", "key-spacing": "error",
{ "keyword-spacing": "error",
"beforeColon": false,
"afterColon": true
}
],
"keyword-spacing": [ "error",
{
"before": true,
"after": true,
"overrides": {
"return": { "after": true },
"throw": { "after": true },
"case": { "after": true }
}
}
],
"max-depth": [ "off", 4 ],
"max-len": [ "error", 100, 2, "max-len": [ "error", 100, 2,
{ {
"ignoreUrls": true, "ignoreUrls": true,
"ignoreComments": false,
"ignoreRegExpLiterals": true, "ignoreRegExpLiterals": true,
"ignoreStrings": true, "ignoreStrings": true,
"ignoreTemplateLiterals": true "ignoreTemplateLiterals": true
} }
], ],
"max-params": [ "off", 3 ],
"max-statements": [ "off", 10 ],
"new-cap": [ "error", "new-cap": [ "error",
{ {
"newIsCap": true,
"capIsNew": false "capIsNew": false
} }
], ],
"new-parens": "error", "new-parens": "error",
"newline-per-chained-call": "off",
"no-alert": "error", "no-alert": "error",
"no-array-constructor": "error", "no-array-constructor": "error",
"no-bitwise": "error", "no-bitwise": "error",
"no-caller": "error", "no-caller": "error",
"no-case-declarations": "error",
"no-catch-shadow": "error", "no-catch-shadow": "error",
"no-console": "off", "no-constant-condition": ["error", {"checkLoops": false}],
"no-const-assign": "error",
"no-control-regex": "error",
"no-debugger": "error",
"no-delete-var": "error",
"no-div-regex": "error", "no-div-regex": "error",
"no-dupe-class-members": "error",
"no-dupe-keys": "error",
"no-duplicate-imports": "error", "no-duplicate-imports": "error",
"no-else-return": "error", "no-else-return": "error",
"no-empty": "error",
"no-empty-character-class": "error",
"no-eq-null": "error", "no-eq-null": "error",
"no-eval": "error", "no-eval": "error",
"no-ex-assign": "error", "no-extra-parens": "error",
"no-extra-parens": ["error", "all"],
"no-extra-semi": "error",
"no-fallthrough": "error",
"no-floating-decimal": "error", "no-floating-decimal": "error",
"no-func-assign": "error",
"no-implied-eval": "error", "no-implied-eval": "error",
"no-inner-declarations": "off",
"no-iterator": "error", "no-iterator": "error",
"no-label-var": "error", "no-label-var": "error",
"no-labels": "error", "no-labels": "error",
"no-loop-func": "error", "no-loop-func": "error",
"no-mixed-requires": [ "off", false ],
"no-multi-str": "error", "no-multi-str": "error",
"no-native-reassign": "error", "no-native-reassign": "error",
"no-nested-ternary": "off",
"no-new-func": "error", "no-new-func": "error",
"no-new-object": "error", "no-new-object": "error",
"no-new-wrappers": "error", "no-new-wrappers": "error",
"no-obj-calls": "error",
"no-octal": "error",
"no-octal-escape": "error", "no-octal-escape": "error",
"no-param-reassign": "off",
"no-plusplus": "error", "no-plusplus": "error",
"no-proto": "error", "no-proto": "error",
"no-redeclare": "error",
"no-regex-spaces": "error",
"no-restricted-syntax": "off",
"no-return-assign": "error", "no-return-assign": "error",
"no-script-url": "error", "no-script-url": "error",
"no-self-compare": "error", "no-self-compare": "error",
"no-shadow": "off",
"no-sync": "error", "no-sync": "error",
"no-ternary": "off",
"no-trailing-spaces": "error", "no-trailing-spaces": "error",
"no-undef": "error",
"no-undef-init": "error", "no-undef-init": "error",
"no-underscore-dangle": "off",
"no-unneeded-ternary": [ "error", { "defaultAssignment": false } ], "no-unneeded-ternary": [ "error", { "defaultAssignment": false } ],
"no-unreachable": "error",
"no-unused-expressions": "error", "no-unused-expressions": "error",
"no-unused-vars": [ "error", "no-unused-vars": [ "error",
{ {
"vars": "local", "vars": "local",
"args": "after-used",
"varsIgnorePattern": "print_elapsed_time|check_duplicate_ids" "varsIgnorePattern": "print_elapsed_time|check_duplicate_ids"
} }
], ],
@ -163,26 +115,16 @@
"no-var": "error", "no-var": "error",
"space-unary-ops": "error", "space-unary-ops": "error",
"no-whitespace-before-property": "error", "no-whitespace-before-property": "error",
"no-with": "error",
"one-var": [ "error", "never" ], "one-var": [ "error", "never" ],
"padded-blocks": "off",
"prefer-const": [ "error", "prefer-const": [ "error",
{ {
"destructuring": "any",
"ignoreReadBeforeAssign": true "ignoreReadBeforeAssign": true
} }
], ],
"quote-props": [ "error", "as-needed", "quote-props": [ "error", "as-needed" ],
{
"keywords": false,
"unnecessary": true,
"numbers": false
}
],
"quotes": [ "off", "single" ],
"radix": "error", "radix": "error",
"semi": "error", "semi": "error",
"semi-spacing": ["error", {"before": false, "after": true}], "semi-spacing": "error",
"sort-imports": "error", "sort-imports": "error",
"space-before-blocks": "error", "space-before-blocks": "error",
"space-before-function-paren": [ "error", "space-before-function-paren": [ "error",
@ -197,11 +139,8 @@
"spaced-comment": "off", "spaced-comment": "off",
"strict": "off", "strict": "off",
"template-curly-spacing": "error", "template-curly-spacing": "error",
"unnecessary-strict": "off",
"use-isnan": "error",
"valid-typeof": [ "error", { "requireStringLiterals": true } ], "valid-typeof": [ "error", { "requireStringLiterals": true } ],
"wrap-iife": [ "error", "outside", { "functionPrototypeMethods": false } ], "wrap-iife": "error",
"wrap-regex": "off",
"yoda": "error" "yoda": "error"
}, },
"overrides": [ "overrides": [
@ -428,73 +367,48 @@
}, },
{ {
"files": ["**/*.ts"], "files": ["**/*.ts"],
"parser": "@typescript-eslint/parser", "extends": [
"plugin:@typescript-eslint/recommended"
],
"parserOptions": { "parserOptions": {
"project": "tsconfig.json" "project": "tsconfig.json"
}, },
"plugins": ["@typescript-eslint"],
"rules": { "rules": {
// Disable base rule to avoid conflict // Disable base rule to avoid conflict
"empty-returns/main": "off", "empty-returns/main": "off",
"indent": "off", "indent": "off",
"func-call-spacing": "off",
"no-extra-parens": "off", "no-extra-parens": "off",
"no-magic-numbers": "off",
"semi": "off", "semi": "off",
"no-unused-vars": "off", "no-unused-vars": "off",
"no-useless-constructor": "off", "no-useless-constructor": "off",
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": "error", "@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error", "@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/camelcase": "off", "@typescript-eslint/camelcase": "off",
"@typescript-eslint/class-name-casing": "error", "@typescript-eslint/class-name-casing": "error",
"@typescript-eslint/consistent-type-assertions": "error", "@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": ["error", { "allowExpressions": true }], "@typescript-eslint/explicit-function-return-type": ["error", { "allowExpressions": true }],
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/func-call-spacing": "error", "@typescript-eslint/func-call-spacing": "error",
"@typescript-eslint/generic-type-naming": "off",
"@typescript-eslint/indent": "error", "@typescript-eslint/indent": "error",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/member-delimiter-style": "error", "@typescript-eslint/member-delimiter-style": "error",
"@typescript-eslint/member-naming": ["error", { "private": "^_" } ], "@typescript-eslint/member-naming": ["error", { "private": "^_" } ],
"@typescript-eslint/member-ordering": "error", "@typescript-eslint/member-ordering": "error",
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-extra-parens": ["error", "all"], "@typescript-eslint/no-extra-parens": ["error", "all"],
"@typescript-eslint/no-extraneous-class": "error", "@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "off",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-magic-numbers": "off",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "off", "@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-parameter-properties": "error", "@typescript-eslint/no-parameter-properties": "error",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-type-alias": "off",
"@typescript-eslint/no-unnecessary-qualifier": "error", "@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error", "@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "^_" } ], "@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "^_" } ],
"@typescript-eslint/no-use-before-define": "error", "@typescript-eslint/no-use-before-define": "error",
"@typescript-eslint/no-useless-constructor": "error", "@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/prefer-for-of": "off",
"@typescript-eslint/prefer-function-type": "off",
"@typescript-eslint/prefer-includes": "error", "@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-interface": "off",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/prefer-regexp-exec": "error", "@typescript-eslint/prefer-regexp-exec": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error", "@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error", "@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/restrict-plus-operands": "off",
"@typescript-eslint/semi": "error", "@typescript-eslint/semi": "error",
"@typescript-eslint/triple-slash-reference": "error",
"@typescript-eslint/type-annotation-spacing": "error", "@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "off",
"@typescript-eslint/unified-signatures": "error" "@typescript-eslint/unified-signatures": "error"
} }
} }