NEXTJS_NO_BEFORE_INTERACTIVE

Requires review of usage of the beforeInteractive strategy in Script (next/script) elements.
Table of Contents

Conformance is available on Enterprise plans

The default loading strategy for next/script is optimised for fast page loads.

Setting the strategy to beforeInteractive forces the script to load before any Next.js code and before hydration occurs, which delays the page from becoming interactive.

For further reading, see:

This rule will catch the following code.

import Script from 'next/script';
 
export default function MyPage() {
  return (
    <Script src="https://example.com/script.js" strategy="beforeInteractive" />
  );
}

This rule flags any usage of beforeInteractive for review. If approved, the exception should be added to the allowlist.

Last updated on July 23, 2024