Skip to content

Instantly share code, notes, and snippets.

@otakustay
Created October 31, 2022 10:03
Show Gist options
  • Save otakustay/9095721437857f35924b44bb6c73677f to your computer and use it in GitHub Desktop.
Save otakustay/9095721437857f35924b44bb6c73677f to your computer and use it in GitHub Desktop.
eslint-typescript config
{
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": ["error", {"default": "array-simple", "readonly": "generic"}],
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-expect-eror": "allow-with-description",
"ts-ignore": true,
"ts-nocheck": true,
"ts-check": false,
"minimumDescriptionLength": 3
}
],
"ban-tslint-comment": "error",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/class-literal-property-style": "off",
"@typescript-eslint/consistent-generic-constructors": ["error", "constructor"],
"@typescript-eslint/consistent-indexed-object-style": ["warn", "record"],
"@typescript-eslint/consistent-type-assertions": [
"warn",
{"assertionStyle": "as", "objectLiteralTypeAssertions": "allow-as-parameter"}
],
"@typescript-eslint/consistent-type-definitions": ["warn", "interface"],
"@typescript-eslint/consistent-type-exports": "off",
"@typescript-eslint/consistent-type-imports": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/member-delimiter-style": ["error", {"multiline": "semi", "singleline": "comma"}],
"@typescript-eslint/member-ordering": "warn",
"@typescript-eslint/method-signature-style": "off",
"@typescript-eslint/naming-convention": [
"error",
[
{
"selector": "default",
"format": ["camelCase"],
"leadingUnderscore": "forbid",
"trailingUnderscore": "forbid"
},
{
"selector": "variableLike",
"format": ["camelCase", "UPPER_CASE"],
"leadingUnderscore": "forbid",
"trailingUnderscore": "forbid"
},
{
"selector": "memberLike",
"format": ["camelCase"],
"leadingUnderscore": "forbid",
"trailingUnderscore": "forbid"
},
{
"selector": "property",
"format": ["camelCase"],
"leadingUnderscore": "forbid",
"trailingUnderscore": "forbid"
},
{
"selector": "method",
"format": ["camelCase"],
"leadingUnderscore": "forbid",
"trailingUnderscore": "forbid"
},
{
"selector": "typeLike",
"format": ["PascalCase"],
"leadingUnderscore": "forbid",
"trailingUnderscore": "forbid"
},
{
"selector": "enumMember",
"format": ["PascalCase", "UPPER_CASE"],
"leadingUnderscore": "forbid",
"trailingUnderscore": "forbid"
}
]
],
"@typescript-eslint/no-base-to-string": "warn",
"@typescript-eslint/no-confusing-non-null-assertion": "error",
"@typescript-eslint/no-confusing-void-expression": "error",
"@typescript-eslint/no-duplicate-enum-values": "error",
"@typescript-eslint/no-dynamic-delete": "warn",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-extra-non-null-assertion": "error",
"@typescript-eslint/no-extraneous-class": "warn",
"@typescript-eslint/no-floating-promises": "warn",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-invalid-void-type": "error",
"@typescript-eslint/no-meaningless-void-operator": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
"typescript-eslint/no-non-null-asserted-optional-chain": "warn",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-redundant-type-constituents": "error",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-this-alias": "warn",
"@typescript-eslint/no-type-alias": "off",
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn",
"@typescript-eslint/no-unnecessary-condition": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "warn",
"@typescript-eslint/no-unnecessary-type-arguments": "warn",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-unnecessary-type-constraint": "error",
"@typescript-eslint/no-unsafe-argument": "error",
"@typescript-eslint/no-unsafe-assignment": "error",
"@typescript-eslint/no-unsafe-call": "error",
"@typescript-eslint/no-unsafe-declaration-merging": "error",
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-return": "error",
"@typescript-eslint/no-useless-empty-export": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/non-nullable-type-assertion-style": "warn",
"@typescript-eslint/parameter-properties": "off",
"@typescript-eslint/prefer-as-const": "error",
"@typescript-eslint/prefer-enum-initializers": "warn",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/prefer-includes": "warn",
"@typescript-eslint/prefer-literal-enum-member": ["error", {"allowBitwiseExpressions": true}],
"@typescript-eslint/prefer-namespace-keyword": "off",
"@typescript-eslint/prefer-nullish-coalescing": "warn",
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/prefer-readonly": "warn",
"@typescript-eslint/prefer-readonly-parameter-types": "off",
"@typescript-eslint/prefer-reduce-type-parameter": "off",
"@typescript-eslint/prefer-regexp-exec": "off",
"@typescript-eslint/prefer-return-this-type": "warn",
"@typescript-eslint/prefer-string-starts-ends-with": "warn",
"@typescript-eslint/prefer-ts-expect-error": "error",
"@typescript-eslint/promise-function-async": "off",
"@typescript-eslint/require-array-sort-compare": "off",
"@typescript-eslint/restrict-plus-operands": "error",
"@typescript-eslint/restrict-template-expressions": [
"error",
{
"allowNumber": true,
"allowBoolean": true,
"allowAny": false,
"allowNullish": false,
"allowRegExp": true
}
],
"@typescript-eslint/sort-type-constituents": "off",
"@typescript-eslint/sort-type-union-intersection-members": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/switch-exhaustiveness-check": "warn",
"@typescript-eslint/triple-slash-reference": "off",
"@typescript-eslint/type-annotation-spacing": [
"error",
{
"before": false,
"after": true,
"overrides": {
"arrow": {"before": true, "after": true}
}
}
],
"@typescript-eslint/typedef": "off",
"@typescript-eslint/unbound-method": "off",
"@typescript-eslint/unified-signatures": "off"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment