bem / bem-xjst

bem-xjst (eXtensible JavaScript Templates): declarative template engine for the browser and server
https://bem.github.io/bem-xjst
Other
116 stars 48 forks source link

runtimeLint fails with TypeError: Converting circular structure to JSON #474

Closed tadatuta closed 6 years ago

tadatuta commented 7 years ago
BEMHTML error TypeError: Converting circular structure to JSON
    at JSON.stringify (<anonymous>)
    at /Users/realetive/_dev/bem-express/bundles/desktop.bundles/schedule/schedule.bemhtml.js:3200:36
    at Array.forEach (native)
    at /Users/realetive/_dev/bem-express/bundles/desktop.bundles/schedule/schedule.bemhtml.js:3192:39
    at Array.forEach (native)
    at checkMixes (/Users/realetive/_dev/bem-express/bundles/desktop.bundles/schedule/schedule.bemhtml.js:3186:11)
    at ContextChild.<anonymous> (/Users/realetive/_dev/bem-express/bundles/desktop.bundles/schedule/schedule.bemhtml.js:3369:7)
    at Match.tryCatch (/Users/realetive/_dev/bem-express/bundles/desktop.bundles/schedule/schedule.bemhtml.js:1329:15)
    at Match.exec (/Users/realetive/_dev/bem-express/bundles/desktop.bundles/schedule/schedule.bemhtml.js:1386:16)
    at BEMHTML.renderMix (/Users/realetive/_dev/bem-express/bundles/desktop.bundles/schedule/schedule.bemhtml.js:328:38)

schedule.bemhtml.js.html.zip

// cc @Realetive

miripiruni commented 7 years ago

What steps to reproduce that error?

miripiruni commented 7 years ago

bem-xjst version?

miripiruni commented 7 years ago

Obviously that error from JSON.stringify which is not working with circular structure in JSON.

Realetive commented 7 years ago

@miripiruni bem-xjst@8.6.7

Realetive commented 7 years ago

Obviously that error from JSON.stringify which is not working with circular structure in JSON.

How can I exclude to use it in the future? Because I have not this problem while runtimeLint was disabled.

tadatuta commented 7 years ago

@miripiruni looks like it's in https://github.com/bem/bem-xjst/blob/master/runtime-lint/index.js#L68 (and bellow)

qfox commented 7 years ago

Use util.inspect for the justice!

miripiruni commented 6 years ago

@zxqfox we can not use util.inspect because of different execution environment for bem-xjst (node.js and browsers). I would suggest a custom stringify function.

Realetive commented 6 years ago

🎉