Skip to content

noSyncScripts

¥Summary

¥How to configure

biome.json
{
"linter": {
"rules": {
"nursery": {
"noSyncScripts": "error"
}
}
}
}

¥Description

防止使用同步脚本。

¥Prevent the usage of synchronous scripts.

同步脚本可能会影响网页性能,请阅读更多关于如何避免 高效加载第三方 JavaScript 的内容。

¥A synchronous script can impact your webpage performance, read more on how to Efficiently load third-party JavaScript.

¥Examples

¥Invalid

<script src=""></script>
code-block.html:1:1 lint/nursery/noSyncScripts ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unexpected synchronous script.

> 1 │ <script src=""></script>
^^^^^^^^^^^^^^^
2 │

Synchronous scripts can impact your webpage performance. Add the “async” or “defer” attribute.

¥Valid

<script src="" async></script>
<script src="" defer></script>
<script src="" type="module"></script>

¥Related links