Closed
Description
IMO, modules that have side-effect just from requiring them are really bad. I would like to see a rule that forbids importing/requiring modules that are not assigned, which implicitly means there is a side-effect or simply not used and therefore useless.
Invalid
import 'dosideeffect';
import './dosideeffect';
require('./dosideeffect');
Valid
import foo from 'bar';
// Explicit effect
import doEffect from './dosideeffect';
doEffect();
As far as rule name goes: no-unnassigned-import
, no-side-effect-import
, ...? I'm leaning toward the former at the moment, though it doesn't capture the rationale of it.