@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
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "next-no-page-custom-font",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
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
|
+
"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": "page",
|
|
23
|
+
"forbid": {
|
|
24
|
+
"ast": {
|
|
25
|
+
"language": "typescript",
|
|
26
|
+
"file": {
|
|
27
|
+
"path": {
|
|
28
|
+
"notRegex": "pages(?:/_document(?:[^p]|p(?:p|ap|agp|agep)*(?:[^pa]|a[^gp]|ag[^ep]|age[^sp]))*(?:p(?:p|ap|agp|agep)*(?:a|ag|age)?)?)?$"
|
|
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": "^link$"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"has": {
|
|
52
|
+
"kind": "jsx_attribute",
|
|
53
|
+
"all": [
|
|
54
|
+
{
|
|
55
|
+
"has": {
|
|
56
|
+
"kind": "property_identifier",
|
|
57
|
+
"regex": "^href$"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"has": {
|
|
62
|
+
"any": [
|
|
63
|
+
{
|
|
64
|
+
"kind": "string",
|
|
65
|
+
"value": {
|
|
66
|
+
"startsWith": "https://fonts.googleapis.com/css"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"kind": "jsx_expression",
|
|
71
|
+
"has": {
|
|
72
|
+
"kind": "string",
|
|
73
|
+
"value": {
|
|
74
|
+
"startsWith": "https://fonts.googleapis.com/css"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"violation": {
|
|
89
|
+
"anchor": "witness.span",
|
|
90
|
+
"code": "@next/next/no-page-custom-font",
|
|
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
|
+
"suppress": {
|
|
93
|
+
"eslint": {
|
|
94
|
+
"rules": [
|
|
95
|
+
"@next/next/no-page-custom-font"
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
"oxlint": {
|
|
99
|
+
"rules": [
|
|
100
|
+
"no-page-custom-font"
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"id": "document",
|
|
108
|
+
"forbid": {
|
|
109
|
+
"ast": {
|
|
110
|
+
"language": "typescript",
|
|
111
|
+
"file": {
|
|
112
|
+
"path": {
|
|
113
|
+
"regex": "pages/_document(?:[^p]|p(?:p|ap|agp|agep)*(?:[^pa]|a[^gp]|ag[^ep]|age[^sp]))*(?:p(?:p|ap|agp|agep)*(?:a|ag|age)?)?$"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"rule": {
|
|
117
|
+
"all": [
|
|
118
|
+
{
|
|
119
|
+
"all": [
|
|
120
|
+
{
|
|
121
|
+
"any": [
|
|
122
|
+
{
|
|
123
|
+
"kind": "jsx_opening_element"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"kind": "jsx_self_closing_element"
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"has": {
|
|
132
|
+
"field": "name",
|
|
133
|
+
"kind": "identifier",
|
|
134
|
+
"regex": "^link$"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"has": {
|
|
139
|
+
"kind": "jsx_attribute",
|
|
140
|
+
"all": [
|
|
141
|
+
{
|
|
142
|
+
"has": {
|
|
143
|
+
"kind": "property_identifier",
|
|
144
|
+
"regex": "^href$"
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"has": {
|
|
149
|
+
"any": [
|
|
150
|
+
{
|
|
151
|
+
"kind": "string",
|
|
152
|
+
"value": {
|
|
153
|
+
"startsWith": "https://fonts.googleapis.com/css"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"kind": "jsx_expression",
|
|
158
|
+
"has": {
|
|
159
|
+
"kind": "string",
|
|
160
|
+
"value": {
|
|
161
|
+
"startsWith": "https://fonts.googleapis.com/css"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"not": {
|
|
175
|
+
"inside": {
|
|
176
|
+
"stopBy": "end",
|
|
177
|
+
"any": [
|
|
178
|
+
{
|
|
179
|
+
"any": [
|
|
180
|
+
{
|
|
181
|
+
"kind": "function_declaration"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"kind": "function_expression"
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
"inside": {
|
|
188
|
+
"kind": "export_statement",
|
|
189
|
+
"regex": "^export\\s+default\\s"
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"all": [
|
|
194
|
+
{
|
|
195
|
+
"all": [
|
|
196
|
+
{
|
|
197
|
+
"any": [
|
|
198
|
+
{
|
|
199
|
+
"kind": "class_declaration"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"kind": "class",
|
|
203
|
+
"inside": {
|
|
204
|
+
"kind": "export_statement"
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
]
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"has": {
|
|
211
|
+
"kind": "class_heritage",
|
|
212
|
+
"any": [
|
|
213
|
+
{
|
|
214
|
+
"has": {
|
|
215
|
+
"kind": "identifier",
|
|
216
|
+
"pattern": "$D"
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"has": {
|
|
221
|
+
"kind": "extends_clause",
|
|
222
|
+
"has": {
|
|
223
|
+
"field": "value",
|
|
224
|
+
"kind": "identifier",
|
|
225
|
+
"pattern": "$D"
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"inside": {
|
|
234
|
+
"kind": "program",
|
|
235
|
+
"stopBy": "end",
|
|
236
|
+
"has": {
|
|
237
|
+
"kind": "import_statement",
|
|
238
|
+
"all": [
|
|
239
|
+
{
|
|
240
|
+
"has": {
|
|
241
|
+
"field": "source",
|
|
242
|
+
"kind": "string",
|
|
243
|
+
"value": {
|
|
244
|
+
"eq": "next/document"
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"has": {
|
|
250
|
+
"kind": "import_clause",
|
|
251
|
+
"has": {
|
|
252
|
+
"kind": "identifier",
|
|
253
|
+
"pattern": "$D"
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
]
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"inside": {
|
|
265
|
+
"kind": "export_statement",
|
|
266
|
+
"regex": "^export\\s+default\\s"
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
]
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"all": [
|
|
273
|
+
{
|
|
274
|
+
"any": [
|
|
275
|
+
{
|
|
276
|
+
"kind": "function_declaration"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"kind": "class_declaration"
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"kind": "function_expression"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"kind": "class"
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"kind": "variable_declarator"
|
|
289
|
+
}
|
|
290
|
+
]
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"has": {
|
|
294
|
+
"field": "name",
|
|
295
|
+
"pattern": "$X"
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
"inside": {
|
|
300
|
+
"kind": "program",
|
|
301
|
+
"stopBy": "end",
|
|
302
|
+
"has": {
|
|
303
|
+
"kind": "export_statement",
|
|
304
|
+
"has": {
|
|
305
|
+
"field": "value",
|
|
306
|
+
"kind": "identifier",
|
|
307
|
+
"pattern": "$X"
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
]
|
|
313
|
+
}
|
|
314
|
+
]
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
"violation": {
|
|
323
|
+
"anchor": "witness.span",
|
|
324
|
+
"code": "@next/next/no-page-custom-font",
|
|
325
|
+
"message": "Move this Google Fonts link into the Head rendered by this file's default-exported Document component.",
|
|
326
|
+
"suppress": {
|
|
327
|
+
"eslint": {
|
|
328
|
+
"rules": [
|
|
329
|
+
"@next/next/no-page-custom-font"
|
|
330
|
+
]
|
|
331
|
+
},
|
|
332
|
+
"oxlint": {
|
|
333
|
+
"rules": [
|
|
334
|
+
"no-page-custom-font"
|
|
335
|
+
]
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
]
|
|
341
|
+
}
|
|
@@ -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",
|