File tree Expand file tree Collapse file tree 1 file changed +33
-3
lines changed
crates/oxc_linter/src/rules/nextjs Expand file tree Collapse file tree 1 file changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -31,16 +31,46 @@ declare_oxc_lint!(
3131 /// ### Why is this bad?
3232 ///
3333 /// * The custom font you're adding was added to a page - this only adds the font to the specific page and not the entire application.
34- /// * The custom font you're adding was added to a separate component within pages/_document.js - this disables automatic font optimization.
34+ /// * The custom font you're adding was added to a separate component within ` pages/_document.js` - this disables automatic font optimization.
3535 ///
3636 /// ### Examples
3737 ///
3838 /// Examples of **incorrect** code for this rule:
39- /// ```javascript
39+ /// ```jsx
40+ /// // pages/index.jsx
41+ /// import Head from "next/head";
42+ /// function IndexPage() {
43+ /// return (
44+ /// <Head>
45+ /// <link
46+ /// href="https://fonts.googleapis.com/css2?family=Krona+One&display=swap"
47+ /// rel="stylesheet"
48+ /// />
49+ /// </Head>
50+ /// );
51+ /// }
52+ /// export default IndexPage;
4053 /// ```
4154 ///
4255 /// Examples of **correct** code for this rule:
43- /// ```javascript
56+ /// ```jsx
57+ /// // pages/_document.jsx
58+ /// import NextDocument, { Html, Head } from "next/document";
59+ /// class Document extends NextDocument {
60+ /// render() {
61+ /// return (
62+ /// <Html>
63+ /// <Head>
64+ /// <link
65+ /// href="https://fonts.googleapis.com/css2?family=Krona+One&display=swap"
66+ /// rel="stylesheet"
67+ /// />
68+ /// </Head>
69+ /// </Html>
70+ /// );
71+ /// }
72+ /// }
73+ /// export default Document;
4474 /// ```
4575 NoPageCustomFont ,
4676 nextjs,
You can’t perform that action at this time.
0 commit comments