Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(eslint-plugin): [no-unsafe-array-reduce] Add rule #1779

Closed

Commits on Mar 21, 2020

  1. feat(eslint-plugin): [no-unsafe-array-reduce] Add rule

    Add rule for protecting against unsafe array reduce calls.
    
    The type of {} is {}. Any object is assignable to {}. {} is assignable
    to any indexed type (`{[key in string]: whatever}`)
    
    A reduce call with an empty object initializer and no type signature,
    will infer the {} type for the accumulator and result of the reduce
    expression. Since anything is assignable to {}, this means the reduce
    function is essentially unchecked. The result of the expression can then
    also be assigned to an incompatible type without raising any errors.
    
    This rule warns if a reduce call takes an empty object as the initial
    value and has no type signatures.
    asmundg committed Mar 21, 2020
    Configuration menu
    Copy the full SHA
    b85866d View commit details
    Browse the repository at this point in the history
  2. Avoid default import

    asmundg committed Mar 21, 2020
    Configuration menu
    Copy the full SHA
    3debc91 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8023661 View commit details
    Browse the repository at this point in the history
  4. Force CI

    asmundg committed Mar 21, 2020
    Configuration menu
    Copy the full SHA
    0d36dda View commit details
    Browse the repository at this point in the history