@neralabs/rerail-pack-next 0.1.0

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.
@@ -0,0 +1,397 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "next-inline-script-id",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "@next/eslint-plugin-next 16.3.8 @next/next/inline-script-id: an element named by the first local an import from next/script binds, with children or dangerouslySetInnerHTML and no id (attributes and keys of object-literal spreads; any other spread makes it uncheckable).",
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_self_closing_element",
32
+ "all": [
33
+ {
34
+ "has": {
35
+ "field": "name",
36
+ "kind": "identifier",
37
+ "pattern": "$N"
38
+ }
39
+ },
40
+ {
41
+ "not": {
42
+ "has": {
43
+ "kind": "jsx_expression",
44
+ "has": {
45
+ "kind": "spread_element",
46
+ "not": {
47
+ "has": {
48
+ "kind": "object"
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+ },
55
+ {
56
+ "not": {
57
+ "has": {
58
+ "any": [
59
+ {
60
+ "kind": "jsx_attribute",
61
+ "all": [
62
+ {
63
+ "has": {
64
+ "kind": "property_identifier",
65
+ "regex": "^id$"
66
+ }
67
+ }
68
+ ]
69
+ },
70
+ {
71
+ "kind": "jsx_expression",
72
+ "has": {
73
+ "kind": "spread_element",
74
+ "has": {
75
+ "kind": "object",
76
+ "has": {
77
+ "any": [
78
+ {
79
+ "kind": "pair",
80
+ "has": {
81
+ "field": "key",
82
+ "kind": "property_identifier",
83
+ "regex": "^id$"
84
+ }
85
+ },
86
+ {
87
+ "kind": "shorthand_property_identifier",
88
+ "regex": "^id$"
89
+ }
90
+ ]
91
+ }
92
+ }
93
+ }
94
+ }
95
+ ]
96
+ }
97
+ }
98
+ }
99
+ ]
100
+ },
101
+ {
102
+ "kind": "jsx_element",
103
+ "has": {
104
+ "field": "open_tag",
105
+ "kind": "jsx_opening_element",
106
+ "all": [
107
+ {
108
+ "has": {
109
+ "field": "name",
110
+ "kind": "identifier",
111
+ "pattern": "$N"
112
+ }
113
+ },
114
+ {
115
+ "not": {
116
+ "has": {
117
+ "kind": "jsx_expression",
118
+ "has": {
119
+ "kind": "spread_element",
120
+ "not": {
121
+ "has": {
122
+ "kind": "object"
123
+ }
124
+ }
125
+ }
126
+ }
127
+ }
128
+ },
129
+ {
130
+ "not": {
131
+ "has": {
132
+ "any": [
133
+ {
134
+ "kind": "jsx_attribute",
135
+ "all": [
136
+ {
137
+ "has": {
138
+ "kind": "property_identifier",
139
+ "regex": "^id$"
140
+ }
141
+ }
142
+ ]
143
+ },
144
+ {
145
+ "kind": "jsx_expression",
146
+ "has": {
147
+ "kind": "spread_element",
148
+ "has": {
149
+ "kind": "object",
150
+ "has": {
151
+ "any": [
152
+ {
153
+ "kind": "pair",
154
+ "has": {
155
+ "field": "key",
156
+ "kind": "property_identifier",
157
+ "regex": "^id$"
158
+ }
159
+ },
160
+ {
161
+ "kind": "shorthand_property_identifier",
162
+ "regex": "^id$"
163
+ }
164
+ ]
165
+ }
166
+ }
167
+ }
168
+ }
169
+ ]
170
+ }
171
+ }
172
+ }
173
+ ]
174
+ }
175
+ }
176
+ ]
177
+ },
178
+ {
179
+ "any": [
180
+ {
181
+ "kind": "jsx_element",
182
+ "has": {
183
+ "not": {
184
+ "any": [
185
+ {
186
+ "kind": "jsx_opening_element"
187
+ },
188
+ {
189
+ "kind": "jsx_closing_element"
190
+ }
191
+ ]
192
+ }
193
+ }
194
+ },
195
+ {
196
+ "any": [
197
+ {
198
+ "kind": "jsx_self_closing_element",
199
+ "all": [
200
+ {
201
+ "has": {
202
+ "any": [
203
+ {
204
+ "kind": "jsx_attribute",
205
+ "all": [
206
+ {
207
+ "has": {
208
+ "kind": "property_identifier",
209
+ "regex": "^dangerouslySetInnerHTML$"
210
+ }
211
+ }
212
+ ]
213
+ },
214
+ {
215
+ "kind": "jsx_expression",
216
+ "has": {
217
+ "kind": "spread_element",
218
+ "has": {
219
+ "kind": "object",
220
+ "has": {
221
+ "any": [
222
+ {
223
+ "kind": "pair",
224
+ "has": {
225
+ "field": "key",
226
+ "kind": "property_identifier",
227
+ "regex": "^dangerouslySetInnerHTML$"
228
+ }
229
+ },
230
+ {
231
+ "kind": "shorthand_property_identifier",
232
+ "regex": "^dangerouslySetInnerHTML$"
233
+ }
234
+ ]
235
+ }
236
+ }
237
+ }
238
+ }
239
+ ]
240
+ }
241
+ }
242
+ ]
243
+ },
244
+ {
245
+ "kind": "jsx_element",
246
+ "has": {
247
+ "field": "open_tag",
248
+ "kind": "jsx_opening_element",
249
+ "all": [
250
+ {
251
+ "has": {
252
+ "any": [
253
+ {
254
+ "kind": "jsx_attribute",
255
+ "all": [
256
+ {
257
+ "has": {
258
+ "kind": "property_identifier",
259
+ "regex": "^dangerouslySetInnerHTML$"
260
+ }
261
+ }
262
+ ]
263
+ },
264
+ {
265
+ "kind": "jsx_expression",
266
+ "has": {
267
+ "kind": "spread_element",
268
+ "has": {
269
+ "kind": "object",
270
+ "has": {
271
+ "any": [
272
+ {
273
+ "kind": "pair",
274
+ "has": {
275
+ "field": "key",
276
+ "kind": "property_identifier",
277
+ "regex": "^dangerouslySetInnerHTML$"
278
+ }
279
+ },
280
+ {
281
+ "kind": "shorthand_property_identifier",
282
+ "regex": "^dangerouslySetInnerHTML$"
283
+ }
284
+ ]
285
+ }
286
+ }
287
+ }
288
+ }
289
+ ]
290
+ }
291
+ }
292
+ ]
293
+ }
294
+ }
295
+ ]
296
+ }
297
+ ]
298
+ },
299
+ {
300
+ "inside": {
301
+ "kind": "program",
302
+ "stopBy": "end",
303
+ "has": {
304
+ "kind": "import_statement",
305
+ "all": [
306
+ {
307
+ "has": {
308
+ "field": "source",
309
+ "kind": "string",
310
+ "value": {
311
+ "eq": "next/script"
312
+ }
313
+ }
314
+ },
315
+ {
316
+ "has": {
317
+ "kind": "import_clause",
318
+ "any": [
319
+ {
320
+ "has": {
321
+ "kind": "identifier",
322
+ "nthChild": 1,
323
+ "pattern": "$N"
324
+ }
325
+ },
326
+ {
327
+ "has": {
328
+ "kind": "namespace_import",
329
+ "nthChild": 1,
330
+ "has": {
331
+ "kind": "identifier",
332
+ "pattern": "$N"
333
+ }
334
+ }
335
+ },
336
+ {
337
+ "has": {
338
+ "kind": "named_imports",
339
+ "nthChild": 1,
340
+ "has": {
341
+ "kind": "import_specifier",
342
+ "nthChild": 1,
343
+ "any": [
344
+ {
345
+ "has": {
346
+ "field": "alias",
347
+ "pattern": "$N"
348
+ }
349
+ },
350
+ {
351
+ "all": [
352
+ {
353
+ "not": {
354
+ "has": {
355
+ "field": "alias",
356
+ "kind": "identifier"
357
+ }
358
+ }
359
+ },
360
+ {
361
+ "has": {
362
+ "field": "name",
363
+ "pattern": "$N"
364
+ }
365
+ }
366
+ ]
367
+ }
368
+ ]
369
+ }
370
+ }
371
+ }
372
+ ]
373
+ }
374
+ }
375
+ ]
376
+ }
377
+ }
378
+ }
379
+ ]
380
+ }
381
+ }
382
+ },
383
+ "violation": {
384
+ "anchor": "witness.span",
385
+ "code": "@next/next/inline-script-id",
386
+ "message": "`next/script` components with inline content must specify an `id` attribute. See: https://nextjs.org/docs/messages/inline-script-id",
387
+ "suppress": {
388
+ "eslint": {
389
+ "rules": [
390
+ "@next/next/inline-script-id"
391
+ ]
392
+ }
393
+ }
394
+ }
395
+ }
396
+ ]
397
+ }
@@ -0,0 +1,143 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "next-next-script-for-ga",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "@next/eslint-plugin-next 16.3.8 @next/next/next-script-for-ga: 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.",
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": "^script$"
43
+ }
44
+ },
45
+ {
46
+ "has": {
47
+ "any": [
48
+ {
49
+ "kind": "jsx_attribute"
50
+ },
51
+ {
52
+ "kind": "jsx_expression"
53
+ }
54
+ ]
55
+ }
56
+ },
57
+ {
58
+ "any": [
59
+ {
60
+ "has": {
61
+ "kind": "jsx_attribute",
62
+ "all": [
63
+ {
64
+ "has": {
65
+ "kind": "property_identifier",
66
+ "regex": "^src$"
67
+ }
68
+ },
69
+ {
70
+ "has": {
71
+ "any": [
72
+ {
73
+ "kind": "string",
74
+ "value": {
75
+ "regex": "www\\.google-analytics\\.com/analytics\\.js|www\\.googletagmanager\\.com/gtag/js"
76
+ }
77
+ },
78
+ {
79
+ "kind": "jsx_expression",
80
+ "has": {
81
+ "kind": "string",
82
+ "value": {
83
+ "regex": "www\\.google-analytics\\.com/analytics\\.js|www\\.googletagmanager\\.com/gtag/js"
84
+ }
85
+ }
86
+ }
87
+ ]
88
+ }
89
+ }
90
+ ]
91
+ }
92
+ },
93
+ {
94
+ "has": {
95
+ "kind": "jsx_attribute",
96
+ "all": [
97
+ {
98
+ "has": {
99
+ "kind": "property_identifier",
100
+ "regex": "^dangerouslySetInnerHTML$"
101
+ }
102
+ },
103
+ {
104
+ "has": {
105
+ "kind": "jsx_expression",
106
+ "has": {
107
+ "kind": "object",
108
+ "has": {
109
+ "kind": "pair",
110
+ "nthChild": 1,
111
+ "has": {
112
+ "field": "value",
113
+ "kind": "template_string",
114
+ "regex": "^`(?:[^$]|\\$[^{])*?(?:www\\.google-analytics\\.com/analytics\\.js|www\\.googletagmanager\\.com/gtm\\.js)"
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
120
+ ]
121
+ }
122
+ }
123
+ ]
124
+ }
125
+ ]
126
+ }
127
+ }
128
+ },
129
+ "violation": {
130
+ "anchor": "witness.span",
131
+ "code": "@next/next/next-script-for-ga",
132
+ "message": "Prefer `@next/third-parties/google` when using the inline script for Google Analytics and Tag Manager. See: https://nextjs.org/docs/messages/next-script-for-ga",
133
+ "suppress": {
134
+ "eslint": {
135
+ "rules": [
136
+ "@next/next/next-script-for-ga"
137
+ ]
138
+ }
139
+ }
140
+ }
141
+ }
142
+ ]
143
+ }
@@ -0,0 +1,60 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "next-no-assign-module-variable",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "@next/eslint-plugin-next 16.3.8 @next/next/no-assign-module-variable: a variable declaration with a declarator whose identifier is `module`.",
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
+ "any": [
28
+ {
29
+ "kind": "lexical_declaration"
30
+ },
31
+ {
32
+ "kind": "variable_declaration"
33
+ }
34
+ ],
35
+ "has": {
36
+ "kind": "variable_declarator",
37
+ "has": {
38
+ "field": "name",
39
+ "kind": "identifier",
40
+ "regex": "^module$"
41
+ }
42
+ }
43
+ }
44
+ }
45
+ },
46
+ "violation": {
47
+ "anchor": "witness.span",
48
+ "code": "@next/next/no-assign-module-variable",
49
+ "message": "Do not assign to the variable `module`. See: https://nextjs.org/docs/messages/no-assign-module-variable",
50
+ "suppress": {
51
+ "eslint": {
52
+ "rules": [
53
+ "@next/next/no-assign-module-variable"
54
+ ]
55
+ }
56
+ }
57
+ }
58
+ }
59
+ ]
60
+ }