@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,212 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "next-no-async-client-component",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "@next/eslint-plugin-next 16.3.8 @next/next/no-async-client-component: after a top-level \"use client\" statement: an `export default async function` with a capitalized name, or the first top-level declaration of the capitalized name `export default` exports when it is an async function or a variable initialized with an async arrow.",
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": "export-default-function",
23
+ "forbid": {
24
+ "ast": {
25
+ "language": "typescript",
26
+ "rule": {
27
+ "kind": "export_statement",
28
+ "all": [
29
+ {
30
+ "inside": {
31
+ "kind": "program"
32
+ }
33
+ },
34
+ {
35
+ "regex": "^export\\s+default\\s"
36
+ },
37
+ {
38
+ "has": {
39
+ "kind": "function_declaration",
40
+ "regex": "^async\\s",
41
+ "has": {
42
+ "field": "name",
43
+ "regex": "^[A-Z]"
44
+ }
45
+ }
46
+ },
47
+ {
48
+ "follows": {
49
+ "stopBy": "end",
50
+ "kind": "expression_statement",
51
+ "has": {
52
+ "kind": "string",
53
+ "value": {
54
+ "eq": "use client"
55
+ }
56
+ }
57
+ }
58
+ }
59
+ ]
60
+ }
61
+ }
62
+ },
63
+ "violation": {
64
+ "anchor": "witness.span",
65
+ "code": "@next/next/no-async-client-component",
66
+ "message": "Prevent Client Components from being async functions. See: https://nextjs.org/docs/messages/no-async-client-component",
67
+ "suppress": {
68
+ "eslint": {
69
+ "rules": [
70
+ "@next/next/no-async-client-component"
71
+ ]
72
+ }
73
+ }
74
+ }
75
+ },
76
+ {
77
+ "id": "exported-declaration",
78
+ "forbid": {
79
+ "ast": {
80
+ "language": "typescript",
81
+ "rule": {
82
+ "all": [
83
+ {
84
+ "inside": {
85
+ "kind": "program"
86
+ }
87
+ },
88
+ {
89
+ "any": [
90
+ {
91
+ "kind": "function_declaration",
92
+ "regex": "^async\\s",
93
+ "has": {
94
+ "field": "name",
95
+ "regex": "^[A-Z]",
96
+ "pattern": "$N"
97
+ }
98
+ },
99
+ {
100
+ "any": [
101
+ {
102
+ "kind": "lexical_declaration"
103
+ },
104
+ {
105
+ "kind": "variable_declaration"
106
+ }
107
+ ],
108
+ "has": {
109
+ "kind": "variable_declarator",
110
+ "all": [
111
+ {
112
+ "has": {
113
+ "field": "name",
114
+ "kind": "identifier",
115
+ "regex": "^[A-Z]",
116
+ "pattern": "$N"
117
+ }
118
+ },
119
+ {
120
+ "has": {
121
+ "field": "value",
122
+ "kind": "arrow_function",
123
+ "regex": "^async\\b"
124
+ }
125
+ }
126
+ ]
127
+ }
128
+ }
129
+ ]
130
+ },
131
+ {
132
+ "not": {
133
+ "follows": {
134
+ "stopBy": "end",
135
+ "any": [
136
+ {
137
+ "kind": "function_declaration",
138
+ "has": {
139
+ "field": "name",
140
+ "pattern": "$N"
141
+ }
142
+ },
143
+ {
144
+ "any": [
145
+ {
146
+ "kind": "lexical_declaration"
147
+ },
148
+ {
149
+ "kind": "variable_declaration"
150
+ }
151
+ ],
152
+ "has": {
153
+ "kind": "variable_declarator",
154
+ "has": {
155
+ "field": "name",
156
+ "kind": "identifier",
157
+ "pattern": "$N"
158
+ }
159
+ }
160
+ }
161
+ ]
162
+ }
163
+ }
164
+ },
165
+ {
166
+ "inside": {
167
+ "kind": "program",
168
+ "stopBy": "end",
169
+ "has": {
170
+ "kind": "export_statement",
171
+ "all": [
172
+ {
173
+ "has": {
174
+ "kind": "identifier",
175
+ "pattern": "$N"
176
+ }
177
+ },
178
+ {
179
+ "follows": {
180
+ "stopBy": "end",
181
+ "kind": "expression_statement",
182
+ "has": {
183
+ "kind": "string",
184
+ "value": {
185
+ "eq": "use client"
186
+ }
187
+ }
188
+ }
189
+ }
190
+ ]
191
+ }
192
+ }
193
+ }
194
+ ]
195
+ }
196
+ }
197
+ },
198
+ "violation": {
199
+ "anchor": "witness.span",
200
+ "code": "@next/next/no-async-client-component",
201
+ "message": "Prevent Client Components from being async functions. See: https://nextjs.org/docs/messages/no-async-client-component",
202
+ "suppress": {
203
+ "eslint": {
204
+ "rules": [
205
+ "@next/next/no-async-client-component"
206
+ ]
207
+ }
208
+ }
209
+ }
210
+ }
211
+ ]
212
+ }
@@ -0,0 +1,118 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "next-no-before-interactive-script-outside-document",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "@next/eslint-plugin-next 16.3.8 @next/next/no-before-interactive-script-outside-document: 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`.",
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/|^(?:[^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)?)?/*(?: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
+ "pattern": "$N"
48
+ }
49
+ },
50
+ {
51
+ "has": {
52
+ "kind": "jsx_attribute",
53
+ "all": [
54
+ {
55
+ "has": {
56
+ "kind": "property_identifier",
57
+ "regex": "^strategy$"
58
+ }
59
+ },
60
+ {
61
+ "has": {
62
+ "kind": "string",
63
+ "value": {
64
+ "eq": "beforeInteractive"
65
+ }
66
+ }
67
+ }
68
+ ]
69
+ }
70
+ },
71
+ {
72
+ "inside": {
73
+ "kind": "program",
74
+ "stopBy": "end",
75
+ "has": {
76
+ "kind": "import_statement",
77
+ "all": [
78
+ {
79
+ "has": {
80
+ "field": "source",
81
+ "kind": "string",
82
+ "value": {
83
+ "eq": "next/script"
84
+ }
85
+ }
86
+ },
87
+ {
88
+ "has": {
89
+ "kind": "import_clause",
90
+ "has": {
91
+ "kind": "identifier",
92
+ "pattern": "$N"
93
+ }
94
+ }
95
+ }
96
+ ]
97
+ }
98
+ }
99
+ }
100
+ ]
101
+ }
102
+ }
103
+ },
104
+ "violation": {
105
+ "anchor": "witness.span",
106
+ "code": "@next/next/no-before-interactive-script-outside-document",
107
+ "message": "`next/script`'s `beforeInteractive` strategy should not be used outside of `pages/_document.js`. See: https://nextjs.org/docs/messages/no-before-interactive-script-outside-document",
108
+ "suppress": {
109
+ "eslint": {
110
+ "rules": [
111
+ "@next/next/no-before-interactive-script-outside-document"
112
+ ]
113
+ }
114
+ }
115
+ }
116
+ }
117
+ ]
118
+ }
@@ -0,0 +1,107 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "next-no-css-tags",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "@next/eslint-plugin-next 16.3.8 @next/next/no-css-tags: a <link> with rel=\"stylesheet\" and a string href that does not start with http(s).",
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": "^rel$"
53
+ }
54
+ },
55
+ {
56
+ "has": {
57
+ "kind": "string",
58
+ "value": {
59
+ "eq": "stylesheet"
60
+ }
61
+ }
62
+ }
63
+ ]
64
+ }
65
+ },
66
+ {
67
+ "has": {
68
+ "kind": "jsx_attribute",
69
+ "all": [
70
+ {
71
+ "has": {
72
+ "kind": "property_identifier",
73
+ "regex": "^href$"
74
+ }
75
+ },
76
+ {
77
+ "has": {
78
+ "kind": "string",
79
+ "not": {
80
+ "value": {
81
+ "startsWith": "http"
82
+ }
83
+ }
84
+ }
85
+ }
86
+ ]
87
+ }
88
+ }
89
+ ]
90
+ }
91
+ }
92
+ },
93
+ "violation": {
94
+ "anchor": "witness.span",
95
+ "code": "@next/next/no-css-tags",
96
+ "message": "Do not include stylesheets manually. See: https://nextjs.org/docs/messages/no-css-tags",
97
+ "suppress": {
98
+ "eslint": {
99
+ "rules": [
100
+ "@next/next/no-css-tags"
101
+ ]
102
+ }
103
+ }
104
+ }
105
+ }
106
+ ]
107
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "next-no-document-import-in-page",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "@next/eslint-plugin-next 16.3.8 @next/next/no-document-import-in-page: an import from next/document, unless the part of the path after its last `pages` is empty or starts with `/_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
+ "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
+ "kind": "import_statement",
33
+ "all": [
34
+ {
35
+ "has": {
36
+ "field": "source",
37
+ "kind": "string",
38
+ "value": {
39
+ "eq": "next/document"
40
+ }
41
+ }
42
+ }
43
+ ]
44
+ }
45
+ }
46
+ },
47
+ "violation": {
48
+ "anchor": "witness.span",
49
+ "code": "@next/next/no-document-import-in-page",
50
+ "message": "`<Document />` from `next/document` should not be imported outside of `pages/_document.js`. See: https://nextjs.org/docs/messages/no-document-import-in-page",
51
+ "suppress": {
52
+ "eslint": {
53
+ "rules": [
54
+ "@next/next/no-document-import-in-page"
55
+ ]
56
+ }
57
+ }
58
+ }
59
+ }
60
+ ]
61
+ }
@@ -0,0 +1,187 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "next-no-duplicate-head",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "@next/eslint-plugin-next 16.3.8 @next/next/no-duplicate-head: every <Head> child of a returned element after the first, in a return inside a class extending the default import of next/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
+ "rule": {
27
+ "all": [
28
+ {
29
+ "any": [
30
+ {
31
+ "kind": "jsx_self_closing_element",
32
+ "has": {
33
+ "field": "name",
34
+ "kind": "identifier",
35
+ "regex": "^Head$"
36
+ }
37
+ },
38
+ {
39
+ "kind": "jsx_element",
40
+ "has": {
41
+ "field": "open_tag",
42
+ "has": {
43
+ "field": "name",
44
+ "kind": "identifier",
45
+ "regex": "^Head$"
46
+ }
47
+ }
48
+ }
49
+ ]
50
+ },
51
+ {
52
+ "follows": {
53
+ "stopBy": "end",
54
+ "any": [
55
+ {
56
+ "kind": "jsx_self_closing_element",
57
+ "has": {
58
+ "field": "name",
59
+ "kind": "identifier",
60
+ "regex": "^Head$"
61
+ }
62
+ },
63
+ {
64
+ "kind": "jsx_element",
65
+ "has": {
66
+ "field": "open_tag",
67
+ "has": {
68
+ "field": "name",
69
+ "kind": "identifier",
70
+ "regex": "^Head$"
71
+ }
72
+ }
73
+ }
74
+ ]
75
+ }
76
+ },
77
+ {
78
+ "inside": {
79
+ "kind": "jsx_element",
80
+ "any": [
81
+ {
82
+ "inside": {
83
+ "kind": "return_statement"
84
+ }
85
+ },
86
+ {
87
+ "inside": {
88
+ "kind": "parenthesized_expression",
89
+ "inside": {
90
+ "kind": "return_statement"
91
+ }
92
+ }
93
+ }
94
+ ]
95
+ }
96
+ },
97
+ {
98
+ "inside": {
99
+ "stopBy": "end",
100
+ "all": [
101
+ {
102
+ "any": [
103
+ {
104
+ "kind": "class_declaration"
105
+ },
106
+ {
107
+ "kind": "class",
108
+ "inside": {
109
+ "kind": "export_statement"
110
+ }
111
+ }
112
+ ]
113
+ },
114
+ {
115
+ "has": {
116
+ "kind": "class_heritage",
117
+ "any": [
118
+ {
119
+ "has": {
120
+ "kind": "identifier",
121
+ "pattern": "$D"
122
+ }
123
+ },
124
+ {
125
+ "has": {
126
+ "kind": "extends_clause",
127
+ "has": {
128
+ "field": "value",
129
+ "kind": "identifier",
130
+ "pattern": "$D"
131
+ }
132
+ }
133
+ }
134
+ ]
135
+ }
136
+ },
137
+ {
138
+ "inside": {
139
+ "kind": "program",
140
+ "stopBy": "end",
141
+ "has": {
142
+ "kind": "import_statement",
143
+ "all": [
144
+ {
145
+ "has": {
146
+ "field": "source",
147
+ "kind": "string",
148
+ "value": {
149
+ "eq": "next/document"
150
+ }
151
+ }
152
+ },
153
+ {
154
+ "has": {
155
+ "kind": "import_clause",
156
+ "has": {
157
+ "kind": "identifier",
158
+ "pattern": "$D"
159
+ }
160
+ }
161
+ }
162
+ ]
163
+ }
164
+ }
165
+ }
166
+ ]
167
+ }
168
+ }
169
+ ]
170
+ }
171
+ }
172
+ },
173
+ "violation": {
174
+ "anchor": "witness.span",
175
+ "code": "@next/next/no-duplicate-head",
176
+ "message": "Do not include multiple instances of `<Head/>`. See: https://nextjs.org/docs/messages/no-duplicate-head",
177
+ "suppress": {
178
+ "eslint": {
179
+ "rules": [
180
+ "@next/next/no-duplicate-head"
181
+ ]
182
+ }
183
+ }
184
+ }
185
+ }
186
+ ]
187
+ }