over_react_style_missing_unit

Severity: AnalysisErrorSeverity.ERROR

Maturity: stable

Since 1.0.0

View the Project on GitHub workiva/over_react

ALWAYS Use CSS property values that are strings with units, or numbers (in which case px will be inferred).

GOOD:

@override
render() {
  return (Dom.div()..style = {'width': 80})(
    'I am eighty pixels wide!',
  );
}

GOOD:

@override
render() {
  return (Dom.div()..style = {'width': '80px'})(
    'I am also eighty pixels wide!',
  );
}

BAD:

@override
render() {
  return (Dom.div()..style = {'width': '80'})(
    'I never rendered because of a ReactJS runtime error :(',
  );
}