Перейти до вмісту

useInlineScriptId

Цей контент ще не доступний вашою мовою.

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

Enforce id attribute on next/script components with inline content or dangerouslySetInnerHTML.

Using inline scripts or dangerouslySetInnerHTML in next/script components requires an id attribute to ensure that Next.js can track and optimize them correctly.

import Script from 'next/script'
export default function Page() {
return (
<Script>{`console.log('Hello world!');`}</Script>
)
}
code-block.jsx:5:6 lint/nursery/useInlineScriptId ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

next/script components have inline content or `dangerouslySetInnerHTML` without id attribute.

3 │ export default function Page() {
4 │ return (
> 5 │ <Script>{`console.log(‘Hello world!’);`}</Script>
^^^^^^^^
6 │ )
7 │ }

Next.js requires id attribute to track and optimize inline scripts. Without it, performance issues may occur.

See the Next.js docs for more details.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

import Script from 'next/script'
export default function Page() {
return (
<Script dangerouslySetInnerHTML={{ __html: `console.log('Hello world!');` }} />
)
}
code-block.jsx:5:6 lint/nursery/useInlineScriptId ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

next/script components have inline content or `dangerouslySetInnerHTML` without id attribute.

3 │ export default function Page() {
4 │ return (
> 5 │ <Script dangerouslySetInnerHTML={{ __html: `console.log(‘Hello world!’);` }} />
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6 │ )
7 │ }

Next.js requires id attribute to track and optimize inline scripts. Without it, performance issues may occur.

See the Next.js docs for more details.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

import Script from 'next/script'
export default function Page() {
return (
<Script id="my-script">{`console.log('Hello world!');`}</Script>
)
}
import Script from 'next/script'
export default function Page() {
return (
<Script id="my-script" dangerouslySetInnerHTML={{ __html: `console.log('Hello world!');` }} />
)
}