Migrate to eslint

Summary
We'd like contributors to use the same linter and lint rules that we use
internally.  This diff swaps out eslint for jshint and fixes all lint failures
except for the max-len failures in the test suites.

Test Plan:
- ka-lint src
- make lint
- make test

Reviewers: emily
This commit is contained in:
Kevin Barabash
2015-11-30 20:52:22 -08:00
parent 1a082e81d9
commit 14a58adb90
34 changed files with 2271 additions and 2206 deletions

View File

@@ -13,12 +13,13 @@ beforeEach(function() {
compare: function(actual, left, right, result) {
var message = {
pass: true,
message: "'" + actual + "' split correctly"
message: "'" + actual + "' split correctly",
};
var startData = [{type: "text", data: actual}];
var split = splitAtDelimiters(startData, left, right, false);
var split =
splitAtDelimiters(startData, left, right, false);
if (split.length !== result.length) {
message.pass = false;
@@ -58,9 +59,9 @@ beforeEach(function() {
}
return message;
}
},
};
}
},
});
});
@@ -69,12 +70,12 @@ describe("A delimiter splitter", function() {
expect("hello").toSplitInto("(", ")", [{type: "text", data: "hello"}]);
});
it("doesn't create a math node when there's only a left delimiter", function() {
it("doesn't create a math node with only one left delimiter", function() {
expect("hello ( world").toSplitInto(
"(", ")",
[
{type: "text", data: "hello "},
{type: "text", data: "( world"}
{type: "text", data: "( world"},
]);
});
@@ -82,7 +83,7 @@ describe("A delimiter splitter", function() {
expect("hello ) world").toSplitInto(
"(", ")",
[
{type: "text", data: "hello ) world"}
{type: "text", data: "hello ) world"},
]);
});
@@ -93,7 +94,7 @@ describe("A delimiter splitter", function() {
{type: "text", data: "hello "},
{type: "math", data: " world ",
rawData: "( world )", display: false},
{type: "text", data: " boo"}
{type: "text", data: " boo"},
]);
});
@@ -104,7 +105,7 @@ describe("A delimiter splitter", function() {
{type: "text", data: "hello "},
{type: "math", data: " world ",
rawData: "[[ world ]]", display: false},
{type: "text", data: " boo"}
{type: "text", data: " boo"},
]);
});
@@ -118,7 +119,7 @@ describe("A delimiter splitter", function() {
{type: "text", data: " boo "},
{type: "math", data: " more ",
rawData: "( more )", display: false},
{type: "text", data: " stuff"}
{type: "text", data: " stuff"},
]);
});
@@ -130,7 +131,7 @@ describe("A delimiter splitter", function() {
{type: "math", data: " world ",
rawData: "( world )", display: false},
{type: "text", data: " boo "},
{type: "text", data: "( left"}
{type: "text", data: "( left"},
]);
});
@@ -141,7 +142,7 @@ describe("A delimiter splitter", function() {
{type: "text", data: "hello "},
{type: "math", data: " world { ) } ",
rawData: "( world { ) } )", display: false},
{type: "text", data: " boo"}
{type: "text", data: " boo"},
]);
expect("hello ( world { { } ) } ) boo").toSplitInto(
@@ -150,7 +151,7 @@ describe("A delimiter splitter", function() {
{type: "text", data: "hello "},
{type: "math", data: " world { { } ) } ",
rawData: "( world { { } ) } )", display: false},
{type: "text", data: " boo"}
{type: "text", data: " boo"},
]);
});
@@ -161,7 +162,7 @@ describe("A delimiter splitter", function() {
{type: "text", data: "hello "},
{type: "math", data: " world \\) ",
rawData: "( world \\) )", display: false},
{type: "text", data: " boo"}
{type: "text", data: " boo"},
]);
/* TODO(emily): make this work maybe?
@@ -171,7 +172,7 @@ describe("A delimiter splitter", function() {
{type: "text", data: "hello \\( "},
{type: "math", data: " world ",
rawData: "( world )", display: false},
{type: "text", data: " boo"}
{type: "text", data: " boo"},
]);
*/
});
@@ -183,7 +184,7 @@ describe("A delimiter splitter", function() {
{type: "text", data: "hello "},
{type: "math", data: " world ",
rawData: "$ world $", display: false},
{type: "text", data: " boo"}
{type: "text", data: " boo"},
]);
});
@@ -195,7 +196,7 @@ describe("A delimiter splitter", function() {
{type: "text", data: "hello "},
{type: "math", data: " world ",
rawData: "( world )", display: true},
{type: "text", data: " boo"}
{type: "text", data: " boo"},
]);
});
@@ -203,7 +204,7 @@ describe("A delimiter splitter", function() {
var startData = [
{type: "text", data: "hello ( world ) boo"},
{type: "math", data: "math", rawData: "(math)", display: true},
{type: "text", data: "hello ( world ) boo"}
{type: "text", data: "hello ( world ) boo"},
];
expect(splitAtDelimiters(startData, "(", ")", false)).toEqual(
@@ -216,7 +217,7 @@ describe("A delimiter splitter", function() {
{type: "text", data: "hello "},
{type: "math", data: " world ",
rawData: "( world )", display: false},
{type: "text", data: " boo"}
{type: "text", data: " boo"},
]);
});
@@ -224,7 +225,7 @@ describe("A delimiter splitter", function() {
var startData = [
{type: "text", data: "hello ( world ) boo"},
{type: "math", data: "hello ( world ) boo",
rawData: "(hello ( world ) boo)", display: true}
rawData: "(hello ( world ) boo)", display: true},
];
expect(splitAtDelimiters(startData, "(", ")", false)).toEqual(
@@ -234,7 +235,7 @@ describe("A delimiter splitter", function() {
rawData: "( world )", display: false},
{type: "text", data: " boo"},
{type: "math", data: "hello ( world ) boo",
rawData: "(hello ( world ) boo)", display: true}
rawData: "(hello ( world ) boo)", display: true},
]);
});
});