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

tools,test: provide duration/interval to timers, require it with lint rule #9472

Closed
wants to merge 2 commits into from

Commits on Jan 6, 2017

  1. test,benchmark: provide duration/interval to timers

    There are several places in the code base where setTimeout() or
    setInterval() are called with just a callback and no duration/interval.
    The timers module will use a value of `1` in that situation.
    
    I find an unspecified duration or interval confusing. I always spend a
    moment wondering if it is a mistake. Did the original author simply
    forget to provide a value? Did they intend to use setImmediate() or even
    process.nextTick() instead of setTimeout()? And so on.
    
    This change provides a duration or interval of `1` to all calls in the
    codebase where it is missing. `parallel/test-timers.js` still tests the
    situation where `setTimeout()` and `setInterval()` are called with
    `undefined` and other non-numeric values for the duration/interval.
    Trott committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    defefba View commit details
    Browse the repository at this point in the history
  2. tools: add lint rule to enforce timer arguments

    Add a custom ESLint rule to require that setTimeout() and setInterval()
    get called with at least two arguments. This prevents omitting the
    duration or interval.
    Trott committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    8a4536d View commit details
    Browse the repository at this point in the history