From 83b9a8240ea300f0678c9ff68c497e2148c6c86d Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Fri, 30 Aug 2024 14:01:14 +0100 Subject: [PATCH] refactor(linter): fix indentation in `nextjs/no_script_component_in_head` rule (#5338) --- .../nextjs/no_script_component_in_head.rs | 38 ++++++++++--------- .../no_script_component_in_head.snap | 10 ++--- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/crates/oxc_linter/src/rules/nextjs/no_script_component_in_head.rs b/crates/oxc_linter/src/rules/nextjs/no_script_component_in_head.rs index 95d9f4d2e39a3..aee71c512d3ab 100644 --- a/crates/oxc_linter/src/rules/nextjs/no_script_component_in_head.rs +++ b/crates/oxc_linter/src/rules/nextjs/no_script_component_in_head.rs @@ -100,31 +100,33 @@ fn test() { use crate::tester::Tester; let pass = vec![ - r#"import Script from "next/script"; - const Head = ({children}) => children + r#" + import Script from "next/script"; + const Head = ({children}) => children - export default function Index() { - return ( + export default function Index() { + return ( - + - ); - } - "#, + ); + } + "#, ]; let fail = vec![ r#" - import Head from "next/head"; - import Script from "next/script"; - - export default function Index() { - return ( - - - - ); - }"#, + import Head from "next/head"; + import Script from "next/script"; + + export default function Index() { + return ( + + + + ); + } + "#, ]; Tester::new(NoScriptComponentInHead::NAME, pass, fail).test_and_snapshot(); diff --git a/crates/oxc_linter/src/snapshots/no_script_component_in_head.snap b/crates/oxc_linter/src/snapshots/no_script_component_in_head.snap index 59ff113c7a2d9..a20144e969a60 100644 --- a/crates/oxc_linter/src/snapshots/no_script_component_in_head.snap +++ b/crates/oxc_linter/src/snapshots/no_script_component_in_head.snap @@ -2,10 +2,10 @@ source: crates/oxc_linter/src/tester.rs --- ⚠ eslint-plugin-next(no-script-component-in-head): Prevent usage of `next/script` in `next/head` component. - ╭─[no_script_component_in_head.tsx:7:17] - 6 │ return ( - 7 │ - · ──── - 8 │ + ╭─[no_script_component_in_head.tsx:7:13] + 6 │ return ( + 7 │ + · ──── + 8 │ ╰──── help: See https://nextjs.org/docs/messages/no-script-component-in-head