E25: Fix bad Javascript

The goal of this experience is to help you get comfortable removing errors found by ESLint:

First, create an IntelliJ project called “BadJavascript”.

Second, set up your project to use our class coding standards. If you’ve already done E24 (which means you configured IntelliJ, and installed Node and NPM), then for new projects such as this one, you just need to:

Download three files into your project directory:

Invoke npm install to install ESLint.

Third, create a file called “BadJavascript.js”, and copy the following code into it:

 * How many violations of the AirBnb Javascript Style guide can we pack into one file?
 * Created by Philip Johnson on 8/4/16.

var foo = 3;
const car = "Toyota";
const obj = {
  car: car,
  'foo': 3,
  bar: 'this' + 'is' + this.car,
  baz: 'b\az'
const zumba = obj['car'];
const stuff = new Array();

function f(){};
function zob(param) {
  param = 2;
  let foob=4+param;
  if (param == 4) {
    return foob;
[1, 2, 3].map(function (x) {
  const y = x + 1;
  return x * y;
class MyClass {
  constructor() {}
  getName() {
    return this.name;
  getName() {
    return this.name;
const TheTitle = 'The Title';

// export names so that there aren't a bunch of spurious "defined but not used" errors (except the first one!)
export default {  obj, stuff, zumba, f, zob, MyClass, TheTitle };

You should find that IntelliJ reports around two dozen errors in this small amount of code.

Now go through the code and fix all the errors. When you’re done, you should see a green checkmark on the top right of your editor window.

If you have problems, you can watch the following screencast for hints:

Submission instructions

You do not have to submit anything for this experience. However, your ability to install ESLint and use it to remove warnings will be evaluated in subsequent experiences, so be sure to complete this experience successfully! If you run into problems, see the TA or the Instructor or a classmate to help you fix it.