src/content/docs/linter/rules/no-sync-scripts.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="HTML" icon="seti:html"> :::caution This rule is part of the [nursery](/linter/#nursery) group. This means that it is experimental and the behavior can change at any time. ::: ## Summary - Rule available since: `v2.3.6` - Diagnostic Category: [`lint/nursery/noSyncScripts`](/reference/diagnostics#diagnostic-category) - This rule doesn't have a fix. - The default severity of this rule is [**information**](/reference/diagnostics#information). - Sources: - Same as [`@next/next/no-sync-scripts`](https://nextjs.org/docs/messages/no-sync-scripts){
"linter": {
"rules": {
"nursery": {
"noSyncScripts": "error"
}
}
}
}
Prevent the usage of synchronous scripts.
A synchronous script can impact your webpage performance, read more on how to Efficiently load third-party JavaScript.
<script src=""></script>
<script src="" async></script>
<script src="" defer></script>
<script src="" type="module"></script>
{
"linter": {
"rules": {
"nursery": {
"noSyncScripts": "error"
}
}
}
}
Prevent the usage of synchronous scripts.
A synchronous script can impact your webpage performance, read more on how to Efficiently load third-party JavaScript.
const Invalid = () => <script src="https://third-party-script.js" />;
const Valid = () => {
return (
<>
<script src="https://third-party-script.js" async />
<script src="https://third-party-script.js" defer />
<script src="https://third-party-script.js" type="module" />
</>
);
}
import Script from 'next/script'
const Valid = () => <Script src="https://third-party-script.js" />;