@neralabs/rerail-pack-next 0.1.2 → 0.1.4
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 +97 -4
- package/licenses/next.js/UPSTREAM.md +4 -4
- package/pack.json +15 -0
- package/package.json +1 -1
- package/rules/next-google-font-display.json +2 -2
- 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 +1 -1
- package/rules/next-no-head-import-in-document.json +2 -2
- package/rules/next-no-img-element.json +2 -2
- package/rules/next-no-location-assign-relative-destination.json +3 -3
- package/rules/next-no-page-custom-font.json +3 -3
- 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
|
@@ -12,7 +12,7 @@ The pack follows the [pack structure and validation contract](../../docs/pack-fo
|
|
|
12
12
|
| `pack.json` | The pack (`rerail.rule-pack/v1`): each rule's document, title and group; six rules carry examples |
|
|
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
|
-
| `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`) |
|
|
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`). All but the recorder are pack test data, derived from the pins (`npm run fixtures:derive`) and archived in S3: `npm run fixtures:pull` |
|
|
16
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
|
|
|
@@ -23,11 +23,14 @@ node packs/next/candidates/build-policies.mjs
|
|
|
23
23
|
node packs/next/candidates/build-probes.mjs
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
Re-recording
|
|
27
|
-
|
|
26
|
+
Re-recording is a maintainer deriving the pack's test data from its pins and archiving it
|
|
27
|
+
([CONTRIBUTING.md](../../CONTRIBUTING.md#pack-test-data)); it is never committed. The recipe
|
|
28
|
+
(`scripts/pack-data/recipes/next.ts`) runs `upstream/eslint-plugin-next/generate.mjs` against the pinned plugin and
|
|
29
|
+
corpora (Node 23.6 or later):
|
|
28
30
|
|
|
29
31
|
```sh
|
|
30
|
-
|
|
32
|
+
npm run fixtures:derive -- --pack next
|
|
33
|
+
npm run fixtures:push -- --pack next # on your own branch: archive it and rewrite its test-data.lock
|
|
31
34
|
```
|
|
32
35
|
|
|
33
36
|
Scoring one rule, shipped or candidate, with every false positive and false negative printed:
|
|
@@ -35,3 +38,93 @@ Scoring one rule, shipped or candidate, with every false positive and false nega
|
|
|
35
38
|
```sh
|
|
36
39
|
node --import tsx conformance/languages/cli.ts --pack next --rule next-no-img-element --fixtures
|
|
37
40
|
```
|
|
41
|
+
|
|
42
|
+
## Rule details
|
|
43
|
+
|
|
44
|
+
What each rule matches beyond its one-line description: exact matching, edge cases, upstream settings and known divergences.
|
|
45
|
+
|
|
46
|
+
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.
|
|
47
|
+
|
|
48
|
+
### `next-google-font-display`
|
|
49
|
+
|
|
50
|
+
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`.
|
|
51
|
+
|
|
52
|
+
### `next-google-font-preconnect`
|
|
53
|
+
|
|
54
|
+
Matches a `<link>` whose literal `href` starts with `https://fonts.gstatic.com` and whose `rel` is not the literal `"preconnect"`.
|
|
55
|
+
|
|
56
|
+
### `next-inline-script-id`
|
|
57
|
+
|
|
58
|
+
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).
|
|
59
|
+
|
|
60
|
+
### `next-next-script-for-ga`
|
|
61
|
+
|
|
62
|
+
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.
|
|
63
|
+
|
|
64
|
+
### `next-no-assign-module-variable`
|
|
65
|
+
|
|
66
|
+
Matches any variable declaration with a declarator whose identifier is `module`.
|
|
67
|
+
|
|
68
|
+
### `next-no-async-client-component`
|
|
69
|
+
|
|
70
|
+
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.
|
|
71
|
+
|
|
72
|
+
### `next-no-before-interactive-script-outside-document`
|
|
73
|
+
|
|
74
|
+
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`.
|
|
75
|
+
|
|
76
|
+
### `next-no-css-tags`
|
|
77
|
+
|
|
78
|
+
Matches a `<link>` with `rel="stylesheet"` and a string `href` that does not start with `http(s)`.
|
|
79
|
+
|
|
80
|
+
### `next-no-document-import-in-page`
|
|
81
|
+
|
|
82
|
+
Matches an import from `next/document` unless the part of the path after its last `pages` is empty or starts with `/_document`.
|
|
83
|
+
|
|
84
|
+
### `next-no-duplicate-head`
|
|
85
|
+
|
|
86
|
+
Flags every `<Head>` child of a returned element after the first, in a `return` inside a class extending the default import of `next/document`.
|
|
87
|
+
|
|
88
|
+
### `next-no-head-element`
|
|
89
|
+
|
|
90
|
+
Matches a `<head>` opening element unless the file's path contains `app/`.
|
|
91
|
+
|
|
92
|
+
### `next-no-head-import-in-document`
|
|
93
|
+
|
|
94
|
+
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`).
|
|
95
|
+
|
|
96
|
+
### `next-no-img-element`
|
|
97
|
+
|
|
98
|
+
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: 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>`.
|
|
99
|
+
|
|
100
|
+
### `next-no-location-assign-relative-destination`
|
|
101
|
+
|
|
102
|
+
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.
|
|
103
|
+
|
|
104
|
+
### `next-no-page-custom-font`
|
|
105
|
+
|
|
106
|
+
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").
|
|
107
|
+
|
|
108
|
+
### `next-no-script-component-in-head`
|
|
109
|
+
|
|
110
|
+
Matches a `<Head>` element with a direct `<Script>` element child, in a file that imports `next/head`.
|
|
111
|
+
|
|
112
|
+
### `next-no-styled-jsx-in-document`
|
|
113
|
+
|
|
114
|
+
Matches a `<style>` opening element with a `jsx` attribute in a file whose path, between its first and second `pages`, names a document.
|
|
115
|
+
|
|
116
|
+
### `next-no-sync-scripts`
|
|
117
|
+
|
|
118
|
+
Matches a `<script>` opening element with a `src` attribute and neither `async` nor `defer`.
|
|
119
|
+
|
|
120
|
+
### `next-no-title-in-document-head`
|
|
121
|
+
|
|
122
|
+
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`.
|
|
123
|
+
|
|
124
|
+
### `next-no-typos`
|
|
125
|
+
|
|
126
|
+
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`.
|
|
127
|
+
|
|
128
|
+
### `next-no-unwanted-polyfillio`
|
|
129
|
+
|
|
130
|
+
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.
|
|
@@ -217,8 +217,8 @@ Paths are relative to the pack directory, `packs/next/`.
|
|
|
217
217
|
| `upstream/eslint-plugin-next/fixtures/no-head-element/2a7f549f6c61.ts` | `test/unit/eslint-plugin-next/no-head-element.test.ts` | derived |
|
|
218
218
|
|
|
219
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
|
|
221
|
-
> It carries excerpts of this upstream's tests (`test/unit/eslint-plugin-next/*.test.ts`:
|
|
222
|
-
> case), redistributed under the licence above, together with Rerail's Apache-2.0;
|
|
223
|
-
> upstream's own, at the pinned commit.
|
|
220
|
+
> table above: the tool-pack's `recording.lock` names it by its sha256, and the bytes are an object in S3, not a file in
|
|
221
|
+
> git (docs/port-readiness.md). It carries excerpts of this upstream's tests (`test/unit/eslint-plugin-next/*.test.ts`:
|
|
222
|
+
> the `code` of each RuleTester case), redistributed under the licence above, together with Rerail's Apache-2.0;
|
|
223
|
+
> `LICENSE` beside this file is this upstream's own, at the pinned commit.
|
|
224
224
|
|
package/pack.json
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"id": "next-no-img-element",
|
|
23
23
|
"document": "rules/next-no-img-element.json",
|
|
24
24
|
"title": "No img element",
|
|
25
|
+
"mode": "log",
|
|
25
26
|
"group": "Next.js",
|
|
26
27
|
"examples": {
|
|
27
28
|
"caught": {
|
|
@@ -38,12 +39,14 @@
|
|
|
38
39
|
"id": "next-no-head-element",
|
|
39
40
|
"document": "rules/next-no-head-element.json",
|
|
40
41
|
"title": "No head element",
|
|
42
|
+
"mode": "log",
|
|
41
43
|
"group": "Next.js"
|
|
42
44
|
},
|
|
43
45
|
{
|
|
44
46
|
"id": "next-no-sync-scripts",
|
|
45
47
|
"document": "rules/next-no-sync-scripts.json",
|
|
46
48
|
"title": "No sync scripts",
|
|
49
|
+
"mode": "log",
|
|
47
50
|
"group": "Next.js",
|
|
48
51
|
"examples": {
|
|
49
52
|
"caught": {
|
|
@@ -60,30 +63,35 @@
|
|
|
60
63
|
"id": "next-no-css-tags",
|
|
61
64
|
"document": "rules/next-no-css-tags.json",
|
|
62
65
|
"title": "No css tags",
|
|
66
|
+
"mode": "log",
|
|
63
67
|
"group": "Next.js"
|
|
64
68
|
},
|
|
65
69
|
{
|
|
66
70
|
"id": "next-google-font-display",
|
|
67
71
|
"document": "rules/next-google-font-display.json",
|
|
68
72
|
"title": "Google font display",
|
|
73
|
+
"mode": "log",
|
|
69
74
|
"group": "Next.js"
|
|
70
75
|
},
|
|
71
76
|
{
|
|
72
77
|
"id": "next-google-font-preconnect",
|
|
73
78
|
"document": "rules/next-google-font-preconnect.json",
|
|
74
79
|
"title": "Google font preconnect",
|
|
80
|
+
"mode": "log",
|
|
75
81
|
"group": "Next.js"
|
|
76
82
|
},
|
|
77
83
|
{
|
|
78
84
|
"id": "next-next-script-for-ga",
|
|
79
85
|
"document": "rules/next-next-script-for-ga.json",
|
|
80
86
|
"title": "Next script for ga",
|
|
87
|
+
"mode": "log",
|
|
81
88
|
"group": "Next.js"
|
|
82
89
|
},
|
|
83
90
|
{
|
|
84
91
|
"id": "next-no-unwanted-polyfillio",
|
|
85
92
|
"document": "rules/next-no-unwanted-polyfillio.json",
|
|
86
93
|
"title": "No unwanted polyfillio",
|
|
94
|
+
"mode": "log",
|
|
87
95
|
"group": "Next.js"
|
|
88
96
|
},
|
|
89
97
|
{
|
|
@@ -118,6 +126,7 @@
|
|
|
118
126
|
"id": "next-no-styled-jsx-in-document",
|
|
119
127
|
"document": "rules/next-no-styled-jsx-in-document.json",
|
|
120
128
|
"title": "No styled jsx in document",
|
|
129
|
+
"mode": "log",
|
|
121
130
|
"group": "Next.js",
|
|
122
131
|
"examples": {
|
|
123
132
|
"caught": {
|
|
@@ -134,6 +143,7 @@
|
|
|
134
143
|
"id": "next-no-title-in-document-head",
|
|
135
144
|
"document": "rules/next-no-title-in-document-head.json",
|
|
136
145
|
"title": "No title in document head",
|
|
146
|
+
"mode": "log",
|
|
137
147
|
"group": "Next.js",
|
|
138
148
|
"examples": {
|
|
139
149
|
"caught": {
|
|
@@ -172,12 +182,14 @@
|
|
|
172
182
|
"id": "next-no-async-client-component",
|
|
173
183
|
"document": "rules/next-no-async-client-component.json",
|
|
174
184
|
"title": "No async client component",
|
|
185
|
+
"mode": "log",
|
|
175
186
|
"group": "Next.js"
|
|
176
187
|
},
|
|
177
188
|
{
|
|
178
189
|
"id": "next-no-before-interactive-script-outside-document",
|
|
179
190
|
"document": "rules/next-no-before-interactive-script-outside-document.json",
|
|
180
191
|
"title": "No before interactive script outside document",
|
|
192
|
+
"mode": "log",
|
|
181
193
|
"group": "Next.js"
|
|
182
194
|
},
|
|
183
195
|
{
|
|
@@ -190,18 +202,21 @@
|
|
|
190
202
|
"id": "next-no-typos",
|
|
191
203
|
"document": "rules/next-no-typos.json",
|
|
192
204
|
"title": "No typos",
|
|
205
|
+
"mode": "log",
|
|
193
206
|
"group": "Next.js"
|
|
194
207
|
},
|
|
195
208
|
{
|
|
196
209
|
"id": "next-no-page-custom-font",
|
|
197
210
|
"document": "rules/next-no-page-custom-font.json",
|
|
198
211
|
"title": "No page custom font",
|
|
212
|
+
"mode": "log",
|
|
199
213
|
"group": "Next.js"
|
|
200
214
|
},
|
|
201
215
|
{
|
|
202
216
|
"id": "next-no-location-assign-relative-destination",
|
|
203
217
|
"document": "rules/next-no-location-assign-relative-destination.json",
|
|
204
218
|
"title": "No location assign relative destination",
|
|
219
|
+
"mode": "log",
|
|
205
220
|
"group": "Next.js"
|
|
206
221
|
}
|
|
207
222
|
]
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-google-font-display",
|
|
4
4
|
"revision": 1,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
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
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"violation": {
|
|
112
112
|
"anchor": "witness.span",
|
|
113
113
|
"code": "@next/next/google-font-display",
|
|
114
|
-
"message": "
|
|
114
|
+
"message": "Add display=swap or display=optional to this Google Fonts URL so text stays visible while the font loads.",
|
|
115
115
|
"suppress": {
|
|
116
116
|
"eslint": {
|
|
117
117
|
"rules": [
|
|
@@ -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",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-no-head-element",
|
|
4
4
|
"revision": 1,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
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
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -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": [
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-no-img-element",
|
|
4
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": [
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-no-location-assign-relative-destination",
|
|
4
4
|
"revision": 1,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Don't navigate to internal pages by setting location.href or calling location.assign with a relative URL; use redirect() or the router for client-side navigation.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -210,7 +210,7 @@
|
|
|
210
210
|
"violation": {
|
|
211
211
|
"anchor": "witness.span",
|
|
212
212
|
"code": "@next/next/no-location-assign-relative-destination",
|
|
213
|
-
"message": "
|
|
213
|
+
"message": "Replace this location.href assignment with redirect() during render or useRouter().push() in a client event handler.",
|
|
214
214
|
"suppress": {
|
|
215
215
|
"eslint": {
|
|
216
216
|
"rules": [
|
|
@@ -418,7 +418,7 @@
|
|
|
418
418
|
"violation": {
|
|
419
419
|
"anchor": "witness.span",
|
|
420
420
|
"code": "@next/next/no-location-assign-relative-destination",
|
|
421
|
-
"message": "
|
|
421
|
+
"message": "Replace this location.assign call with redirect() during render or useRouter().push() in a client event handler.",
|
|
422
422
|
"suppress": {
|
|
423
423
|
"eslint": {
|
|
424
424
|
"rules": [
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-no-page-custom-font",
|
|
4
4
|
"revision": 1,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Add Google Fonts stylesheet links only inside the default-exported custom Document in pages/_document; fonts linked elsewhere load for one page and skip font optimization.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"violation": {
|
|
89
89
|
"anchor": "witness.span",
|
|
90
90
|
"code": "@next/next/no-page-custom-font",
|
|
91
|
-
"message": "
|
|
91
|
+
"message": "Move this Google Fonts link into the Head of the custom Document in pages/_document so the font loads on every page.",
|
|
92
92
|
"suppress": {
|
|
93
93
|
"eslint": {
|
|
94
94
|
"rules": [
|
|
@@ -322,7 +322,7 @@
|
|
|
322
322
|
"violation": {
|
|
323
323
|
"anchor": "witness.span",
|
|
324
324
|
"code": "@next/next/no-page-custom-font",
|
|
325
|
-
"message": "
|
|
325
|
+
"message": "Move this Google Fonts link into the Head rendered by this file's default-exported Document component.",
|
|
326
326
|
"suppress": {
|
|
327
327
|
"eslint": {
|
|
328
328
|
"rules": [
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-no-script-component-in-head",
|
|
4
4
|
"revision": 2,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Place next/script Script components outside Head from next/head; scripts inside Head are not loaded as intended.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"violation": {
|
|
89
89
|
"anchor": "witness.span",
|
|
90
90
|
"code": "@next/next/no-script-component-in-head",
|
|
91
|
-
"message": "
|
|
91
|
+
"message": "Move this Script component outside the Head from next/head; Script places the tag itself.",
|
|
92
92
|
"suppress": {
|
|
93
93
|
"eslint": {
|
|
94
94
|
"rules": [
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-no-styled-jsx-in-document",
|
|
4
4
|
"revision": 2,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Don't use styled-jsx style tags in pages/_document; the custom Document does not support them.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"violation": {
|
|
68
68
|
"anchor": "witness.span",
|
|
69
69
|
"code": "@next/next/no-styled-jsx-in-document",
|
|
70
|
-
"message": "
|
|
70
|
+
"message": "Move these styled-jsx styles out of pages/_document into a global stylesheet imported in pages/_app.",
|
|
71
71
|
"suppress": {
|
|
72
72
|
"eslint": {
|
|
73
73
|
"rules": [
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-no-sync-scripts",
|
|
4
4
|
"revision": 3,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Add async or defer to script tags that load an external src; synchronous scripts block page rendering.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"violation": {
|
|
93
93
|
"anchor": "witness.span",
|
|
94
94
|
"code": "@next/next/no-sync-scripts",
|
|
95
|
-
"message": "
|
|
95
|
+
"message": "Add async or defer to this external script tag so it stops blocking page rendering.",
|
|
96
96
|
"suppress": {
|
|
97
97
|
"eslint": {
|
|
98
98
|
"rules": [
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-no-title-in-document-head",
|
|
4
4
|
"revision": 2,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Set page titles with Head from next/head on each page, not with a title inside the custom Document's Head from next/document.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
"violation": {
|
|
173
173
|
"anchor": "witness.span",
|
|
174
174
|
"code": "@next/next/no-title-in-document-head",
|
|
175
|
-
"message": "
|
|
175
|
+
"message": "Move this title out of the Document's Head into each page's Head from next/head.",
|
|
176
176
|
"suppress": {
|
|
177
177
|
"eslint": {
|
|
178
178
|
"rules": [
|
package/rules/next-no-typos.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-no-typos",
|
|
4
4
|
"revision": 2,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Spell getStaticProps, getStaticPaths and getServerSideProps exactly in page files; an export one letter off is silently ignored by Next.js.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "next-no-unwanted-polyfillio",
|
|
4
4
|
"revision": 3,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Don't load polyfills from polyfill.io for features Next.js already polyfills; they duplicate code and add page weight.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|