---
extends:
- tslint:recommended
- tslint-eslint-rules
- tslint-clean-code
- tslint-no-unused-expression-chai
rules:
  # Class and Member design
  no-unnecessary-class:
  - true
  - allow-constructor-only
  - allow-static-only
  - allow-empty-class
  member-access:
  - true
  - no-public
  member-ordering:
  - true
  - order:
    - private-static-field
    - public-static-field
    - public-instance-field
    - private-instance-field
    - private-constructor
    - public-constructor
    - public-instance-method
    - protected-instance-method
    - private-instance-method
  adjacent-overload-signatures: true
  unified-signatures: true
  prefer-function-over-method:
  - true
  - allow-public
  - allow-protected
  no-invalid-this:
  - true
  - check-function-in-method
  no-duplicate-super: true
  new-parens: true
  no-misused-new: true
  no-construct: true

  # Interface design
  no-empty-interface: true
  prefer-method-signature: true
  interface-over-type-literal: false
  interface-name:
  - true
  - never-prefix

  # Function design
  no-arg: true
  only-arrow-functions:
  - true
  - allow-declarations
  - allow-named-functions
  arrow-parens:
  - true
  - ban-single-arg-parens
  arrow-return-shorthand: true
  no-return-await: true

  # Variable design
  prefer-const: true
  no-shadowed-variable:
  - true
  - temporalDeadZone
  one-variable-per-declaration:
  - true
  - ignore-for-loop
  no-duplicate-variable:
  - true
  - check-parameters
  no-unnecessary-initializer: true

  # Requires and Imports
  no-implicit-dependencies:
  - true
  - dev
  ordered-imports:
  - true
  - import-sources-order: lowercase-last
    named-imports-order: case-insensitive
    grouped-imports: true
  no-duplicate-imports: true
  no-require-imports: true
  no-default-export: true
  no-reference: true

  # Types
  typedef:
  - true
  - call-signature
  - property-declaration
  no-inferrable-types:
  - true
  - ignore-params
  no-angle-bracket-type-assertion: true
  callable-types: true
  no-null-keyword: true
  no-non-null-assertion: true
  array-type:
  - true
  - generic

  # Objects
  prefer-object-spread: true
  object-literal-shorthand: true
  object-literal-key-quotes:
  - true
  - as-needed
  no-string-literal: false

  # Strings
  quotemark:
  - true
  - single
  - avoid-template
  - avoid-escape
  prefer-template: true
  no-invalid-template-strings: true

  # Operators
  triple-equals:
  - true
  - allow-null-check
  binary-expression-operand-order: true
  no-dynamic-delete: true
  no-bitwise: true
  use-isnan: true
  no-conditional-assignment: true

  # Conditional statements
  prefer-conditional-expression:
  - true
  - check-else-if

  # For statement
  prefer-for-of: true
  forin: true

  # Switch statement
  switch-default: true
  no-switch-case-fall-through: true
  no-duplicate-switch-case: true

  # Try statement
  no-unsafe-finally: true

  # Maintainability
  encoding: true
  cyclomatic-complexity:
  - true
  - 20
  max-file-line-count:
  - true
  - 1500
  max-line-length:
  - true
  - 140
  indent:
  - true
  - spaces
  - 2
  eofline: true
  no-unused-variable:
  - true
  - check-parameters
  - ignore-pattern: "^_"

  # Layout
  curly:
  - false
  whitespace:
  - true
  - check-branch
  - check-decl
  - check-operator
  - check-module
  - check-separator
  - check-rest-spread
  - check-type
  - check-typecast
  - check-type-operator
  - check-preblock
  typedef-whitespace:
  - true
  - call-signature: nospace
    index-signature: nospace
    parameter: nospace
    property-declaration: nospace
    variable-declaration: nospace
  - call-signature: onespace
    index-signature: onespace
    parameter: onespace
    property-declaration: onespace
    variable-declaration: onespace
  space-before-function-paren:
  - true
  - anonymous: never
    named: never
    asyncArrow: always
    method: never
    constructor: never
  space-within-parens: 0
  import-spacing: true
  no-trailing-whitespace: true

  # Empty lines
  newline-before-return: true
  newline-per-chained-call: true
  one-line:
  - true
  - check-open-brace
  - check-catch
  - check-else
  - check-whitespace
  no-consecutive-blank-lines:
  - true
  - 1

  # Alignment
  semicolon:
  - true
  - never
  align:
  - true
  - parameters
  - statements
  trailing-comma:
  - true
  - multiline: never
    singleline: never

  # Naming
  class-name: true
  variable-name:
  - true
  - check-format
  - allow-leading-underscore
  - ban-keywords

  # Documentation
  comment-format:
  - true
  - check-space
  jsdoc-format:
  - true
  - check-multiline-start
  no-redundant-jsdoc: true

  # Misc
  no-console:
  - true
  - debug
  - info
  - time
  - timeEnd
  - trace
  no-debugger: true
  no-eval: true
  no-string-throw: true
  no-namespace: true
  no-internal-module: true
  radix: true
  no-unused-expression-chai:
  - true
  - allow-fast-null-checks
  no-empty: true
  no-sparse-arrays: true
  label-position: true
  no-use-before-declare: true
  no-var-keyword: true
  object-literal-sort-keys: false

  # tslint-eslint-rules
  ter-padded-blocks:
  - true
  - never
  ter-no-irregular-whitespace: true
  ter-no-sparse-arrays: true
  ter-indent:
  - true
  - 2
  - SwitchCase: 1

  # tslint-clean-code
  id-length:
  - true
  - - _
    - x
    - y
    - i
    - j
    - T
  try-catch-first: true
  no-map-without-usage: true
  no-complex-conditionals: true
  prefer-dry-conditionals: true
  no-flag-args: true
  max-func-args: true
  no-for-each-push: true