49

Module build failed: Module failed because of a eslint error.

217:15 error 'param' is assigned a value but never used no-unused-vars

Me:
Don't do it
Don't do it
Don't do it
Don't do it
Don't do it
Don't do it
Don't do it
Don't do it
Don't do it
Don't do it
Don't do it
Don't do it

Me:
console.log(param);

Comments
  • 4
    I do the same, even if it's just a warning...
  • 2
    Sometimes, unused parameters can be good design if that's necessary for having a uniform interface across similar functions.

    But that should not be logged, rather some "unused" macro or so should be used.
  • 3
    @Fast-Nop Can you give me an example where it would make sense to keep an unused variable?
    I would sure as hell remove it if I saw it in the code.
  • 2
    @PonySlaystation the main() function when you don't need argv and argc, for example.

    Or in general, if you have say 10 tool functions with identical prototype, but the 11th doesn't need one of the variables. I'd keep the variable in the 11th, too, because then you always call all of them in the same way.
  • 4
    // eslint-disable-line
  • 1
    That reminds me of my days in Uni, our C code had to compile with an ludicrous set of warning to error setup and of course unused parameters was one of them, the trick -> (void) param;
  • 1
    @PonySlaystation Global vars in headers throw that warning for every file that imports it if they're not part of a class, even if used in said file that imports it.
  • 3
    @Parzi Global vars... *shivers*
  • 2
    @PonySlaystation i've had a few be required in C in low-RAM situations (4MB, Nintendo DS) but if I were working with more RAM (say, 16MB, Nintendo DSi in DSi mode) it'd be perfectly fine to not use them and implement other things, but no...

    By the way, fuck the DS. "Oh, computers have like 4GB of RAM or so. Let's give it 4 megs instead so we can squeeze both an ARM7 and ARM9 on it."
Add Comment