@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,61 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "next-no-head-import-in-document",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "@next/eslint-plugin-next 16.3.8 @next/next/no-head-import-in-document: 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`).",
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
+ "regex": "^(?:[^p]|p(?:p|ap|agp|agep)*(?:[^pa]|a[^gp]|ag[^ep]|age[^sp]))*(?:p(?:p|ap|agp|agep)*(?:a|ag|age)?)?pages(?:(?:(?:[^p]|p(?:p|ap|agp|agep)*(?:[^pa]|a[^gp]|ag[^ep]|age[^sp]))*(?:p(?:p|ap|agp|agep)*(?:a|ag|age)?)?/)?_document(?:[^p/]|p(?:p|ap|agp|agep)*(?:[^pa/]|a[^gp/]|ag[^ep/]|age[^sp/]))*(?:p(?:p|ap|agp|agep)*(?:a|ag|age)?)?/*|/_document/index(?:\\.[^./]*)?/*)(?:pages.*)?$"
29
+ }
30
+ },
31
+ "rule": {
32
+ "kind": "import_statement",
33
+ "all": [
34
+ {
35
+ "has": {
36
+ "field": "source",
37
+ "kind": "string",
38
+ "value": {
39
+ "eq": "next/head"
40
+ }
41
+ }
42
+ }
43
+ ]
44
+ }
45
+ }
46
+ },
47
+ "violation": {
48
+ "anchor": "witness.span",
49
+ "code": "@next/next/no-head-import-in-document",
50
+ "message": "`next/head` should not be imported in `pages/_document.js`. Use `<Head />` from `next/document` instead. See: https://nextjs.org/docs/messages/no-head-import-in-document",
51
+ "suppress": {
52
+ "eslint": {
53
+ "rules": [
54
+ "@next/next/no-head-import-in-document"
55
+ ]
56
+ }
57
+ }
58
+ }
59
+ }
60
+ ]
61
+ }
@@ -0,0 +1,231 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "next-no-img-element",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "@next/eslint-plugin-next 16.3.8 @next/next/no-img-element: an <img> opening element with attributes, not a direct child of <picture>, unless the file is an app-dir metadata image route (the path relative to the ESLint cwd matches ^(src/)?app/ and /opengraph-image|twitter-image|icon.ext).",
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": "^(?:src/)?app(?:/.*)?/opengraph-image|^(?:src/)?app/.*twitter-image|^(?:src/)?app/.*icon\\.[A-Za-z0-9_]+$"
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": "^img$"
48
+ }
49
+ },
50
+ {
51
+ "has": {
52
+ "any": [
53
+ {
54
+ "kind": "jsx_attribute"
55
+ },
56
+ {
57
+ "kind": "jsx_expression"
58
+ }
59
+ ]
60
+ }
61
+ },
62
+ {
63
+ "any": [
64
+ {
65
+ "kind": "jsx_self_closing_element",
66
+ "inside": {
67
+ "matches": "not-picture"
68
+ }
69
+ },
70
+ {
71
+ "kind": "jsx_opening_element",
72
+ "inside": {
73
+ "kind": "jsx_element",
74
+ "inside": {
75
+ "matches": "not-picture"
76
+ }
77
+ }
78
+ }
79
+ ]
80
+ }
81
+ ]
82
+ },
83
+ "utils": {
84
+ "not-picture": {
85
+ "any": [
86
+ {
87
+ "kind": "jsx_element",
88
+ "has": {
89
+ "field": "open_tag",
90
+ "kind": "jsx_opening_element",
91
+ "any": [
92
+ {
93
+ "has": {
94
+ "field": "name",
95
+ "kind": "identifier",
96
+ "regex": "^(?:.{0,6}|.{8,}|[^p].{6}|p[^i].{5}|pi[^c].{4}|pic[^t].{3}|pict[^u].{2}|pictu[^r].|pictur[^e])$"
97
+ }
98
+ },
99
+ {
100
+ "has": {
101
+ "field": "name",
102
+ "any": [
103
+ {
104
+ "kind": "member_expression"
105
+ },
106
+ {
107
+ "kind": "jsx_namespace_name"
108
+ }
109
+ ]
110
+ }
111
+ },
112
+ {
113
+ "regex": "^<\\s*>$"
114
+ }
115
+ ]
116
+ }
117
+ },
118
+ {
119
+ "any": [
120
+ {
121
+ "kind": "parenthesized_expression"
122
+ },
123
+ {
124
+ "kind": "jsx_expression"
125
+ },
126
+ {
127
+ "kind": "arrow_function"
128
+ },
129
+ {
130
+ "kind": "return_statement"
131
+ },
132
+ {
133
+ "kind": "variable_declarator"
134
+ },
135
+ {
136
+ "kind": "assignment_expression"
137
+ },
138
+ {
139
+ "kind": "augmented_assignment_expression"
140
+ },
141
+ {
142
+ "kind": "arguments"
143
+ },
144
+ {
145
+ "kind": "array"
146
+ },
147
+ {
148
+ "kind": "pair"
149
+ },
150
+ {
151
+ "kind": "ternary_expression"
152
+ },
153
+ {
154
+ "kind": "binary_expression"
155
+ },
156
+ {
157
+ "kind": "unary_expression"
158
+ },
159
+ {
160
+ "kind": "spread_element"
161
+ },
162
+ {
163
+ "kind": "jsx_attribute"
164
+ },
165
+ {
166
+ "kind": "expression_statement"
167
+ },
168
+ {
169
+ "kind": "sequence_expression"
170
+ },
171
+ {
172
+ "kind": "await_expression"
173
+ },
174
+ {
175
+ "kind": "yield_expression"
176
+ },
177
+ {
178
+ "kind": "export_statement"
179
+ },
180
+ {
181
+ "kind": "template_substitution"
182
+ },
183
+ {
184
+ "kind": "member_expression"
185
+ },
186
+ {
187
+ "kind": "subscript_expression"
188
+ },
189
+ {
190
+ "kind": "as_expression"
191
+ },
192
+ {
193
+ "kind": "satisfies_expression"
194
+ },
195
+ {
196
+ "kind": "non_null_expression"
197
+ },
198
+ {
199
+ "kind": "public_field_definition"
200
+ },
201
+ {
202
+ "kind": "assignment_pattern"
203
+ },
204
+ {
205
+ "kind": "object_assignment_pattern"
206
+ },
207
+ {
208
+ "kind": "program"
209
+ }
210
+ ]
211
+ }
212
+ ]
213
+ }
214
+ }
215
+ }
216
+ },
217
+ "violation": {
218
+ "anchor": "witness.span",
219
+ "code": "@next/next/no-img-element",
220
+ "message": "Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element",
221
+ "suppress": {
222
+ "eslint": {
223
+ "rules": [
224
+ "@next/next/no-img-element"
225
+ ]
226
+ }
227
+ }
228
+ }
229
+ }
230
+ ]
231
+ }
@@ -0,0 +1,102 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "next-no-script-component-in-head",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "@next/eslint-plugin-next 16.3.8 @next/next/no-script-component-in-head: a <Head> element with a direct <Script> element child, in a file that imports next/head.",
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
+ "kind": "jsx_element",
28
+ "all": [
29
+ {
30
+ "has": {
31
+ "field": "open_tag",
32
+ "has": {
33
+ "field": "name",
34
+ "kind": "identifier",
35
+ "regex": "^Head$"
36
+ }
37
+ }
38
+ },
39
+ {
40
+ "has": {
41
+ "any": [
42
+ {
43
+ "kind": "jsx_self_closing_element",
44
+ "has": {
45
+ "field": "name",
46
+ "kind": "identifier",
47
+ "regex": "^Script$"
48
+ }
49
+ },
50
+ {
51
+ "kind": "jsx_element",
52
+ "has": {
53
+ "field": "open_tag",
54
+ "has": {
55
+ "field": "name",
56
+ "kind": "identifier",
57
+ "regex": "^Script$"
58
+ }
59
+ }
60
+ }
61
+ ]
62
+ }
63
+ },
64
+ {
65
+ "inside": {
66
+ "kind": "program",
67
+ "stopBy": "end",
68
+ "has": {
69
+ "kind": "import_statement",
70
+ "all": [
71
+ {
72
+ "has": {
73
+ "field": "source",
74
+ "kind": "string",
75
+ "value": {
76
+ "eq": "next/head"
77
+ }
78
+ }
79
+ }
80
+ ]
81
+ }
82
+ }
83
+ }
84
+ ]
85
+ }
86
+ }
87
+ },
88
+ "violation": {
89
+ "anchor": "witness.span",
90
+ "code": "@next/next/no-script-component-in-head",
91
+ "message": "`next/script` should not be used in `next/head` component. Move `<Script />` outside of `<Head>` instead. See: https://nextjs.org/docs/messages/no-script-component-in-head",
92
+ "suppress": {
93
+ "eslint": {
94
+ "rules": [
95
+ "@next/next/no-script-component-in-head"
96
+ ]
97
+ }
98
+ }
99
+ }
100
+ }
101
+ ]
102
+ }
@@ -0,0 +1,81 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "next-no-styled-jsx-in-document",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "@next/eslint-plugin-next 16.3.8 @next/next/no-styled-jsx-in-document: a <style> opening element with a `jsx` attribute in a file whose path, between its first and second `pages`, names a document.",
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
+ "regex": "^(?:[^p]|p(?:p|ap|agp|agep)*(?:[^pa]|a[^gp]|ag[^ep]|age[^sp]))*(?:p(?:p|ap|agp|agep)*(?:a|ag|age)?)?pages(?:(?:(?:[^p]|p(?:p|ap|agp|agep)*(?:[^pa]|a[^gp]|ag[^ep]|age[^sp]))*(?:p(?:p|ap|agp|agep)*(?:a|ag|age)?)?/)?_document(?:[^p/]|p(?:p|ap|agp|agep)*(?:[^pa/]|a[^gp/]|ag[^ep/]|age[^sp/]))*(?:p(?:p|ap|agp|agep)*(?:a|ag|age)?)?/*|/_document/index(?:\\.[^./]*)?/*)(?:pages.*)?$"
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": "^style$"
48
+ }
49
+ },
50
+ {
51
+ "has": {
52
+ "kind": "jsx_attribute",
53
+ "all": [
54
+ {
55
+ "has": {
56
+ "kind": "property_identifier",
57
+ "regex": "^jsx$"
58
+ }
59
+ }
60
+ ]
61
+ }
62
+ }
63
+ ]
64
+ }
65
+ }
66
+ },
67
+ "violation": {
68
+ "anchor": "witness.span",
69
+ "code": "@next/next/no-styled-jsx-in-document",
70
+ "message": "`styled-jsx` should not be used in `pages/_document.js`. See: https://nextjs.org/docs/messages/no-styled-jsx-in-document",
71
+ "suppress": {
72
+ "eslint": {
73
+ "rules": [
74
+ "@next/next/no-styled-jsx-in-document"
75
+ ]
76
+ }
77
+ }
78
+ }
79
+ }
80
+ ]
81
+ }
@@ -0,0 +1,106 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "next-no-sync-scripts",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "@next/eslint-plugin-next 16.3.8 @next/next/no-sync-scripts: a <script> opening element with a src attribute and neither async nor defer.",
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
+ "kind": "jsx_attribute",
48
+ "all": [
49
+ {
50
+ "has": {
51
+ "kind": "property_identifier",
52
+ "regex": "^src$"
53
+ }
54
+ }
55
+ ]
56
+ }
57
+ },
58
+ {
59
+ "not": {
60
+ "has": {
61
+ "kind": "jsx_attribute",
62
+ "all": [
63
+ {
64
+ "has": {
65
+ "kind": "property_identifier",
66
+ "regex": "^async$"
67
+ }
68
+ }
69
+ ]
70
+ }
71
+ }
72
+ },
73
+ {
74
+ "not": {
75
+ "has": {
76
+ "kind": "jsx_attribute",
77
+ "all": [
78
+ {
79
+ "has": {
80
+ "kind": "property_identifier",
81
+ "regex": "^defer$"
82
+ }
83
+ }
84
+ ]
85
+ }
86
+ }
87
+ }
88
+ ]
89
+ }
90
+ }
91
+ },
92
+ "violation": {
93
+ "anchor": "witness.span",
94
+ "code": "@next/next/no-sync-scripts",
95
+ "message": "Synchronous scripts should not be used. See: https://nextjs.org/docs/messages/no-sync-scripts",
96
+ "suppress": {
97
+ "eslint": {
98
+ "rules": [
99
+ "@next/next/no-sync-scripts"
100
+ ]
101
+ }
102
+ }
103
+ }
104
+ }
105
+ ]
106
+ }