bem/bem-xjst

Add static check: warning on several block/mix/attrs/js/etc subpredicates

Opened this issue · 3 comments

block('page')(
    tag()('body'),
    block('content').tag()('article'),
    block('footer').tag()('footer')
)

P.S. Test needed.

Need tests for cases such as block('a').mod('m1', 'v1').mod('m2', 'v2')…

We have three options:

  1. Throw error only in case of block in block case (block('a').block('b')… or block('a')(block('b')…)) (see my commit e7c5cb1)
  2. Throw error in any necessary case: tag().tag()…, mix().mix()…, attrs().attrs()…, js().js()…, content().content()…, etc
  3. Do not throw errors but introduce static check.

IMHO we need a combination of 1 and 3. Because 2 is much more heavy for bundle size.

@veged @zxqfox @tadatuta what are you think about it?

veged commented

let's do this through static check