Code Transformation and Linting with ASTs

Challenge 4: Edge Cases

Kent C. Dodds

Kent C. Dodds

Professional Trainer
Code Transformation and Linting with ASTs

Check out a free preview of the full Code Transformation and Linting with ASTs course

The "Challenge 4: Edge Cases" Lesson is part of the full, Code Transformation and Linting with ASTs course featured in this preview video. Here's what you'd learn in this lesson:

In this challenge, students learn how to create plugins for edge cases.


Transcript from the "Challenge 4: Edge Cases" Lesson

>> Speaker 1: So this next one is quite a bit bigger. Let's go ahead and run the exercise script. So we'll run, it's number two is our exercise, so exercises.esn.two.
>> Speaker 2: That wasn't the one we just were on?
>> Speaker 1: Maybe it was. Yes, so it was, you're right. How did?

Wait a second.
>> Speaker 1: You're right, that was the one we were just on. Three,
>> Speaker 1: Sorry.
>> Speaker 1: Let me copy that one over to the chat.
>> Speaker 1: Okay, so now your code should look like mine.
>> Speaker 1: And we have a new case here. So somebody, some person, decided that it would be a good idea to reassign console to CSL, I don't know, and then start calling stuff on that.

Maybe they didn't like that our es lint rule was yelling at them or something. So this is where things really start to get edge casey. And you can think of some really edge case things, like what if they assign this to x? And then, wait, we're gonna bind, or take the log and bind it to CSL or console or something like that, now we're calling x.

So there's a point where you just say, okay, I'm not gonna cover that edge case, because anybody writing code like that doesn't deserve to have my plugin.
>> Speaker 2: [LAUGH]
>> Speaker 1: But there are like, if it really is important to you, the cool thing is that you can do it, it's possible.

You can handle these edge cases. And this is one that we definitely can, and the workshop does.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now