Skip to content

Files

Latest commit

 

History

History
31 lines (24 loc) · 702 Bytes

no-multiple-whitespaces.md

File metadata and controls

31 lines (24 loc) · 702 Bytes

Pattern: Use of multiple whitespaces

Issue: -

Description

Consecutive whitespaces are handled differently in different locales. It also prevents \ linebreaks in JS string which results in awkward whitespaces.

import {defineMessages} from 'react-intl'

const messages = defineMessages({
  // WORKS
  foo: {
    defaultMessage: 'Smileys & People',
  },
  // FAILS
  bar: {
    defaultMessage: 'Smileys &   People',
  },
  // FAILS
  baz: {
    defaultMessage: 'this message is too long \
    so I wanna line break it.',
  },
})

Further Reading