@neralabs/rerail-pack-next 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +92 -2
- package/licenses/next.js/UPSTREAM.md +8 -0
- package/pack.json +31 -4
- package/package.json +1 -1
- package/rules/next-google-font-display.json +135 -0
- package/rules/next-google-font-preconnect.json +1 -1
- package/rules/next-inline-script-id.json +1 -1
- package/rules/next-next-script-for-ga.json +2 -2
- package/rules/next-no-assign-module-variable.json +1 -1
- package/rules/next-no-async-client-component.json +3 -3
- package/rules/next-no-before-interactive-script-outside-document.json +2 -2
- package/rules/next-no-css-tags.json +2 -2
- package/rules/next-no-document-import-in-page.json +2 -2
- package/rules/next-no-duplicate-head.json +1 -1
- package/rules/next-no-head-element.json +78 -0
- package/rules/next-no-head-import-in-document.json +2 -2
- package/rules/next-no-img-element.json +3 -3
- package/rules/next-no-location-assign-relative-destination.json +432 -0
- package/rules/next-no-page-custom-font.json +341 -0
- package/rules/next-no-script-component-in-head.json +2 -2
- package/rules/next-no-styled-jsx-in-document.json +2 -2
- package/rules/next-no-sync-scripts.json +2 -2
- package/rules/next-no-title-in-document-head.json +2 -2
- package/rules/next-no-typos.json +1 -1
- package/rules/next-no-unwanted-polyfillio.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Rerail rule pack: Next.js
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
21 code rules for Next.js projects, ported from `@next/eslint-plugin-next` 16.3.8. Each is scored against the
|
|
4
4
|
plugin's own findings on the plugin's rule tests, through the engine's production workspace path; no disagreement is
|
|
5
5
|
declared today, so the pack has no `divergences.json`.
|
|
6
6
|
|
|
@@ -13,7 +13,7 @@ The pack follows the [pack structure and validation contract](../../docs/pack-fo
|
|
|
13
13
|
| `rules/` | The code-rule documents (`rerail.policy/v1`) |
|
|
14
14
|
| `conformance.json` | Each ported rule's upstream rule, how findings compare, and the capabilities it exercises, the shipped rules first and then the candidates; the pinned plugin and the pinned corpora (shadcn-ui, next-examples, commerce) |
|
|
15
15
|
| `upstream/eslint-plugin-next/` | The plugin's copied rule tests (`tests/`) and the cases extracted from them (`fixtures/`), its recordings (`fixtures.expected.json`, `corpus-<name>.expected.json`, `fixtures.cases.json`) and the recorder (`generate.mjs`) |
|
|
16
|
-
| `candidates/` | Ports that cannot pass their fixtures yet or that fail the
|
|
16
|
+
| `candidates/` | Ports that cannot pass their fixtures yet or that fail the port readiness gates (`rules/`, none today; scored through `conformance.json`, never gating), the Next fact model's probes (`probes/`), and the generators that write them and `rules/` (`build-policies.mjs`, `build-probes.mjs`) |
|
|
17
17
|
| `licenses/next.js/` | Next.js's licence and `UPSTREAM.md`, listing every copied file |
|
|
18
18
|
|
|
19
19
|
The rule documents, `conformance.json`'s and `pack.json`'s rule lists and the candidates are generated, offline:
|
|
@@ -35,3 +35,93 @@ Scoring one rule, shipped or candidate, with every false positive and false nega
|
|
|
35
35
|
```sh
|
|
36
36
|
node --import tsx conformance/languages/cli.ts --pack next --rule next-no-img-element --fixtures
|
|
37
37
|
```
|
|
38
|
+
|
|
39
|
+
## Rule details
|
|
40
|
+
|
|
41
|
+
What each rule matches beyond its one-line description: exact matching, edge cases, upstream settings and known divergences.
|
|
42
|
+
|
|
43
|
+
All rules in this chunk are ports of `@next/eslint-plugin-next` 16.3.8 (rule `@next/next/<name>`). Note: the rule documents are generated by `packs/next/candidates/build-policies.mjs`, which prefixes each description with the upstream version and rule code (line ~139); re-running it overwrites the rewritten descriptions unless the generator is updated too.
|
|
44
|
+
|
|
45
|
+
### `next-google-font-display`
|
|
46
|
+
|
|
47
|
+
Matches a `<link>` whose literal `href` is a Google Fonts CSS URL (`https://fonts.googleapis.com/css...`) whose query has no `display` parameter, or has `display=auto`, `block` or `fallback`.
|
|
48
|
+
|
|
49
|
+
### `next-google-font-preconnect`
|
|
50
|
+
|
|
51
|
+
Matches a `<link>` whose literal `href` starts with `https://fonts.gstatic.com` and whose `rel` is not the literal `"preconnect"`.
|
|
52
|
+
|
|
53
|
+
### `next-inline-script-id`
|
|
54
|
+
|
|
55
|
+
Matches an element named by the first local name that an import from `next/script` binds, with children or `dangerouslySetInnerHTML` and no `id`. Attributes and the keys of object-literal spreads count; any other spread makes the element uncheckable (no finding).
|
|
56
|
+
|
|
57
|
+
### `next-next-script-for-ga`
|
|
58
|
+
|
|
59
|
+
Matches a `<script>` with a literal `src` containing the Google Analytics or gtag URL, or whose `dangerouslySetInnerHTML` object's first property is a template literal whose first quasi contains the GA or GTM script URL.
|
|
60
|
+
|
|
61
|
+
### `next-no-assign-module-variable`
|
|
62
|
+
|
|
63
|
+
Matches any variable declaration with a declarator whose identifier is `module`.
|
|
64
|
+
|
|
65
|
+
### `next-no-async-client-component`
|
|
66
|
+
|
|
67
|
+
Only after a top-level `"use client"` statement. Matches an `export default async function` with a capitalized name, or the first top-level declaration of the capitalized name that `export default` exports when it is an async function or a variable initialized with an async arrow.
|
|
68
|
+
|
|
69
|
+
### `next-no-before-interactive-script-outside-document`
|
|
70
|
+
|
|
71
|
+
Matches an opening element named by the default import of `next/script` with a plain `strategy="beforeInteractive"`, unless the path contains `/app/` or its segment after the first `pages` has a name starting with `_document`.
|
|
72
|
+
|
|
73
|
+
### `next-no-css-tags`
|
|
74
|
+
|
|
75
|
+
Matches a `<link>` with `rel="stylesheet"` and a string `href` that does not start with `http(s)`.
|
|
76
|
+
|
|
77
|
+
### `next-no-document-import-in-page`
|
|
78
|
+
|
|
79
|
+
Matches an import from `next/document` unless the part of the path after its last `pages` is empty or starts with `/_document`.
|
|
80
|
+
|
|
81
|
+
### `next-no-duplicate-head`
|
|
82
|
+
|
|
83
|
+
Flags every `<Head>` child of a returned element after the first, in a `return` inside a class extending the default import of `next/document`.
|
|
84
|
+
|
|
85
|
+
### `next-no-head-element`
|
|
86
|
+
|
|
87
|
+
Matches a `<head>` opening element unless the file's path contains `app/`.
|
|
88
|
+
|
|
89
|
+
### `next-no-head-import-in-document`
|
|
90
|
+
|
|
91
|
+
Matches an import from `next/head` in a file whose path, between its first and second `pages`, names a document (name starts with `_document`, or `/_document/index`).
|
|
92
|
+
|
|
93
|
+
### `next-no-img-element`
|
|
94
|
+
|
|
95
|
+
Matches an `<img>` opening element with attributes that is not a direct child of `<picture>`, unless the file is an app-dir metadata image route (path relative to the ESLint cwd matches `^(src/)?app/` and `/opengraph-image|twitter-image|icon.<ext>`). The violation message is upstream's plus Rerail additions (NER-1946): what `<Image />` needs (`width` and `height` or `fill`; a matching `images.remotePatterns` entry for a remote `src`) and the eslint-disable comment that keeps `<img>`.
|
|
96
|
+
|
|
97
|
+
### `next-no-location-assign-relative-destination`
|
|
98
|
+
|
|
99
|
+
Matches an assignment to `location.href` (or `window`/`globalThis`/`document`/`self` `.location.href`) or a call of its `assign()`, whose value's static string prefix is a relative URL.
|
|
100
|
+
|
|
101
|
+
### `next-no-page-custom-font`
|
|
102
|
+
|
|
103
|
+
Matches a `<link>` whose literal `href` is a Google Fonts CSS URL, unless the file is `pages/_document` (last `pages` piece starts with `/_document`) and the link is inside the default-exported component. Two clauses: outside `_document` ("only loads for a single page"), and inside `_document` but outside the default-exported component ("outside `<Head>` disables font optimization").
|
|
104
|
+
|
|
105
|
+
### `next-no-script-component-in-head`
|
|
106
|
+
|
|
107
|
+
Matches a `<Head>` element with a direct `<Script>` element child, in a file that imports `next/head`.
|
|
108
|
+
|
|
109
|
+
### `next-no-styled-jsx-in-document`
|
|
110
|
+
|
|
111
|
+
Matches a `<style>` opening element with a `jsx` attribute in a file whose path, between its first and second `pages`, names a document.
|
|
112
|
+
|
|
113
|
+
### `next-no-sync-scripts`
|
|
114
|
+
|
|
115
|
+
Matches a `<script>` opening element with a `src` attribute and neither `async` nor `defer`.
|
|
116
|
+
|
|
117
|
+
### `next-no-title-in-document-head`
|
|
118
|
+
|
|
119
|
+
Matches the first `<title>` element child of a `<Head>` element, in a file with an import from `next/document` that binds the local name `Head`.
|
|
120
|
+
|
|
121
|
+
### `next-no-typos`
|
|
122
|
+
|
|
123
|
+
Matches an exported function or variable whose name is one edit away from `getStaticProps`, `getStaticPaths` or `getServerSideProps`, in a file whose segment after the first `pages` is non-empty and not under `/api`.
|
|
124
|
+
|
|
125
|
+
### `next-no-unwanted-polyfillio`
|
|
126
|
+
|
|
127
|
+
Matches a `<script>` (or the first local name an import from `next/script` binds) with a plain string `src` on a polyfill.io host whose first `features` parameter lists a feature Next.js already polyfills.
|
|
@@ -214,3 +214,11 @@ Paths are relative to the pack directory, `packs/next/`.
|
|
|
214
214
|
| `upstream/eslint-plugin-next/fixtures/no-unwanted-polyfillio/invalid-001.js` | `test/unit/eslint-plugin-next/no-unwanted-polyfillio.test.ts` | extracted from invalid[1] (its `code`, verbatim) |
|
|
215
215
|
| `upstream/eslint-plugin-next/fixtures/no-unwanted-polyfillio/invalid-002.js` | `test/unit/eslint-plugin-next/no-unwanted-polyfillio.test.ts` | extracted from invalid[2] (its `code`, verbatim) |
|
|
216
216
|
| `upstream/eslint-plugin-next/fixtures/no-unwanted-polyfillio/invalid-003.js` | `test/unit/eslint-plugin-next/no-unwanted-polyfillio.test.ts` | extracted from invalid[3] (its `code`, verbatim) |
|
|
217
|
+
| `upstream/eslint-plugin-next/fixtures/no-head-element/2a7f549f6c61.ts` | `test/unit/eslint-plugin-next/no-head-element.test.ts` | derived |
|
|
218
|
+
|
|
219
|
+
> `recording.json` is a port readiness recording, and no file of this pack, so it is recorded here rather than in the
|
|
220
|
+
> table above: the tool-pack's `recording.lock` names it and a GitHub release holds the bytes (docs/port-readiness.md).
|
|
221
|
+
> It carries excerpts of this upstream's tests (`test/unit/eslint-plugin-next/*.test.ts`: the `code` of each RuleTester
|
|
222
|
+
> case), redistributed under the licence above, together with Rerail's Apache-2.0; the LICENSE beside this file is this
|
|
223
|
+
> upstream's own, at the pinned commit.
|
|
224
|
+
|
package/pack.json
CHANGED
|
@@ -3,14 +3,17 @@
|
|
|
3
3
|
"id": "next",
|
|
4
4
|
"name": "Next.js",
|
|
5
5
|
"category": "framework",
|
|
6
|
-
"covers": "
|
|
6
|
+
"covers": "21 @next/eslint-plugin-next rules ported to Rerail, each scored against the plugin's own recorded findings on its rule tests.",
|
|
7
7
|
"reason": "matches Next.js",
|
|
8
8
|
"match": {
|
|
9
9
|
"any": [
|
|
10
10
|
{
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"ecosystem": "npm",
|
|
13
|
+
"names": [
|
|
14
|
+
"next"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
14
17
|
}
|
|
15
18
|
]
|
|
16
19
|
},
|
|
@@ -31,6 +34,12 @@
|
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
36
|
},
|
|
37
|
+
{
|
|
38
|
+
"id": "next-no-head-element",
|
|
39
|
+
"document": "rules/next-no-head-element.json",
|
|
40
|
+
"title": "No head element",
|
|
41
|
+
"group": "Next.js"
|
|
42
|
+
},
|
|
34
43
|
{
|
|
35
44
|
"id": "next-no-sync-scripts",
|
|
36
45
|
"document": "rules/next-no-sync-scripts.json",
|
|
@@ -53,6 +62,12 @@
|
|
|
53
62
|
"title": "No css tags",
|
|
54
63
|
"group": "Next.js"
|
|
55
64
|
},
|
|
65
|
+
{
|
|
66
|
+
"id": "next-google-font-display",
|
|
67
|
+
"document": "rules/next-google-font-display.json",
|
|
68
|
+
"title": "Google font display",
|
|
69
|
+
"group": "Next.js"
|
|
70
|
+
},
|
|
56
71
|
{
|
|
57
72
|
"id": "next-google-font-preconnect",
|
|
58
73
|
"document": "rules/next-google-font-preconnect.json",
|
|
@@ -176,6 +191,18 @@
|
|
|
176
191
|
"document": "rules/next-no-typos.json",
|
|
177
192
|
"title": "No typos",
|
|
178
193
|
"group": "Next.js"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"id": "next-no-page-custom-font",
|
|
197
|
+
"document": "rules/next-no-page-custom-font.json",
|
|
198
|
+
"title": "No page custom font",
|
|
199
|
+
"group": "Next.js"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"id": "next-no-location-assign-relative-destination",
|
|
203
|
+
"document": "rules/next-no-location-assign-relative-destination.json",
|
|
204
|
+
"title": "No location assign relative destination",
|
|
205
|
+
"group": "Next.js"
|
|
179
206
|
}
|
|
180
207
|
]
|
|
181
208
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "next-google-font-display",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Add a display value of swap or optional to Google Fonts stylesheet links; a missing, auto, block or fallback value can hide or shift text while the font loads.",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*.ts",
|
|
10
|
+
"**/*.mts",
|
|
11
|
+
"**/*.cts",
|
|
12
|
+
"**/*.tsx",
|
|
13
|
+
"**/*.js",
|
|
14
|
+
"**/*.jsx",
|
|
15
|
+
"**/*.mjs",
|
|
16
|
+
"**/*.cjs"
|
|
17
|
+
],
|
|
18
|
+
"exclude": []
|
|
19
|
+
},
|
|
20
|
+
"clauses": [
|
|
21
|
+
{
|
|
22
|
+
"id": "upstream",
|
|
23
|
+
"forbid": {
|
|
24
|
+
"ast": {
|
|
25
|
+
"language": "typescript",
|
|
26
|
+
"rule": {
|
|
27
|
+
"all": [
|
|
28
|
+
{
|
|
29
|
+
"any": [
|
|
30
|
+
{
|
|
31
|
+
"kind": "jsx_opening_element"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"kind": "jsx_self_closing_element"
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"has": {
|
|
40
|
+
"field": "name",
|
|
41
|
+
"kind": "identifier",
|
|
42
|
+
"regex": "^link$"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"has": {
|
|
47
|
+
"kind": "jsx_attribute",
|
|
48
|
+
"all": [
|
|
49
|
+
{
|
|
50
|
+
"has": {
|
|
51
|
+
"kind": "property_identifier",
|
|
52
|
+
"regex": "^href$"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"has": {
|
|
57
|
+
"any": [
|
|
58
|
+
{
|
|
59
|
+
"kind": "string",
|
|
60
|
+
"value": {
|
|
61
|
+
"startsWith": "https://fonts.googleapis.com/css"
|
|
62
|
+
},
|
|
63
|
+
"any": [
|
|
64
|
+
{
|
|
65
|
+
"not": {
|
|
66
|
+
"value": {
|
|
67
|
+
"regex": "^[^?]*\\?(?:[^&?]*&)*display(?:=|&|\\?|$)"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"value": {
|
|
73
|
+
"regex": "^[^?]*\\?(?:[^&?]*&)*display=(?:auto|block|fallback)(?:&|\\?|$)"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"kind": "jsx_expression",
|
|
80
|
+
"has": {
|
|
81
|
+
"kind": "string",
|
|
82
|
+
"value": {
|
|
83
|
+
"startsWith": "https://fonts.googleapis.com/css"
|
|
84
|
+
},
|
|
85
|
+
"any": [
|
|
86
|
+
{
|
|
87
|
+
"not": {
|
|
88
|
+
"value": {
|
|
89
|
+
"regex": "^[^?]*\\?(?:[^&?]*&)*display(?:=|&|\\?|$)"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"value": {
|
|
95
|
+
"regex": "^[^?]*\\?(?:[^&?]*&)*display=(?:auto|block|fallback)(?:&|\\?|$)"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"violation": {
|
|
112
|
+
"anchor": "witness.span",
|
|
113
|
+
"code": "@next/next/google-font-display",
|
|
114
|
+
"message": "Add display=swap or display=optional to this Google Fonts URL so text stays visible while the font loads.",
|
|
115
|
+
"suppress": {
|
|
116
|
+
"eslint": {
|
|
117
|
+
"rules": [
|
|
118
|
+
"@next/next/google-font-display"
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
"oxlint": {
|
|
122
|
+
"rules": [
|
|
123
|
+
"google-font-display"
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
"biome": {
|
|
127
|
+
"rules": [
|
|
128
|
+
"lint/suspicious/useGoogleFontDisplay"
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-google-font-preconnect",
|
|
4
4
|
"revision": 3,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Mark links to Google's font file host (fonts.gstatic.com) as preconnect; it opens the connection early so fonts load sooner.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-inline-script-id",
|
|
4
4
|
"revision": 3,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Give every next/script component with inline content an id; Next.js needs it to track and optimize the script.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-next-script-for-ga",
|
|
4
4
|
"revision": 2,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Use the Google helpers from @next/third-parties instead of raw script tags for Google Analytics or Tag Manager; they load the tags without slowing the page.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"violation": {
|
|
130
130
|
"anchor": "witness.span",
|
|
131
131
|
"code": "@next/next/next-script-for-ga",
|
|
132
|
-
"message": "
|
|
132
|
+
"message": "Replace this inline Google Analytics or Tag Manager script with GoogleAnalytics or GoogleTagManager from @next/third-parties/google.",
|
|
133
133
|
"suppress": {
|
|
134
134
|
"eslint": {
|
|
135
135
|
"rules": [
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-no-assign-module-variable",
|
|
4
4
|
"revision": 2,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Don't declare a variable named module in Next.js code; it shadows the module object Node.js and the bundler rely on.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-no-async-client-component",
|
|
4
4
|
"revision": 3,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Don't make the default-exported component of a \"use client\" file an async function; Client Components cannot be async.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"violation": {
|
|
64
64
|
"anchor": "witness.span",
|
|
65
65
|
"code": "@next/next/no-async-client-component",
|
|
66
|
-
"message": "
|
|
66
|
+
"message": "Remove async from this Client Component and load its data in a parent Server Component or an effect instead.",
|
|
67
67
|
"suppress": {
|
|
68
68
|
"eslint": {
|
|
69
69
|
"rules": [
|
|
@@ -208,7 +208,7 @@
|
|
|
208
208
|
"violation": {
|
|
209
209
|
"anchor": "witness.span",
|
|
210
210
|
"code": "@next/next/no-async-client-component",
|
|
211
|
-
"message": "
|
|
211
|
+
"message": "Remove async from this Client Component and load its data in a parent Server Component or an effect instead.",
|
|
212
212
|
"suppress": {
|
|
213
213
|
"eslint": {
|
|
214
214
|
"rules": [
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-no-before-interactive-script-outside-document",
|
|
4
4
|
"revision": 3,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Use the beforeInteractive strategy of next/script only in pages/_document or the app directory; elsewhere it cannot run before hydration.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"violation": {
|
|
105
105
|
"anchor": "witness.span",
|
|
106
106
|
"code": "@next/next/no-before-interactive-script-outside-document",
|
|
107
|
-
"message": "
|
|
107
|
+
"message": "Move this beforeInteractive Script into pages/_document or the app directory, or switch it to afterInteractive.",
|
|
108
108
|
"suppress": {
|
|
109
109
|
"eslint": {
|
|
110
110
|
"rules": [
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-no-css-tags",
|
|
4
4
|
"revision": 2,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Import local stylesheets instead of adding them with link tags, so Next.js can bundle and optimize the CSS; links to external stylesheet URLs are allowed.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"violation": {
|
|
94
94
|
"anchor": "witness.span",
|
|
95
95
|
"code": "@next/next/no-css-tags",
|
|
96
|
-
"message": "
|
|
96
|
+
"message": "Import this local stylesheet from the component (import './styles.css') instead of adding it with a link tag.",
|
|
97
97
|
"suppress": {
|
|
98
98
|
"eslint": {
|
|
99
99
|
"rules": [
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-no-document-import-in-page",
|
|
4
4
|
"revision": 3,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Import next/document only in pages/_document; the custom Document API does not work in regular pages or components.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"violation": {
|
|
48
48
|
"anchor": "witness.span",
|
|
49
49
|
"code": "@next/next/no-document-import-in-page",
|
|
50
|
-
"message": "
|
|
50
|
+
"message": "Move this next/document import into pages/_document; the custom Document API does not work in pages or components.",
|
|
51
51
|
"suppress": {
|
|
52
52
|
"eslint": {
|
|
53
53
|
"rules": [
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-no-duplicate-head",
|
|
4
4
|
"revision": 2,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Keep a single Head element in a custom Next.js Document's render output; duplicate heads produce unexpected markup.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "next-no-head-element",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Use the Head component from next/head instead of a raw head element outside the app directory; Next.js manages the page head itself.",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*.ts",
|
|
10
|
+
"**/*.mts",
|
|
11
|
+
"**/*.cts",
|
|
12
|
+
"**/*.tsx",
|
|
13
|
+
"**/*.js",
|
|
14
|
+
"**/*.jsx",
|
|
15
|
+
"**/*.mjs",
|
|
16
|
+
"**/*.cjs"
|
|
17
|
+
],
|
|
18
|
+
"exclude": []
|
|
19
|
+
},
|
|
20
|
+
"clauses": [
|
|
21
|
+
{
|
|
22
|
+
"id": "upstream",
|
|
23
|
+
"forbid": {
|
|
24
|
+
"ast": {
|
|
25
|
+
"language": "typescript",
|
|
26
|
+
"file": {
|
|
27
|
+
"path": {
|
|
28
|
+
"notRegex": "app/"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"rule": {
|
|
32
|
+
"all": [
|
|
33
|
+
{
|
|
34
|
+
"any": [
|
|
35
|
+
{
|
|
36
|
+
"kind": "jsx_opening_element"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"kind": "jsx_self_closing_element"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"has": {
|
|
45
|
+
"field": "name",
|
|
46
|
+
"kind": "identifier",
|
|
47
|
+
"regex": "^head$"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"violation": {
|
|
55
|
+
"anchor": "witness.span",
|
|
56
|
+
"code": "@next/next/no-head-element",
|
|
57
|
+
"message": "Do not use `<head>` element. Use `<Head />` from `next/head` instead. See: https://nextjs.org/docs/messages/no-head-element",
|
|
58
|
+
"suppress": {
|
|
59
|
+
"eslint": {
|
|
60
|
+
"rules": [
|
|
61
|
+
"@next/next/no-head-element"
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"oxlint": {
|
|
65
|
+
"rules": [
|
|
66
|
+
"no-head-element"
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"biome": {
|
|
70
|
+
"rules": [
|
|
71
|
+
"lint/style/noHeadElement"
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-no-head-import-in-document",
|
|
4
4
|
"revision": 3,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Use Head from next/document, not next/head, in pages/_document; next/head is meant for individual pages.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"violation": {
|
|
48
48
|
"anchor": "witness.span",
|
|
49
49
|
"code": "@next/next/no-head-import-in-document",
|
|
50
|
-
"message": "
|
|
50
|
+
"message": "Import Head from next/document instead of next/head in this custom Document.",
|
|
51
51
|
"suppress": {
|
|
52
52
|
"eslint": {
|
|
53
53
|
"rules": [
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"format": "rerail.policy/v1",
|
|
3
3
|
"id": "next-no-img-element",
|
|
4
|
-
"revision":
|
|
4
|
+
"revision": 4,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Use the next/image Image component instead of img elements (picture children and metadata image routes aside); it optimizes images for faster loads and less bandwidth.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -217,7 +217,7 @@
|
|
|
217
217
|
"violation": {
|
|
218
218
|
"anchor": "witness.span",
|
|
219
219
|
"code": "@next/next/no-img-element",
|
|
220
|
-
"message": "
|
|
220
|
+
"message": "Replace this img with Image from next/image, giving it width and height or fill unless src is a static import.",
|
|
221
221
|
"suppress": {
|
|
222
222
|
"eslint": {
|
|
223
223
|
"rules": [
|