Commit bcea869
authored
[compiler][rfc] Enable more validations in playground. (facebook#33777)
This is mostly to kick off conversation, i think we should go with a
modified version of the implemented approach that i'll describe here.
The playground currently serves two roles. The primary one we think
about is for verifying compiler output. We use it for this sometimes,
and developers frequently use it for this, including to send us repros
if they have a potential bug. The second mode is to help developers
learn about React. Part of that includes learning how to use React
correctly — where it's helpful to see feedback about problematic code —
and also to understand what kind of tools we provide compared to other
frameworks, to make an informed choice about what tools they want to
use.
Currently we primarily think about the first role, but I think we should
emphasize the second more. In this PR i'm doing the worst of both:
enabling all the validations used by both the compiler and the linter by
default. This means that code that would actually compile can fail with
validations, which isn't great.
What I think we should actually do is compile twice, one in
"compilation" mode and once in "linter" mode, and combine the results as
follows:
* If "compilation" mode succeeds, show the compiled output _and_ any
linter errors.
* If "compilation" mode fails, show only the compilation mode failures.
We should also distinguish which case it is when we show errors:
"Compilation succeeded", "Compilation succeeded with linter errors",
"Compilation failed".
This lets developers continue to verify compiler output, while also
turning the playground into a much more useful tool for learning React.
Thoughts?
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33777).
* facebook#33981
* __->__ facebook#337771 parent 2ae8b3d commit bcea869
File tree
3 files changed
+99
-21
lines changed- compiler
- apps/playground/components/Editor
- packages/babel-plugin-react-compiler/src/Utils
3 files changed
+99
-21
lines changedLines changed: 44 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
146 | 149 | | |
147 | 150 | | |
148 | 151 | | |
| |||
204 | 207 | | |
205 | 208 | | |
206 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
207 | 226 | | |
208 | 227 | | |
209 | 228 | | |
| |||
249 | 268 | | |
250 | 269 | | |
251 | 270 | | |
252 | | - | |
| 271 | + | |
253 | 272 | | |
254 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
255 | 277 | | |
256 | 278 | | |
257 | 279 | | |
| |||
260 | 282 | | |
261 | 283 | | |
262 | 284 | | |
263 | | - | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
264 | 290 | | |
265 | 291 | | |
266 | 292 | | |
| |||
286 | 312 | | |
287 | 313 | | |
288 | 314 | | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
289 | 327 | | |
290 | 328 | | |
291 | 329 | | |
292 | 330 | | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
| 331 | + | |
299 | 332 | | |
300 | 333 | | |
301 | | - | |
| 334 | + | |
302 | 335 | | |
303 | 336 | | |
304 | 337 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| |||
44 | 48 | | |
45 | 49 | | |
46 | 50 | | |
| 51 | + | |
47 | 52 | | |
48 | 53 | | |
49 | 54 | | |
| |||
123 | 128 | | |
124 | 129 | | |
125 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
126 | 156 | | |
127 | | - | |
| 157 | + | |
128 | 158 | | |
129 | | - | |
| 159 | + | |
| 160 | + | |
130 | 161 | | |
131 | 162 | | |
132 | 163 | | |
| |||
147 | 178 | | |
148 | 179 | | |
149 | 180 | | |
150 | | - | |
| 181 | + | |
151 | 182 | | |
152 | 183 | | |
| 184 | + | |
153 | 185 | | |
154 | 186 | | |
155 | 187 | | |
| |||
173 | 205 | | |
174 | 206 | | |
175 | 207 | | |
176 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
177 | 211 | | |
178 | 212 | | |
179 | 213 | | |
| |||
187 | 221 | | |
188 | 222 | | |
189 | 223 | | |
190 | | - | |
| 224 | + | |
191 | 225 | | |
192 | 226 | | |
193 | 227 | | |
| |||
196 | 230 | | |
197 | 231 | | |
198 | 232 | | |
199 | | - | |
| 233 | + | |
200 | 234 | | |
201 | 235 | | |
202 | 236 | | |
| |||
228 | 262 | | |
229 | 263 | | |
230 | 264 | | |
| 265 | + | |
231 | 266 | | |
232 | 267 | | |
233 | 268 | | |
234 | 269 | | |
| 270 | + | |
235 | 271 | | |
236 | 272 | | |
237 | 273 | | |
| |||
282 | 318 | | |
283 | 319 | | |
284 | 320 | | |
285 | | - | |
| 321 | + | |
286 | 322 | | |
287 | 323 | | |
288 | 324 | | |
| |||
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
116 | 117 | | |
117 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
118 | 123 | | |
119 | 124 | | |
120 | 125 | | |
| |||
174 | 179 | | |
175 | 180 | | |
176 | 181 | | |
| 182 | + | |
177 | 183 | | |
178 | 184 | | |
179 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
180 | 189 | | |
181 | 190 | | |
182 | 191 | | |
| |||
0 commit comments