-
Notifications
You must be signed in to change notification settings - Fork 0
/
sections.html
621 lines (552 loc) · 16.4 KB
/
sections.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Fancy React</title>
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/custom.css">
<link rel="stylesheet" href="css/theme/night.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h1>Fancy React</h1>
<h3>React Super Powers in Atom</h3>
<p>Eddie Sholl <a href="https://twitter.com/eddiesholl">@eddiesholl</a></p>
<aside class="notes">
<ul>
<li>Welcome everyone</li>
<li>Thanks for having me, first time talking</li>
<li>Talk about fancy react, an atom plugin to speed up react development</li>
<li>Useful and interesting</li>
</ul>
</aside>
</section>
<section>
<p class="color-orange">atom.io/packages/fancy-react</p>
<div class="flex-row">
<div class="flex-column flex-end flex-g-1">
<span>It might help you</span>
<span>It might encourage you</span>
<span>It might remind you</span>
</div>
<div style="width: 30px"></div>
<div class="flex-column flex-start flex-g-1">
<span class="fragment color-red">write react code</span>
<span class="fragment color-green">to hack on something</span>
<span class="fragment color-blue">that tools really matter</span>
</div>
</div>
<aside class="notes">
<ul>
<li>Goals for the talk</li>
</ul>
</aside>
</section>
<section data-background-image="images/react-logo-og.png">
<div class="flex-row flex-centered">
<div class="fragment">
<h3>Modular</h3>
<h3>Precise</h3>
<h3>Flexible</h3>
</div>
<div class="flex-pad-100"></div>
<div class="fragment">
<h3>Files</h3>
<h3>Verbose</h3>
<h3>Standards</h3>
</div>
</div>
<aside class="notes">
<ul>
<li>The things that set you up for success in React</li>
<li>Comparison with ember</li>
<li>Learning curve hump, but then payoff</li>
<li>Low defect rate from small controlled snippets</li>
</ul>
</aside>
</section>
<section>
<div class="flex-row flex-centered">
<video loop>
<source data-src="images/atom-rocket.mp4" type="video/mp4" />
</video>
<div class="flex-pad-100"></div>
<div>
<h3>The Atom experience</h3>
<p class="fragment">No context switching</p>
<p class="fragment">Active and mature</p>
<p class="fragment">Please come and hack me!</p>
</div>
</div>
<aside class="notes">
<ul>
<li>What draws you to atom</li>
<li>Most IDEs have a similar story</li>
<li>You should be able to transfer</li>
</ul>
</aside>
</section>
<section data-background-image="images/melbjs-twitter.png">
<aside class="notes">
<ul>
<li>Planted the seed / vision</li>
<li>I want some of that</li>
</ul>
</aside>
</section>
<section data-background-image="images/zendesk-medium-white.svg">
<aside class="notes">
<ul>
<li>Great opportunity, learning encouraged</li>
<li>Massive learning curve</li>
<li>ember and node.js, before that .NET</li>
<li>React and rails, no real experience in either</li>
</ul>
</aside>
</section>
<section class="width-90pc" data-transition="zoom slide-out">
<div class="flex-row flex-centered">
<img class="primary-image" src="images/comp-per-day.png"></img>
</div>
<aside class="notes">
<ul>
<li>First 3 months of data</li>
<li>Actual git repo data</li>
<li>A bit sad, felt like a lot more</li>
</ul>
</aside>
</section>
<section class="width-90pc" data-transition="fade">
<div class="flex-row flex-centered">
<img class="primary-image" src="images/test-per-day.png"></img>
</div>
<aside class="notes">
<ul>
<li>Current LOC ~4400 src, ~5700 test. 95% functions covered</li>
<li>Use a type system? Later</li>
</ul>
</aside>
</section>
<section>
<h1>That's great</h1>
<h3>Now show me something awesome</h3>
<aside class="notes">
<ul>
<li>So far, not that interesting</li>
<li>I have basically explained to you that I'm a modern web developer</li>
</ul>
</aside>
</section>
<section>
<h3>Actions</h3>
<div class="flex-row">
<div class="flex-column flex-g-1">
<span>Generate component from JSX snippet</span>
<span>Generate tests</span>
<span>Switch between source <-> test file</span>
</div>
</div>
<aside class="notes">
<ul>
<li>Quick introduction</li>
<li>MVP set of actions</li>
</ul>
</aside>
</section>
<section data-background-image="images/generate-component.gif" data-background-size="contain">
<aside class="notes">
<ul>
<li>Allows you to finish your thoughts</li>
<li>Expands to find the scope of the nearest starting JSX element</li>
<li>Creates props from snippet</li>
<li>Fairly strict structure</li>
</ul>
</aside>
</section>
<section data-background-image="images/generate-tests.gif" data-background-size="contain">
<aside class="notes">
<ul>
<li>Once you're happy with your component...</li>
<li>Fewer keystrokes</li>
</ul>
</aside>
</section>
<section data-background-image="images/switch-files.gif" data-background-size="contain">
<aside class="notes">
<ul>
<li>Benefits from package structure settings</li>
<li>Really added to muscle memory, miss it when it's not there</li>
<li>Should become standalone</li>
</ul>
</aside>
</section>
<section>
<img class="img width-50pc" src="images/atom-generate-package.png"></img>
<p>Commands</p>
<p>Key bindings</p>
<p>Menus</p>
<p>Activation</p>
<aside class="notes">
<ul>
<li>All generated in template with 'Generate package'</li>
<li>Activation important for performance</li>
</ul>
</aside>
</section>
<section>
<p>keymaps json</p>
<pre><code>
{
"atom-workspace atom-text-editor[data-grammar='source js jsx']": {
"ctrl-alt-g": "fancy-react:generate",
"ctrl-alt-t": "fancy-react:tests",
"ctrl-alt-s": "fancy-react:switch"
}
}
</code></pre>
</section>
<section>
<h3>Atom ecosystem</h3>
<p>Package Manager - APM</p>
<p>Chrome dev tools</p>
<p>Jasmine test runner</p>
<aside class="notes">
<ul>
<li>APM allows link, unlink and publish</li>
<li>Jasmine seems great but in hindsight would just use something else</li>
</ul>
</aside>
</section>
<section data-background-image="images/package-settings.png" data-background-size="50%">
<aside class="notes">
<ul>
<li>ParallelDirs</li>
<li>SameDir</li>
<li>SubDir</li>
</ul>
</aside>
</section>
<section>
<h3>Other juicy stuff</h3>
<p>Format using your eslintrc</p>
<p>Generates tests for all exports</p>
<p>Support for jest, enzyme, react props</p>
<p>Local config in package.json</p>
<aside class="notes">
<ul>
<li>eslint --fix</li>
<li>Different generation based on export</li>
<li></li>
</ul>
</aside>
</section>
<section>
<h3>Demo</h3>
<aside class="notes">
<ul>
<li>Swap desktop left to react browser</li>
<li>Swap desktop left to show atom</li>
<li>create-react-app plus eslint, jest, enzyme, babel deps</li>
<li>eslintrc, babelrc</li>
<li>fancyReact settings in local package.json</li>
<li>added src folder as webpack module path</li>
<li>1 - yarn start to kick off the server, check out the webpage</li>
<li>2 - switch to atom, add a BottomWidget with 1 prop. ctrl-alt-g. Save the files</li>
<li>3 - generate tests. ctrl-alt-t</li>
<li>4 - jump between test files. ctrl-alt-s</li>
</ul>
</aside>
</section>
<section>
<h3>eslint WTF?!</h3>
<p>eval, new Function(), json parsing</p>
<pre><code>const { allowUnsafeNewFunction } = require("loophole")
// ...
const e = this.engine
let config
allowUnsafeNewFunction(function() {
config = e.getConfigForFile(filePath)
})
const linterResult = this.linter.verifyAndFix(text, config)</pre></code>
<p>https://github.com/AtomLinter/linter-eslint/issues/253</p>
<aside class="notes">
<ul>
<li>Atom doesn't allow unsafe-eval</li>
<li>Dependency of dependency of dependency</li>
<li>Patience wearing thin</li>
</ul>
</aside>
</section>
<section>
<h1>We need to talk...</h1>
<h3 class="fragment">about ASTs</h3>
<aside class="notes">
<ul>
<li>Meat of the story</li>
<li>Things that I have learned along the way</li>
<li></li>
</ul>
</aside>
</section>
<section>
<blockquote class="width-90pc">
Once upon a time, an unsuspecting Mozilla engineer created an API in Firefox that exposed the SpiderMonkey engine's JavaScript parser as a JavaScript API. Said engineer documented the format it produced, and this format caught on as a lingua franca for tools that manipulate JavaScript source code.
</blockquote>
<p>https://github.com/estree/estree</p>
<aside class="notes">
<ul>
<li>Incredible how critical and widespread this now is</li>
<li>babel, webpack, es6</li>
</ul>
</aside>
</section>
<section>
<pre><code>interface Function <: Node {
id: Identifier | null;
params: [ Pattern ];
body: FunctionBody;
}
// es5 variable
interface VariableDeclaration <: Declaration {
type: "VariableDeclaration";
declarations: [ VariableDeclarator ];
kind: "var";
}
// es2015 variables
extend interface VariableDeclaration {
kind: "var" | "let" | "const";
}</pre></code>
<aside class="notes">
<ul>
<li>Plain old function</li>
<li>es5</li>
<li>es2015 extension</li>
</ul>
</aside>
</section>
<section>
<pre><code>interface JSXElement <: Expression {
type: "JSXElement";
openingElement: JSXOpeningElement;
children: [ JSXText | JSXExpressionContainer |
JSXSpreadChild | JSXElement ];
closingElement: JSXClosingElement | null;
}
interface JSXAttribute <: Node {
type: "JSXAttribute";
name: JSXIdentifier | JSXNamespacedName;
value: Literal | JSXExpressionContainer |
JSXElement | null;
}</pre></code>
</section>
<section>
<div class="width-90pc">
<pre><code>Program
body:
| ImportDeclaration
| source:
| | Literal react
| | value:
| | | undefined
| specifiers:
| | ImportDefaultSpecifier
| | local:
| | | Identifier React
| | ImportSpecifier
| | local:
| | | Identifier Component
| ImportDeclaration
| source:
| | Literal ./logo.svg
| | value:
| | | undefined
| specifiers:
| | ImportDefaultSpecifier
| | local:
| | | Identifier logo
| ImportDeclaration
| source:
| | Literal ./App.css
| | value:
| | | undefined
| specifiers:
| ImportDeclaration
| source:
| | Literal components/BottomWidget/BottomWidget
| | value:
| | | undefined
| specifiers:
| | ImportDefaultSpecifier
| | local:
| | | Identifier BottomWidget
| ClassDeclaration
| id:
| | Identifier App
| body:
| | ClassBody
| | body:
| | | MethodDefinition [object Object]
| | | key:
| | | | Identifier render
| | | value:
| | | | FunctionExpression
| | | | body:
| | | | | BlockStatement
| | | | | body:
| | | | | | ReturnStatement
| | | | | | argument:
| | | | | | | JSXElement
| | | | params:
| ExportDefaultDeclaration
| declaration:
| | Identifier App
</code></pre>
<aside class="notes">
<ul>
<li>Taken from App.js</li>
<li>Talk about imports then switch desktop left to App.js</li>
<li>Just a subset of nodes</li>
<li>Snippets offer the 80/20 benefits</li>
<li>AST pays off in the end</li>
</ul>
</aside>
</section>
<section>
<h1>Peeling the Javascript Onion</h1>
</section>
<section>
<div class="ring">
Browser time!
<div class="fragment ring">
Your Babel/Webpack
<div class="fragment ring">
Your React
<div class="fragment ring">
Atom
<div class="fragment ring">
My babel and eslint
<div class="fragment ring">
Generated Javascript snippets
<div class="fragment ring">
My plugin code
<div class="fragment ring fade-in">
<span class="fragment highlight-red">
<div class="fragment fade-out">
😱 🆘 🚒 TypeScript 🚒 🆘 😱
</div>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<aside class="notes">
<ul>
<li>Tedious writing in raw es6</li>
<li>Extra compiler layer? No thank you</li>
<li>Nice use for tcomb</li>
</ul>
</aside>
</section>
<section data-background-image="images/george-onion.gif" data-background-size="contain">
<!-- <img class="height-300px img" src="images/george-onion.gif"></img> -->
<h3 class="fragment">Tastes like regular onion</h3>
</section>
<section>
<div class="flex-row flex-spaced-out">
<div class="flex-column flex-spaced-out">
<p>ES6</p>
<p>JSX</p>
<p>Experimental features</p>
<p class="fragment">TypeScript</p>
</div>
<img src="images/arrow-right.svg" class="medium-img"></img>
<div class="flex-column">
<p>AST</p>
</div>
<img src="images/arrow-right.svg" class="medium-img"></img>
<div class="flex-column">
<p>Browser output</p>
</div>
<aside class="notes">
<ul>
<li>Early proposals like object spreading</li>
<li>JSX is just a set of ideas</li>
<li>Estree is really the 'compiler target'</li>
</ul>
</aside>
</section>
<section>
<div class="flex-row flex-spaced-out">
<div class="flex-column flex-spaced-out">
<h3 class="fragment">ClosureScript</h3>
<h3 class="fragment">Elm</h3>
</div>
<img src="images/arrow-right.svg" class="medium-img"></img>
<div class="flex-column">
<p>AST</p>
</div>
<img src="images/arrow-right.svg" class="medium-img"></img>
<div class="flex-column">
<p>Browser output</p>
</div>
<aside class="notes">
<ul>
<li>Time to put my chips down</li>
<li>Maximise developer joy</li>
<li>No longer constrained, what can we learn from last 50 years?</li>
<li>Not really contraversial</li>
<li>What about straight to browser JS?</li>
<li>AST allows interop ie elm webpack plugin</li>
</ul>
</aside>
</section>
<section data-background-image="images/IMG_5848.JPG" data-background-size="cover" data-transition="fade-in">
<h3>Thanks!</h3>
<p>atom.io/packages/fancy-react</p>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// More info about config & dependencies:
// - https://github.com/hakimel/reveal.js#configuration
// - https://github.com/hakimel/reveal.js#dependencies
Reveal.initialize({
autoPlayMedia: true,
controls: false,
defaultTiming: 60,
history: true,
fragments: true,
// fragments: false, // dev mode
slideNumber: true, // dev mode
width: "90%",
height: "90%",
margin: 0.1,
dependencies: [
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
]
});
</script>
</body>
</html>